From 324a27577cb3033b4beda8c9eefe962b6d051b20 Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Tue, 30 Jun 2026 18:39:50 -0400 Subject: [PATCH] fix(notify): make TauriNotification.permission assignable (no-op setter) The injected notification bridge defined `permission` as a getter-only property. When the notification plugin / a polyfill assigned `Notification.permission`, it threw "Cannot set property permission of function TauriNotification ... which has only a getter" at page load. Add a no-op setter so it still reads 'granted' but assignment can't crash. Co-Authored-By: Claude Opus 4.8 --- src-tauri/src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 8501fdf..306f17f 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -58,7 +58,10 @@ const NOTIFICATION_BRIDGE: &str = r#"(function(){ TauriNotification.prototype=Object.create(EventTarget.prototype); TauriNotification.prototype.constructor=TauriNotification; TauriNotification.prototype.close=function(){}; - Object.defineProperty(TauriNotification,'permission',{get:function(){return 'granted';},configurable:true}); + // get-only 'permission' threw "Cannot set property permission ... which has + // only a getter" when the notification plugin / a polyfill assigned it. Add a + // no-op setter so the value stays 'granted' but assignment can't crash. + Object.defineProperty(TauriNotification,'permission',{get:function(){return 'granted';},set:function(){},configurable:true}); TauriNotification.requestPermission=function(){return Promise.resolve('granted');}; TauriNotification.maxActions=0; Object.defineProperty(window,'Notification',{value:TauriNotification,writable:true,configurable:true});