Closed Bug 1102368 Opened 8 years ago Closed 8 years ago

[e10s] console.log not working in frame scripts


(Core :: General, defect)

36 Branch
Not set



38.1 - 26 Jan
Tracking Status
e10s m5+ ---


(Reporter: disya2, Assigned: mossop)



User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.62 Safari/537.36

Steps to reproduce:

I'm trying to load a frame script to a just created tab (for example by gBrowser.addTab() or manually created) using gBrowser.selectedBrowser.loadFrameScript(script, true). I specifically use allowDelayedLoad flag here.

Actual results:

The script doesn't seem to be executed at all. I was trying to dump() as well as sendAsyncMessage(some_test_message) at the start of the script to see if it works.

Expected results:

When a tab have already some web-page preloaded the frame script works fine.

If it matters I use Firefox Nightly on Mac OS X, the latest version tested was 36.0a1 (2014-11-20)
Blocks: e10s
tracking-e10s: --- → ?
Product: Firefox → Core
Summary: Frame scripts are not loaded to a just created tab → e10s - Frame scripts are not loaded to a just created tab
Could you try to post a test case? It's hard to figure out the issue from the report.
Flags: needinfo?(disya2)
While making a test case I found that a frame script is actually working. What not working is console.log() inside a frame script. Tested in Nightly 36.0a1 (2014-11-25). Sorry for the misleading report. 

Anyway, here is a test case: 

Inside a chrome script:
gBrowser.selectedTab = gBrowser.addTab();
let mm = gBrowser.selectedBrowser.messageManager;
mm.loadFrameScript("chrome://imacros/content/test.js", true);
mm.addMessageListener("test-response", function(msg) {
    console.log("got response from script %O",;
mm.sendAsyncMessage("test", {});

Frame script (test.js):
addMessageListener("test", function(msg) {
    console.log("got test message");
    sendAsyncMessage("test-response", {greetings: "hi"});

If you comment out the first line (i.e. no new tab is created) then two lines are printed in the console:
"got test message" 
"got response from script ", Object {greetings: "hi"}

When first line in chrome script is active only one line is printed in the console:
"got response from script ", Object {greetings: "hi"}

Since I couldn't get anything logged from a frame script I thought that it hadn't been executed at all.
Flags: needinfo?(disya2)
Assignee: nobody → wmccloskey
Summary: e10s - Frame scripts are not loaded to a just created tab → [e10s] console.log not working in frame scripts
Component: Untriaged → General
Flags: firefox-backlog+
Points: --- → 5
Flags: qe-verify-
Assignee: wmccloskey → dtownsend
Iteration: --- → 38.1 - 26 Jan
Ever confirmed: true
I just experimented with this and wasn't able to reproduce the problem, can you let me know where I am going wrong:

I opened Firefox, the browser console and scratchpad.
I set scratchpad to run in the browser environment and ran the following code:

function frame_script() {
  addMessageListener("fs-test", function listener(msg) {
    removeMessageListener("fs-test", listener);
    console.log("got test message");
    sendAsyncMessage("fs-test-response", {greetings: "hi"});

gBrowser.selectedTab = gBrowser.addTab();
let mm = gBrowser.selectedBrowser.messageManager;
mm.loadFrameScript("data:,(" + frame_script.toString() + ")();", false);
mm.addMessageListener("fs-test-response", function listener(msg) {
  mm.removeMessageListener("fs-test-response", listener);
  console.log("got response from script %O",;
mm.sendAsyncMessage("fs-test", {});

A new tab opens and both console log messages show up in the browser console.
Flags: needinfo?(disya2)
It seems working now (tested with Nightly 38.0a1 (2015-01-13) on Mac OS X 10.10). 

I guess it has been fixed along with some other bug.
Flags: needinfo?(disya2)
Closed: 8 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.