Skip to content

Commit

Permalink
Support actual-source-URL relative downloadURL and updateURL meta.
Browse files Browse the repository at this point in the history
Fixes #1658
  • Loading branch information
arantius committed Oct 17, 2012
1 parent 578d4e5 commit 059a71c
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions modules/parseScript.js
Expand Up @@ -7,6 +7,8 @@ Components.utils.import('resource://greasemonkey/scriptResource.js');
Components.utils.import('resource://greasemonkey/third-party/MatchPattern.js');
Components.utils.import('resource://greasemonkey/util.js');

var gIoService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var gLineSplitRegexp = /.+/g;
var gAllMetaRegexp = new RegExp(
'^// ==UserScript==([\\s\\S]*?)^// ==/UserScript==', 'm');
Expand Down Expand Up @@ -54,15 +56,22 @@ function parse(aSource, aUri, aFailWhenMissing, aNoMetaOk) {
case 'description':
case 'name':
case 'namespace':
case 'updateURL':
case 'version':
script['_' + header] = value;
break;

case 'downloadURL':
case 'installURL':
script._downloadURL = value;
header = 'downloadURL';
case 'downloadURL':
case 'updateURL':
try {
var uri = GM_util.uriFromUrl(value, aUri || this._downloadURL);
script['_' + header] = uri.spec;
} catch (e) {
dump('Failed to parse ' + header + ' "' + value + '":\n' + e + '\n');
}
break;

case 'exclude':
script._excludes.push(value);
break;
Expand Down

0 comments on commit 059a71c

Please sign in to comment.