Tuesday, 19 January 2021

Access any site's service worker context/world/excution environment to proxy self.registration.showNotification via browser addon?

I'd like to create a browser extension that at its core proxies the registration.showNotification function to filter then based on rules set within the addon. Proxying window.Notification is trivial, but I'm having trouble even approaching the problem. I know I can get service worker registrations, but reassigning showNotification doesn't seem to be permanent and doesn't actually seem to work except when I'm the one calling the function through the console.

My 'last resort' idea (which seems difficult) is intercept and modify incoming requests to modify the showNotification function via window.postMessage or something similar - but I want that to be the last resort.

Is there any conceivable way to do what I'm trying to do here? Or maybe a API I'm missing? Based on my research so far my guess is no. I'm not the most experienced when in comes to JS, so I thought I'd give this question a shot. I'm using Firefox if that makes a difference.



from Access any site's service worker context/world/excution environment to proxy self.registration.showNotification via browser addon?

No comments:

Post a Comment