mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 342098 - Refactor startup in extensions.js so that showView will only ever be called once. patch=michael.wu, r=rob_strong
This commit is contained in:
parent
216739aaf7
commit
d504dd072a
@ -54,8 +54,8 @@ pref("general.startup.browser", true);
|
||||
pref("browser.chromeURL","chrome://browser/content/");
|
||||
pref("browser.hiddenWindowChromeURL", "chrome://browser/content/hiddenWindow.xul");
|
||||
pref("xpinstall.dialog.confirm", "chrome://mozapps/content/xpinstall/xpinstallConfirm.xul");
|
||||
pref("xpinstall.dialog.progress.skin", "chrome://mozapps/content/extensions/extensions.xul?view=installs");
|
||||
pref("xpinstall.dialog.progress.chrome", "chrome://mozapps/content/extensions/extensions.xul?view=installs");
|
||||
pref("xpinstall.dialog.progress.skin", "chrome://mozapps/content/extensions/extensions.xul");
|
||||
pref("xpinstall.dialog.progress.chrome", "chrome://mozapps/content/extensions/extensions.xul");
|
||||
pref("xpinstall.dialog.progress.type.skin", "Extension:Manager");
|
||||
pref("xpinstall.dialog.progress.type.chrome", "Extension:Manager");
|
||||
|
||||
|
@ -475,7 +475,6 @@ function setRestartMessage(aItem)
|
||||
// Startup, Shutdown
|
||||
function Startup()
|
||||
{
|
||||
var startupView = window.location.search.substr("?view=".length, window.location.search.length);
|
||||
gExtensionStrings = document.getElementById("extensionsStrings");
|
||||
gPref = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
@ -512,12 +511,6 @@ function Startup()
|
||||
gExtensionsView.setAttribute("ref", RDFURI_ITEM_ROOT);
|
||||
|
||||
var viewGroup = document.getElementById("viewGroup");
|
||||
if (startupView == "installs")
|
||||
showView("installs");
|
||||
else if (viewGroup.hasAttribute("last-selected"))
|
||||
showView(viewGroup.getAttribute("last-selected"));
|
||||
else
|
||||
showView("extensions");
|
||||
|
||||
gExtensionsView.focus();
|
||||
gExtensionsViewController.onCommandUpdate();
|
||||
@ -551,16 +544,15 @@ function Startup()
|
||||
if ("arguments" in window) {
|
||||
try {
|
||||
var params = window.arguments[0].QueryInterface(Components.interfaces.nsIDialogParamBlock);
|
||||
showView("installs");
|
||||
gDownloadManager.addDownloads(params);
|
||||
}
|
||||
catch (e) {
|
||||
if (window.arguments[0] == "updatecheck")
|
||||
checkUpdatesAll();
|
||||
else if (window.arguments[0] == "updates-only") {
|
||||
if (window.arguments[0] == "updates-only") {
|
||||
gUpdatesOnly = true;
|
||||
document.getElementById("viewGroup").hidden = true;
|
||||
document.getElementById("extensionsView").setAttribute("norestart", "");
|
||||
showView('updates');
|
||||
showView("updates");
|
||||
var addonsMsg = document.getElementById("addonsMsg");
|
||||
addonsMsg.showMessage("chrome://mozapps/skin/extensions/question.png",
|
||||
getExtensionString("newUpdatesAvailableMsg"),
|
||||
@ -569,11 +561,18 @@ function Startup()
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (viewGroup.hasAttribute("last-selected"))
|
||||
showView(viewGroup.getAttribute("last-selected"));
|
||||
else
|
||||
showView("extensions");
|
||||
|
||||
if (gExtensionsView.selectedItem)
|
||||
gExtensionsView.scrollBoxObject.scrollToElement(gExtensionsView.selectedItem);
|
||||
|
||||
gPref.setBoolPref(PREF_UPDATE_NOTIFYUSER, false);
|
||||
|
||||
if (gUpdatesOnly && gExtensionsView.children.length == 0)
|
||||
window.close();
|
||||
}
|
||||
|
||||
function Shutdown()
|
||||
|
@ -72,7 +72,6 @@ const PREF_DSS_SKIN_TO_SELECT = "extensions.lastSelectedSkin";
|
||||
const PREF_GENERAL_SKINS_SELECTEDSKIN = "general.skins.selectedSkin";
|
||||
const PREF_EM_LOGGING_ENABLED = "extensions.logging.enabled";
|
||||
const PREF_EM_UPDATE_INTERVAL = "extensions.update.interval";
|
||||
const PREF_XPINSTALL_STATUS_DLG_SKIN = "xpinstall.dialog.progress.skin";
|
||||
const PREF_BLOCKLIST_URL = "extensions.blocklist.url";
|
||||
const PREF_BLOCKLIST_DETAILS_URL = "extensions.blocklist.detailsURL";
|
||||
const PREF_BLOCKLIST_ENABLED = "extensions.blocklist.enabled";
|
||||
@ -4391,29 +4390,6 @@ ExtensionManager.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
// When installing themes we need to open the theme manager if it is not
|
||||
// already opened except when we are installing a xpi dropped into a
|
||||
// extensions directory.
|
||||
fileURL = getURIFromFile(files[files.length - 1]).QueryInterface(nsIURL);
|
||||
if (fileURL.fileExtension.toLowerCase() == "jar") {
|
||||
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
|
||||
.getService(Components.interfaces.nsIWindowMediator);
|
||||
var win = wm.getMostRecentWindow("Extension:Manager-extensions");
|
||||
if (win) {
|
||||
win = wm.getMostRecentWindow("Extension:Manager-themes");
|
||||
if (win) {
|
||||
win.focus();
|
||||
}
|
||||
else {
|
||||
var themeManagerURL = gPref.getCharPref(PREF_XPINSTALL_STATUS_DLG_SKIN);
|
||||
var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
|
||||
.getService(Components.interfaces.nsIWindowWatcher);
|
||||
ww.openWindow(null, themeManagerURL,
|
||||
"", "chrome,centerscreen,titlebar,dialog=no,resizable", []);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < files.length; ++i) {
|
||||
em.installItemFromFileInternal(files[i], aInstallLocationKey, null);
|
||||
files[i].remove(false);
|
||||
|
Loading…
Reference in New Issue
Block a user