fix(notify): make TauriNotification.permission assignable (no-op setter)
Build Lotus Chat Desktop / prepare (push) Successful in 4s
Build Lotus Chat Desktop / build-linux (push) Successful in 28m55s
Build Lotus Chat Desktop / build-windows (push) Successful in 40m21s
Build Lotus Chat Desktop / update-manifest (push) Successful in 4s

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 <noreply@anthropic.com>
This commit is contained in:
2026-06-30 18:39:50 -04:00
parent 49496678ba
commit 324a27577c
+4 -1
View File
@@ -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});