Bug 1369750 - Get window from event.target.defaultView inside load event to make r=mossop

sure getting the right target window, r?mossop

MozReview-Commit-ID: HwHSwvCrXh7

--HG--
extra : rebase_source : 46293d2485b6a019cdcc5b5a9f260058fbdaaf8f
This commit is contained in:
Fischer.json 2017-06-05 11:03:09 +08:00
parent f7de73f89f
commit 4b21f8e958

View File

@ -102,14 +102,20 @@ class Onboarding {
}
}
addEventListener("load", function(evt) {
addEventListener("load", function onLoad(evt) {
if (!content || evt.target != content.document) {
return;
}
removeEventListener("load", onLoad);
let window = evt.target.defaultView;
// Load onboarding module only when we enable it.
if ((content.location.href == ABOUT_NEWTAB_URL ||
content.location.href == ABOUT_HOME_URL) &&
if ((window.location.href == ABOUT_NEWTAB_URL ||
window.location.href == ABOUT_HOME_URL) &&
Services.prefs.getBoolPref("browser.onboarding.enabled", false)) {
content.requestIdleCallback(() => {
new Onboarding(content);
window.requestIdleCallback(() => {
new Onboarding(window);
});
}
}, true);