зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1301514 - Clarify ownership of BrowserElementIsReady. r=kanru
It wasn't immediately obvious to me that BrowserElementIsReady was correctly guarding against re-running the browser element scripts in a frame. After more testing, it was working, but I've added some debug lines for future clarity. No functionality changes in this patch. MozReview-Commit-ID: CW4o2TsGKmj --HG-- extra : rebase_source : 62ec06d4b75f90b3478e403906efaa2f3c3658e2
This commit is contained in:
Родитель
e9a55e8604
Коммит
bcefcd65fe
|
@ -33,8 +33,12 @@ function isTopBrowserElement(docShell) {
|
|||
return true;
|
||||
}
|
||||
|
||||
var BrowserElementIsReady;
|
||||
|
||||
debug(`Might load BE scripts: BEIR: ${BrowserElementIsReady}`);
|
||||
if (!BrowserElementIsReady) {
|
||||
if (!('BrowserElementIsPreloaded' in this)) {
|
||||
debug("Loading BE scripts")
|
||||
if (!("BrowserElementIsPreloaded" in this)) {
|
||||
if (isTopBrowserElement(docShell)) {
|
||||
if (Services.prefs.getBoolPref("dom.mozInputMethod.enabled")) {
|
||||
try {
|
||||
|
@ -73,8 +77,9 @@ if (!BrowserElementIsReady) {
|
|||
ContentPanning.init();
|
||||
}
|
||||
}
|
||||
BrowserElementIsReady = true;
|
||||
} else {
|
||||
debug("BE already loaded, abort");
|
||||
}
|
||||
|
||||
var BrowserElementIsReady = true;
|
||||
|
||||
sendAsyncMessage('browser-element-api:call', { 'msg_name': 'hello' });
|
||||
|
|
|
@ -10,7 +10,7 @@ function debug(msg) {
|
|||
|
||||
debug("loaded");
|
||||
|
||||
var BrowserElementIsReady = false;
|
||||
var BrowserElementIsReady;
|
||||
|
||||
var { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
@ -37,8 +37,9 @@ const Timer = Components.Constructor("@mozilla.org/timer;1",
|
|||
function sendAsyncMsg(msg, data) {
|
||||
// Ensure that we don't send any messages before BrowserElementChild.js
|
||||
// finishes loading.
|
||||
if (!BrowserElementIsReady)
|
||||
if (!BrowserElementIsReady) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data) {
|
||||
data = { };
|
||||
|
@ -51,8 +52,9 @@ function sendAsyncMsg(msg, data) {
|
|||
function sendSyncMsg(msg, data) {
|
||||
// Ensure that we don't send any messages before BrowserElementChild.js
|
||||
// finishes loading.
|
||||
if (!BrowserElementIsReady)
|
||||
if (!BrowserElementIsReady) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data) {
|
||||
data = { };
|
||||
|
|
Загрузка…
Ссылка в новой задаче