-
Notifications
You must be signed in to change notification settings - Fork 4
Description
If you disable a Safari extension, the extension's content script remains loaded and functional in open Safari tabs. If you then re-enable the Safari extension, an additional duplicate content script is loaded into open Safari tabs. The duplicate content scripts keep accumulating in open Safari tabs every time you disable and re-enable an extension.
Steps to reproduce:
- Enable the extension StopTheMadness Pro (App ID 6471380298) in Safari
- Open https://example.org
- Disable StopTheMadness Pro in Safari Extensions Settings
- Enable StopTheMadness Pro in Safari Extensions Settings
- Open the web inspector in the example.org tab
- Select the Sources tab
- Look under Extension Scripts
Expected results: One instance of script.js is enabled
Actual results: Two instances of script.js are enabled
In some recent version of macOS, between 15.3 and 15.5, the Mac App Store started to allow Safari app extensions to be updated without quitting Safari first. Updating the extension app causes the extension to automatically disable and re-enable in Safari, thereby triggering this bug too.
To compare with other web browsers, Firefox disables the extension's content script when you disable the extension, so the bug does not occur there. Chrome fails to disable the extension's content script when you disable the extension, but Chrome does not inject the content script into open browser tabs when you enable the extension, so the problem of duplicates never occurs. Safari both fails to disable the content script and injects a new copy of the content script, leading to duplicates.
Also, there's the issue of keeping a disabled extension's content scripts in the page cache.
For more details and discussion, see the blog post https://lapcatsoftware.com/articles/2023/11/7.html
This issue appears to affect mobile Safari on iOS too.