Skip to content
This repository has been archived by the owner on Feb 26, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1800 from zombie/1107438-pagemod-startup
Browse files Browse the repository at this point in the history
bug 1107438 - check contentWindow exists on startup with e10s, r=@Mossop
  • Loading branch information
zombie committed Jan 5, 2015
2 parents 5fbaee3 + 195cc08 commit 9eae76e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/sdk/page-mod.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ function applyOnExistingDocuments (mod) {
getTabs().forEach(tab => {
// Fake a newly created document
let window = getTabContentWindow(tab);
// on startup with e10s, contentWindow might not exist yet,
// in which case we will get notified by "document-element-inserted".
if (!window || !window.frames)
return;
let uri = getTabURI(tab);
if (has(mod.attachTo, "top") && modMatchesURI(mod, uri))
onContent(mod, window);
Expand Down Expand Up @@ -216,7 +220,7 @@ function createWorker (mod, window) {
// page-mod's "attach" event needs a worker
if (event === 'attach')
emit(mod, event, worker)
else
else
emit(mod, event, ...args);
})
once(worker, 'detach', () => worker.destroy());
Expand Down

0 comments on commit 9eae76e

Please sign in to comment.