зеркало из https://github.com/mozilla/pjs.git
Backed out changeset 58175e77c460 from bug 553494 due to test failures
This commit is contained in:
Родитель
7f36d053d4
Коммит
e3c96ccaf4
|
@ -133,8 +133,8 @@ function shutdown() {
|
|||
}
|
||||
|
||||
// Used by external callers to load a specific view into the manager
|
||||
function loadView(aViewId, aCallback) {
|
||||
gViewController.loadView(aViewId, aCallback);
|
||||
function loadView(url) {
|
||||
gViewController.loadView(url);
|
||||
}
|
||||
|
||||
var gEventManager = {
|
||||
|
@ -253,7 +253,6 @@ var gViewController = {
|
|||
currentViewRequest: 0,
|
||||
previousViewId: "",
|
||||
viewObjects: {},
|
||||
viewChangeCallback: null,
|
||||
|
||||
initialize: function() {
|
||||
this.viewPort = document.getElementById("view-port");
|
||||
|
@ -270,8 +269,6 @@ var gViewController = {
|
|||
},
|
||||
|
||||
shutdown: function() {
|
||||
if (this.currentViewObj)
|
||||
this.currentViewObj.hide();
|
||||
this.currentViewRequest = 0;
|
||||
},
|
||||
|
||||
|
@ -285,7 +282,7 @@ var gViewController = {
|
|||
return this.currentViewObj.node.hasAttribute("loading");
|
||||
},
|
||||
|
||||
loadView: function(aViewId, aCallback) {
|
||||
loadView: function(aViewId) {
|
||||
if (aViewId == this.currentViewId)
|
||||
return;
|
||||
|
||||
|
@ -317,8 +314,6 @@ var gViewController = {
|
|||
this.currentViewId = aViewId;
|
||||
this.currentViewObj = viewObj;
|
||||
|
||||
this.viewChangeCallback = aCallback;
|
||||
|
||||
this.viewPort.selectedPanel = this.currentViewObj.node;
|
||||
this.viewPort.selectedPanel.setAttribute("loading", "true");
|
||||
this.currentViewObj.show(view.param, ++this.currentViewRequest);
|
||||
|
@ -326,10 +321,6 @@ var gViewController = {
|
|||
|
||||
notifyViewChanged: function() {
|
||||
this.viewPort.selectedPanel.removeAttribute("loading");
|
||||
|
||||
if (this.viewChangeCallback)
|
||||
this.viewChangeCallback();
|
||||
|
||||
var event = document.createEvent("Events");
|
||||
event.initEvent("ViewChanged", true, true);
|
||||
this.currentViewObj.node.dispatchEvent(event);
|
||||
|
@ -536,14 +527,7 @@ var gViewController = {
|
|||
return hasPermission(aAddon, "uninstall");
|
||||
},
|
||||
doCommand: function(aAddon) {
|
||||
if (gViewController.currentViewObj != gDetailView) {
|
||||
aAddon.uninstall();
|
||||
return;
|
||||
}
|
||||
|
||||
gViewController.loadView(gViewController.previousViewId, function() {
|
||||
gViewController.currentViewObj.getListItemForID(aAddon.id).uninstall();
|
||||
});
|
||||
aAddon.uninstall();
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -1093,15 +1077,7 @@ var gSearchView = {
|
|||
gViewController.updateCommands();
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
var listitem = this._listBox.firstChild;
|
||||
while (listitem) {
|
||||
if (listitem.getAttribute("status") == "uninstalled" &&
|
||||
!listitem.isPending("uninstall"))
|
||||
listitem.mAddon.uninstall();
|
||||
listitem = listitem.nextSibling;
|
||||
}
|
||||
},
|
||||
hide: function() { },
|
||||
|
||||
getMatchScore: function(aObj, aQuery) {
|
||||
var score = 0;
|
||||
|
@ -1168,16 +1144,8 @@ var gSearchView = {
|
|||
if (item)
|
||||
return item.mAddon;
|
||||
return null;
|
||||
},
|
||||
|
||||
getListItemForID: function(aId) {
|
||||
var listitem = this._listBox.firstChild;
|
||||
while (listitem) {
|
||||
if (listitem.getAttribute("status") == "installed" && listitem.mAddon.id == aId)
|
||||
return listitem;
|
||||
listitem = listitem.nextSibling;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -1245,14 +1213,6 @@ var gListView = {
|
|||
|
||||
hide: function() {
|
||||
gEventManager.unregisterInstallListener(this);
|
||||
|
||||
var listitem = this._listBox.firstChild;
|
||||
while (listitem) {
|
||||
if (listitem.getAttribute("status") == "uninstalled" &&
|
||||
!listitem.isPending("uninstall"))
|
||||
listitem.mAddon.uninstall();
|
||||
listitem = listitem.nextSibling;
|
||||
}
|
||||
},
|
||||
|
||||
showEmptyNotice: function(aShow) {
|
||||
|
@ -1306,15 +1266,6 @@ var gListView = {
|
|||
if (item)
|
||||
return item.mAddon;
|
||||
return null;
|
||||
},
|
||||
|
||||
getListItemForID: function(aId) {
|
||||
var listitem = this._listBox.firstChild;
|
||||
while (listitem) {
|
||||
if (listitem.getAttribute("status") == "installed" && listitem.mAddon.id == aId)
|
||||
return listitem;
|
||||
listitem = listitem.nextSibling;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -711,14 +711,6 @@
|
|||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="opRequiresRestart">
|
||||
<parameter name="aOperation"/>
|
||||
<body><![CDATA[
|
||||
var operation = AddonManager["OP_NEEDS_RESTART_" + aOperation.toUpperCase()];
|
||||
return !!(this.mAddon.operationsRequiringRestart & operation);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="isPending">
|
||||
<parameter name="aAction"/>
|
||||
<body><![CDATA[
|
||||
|
@ -726,12 +718,6 @@
|
|||
return !!(this.mAddon.pendingOperations & action);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="onUninstalled">
|
||||
<body><![CDATA[
|
||||
this.parentNode.removeChild(this);
|
||||
]]></body>
|
||||
</method>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
|
@ -1045,18 +1031,8 @@
|
|||
|
||||
<method name="uninstall">
|
||||
<body><![CDATA[
|
||||
// If uninstalling does not require a restart then just disable it
|
||||
// and show the undo UI.
|
||||
if (!this.opRequiresRestart("uninstall")) {
|
||||
// This won't update any other add-on manager views (bug 582002)
|
||||
this.setAttribute("wasDisabled", this.mAddon.userDisabled);
|
||||
this.setAttribute("restartrequired", false);
|
||||
this.setAttribute("status", "uninstalled");
|
||||
this.mAddon.userDisabled = true;
|
||||
} else {
|
||||
this.mAddon.uninstall();
|
||||
}
|
||||
]]></body>
|
||||
this.mAddon.uninstall();
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="showPreferences">
|
||||
|
@ -1199,17 +1175,9 @@
|
|||
|
||||
<method name="cancelUninstall">
|
||||
<body><![CDATA[
|
||||
// This assumes that disabling does not require a restart when
|
||||
// uninstalling doesn't. Things will still work if not, the add-on
|
||||
// will just still be active until finally getting uninstalled.
|
||||
|
||||
if (this.isPending("uninstall"))
|
||||
this.mAddon.cancelUninstall();
|
||||
else if (this.getAttribute("wasDisabled") != "true")
|
||||
this.mAddon.userDisabled = false;
|
||||
|
||||
this.removeAttribute("restartrequired");
|
||||
this.setAttribute("status", "installed");
|
||||
this.mAddon.userDisabled = false;
|
||||
this.mAddon.cancelUninstall();
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
|
|
|
@ -56,7 +56,6 @@ _TEST_FILES = \
|
|||
browser_searching.xml \
|
||||
browser_searching_empty.xml \
|
||||
browser_sorting.js \
|
||||
browser_uninstalling.js \
|
||||
browser_updatessl.js \
|
||||
browser_updatessl.rdf \
|
||||
browser_installssl.js \
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -282,7 +282,6 @@ MockProvider.prototype = {
|
|||
*/
|
||||
addAddon: function MP_addAddon(aAddon) {
|
||||
this.addons.push(aAddon);
|
||||
aAddon._provider = this;
|
||||
|
||||
if (!this.started)
|
||||
return;
|
||||
|
@ -293,28 +292,6 @@ MockProvider.prototype = {
|
|||
null, requiresRestart)
|
||||
},
|
||||
|
||||
/**
|
||||
* Removes an add-on from the list of add-ons that this provider exposes to
|
||||
* the AddonManager, dispatching the onUninstalled event in the process.
|
||||
*
|
||||
* @param aAddon
|
||||
* The add-on to add
|
||||
*/
|
||||
removeAddon: function MP_removeAddon(aAddon) {
|
||||
var pos = this.addons.indexOf(aAddon);
|
||||
if (pos == -1) {
|
||||
ok(false, "Tried to remove an add-on that wasn't registered with the mock provider");
|
||||
return;
|
||||
}
|
||||
|
||||
this.addons.splice(pos, 1);
|
||||
|
||||
if (!this.started)
|
||||
return;
|
||||
|
||||
AddonManagerPrivate.callAddonListeners("onUninstalled", aAddon);
|
||||
},
|
||||
|
||||
/**
|
||||
* Adds an add-on install to the list of installs that this provider exposes
|
||||
* to the AddonManager, dispatching appropriate events in the process.
|
||||
|
@ -611,15 +588,12 @@ function MockAddon(aId, aName, aType, aOperationsRequiringRestart) {
|
|||
this.providesUpdatesSecurely = true;
|
||||
this.blocklistState = 0;
|
||||
this.appDisabled = false;
|
||||
this._userDisabled = false;
|
||||
this.userDisabled = false;
|
||||
this.scope = AddonManager.SCOPE_PROFILE;
|
||||
this.isActive = true;
|
||||
this.creator = "";
|
||||
this.pendingOperations = 0;
|
||||
this.permissions = AddonManager.PERM_CAN_UNINSTALL |
|
||||
AddonManager.PERM_CAN_ENABLE |
|
||||
AddonManager.PERM_CAN_DISABLE |
|
||||
AddonManager.PERM_CAN_UPGRADE;
|
||||
this.permissions = 0;
|
||||
this.operationsRequiringRestart = aOperationsRequiringRestart ||
|
||||
(AddonManager.OP_NEEDS_RESTART_INSTALL |
|
||||
AddonManager.OP_NEEDS_RESTART_UNINSTALL |
|
||||
|
@ -628,26 +602,6 @@ function MockAddon(aId, aName, aType, aOperationsRequiringRestart) {
|
|||
}
|
||||
|
||||
MockAddon.prototype = {
|
||||
get shouldBeActive() {
|
||||
return !this.appDisabled && !this._userDisabled;
|
||||
},
|
||||
|
||||
get userDisabled() {
|
||||
return this._userDisabled;
|
||||
},
|
||||
|
||||
set userDisabled(val) {
|
||||
if (val == this._userDisabled)
|
||||
return val;
|
||||
|
||||
var currentActive = this.shouldBeActive;
|
||||
this._userDisabled = val;
|
||||
var newActive = this.shouldBeActive;
|
||||
this._updateActiveState(currentActive, newActive);
|
||||
|
||||
return val;
|
||||
},
|
||||
|
||||
isCompatibleWith: function(aAppVersion, aPlatformVersion) {
|
||||
return true;
|
||||
},
|
||||
|
@ -657,53 +611,11 @@ MockAddon.prototype = {
|
|||
},
|
||||
|
||||
uninstall: function() {
|
||||
if (this.pendingOperations & AddonManager.PENDING_UNINSTALL)
|
||||
throw new Error("Add-on is already pending uninstall");
|
||||
|
||||
var needsRestart = !!(this.operationsRequiringRestart & AddonManager.OP_NEEDS_RESTART_UNINSTALL);
|
||||
this.pendingOperations |= AddonManager.PENDING_UNINSTALL;
|
||||
AddonManagerPrivate.callAddonListeners("onUninstalling", this, needsRestart);
|
||||
if (!needsRestart) {
|
||||
this.pendingOperations -= AddonManager.PENDING_UNINSTALL;
|
||||
this._provider.removeAddon(this);
|
||||
}
|
||||
// To be implemented when needed
|
||||
},
|
||||
|
||||
cancelUninstall: function() {
|
||||
if (!(this.pendingOperations & AddonManager.PENDING_UNINSTALL))
|
||||
throw new Error("Add-on is not pending uninstall");
|
||||
|
||||
this.pendingOperations -= AddonManager.PENDING_UNINSTALL;
|
||||
AddonManagerPrivate.callAddonListeners("onOperationCancelled", this);
|
||||
},
|
||||
|
||||
_updateActiveState: function(currentActive, newActive) {
|
||||
if (currentActive == newActive)
|
||||
return;
|
||||
|
||||
if (newActive == this.isActive) {
|
||||
AddonManagerPrivate.callAddonListeners("onOperationCancelled", this);
|
||||
}
|
||||
else if (newActive) {
|
||||
var needsRestart = !!(this.operationsRequiringRestart & AddonManager.OP_NEEDS_RESTART_ENABLE);
|
||||
this.pendingOperations |= AddonManager.PENDING_ENABLE;
|
||||
AddonManagerPrivate.callAddonListeners("onEnabling", this, needsRestart);
|
||||
if (!needsRestart) {
|
||||
this.isActive = newActive;
|
||||
this.pendingOperations -= AddonManager.PENDING_ENABLE;
|
||||
AddonManagerPrivate.callAddonListeners("onEnabled", this);
|
||||
}
|
||||
}
|
||||
else {
|
||||
var needsRestart = !!(this.operationsRequiringRestart & AddonManager.OP_NEEDS_RESTART_DISABLE);
|
||||
this.pendingOperations |= AddonManager.PENDING_DISABLE;
|
||||
AddonManagerPrivate.callAddonListeners("onDisabling", this, needsRestart);
|
||||
if (!needsRestart) {
|
||||
this.isActive = newActive;
|
||||
this.pendingOperations -= AddonManager.PENDING_DISABLE;
|
||||
AddonManagerPrivate.callAddonListeners("onDisabled", this);
|
||||
}
|
||||
}
|
||||
// To be implemented when needed
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче