blackout
unread,Nov 23, 2022, 5:31:55 AM11/23/22Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Chromium Extensions, oliver.m...@gmail.com, wOxxOm, blackout
Thank you w0xx0m! Really appreciate the hint for this new api. Following w0xx0m suggestion i could find a workaround which seems to work.
If you really need your requests from extension pages to trigger onAuthRequired you can create a offscreen document which creates a Web Worker which makes the request for you. It seems like requests made by Web Worker will trigger onAuthRequired. So you can make this work by redirecting all you extension page requests to the worker via messaging.
You could also use popup page or a content page to create Web Worker. This works also but if you want the request in "the background". The offscreen api seems to be workaround until this issue is fixed.
service worker ==> creates == > offscreen ==> creates ==> Web Worker
service worker ===> send request(url) message to offscreen ===> sends request(url) message to Web Worker ==> Web Worker makes request (which triggers onAuthRequired in service worker) and sends response back to service worker.
- Doing the request directly in the offscreen page will result in the same issue that onAuthRequired will not be triggered. You need to create a Web Worker in the offscreen page.
- Creating Web Worker in service worker directly does also NOT work. So offscreen api is needed to make this work in the background.
This workaround also requires an extra permission in the manifest: "offscreen". Which will probably deactivate your extension if you update your already existing extension on CWS.
Currently two bug reports are open regarding this issue:
I really hope that these are fixed before January 2023 so we don't need to rely on workarounds which create unnecessary load to the browser.