Skip to content

Commit

Permalink
Bug 1316875 - Fix page-worker SDK test addon intermittency and re-ena…
Browse files Browse the repository at this point in the history
…ble it. r=mossop

MozReview-Commit-ID: 94ImlSy0dU8

--HG--
extra : rebase_source : 3e20c6617d96e8da99f43723ac65bb6f0c23ac2b
  • Loading branch information
rpl committed Nov 11, 2016
1 parent 0879339 commit 0f0981e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
11 changes: 6 additions & 5 deletions addon-sdk/source/lib/sdk/content/page-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ const { Rules } = require('../util/rules');
const { uuid } = require('../util/uuid');
const { WorkerChild } = require("./worker-child");
const { Cc, Ci, Cu } = require("chrome");
const { observe } = require("../event/chrome");
const { on } = require("../event/core");
const { on: onSystemEvent } = require("../system/events");

const appShell = Cc["@mozilla.org/appshell/appShellService;1"].getService(Ci.nsIAppShellService);

Expand Down Expand Up @@ -96,6 +95,7 @@ const ChildPage = Class({
this.options.contentURL = url;

url = this.options.contentURL ? data.url(this.options.contentURL) : "about:blank";

this.webNav.loadURI(url, Ci.nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null);
},

Expand All @@ -121,14 +121,15 @@ const ChildPage = Class({
QueryInterface: XPCOMUtils.generateQI(["nsIWebProgressListener", "nsISupportsWeakReference"])
});

on(observe(DOC_INSERTED), "data", ({ target }) => {
let page = Array.from(pages.values()).find(p => p.contentWindow.document === target);
onSystemEvent(DOC_INSERTED, ({type, subject, data}) => {
let page = Array.from(pages.values()).find(p => p.contentWindow.document === subject);

if (!page)
return;

if (getAttachEventType(page.options) == DOC_INSERTED)
page.attachWorker();
});
}, true);

frames.port.on("sdk/frame/create", (frame, id, options) => {
new ChildPage(frame, id, options);
Expand Down
1 change: 0 additions & 1 deletion addon-sdk/source/test/addons/jetpack-addon.ini
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ skip-if = true
[page-mod-debugger-post.xpi]
[page-mod-debugger-pre.xpi]
[page-worker.xpi]
skip-if = true # Bug 1288619 and Bug 1288708
[places.xpi]
[predefined-id-with-at.xpi]
[preferences-branch.xpi]
Expand Down

0 comments on commit 0f0981e

Please sign in to comment.