Skip to content

Commit

Permalink
Only examine the URI when we have one.
Browse files Browse the repository at this point in the history
(In RemoteScript._downloadFile().)

Fixes greasemonkey#1504
  • Loading branch information
Anthony Lieuallen committed Feb 6, 2012
1 parent b63e754 commit 208469d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
1 change: 0 additions & 1 deletion content/config.js
Expand Up @@ -231,7 +231,6 @@ Config.prototype.updateModifiedScripts = function(aWhen, aSafeWin, aChromeWin) {


for (var i = 0, script; script = scripts[i]; i++) { for (var i = 0, script; script = scripts[i]; i++) {
if (0 == script.pendingExec.length) { if (0 == script.pendingExec.length) {
var oldScriptId = new String(script.id);
var scope = {}; var scope = {};
Components.utils.import('resource://greasemonkey/parseScript.js', scope); Components.utils.import('resource://greasemonkey/parseScript.js', scope);
var parsedScript = scope.parse( var parsedScript = scope.parse(
Expand Down
19 changes: 11 additions & 8 deletions modules/remoteScript.js
Expand Up @@ -369,14 +369,17 @@ RemoteScript.prototype._downloadFile = function(
assertIsFunction(aCompletionCallback, assertIsFunction(aCompletionCallback,
'_downloadFile() completion callback is not a function.'); '_downloadFile() completion callback is not a function.');


if (aUri == this._uri) { // If we have a URI (locally installed scripts, when updating, won't!) ...
// No-op, always download the script itself. if (this._uri) {
} else if (aUri.scheme == this._uri.scheme) { if (aUri == this._uri) {
// No-op, always allow files from the same scheme as the script. // No-op, always download the script itself.
} else if (!GM_util.isGreasemonkeyable(aUri.spec)) { } else if (aUri.scheme == this._uri.scheme) {
// Otherwise, these are unsafe. Do not download them. // No-op, always allow files from the same scheme as the script.
this.cleanup('Will not download unsafe URL:\n' + aUri.spec); } else if (!GM_util.isGreasemonkeyable(aUri.spec)) {
return; // 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 // Dangerous semi-global state: The web browser persist object is stored
Expand Down

0 comments on commit 208469d

Please sign in to comment.