Steps to reproduce
- Unpack the attached ZIP file and load it as an extension in Edge.
- Restart Edge.
- Load http://example.com/ in the active tab.
- Allow extensions from untrusted sources to load and wait a little for the message to appear (dismiss it).
- Reload “executeScript test” extension and wait a little for the message to appear (dismiss it).
- Reload http://example.com/ and repeat step 5.
A message “Content script running!” appears after steps 4, 5 and 6 - the extension always succeeds injecting its content script into the page.
The message “Failed executing script: Unknown error” appears after steps 4 and 5 -
browser.tabs.executeScript() always fails with
browser.runtime.lastError being “Unknown error” for pages that loaded before extensions were allowed. Only after step 6 you get the expected “Content script running!” message - the page was reloaded and became accessible to extensions now.
Comments and activity
- Microsoft Edge Team
Changed Assigned To to “Brad E.”
Changed Assigned To from “Brad E.” to “Scott S.”
This problem also occurs when the content script is injected by the event handler of an browserAction. After loading or reenabling of an extension the icon of the browserAction appears, but when you click it, the injecting of the content script fails. After a page reload it works. It also works on other tabs that are loaded later.
Maybe this problem only appears with locally loaded extensions but not with extension loaded from the Microsoft Store.
If it helps, I could attach a simple example extension to reproduce this problem.