Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Only try to parse the supplied base if it's a string, otherwise assume it's already a uri object.
  • Loading branch information
Ventero authored and arantius committed Jan 25, 2011
1 parent 3c0c9e0 commit c838d49
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions content/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,11 +315,16 @@ function GM_setEnabled(enabled) {
GM_prefRoot.setValue("enabled", enabled);
}

function GM_uriFromUrl(url, baseUrl) {
function GM_uriFromUrl(url, base) {
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var baseUri = null;
if (baseUrl) baseUri = GM_uriFromUrl(baseUrl);
if (typeof base === "string") {
baseUri = GM_uriFromUrl(base);
} else if (base) {
baseUri = base;
}

try {
return ioService.newURI(url, null, baseUri);
} catch (e) {
Expand Down

0 comments on commit c838d49

Please sign in to comment.