author | Marshall Culpepper <marshall@mozilla.com> |
Mon, 14 Jan 2013 23:40:51 -0800 | |
changeset 118867 | 2fb031ef6180ae7a8a97a4dfd570b546cdf5a423 |
parent 118866 | d18a896bcde612d8b1dc295d19ecc276b2b1c9d4 |
child 118868 | 7265493e26b047b97af8b85eeadb41b190cc55b0 |
push id | 24180 |
push user | emorley@mozilla.com |
push date | Tue, 15 Jan 2013 22:58:27 +0000 |
treeherder | mozilla-central@72e34ce7fd92 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | fabrice |
bugs | 823695 |
milestone | 21.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
|
b2g/chrome/content/shell.js | file | annotate | diff | comparison | revisions | |
b2g/components/UpdatePrompt.js | file | annotate | diff | comparison | revisions |
--- a/b2g/chrome/content/shell.js +++ b/b2g/chrome/content/shell.js @@ -1000,19 +1000,21 @@ window.addEventListener('ContentStart', shell.submitCrash(e.detail.crashID); } }); }); window.addEventListener('ContentStart', function update_onContentStart() { let updatePrompt = Cc["@mozilla.org/updates/update-prompt;1"] .createInstance(Ci.nsIUpdatePrompt); + if (!updatePrompt) { + return; + } - let content = shell.contentBrowser.contentWindow; - content.addEventListener("mozContentEvent", updatePrompt.wrappedJSObject); + updatePrompt.wrappedJSObject.handleContentStart(shell); }); (function geolocationStatusTracker() { let gGeolocationActiveCount = 0; Services.obs.addObserver(function(aSubject, aTopic, aData) { let oldCount = gGeolocationActiveCount; if (aData == "starting") {
--- a/b2g/components/UpdatePrompt.js +++ b/b2g/components/UpdatePrompt.js @@ -113,25 +113,36 @@ UpdatePrompt.prototype = { Ci.nsIProgressEventSink, Ci.nsIObserver]), _xpcom_factory: XPCOMUtils.generateSingletonFactory(UpdatePrompt), _update: null, _applyPromptTimer: null, _waitingForIdle: false, _updateCheckListner: null, + _pendingEvents: [], get applyPromptTimeout() { return Services.prefs.getIntPref(PREF_APPLY_PROMPT_TIMEOUT); }, get applyIdleTimeout() { return Services.prefs.getIntPref(PREF_APPLY_IDLE_TIMEOUT); }, + handleContentStart: function UP_handleContentStart(shell) { + let content = shell.contentBrowser.contentWindow; + content.addEventListener("mozContentEvent", this); + + for (let i = 0; i < this._pendingEvents.length; i++) { + shell.sendChromeEvent(this._pendingEvents[i]); + } + this._pendingEvents.length = 0; + }, + // nsIUpdatePrompt // FIXME/bug 737601: we should have users opt-in to downloading // updates when on a billed pipe. Initially, opt-in for 3g, but // that doesn't cover all cases. checkForUpdates: function UP_checkForUpdates() { }, showUpdateAvailable: function UP_showUpdateAvailable(aUpdate) { @@ -232,26 +243,27 @@ UpdatePrompt.prototype = { log("Warning: no patches available in update"); } this._update = aUpdate; return this.sendChromeEvent(aType, detail); }, sendChromeEvent: function UP_sendChromeEvent(aType, aDetail) { + let detail = aDetail || {}; + detail.type = aType; + let browser = Services.wm.getMostRecentWindow("navigator:browser"); if (!browser) { + this._pendingEvents.push(detail); log("Warning: Couldn't send update event " + aType + - ": no content browser"); + ": no content browser. Will send again when content becomes available."); return false; } - let detail = aDetail || {}; - detail.type = aType; - browser.shell.sendChromeEvent(detail); return true; }, handleAvailableResult: function UP_handleAvailableResult(aDetail) { // If the user doesn't choose "download", the updater will implicitly call // showUpdateAvailable again after a certain period of time switch (aDetail.result) {