executeScript does not correctly return results in its callback

Fixed Issue #8504764


Aug 16, 2016
This issue is public.
Fixed in build #
Reported by 6 people

Sign in to watch or report this issue.

Steps to reproduce

Background script:

browser.browserAction.onClicked.addListener(function() {
    browser.tabs.query({ active: true, lastFocusedWindow: true }, function(tabs) {
        var tab = tabs[0];
        browser.tabs.executeScript(tab.id, {code: "var x = 10; x"}, function(result) {

This results in an empty alert in Edge, but does not in Chrome


0 attachments

    Comments and activity

    • Microsoft Edge Team

      Changed Assigned To to “Sermet I.”

      Changed Assigned To from “Sermet I.” to “Scott S.”

      Changed Status to “Confirmed”

    • Hi,

      is there any plan, when this problem will be fixed?


      Svatopluk Ordelt

    • This is an important API to support properly since, among other reasons, in Chrome, you can’t use sendMessage to broadcast a message to all frames of a tab and get answers from all of them - you get whatever answer arrives first. (note: this applies to sendResponse - you can of course call runtime.sendMessage from the content scripts, but then you have to implement your own message tracking logic)
      In contrast, executeScript aggregates answers, which makes it useful as a workaround. I realize this bug is not about frame support, but it will be important on the way.

    • more compact repro:

      chrome.tabs.query({}, tabs =>
              {code: '"foo"'},
              results => console.log("results", results)))

      should log: results ["foo"]

      logs: results undefined

    • I can confirm that this bug is not fixed yet!
      Guys why? It’s essential API, how you wait for any extensions from developers, when basic things are not working :(

    • Any work around for this issue in Edge?

    • Microsoft Edge Team

      Changed Status from “Confirmed” to “In progress”

      Changed Status from “In progress” to “Confirmed”

      Changed Status from “Confirmed” to “In progress”

      Changed Status from “In progress” to “In code review”

      Changed Assigned To from “Scott S.” to “Scott L.”

      Changed Status from “In code review” to “Fixed”

    • Hello,

      Thank you for providing this information about the issue. We are pleased to report this feature is fixed in Edge and will be available in an upcoming insider build.

      Best Wishes,
      The MS Edge Team

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

    Sign in