Bug 624630 - [JS Error] browser_addons.js message listener is stuck and UIReadyDelayed is busted [r=me-bustage]

This commit is contained in:
Mark Finkle 2011-01-11 00:56:29 -05:00
parent 8f5a4085e9
commit e7ea75a738
4 changed files with 26 additions and 22 deletions

View File

@ -109,6 +109,9 @@ var SelectHelperUI = {
},
hide: function selectHelperResize() {
if (!this._list)
return;
this.showFilter = false;
this._container.removeEventListener("click", this, false);
this._panel.removeEventListener("overflow", this, true);

View File

@ -942,7 +942,7 @@ var BrowserUI = {
let dlFile = download.targetFile;
if (!dlFile.exists())
dlFile.create(file.NORMAL_FILE_TYPE, 0666);
let tmpDir = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties).get("TmpD", Ci.nsIFile);
let tmpDir = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties).get("TmpD", Ci.nsIFile);
let tmpFile = tmpDir.clone();
tmpFile.append(dlFile.leafName);

View File

@ -234,11 +234,13 @@ var ExtensionsView = {
},
false);
#ifdef ANDROID
// Hide the notification
let alertsService = Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService);
let progressListener = alertsService.QueryInterface(Ci.nsIAlertsProgressListener);
if (progressListener)
progressListener.onCancel(ADDONS_NOTIFICATION_NAME);
#endif
},
_delayedInit: function ev__delayedInit() {
@ -304,7 +306,7 @@ var ExtensionsView = {
case Ci.nsIBlocklistService.STATE_OUTDATED:
blocked = srings.getString("addonBlocked.outdated");
break;
}
}
let listitem = this._createItem(aAddon, "local");
listitem.setAttribute("isDisabled", !aAddon.isActive);
@ -474,7 +476,7 @@ var ExtensionsView = {
// can't be cancelled
if (!aItem.addon.isActive && opType == "")
opType = "needs-uninstall";
aItem.setAttribute("opType", opType);
} else {
this._list.removeChild(aItem);
@ -746,7 +748,7 @@ var ExtensionsView = {
updateAll: function ev_updateAll() {
let aus = Cc["@mozilla.org/browser/addon-update-service;1"].getService(Ci.nsITimerCallback);
aus.notify(null);
if (this._list.selectedItem)
this._list.selectedItem.focus();
},
@ -947,7 +949,7 @@ AddonInstallListener.prototype = {
let element = ExtensionsView.getElementForAddon(aInstall.sourceURI.spec);
if (!element)
return;
element.removeAttribute("opType");
let strings = Services.strings.createBundle("chrome://global/locale/xpinstall/xpinstall.properties");
@ -1022,7 +1024,7 @@ AddonInstallListener.prototype = {
messageString = messageString.replace("#2", host);
messageString = messageString.replace("#3", brandShortName);
messageString = messageString.replace("#4", Services.appinfo.version);
ExtensionsView.showAlert(messageString);
},

View File

@ -208,7 +208,7 @@ function checkAlert(aId, aName, aLabel, aShown, aCallback) {
let msg = null;
if (aId)
msg = document.getElementById(aId);
else
else
msg = window.getNotificationBox(gCurrentTab.browser);
ok(!!msg, "Have notification box");
@ -275,7 +275,7 @@ function open_manager(aView, aCallback) {
function close_manager(aCallback) {
var prefsButton = document.getElementById("tool-preferences");
prefsButton.click();
ExtensionsView.clearSection();
ExtensionsView.clearSection("local");
ExtensionsView._list = null;
@ -287,18 +287,20 @@ function close_manager(aCallback) {
}
function loadUrl(aURL, aCallback, aNewTab) {
messageManager.addMessageListener("pageshow", function() {
if (gCurrentTab.browser.currentURI.spec == aURL) {
messageManager.removeMessageListener("pageshow", arguments.callee);
if (aCallback)
aCallback();
}
});
if (aNewTab)
gCurrentTab = Browser.addTab(aURL, true);
else
Browser.loadURI(aURL);
gCurrentTab.browser.messageManager.addMessageListener("pageshow", function(aMessage) {
if (gCurrentTab.browser.currentURI.spec == aURL) {
gCurrentTab.browser.messageManager.removeMessageListener(aMessage.name, arguments.callee);
if (aCallback)
setTimeout(aCallback, 0);
}
});
}
function checkInstallPopup(aName, aCallback) {
testPrompt("Installing Add-on", aName, [ {label: "Install", click: true}, {label: "Cancel", click: false}], aCallback);
}
@ -313,7 +315,7 @@ function testPrompt(aTitle, aMessage, aButtons, aCallback) {
let message = document.getElementById("prompt-confirm-message");
is(aTitle, title.value, "Correct title shown");
is(aMessage, message.textContent, "Correct message shown");
let buttons = document.getElementsByClassName("prompt-button");
let clickButton = null;
ok(buttons.length == aButtons.length, "Prompt has correct number of buttons");
@ -358,10 +360,10 @@ function installFromURLBar(aAddon) {
checkAddonListing(aAddon, elt, "local");
var button = document.getAnonymousElementByAttribute(elt, "anonid", "uninstall-button");
ok(!!button, "Extension has uninstall button");
var updateButton = document.getElementById("addons-update-all");
is(updateButton.disabled, false, "Update button is enabled");
ExtensionsView.uninstall(elt);
elt = get_addon_element(aAddon.id);
ok(!elt, "Addon element removed during uninstall");
@ -483,7 +485,7 @@ updateListener.prototype = {
os.removeObserver(this, "addon-update-ended", false);
let element = get_addon_element(update.id);
ok(!!element, "Have element for upgrade");
ok(!!element, "Have element for upgrade");
let self = this;
isRestartShown(!this.addon.bootstrapped, true, function() {
@ -495,6 +497,3 @@ updateListener.prototype = {
}
},
}