browser.tabs.executeScript() fails with "unknown error" for pages that loaded "too early"

Issue #9594305 • Assigned to Scott S.

Details

Author
Wladimir P.
Created
Oct 30, 2016
Privacy
This issue is public.
Found in
  • Microsoft Edge
Found in build #
14.14393
Reports
Reported by 4 people

Sign in to watch or report this issue.

Steps to reproduce

  1. Unpack the attached ZIP file and load it as an extension in Edge.
  2. Restart Edge.
  3. Load http://example.com/ in the active tab.
  4. Allow extensions from untrusted sources to load and wait a little for the message to appear (dismiss it).
  5. Reload “executeScript test” extension and wait a little for the message to appear (dismiss it).
  6. Reload http://example.com/ and repeat step 5.

Expected results

A message “Content script running!” appears after steps 4, 5 and 6 - the extension always succeeds injecting its content script into the page.

Actual results

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.

Attachments

1 attachment

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.

You need to sign in to your Microsoft account to add a comment.

Sign in