зеркало из https://github.com/mozilla/gecko-dev.git
Bug 793082 - Allow sendChromeEvent to queue the events until window.onload fires, r=fabrice
This commit is contained in:
Родитель
f558586922
Коммит
9779c20ced
|
@ -187,6 +187,7 @@ var shell = {
|
|||
});
|
||||
|
||||
this.contentBrowser.src = homeURL;
|
||||
this.isHomeLoaded = false;
|
||||
|
||||
ppmm.addMessageListener("content-handler", this);
|
||||
},
|
||||
|
@ -312,6 +313,17 @@ var shell = {
|
|||
DOMApplicationRegistry.allAppsLaunchable = true;
|
||||
|
||||
this.sendEvent(window, 'ContentStart');
|
||||
|
||||
content.addEventListener('load', function shell_homeLoaded() {
|
||||
content.removeEventListener('load', shell_homeLoaded);
|
||||
shell.isHomeLoaded = true;
|
||||
|
||||
if ('pendingChromeEvents' in shell) {
|
||||
shell.pendingChromeEvents.forEach((shell.sendChromeEvent).bind(shell));
|
||||
}
|
||||
delete shell.pendingChromeEvents;
|
||||
});
|
||||
|
||||
break;
|
||||
case 'MozApplicationManifest':
|
||||
try {
|
||||
|
@ -357,6 +369,15 @@ var shell = {
|
|||
},
|
||||
|
||||
sendChromeEvent: function shell_sendChromeEvent(details) {
|
||||
if (!this.isHomeLoaded) {
|
||||
if (!('pendingChromeEvents' in this)) {
|
||||
this.pendingChromeEvents = [];
|
||||
}
|
||||
|
||||
this.pendingChromeEvents.push(details);
|
||||
return;
|
||||
}
|
||||
|
||||
this.sendEvent(getContentWindow(), "mozChromeEvent",
|
||||
ObjectWrapper.wrap(details, getContentWindow()));
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче