Content script sometimes does not load

Steps to reproduce the problem:

  1. Have an extension which has a content_scripts section in its manifest that specifies a content script for some URLs.
  2. Open a tab at a URL that the extension should inject a content script in.

What is the expected behaviour? The content script should execute on the page, and if you open the Developer Tools and go to the Console tab, then the extension should be listed inside of the "Extension Scripts" dropdown (the dropdown immediately to the right of the "Clear console" button).

What went wrong? After prolonged inactivity, sometimes the content script doesn't show up in the Extension Scripts dropdown (which it would if it were executing). There's no evidence in the page's Developer Tools that the extension is active. It doesn't execute at all, there's no messages in the console related to it or its non-execution, and its content scripts don't show up in the Sources tab of Developer Tools. When the issue happens, the extension still shows up in the browser toolbar as an option.. The extension's icon shows up and functions normally. The extension background page is inspectable and seems to be running normally. Refreshing the webpage doesn't fix it. But once we open the ios App it starts working again.

Safari version: 74
OS Version: OS X 10.14.5

Replies

I recently started having the exact same problem. It occurs when I call browser.tabs.update({url: ''});. Then the content_script.js is no longer loaded. Looks like a bug, but I'm still looking for a workaround. It's definitely annoying!