mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 823695: Part 1 - Send update errors after the shell is ready in B2G. r=fabrice
This commit is contained in:
parent
32ab354a8f
commit
e85796faf3
@ -1005,9 +1005,11 @@ window.addEventListener('ContentStart', function cr_onContentStart() {
|
||||
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() {
|
||||
|
@ -118,6 +118,7 @@ UpdatePrompt.prototype = {
|
||||
_applyPromptTimer: null,
|
||||
_waitingForIdle: false,
|
||||
_updateCheckListner: null,
|
||||
_pendingEvents: [],
|
||||
|
||||
get applyPromptTimeout() {
|
||||
return Services.prefs.getIntPref(PREF_APPLY_PROMPT_TIMEOUT);
|
||||
@ -127,6 +128,16 @@ UpdatePrompt.prototype = {
|
||||
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
|
||||
@ -237,16 +248,17 @@ UpdatePrompt.prototype = {
|
||||
},
|
||||
|
||||
sendChromeEvent: function UP_sendChromeEvent(aType, aDetail) {
|
||||
let browser = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
if (!browser) {
|
||||
log("Warning: Couldn't send update event " + aType +
|
||||
": no content browser");
|
||||
return false;
|
||||
}
|
||||
|
||||
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. Will send again when content becomes available.");
|
||||
return false;
|
||||
}
|
||||
|
||||
browser.shell.sendChromeEvent(detail);
|
||||
return true;
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user