author | Timothy Guan-tin Chien <timdream@gmail.com> |
Sat, 29 Sep 2012 10:57:18 -0700 | |
changeset 108664 | 3d34057e17d8fe157ed5874bb435abc59c10a520 |
parent 108663 | 6676711a510bed4692e70a2516546952689977ae |
child 108665 | d95f2229451eb5934b73687ff1950fa3540b8ab8 |
push id | 23577 |
push user | mlamouri@mozilla.com |
push date | Sun, 30 Sep 2012 12:19:29 +0000 |
treeherder | mozilla-central@0df33af01cee [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | fabrice |
bugs | 793082 |
milestone | 18.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/b2g/chrome/content/shell.js +++ b/b2g/chrome/content/shell.js @@ -182,16 +182,17 @@ var shell = { SettingsListener.observe("debug.fps.enabled", false, function(value) { Services.prefs.setBoolPref("layers.acceleration.draw-fps", value); }); SettingsListener.observe("debug.paint-flashing.enabled", false, function(value) { Services.prefs.setBoolPref("nglayout.debug.paint_flashing", value); }); this.contentBrowser.src = homeURL; + this.isHomeLoaded = false; ppmm.addMessageListener("content-handler", this); }, stop: function shell_stop() { window.removeEventListener('keydown', this, true); window.removeEventListener('keypress', this, true); window.removeEventListener('keyup', this, true); @@ -307,16 +308,27 @@ var shell = { let chromeWindow = window.QueryInterface(Ci.nsIDOMChromeWindow); chromeWindow.browserDOMWindow = new nsBrowserAccess(); Cu.import('resource://gre/modules/Webapps.jsm'); 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 { if (!Services.prefs.getBoolPref('browser.cache.offline.enable')) return; let contentWindow = evt.originalTarget.defaultView; let documentElement = contentWindow.document.documentElement; @@ -352,16 +364,25 @@ var shell = { sendEvent: function shell_sendEvent(content, type, details) { let event = content.document.createEvent('CustomEvent'); event.initCustomEvent(type, true, true, details ? details : {}); content.dispatchEvent(event); }, 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())); }, sendSystemMessage: function shell_sendSystemMessage(msg) { let origin = Services.io.newURI(msg.manifest, null, null).prePath; this.sendChromeEvent({ type: 'open-app',