Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove a bunch of old manual-update support code.

Instead make "availableUpdate" the parsed script when it was determined to be a valid update.  (To support coming fix for #1497.)
  • Loading branch information...
commit 660522f85770775d25a692dcb6431b11586e4079 1 parent 8fe0d4a
@arantius arantius authored
Showing with 7 additions and 31 deletions.
  1. +0 −8 content/config.js
  2. +3 −3 modules/addons4.js
  3. +4 −20 modules/script.js
View
8 content/config.js
@@ -243,14 +243,6 @@ Config.prototype.updateModifiedScripts = function(aWhen, aSafeWin) {
this._save();
};
-Config.prototype._notifyUpdates = function() {
- var scripts = this.getMatchingScripts(
- function (script) { return script.updateAvailable; });
- if (0 == scripts.length) return;
-
- GM_util.getBrowserWindow().GM_OpenUpdatesMgr();
-};
-
Config.prototype.getScriptById = function(scriptId) {
for (var i = 0, script = null; script = this.scripts[i]; i++) {
if (scriptId == script.id) {
View
6 modules/addons4.js
@@ -57,7 +57,7 @@ var AddonProvider = {
getInstallsByTypes: function(aTypes, aCallback) {
var scriptInstalls = [];
GM_util.getService().config.scripts.forEach(function(script) {
- if (!script.updateAvailable) return;
+ if (!script.availableUpdate) return;
var aAddon = ScriptAddonFactoryByScript(script);
var scriptInstall = ScriptInstallFactoryByAddon(aAddon);
@@ -295,9 +295,9 @@ ScriptInstall.prototype.install = function() {
// was just downloaded; "this._script" is the previously existing script
// that rs.install() just removed from the config, to update it.
if (gVersionChecker.compare(
- this._script._updateVersion, rs.script.version) > 0
+ this._script.availableUpdate.version, rs.script.version) > 0
) {
- rs.script._version = this._script._updateVersion;
+ rs.script._version = this._script.availableUpdate.version;
}
this.state = AddonManager.STATE_INSTALLING;
View
24 modules/script.js
@@ -50,7 +50,6 @@ function Script(configNode) {
this._runAt = null;
this._tempFile = null;
this._updateURL = null;
- this._updateVersion = null;
this._userExcludes = [];
this._userIncludes = [];
this._uuid = [];
@@ -60,7 +59,7 @@ function Script(configNode) {
this.needsUninstall = false;
this.parseErrors = [];
this.pendingExec = [];
- this.updateAvailable = null;
+ this.availableUpdate = null;
if (configNode) this._loadFromConfigNode(configNode);
}
@@ -287,16 +286,6 @@ Script.prototype._loadFromConfigNode = function(node) {
this._version = node.getAttribute("version");
}
- if (!node.getAttribute("updateAvailable")
- || !node.getAttribute("lastUpdateCheck")
- ) {
- this.updateAvailable = false;
- this._changed('modified', null);
- } else {
- this.updateAvailable = node.getAttribute("updateAvailable") == 'true';
- this._updateVersion = node.getAttribute("updateVersion") || null;
- }
-
// Note that "checkRemoteUpdates" used to be a boolean. As of #1647, it now
// holds one of the AddonManager.AUTOUPDATE_* values; so it's name is
// suboptimal.
@@ -426,7 +415,6 @@ Script.prototype.toConfigNode = function(doc) {
scriptNode.setAttribute("name", this._name);
scriptNode.setAttribute("namespace", this._namespace);
scriptNode.setAttribute("runAt", this._runAt);
- scriptNode.setAttribute("updateAvailable", this.updateAvailable);
scriptNode.setAttribute("uuid", this._uuid);
scriptNode.setAttribute("version", this._version);
@@ -436,9 +424,6 @@ Script.prototype.toConfigNode = function(doc) {
if (this.updateURL) {
scriptNode.setAttribute("updateurl", this.updateURL);
}
- if (this._updateVersion) {
- scriptNode.setAttribute("updateVersion", this._updateVersion);
- }
if (this.icon.filename) {
scriptNode.setAttribute("icon", this.icon.filename);
}
@@ -447,7 +432,7 @@ Script.prototype.toConfigNode = function(doc) {
};
Script.prototype.toString = function() {
- return '[Greasemonkey Script ' + this.id + ']';
+ return '[Greasemonkey Script ' + this.id + '; ' + this.version + ']';
};
Script.prototype.setDownloadedFile = function(file) { this._tempFile = file; };
@@ -709,7 +694,7 @@ Script.prototype.checkConfig = function() {
};
Script.prototype.checkForRemoteUpdate = function(aCallback) {
- if (this.updateAvailable) return aCallback(true);
+ if (this.availableUpdate) return aCallback(true);
var req = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(Components.interfaces.nsIXMLHttpRequest);
@@ -736,8 +721,7 @@ Script.prototype.checkRemoteVersion = function(req, aCallback) {
return aCallback(false);
}
- this.updateAvailable = true;
- this._updateVersion = remoteVersion;
+ this.availableUpdate = newScript;
this._changed('modified', null);
aCallback(true);
};
Please sign in to comment.
Something went wrong with that request. Please try again.