Browser extension stops working on Safari 15.4 version

Safari browser(especially 15.4). I have few html pages deployed as part of extension. When I try to set the current Tab page url to one of these html pages, extension stops working. May I know why ? Am I doing something wrong here ?

Answered by here_nerd in 710519022

I have experienced a similar issue where a number of web extensions stop working on Safari 15.4. A deeper investigation shows that this is likely a Safari issue in breaking the web extension 'tabs' API:

chrome.tabs.create doesn't work when the url is a page that's packaged with an extension. It seems to crash and ruin all chrome.tabs event handlers.

Reproducible scenario:

  1. chrome.tabs.onActivated.addListener(()=> console.log('new active tab')) .. Note: I use onActivated just to test whether event listeners on tabs still works.
  2. Switching between tabs.. You should see the 'new active tab' printed in the console.
  3. chrome.tabs.create({url: chrome.runtime.getURL('/index.html')}) --> a new tab is created. Note: index.html is an html file packaged in your extension.
  4. Switching between tabs..

Expect: 'new active tab' printed in the console as usual
Actual: no 'new active tab' printed in the console…

Note: this problem does not occur when the url is a public reachable URL, nor on Safari 15.3 Version 15.4 (17613.1.17.1.13)

Please fix.

Accepted Answer

I have experienced a similar issue where a number of web extensions stop working on Safari 15.4. A deeper investigation shows that this is likely a Safari issue in breaking the web extension 'tabs' API:

chrome.tabs.create doesn't work when the url is a page that's packaged with an extension. It seems to crash and ruin all chrome.tabs event handlers.

Reproducible scenario:

  1. chrome.tabs.onActivated.addListener(()=> console.log('new active tab')) .. Note: I use onActivated just to test whether event listeners on tabs still works.
  2. Switching between tabs.. You should see the 'new active tab' printed in the console.
  3. chrome.tabs.create({url: chrome.runtime.getURL('/index.html')}) --> a new tab is created. Note: index.html is an html file packaged in your extension.
  4. Switching between tabs..

Expect: 'new active tab' printed in the console as usual
Actual: no 'new active tab' printed in the console…

Note: this problem does not occur when the url is a public reachable URL, nor on Safari 15.3 Version 15.4 (17613.1.17.1.13)

Please fix.

Hi, have you found a solution any chance?

For me this happens, even when opening the page manual.

safari-web-extension://6E5A7D9D-1C6E-4DC5-BFA3-E7AD5C9FEE53/testpage.html

When pasting this URL in the address bar, the service worker crashes as well. Is Apple working on this, or is there a workaround?

Seeing the same on Safari 15.5, is there a fix planned for this? Notably I do not see this issue in Safari Technology Preview.

Browser extension stops working on Safari 15.4 version
 
 
Q