From 208469ddbded7d6a66a858b9e8149aee672756e6 Mon Sep 17 00:00:00 2001 From: Anthony Lieuallen Date: Mon, 6 Feb 2012 17:08:25 -0500 Subject: [PATCH] Only examine the URI when we have one. (In RemoteScript._downloadFile().) Fixes #1504 --- content/config.js | 1 - modules/remoteScript.js | 19 +++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/content/config.js b/content/config.js index f1c3f2c85..c3a0f8b9d 100644 --- a/content/config.js +++ b/content/config.js @@ -231,7 +231,6 @@ Config.prototype.updateModifiedScripts = function(aWhen, aSafeWin, aChromeWin) { for (var i = 0, script; script = scripts[i]; i++) { if (0 == script.pendingExec.length) { - var oldScriptId = new String(script.id); var scope = {}; Components.utils.import('resource://greasemonkey/parseScript.js', scope); var parsedScript = scope.parse( diff --git a/modules/remoteScript.js b/modules/remoteScript.js index 6431bf107..1f5cfda93 100644 --- a/modules/remoteScript.js +++ b/modules/remoteScript.js @@ -369,14 +369,17 @@ RemoteScript.prototype._downloadFile = function( assertIsFunction(aCompletionCallback, '_downloadFile() completion callback is not a function.'); - if (aUri == this._uri) { - // No-op, always download the script itself. - } else if (aUri.scheme == this._uri.scheme) { - // No-op, always allow files from the same scheme as the script. - } else if (!GM_util.isGreasemonkeyable(aUri.spec)) { - // Otherwise, these are unsafe. Do not download them. - this.cleanup('Will not download unsafe URL:\n' + aUri.spec); - return; + // If we have a URI (locally installed scripts, when updating, won't!) ... + if (this._uri) { + if (aUri == this._uri) { + // No-op, always download the script itself. + } else if (aUri.scheme == this._uri.scheme) { + // No-op, always allow files from the same scheme as the script. + } else if (!GM_util.isGreasemonkeyable(aUri.spec)) { + // Otherwise, these are unsafe. Do not download them. + this.cleanup('Will not download unsafe URL:\n' + aUri.spec); + return; + } } // Dangerous semi-global state: The web browser persist object is stored