Skip to content

Commit

Permalink
Pass the proper arguments for various FF versions.
Browse files Browse the repository at this point in the history
Detect which version of firefox we are running in, and pass the proper
arguments to openNewTabWith(), as it changed across version 2 and 3.

Fixes #1003
  • Loading branch information
arantius committed Sep 20, 2009
1 parent 37ff12a commit 8cd7382
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions components/greasemonkey.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,19 @@ var greasemonkeyService = {
if (!GM_apiLeakCheck("GM_openInTab")) {
return undefined;
}
var newTab = chromeWin.openNewTabWith(
url, safeContentWin.document, null, null, null, null);

var info = Cc["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULAppInfo);
if (parseFloat(info.version, 10) < 3.0) {
// Pre FF 3.0 wants the URL as the second argument.
var newTab = chromeWin.openNewTabWith(
url, safeContentWin.document.location.href, null, null, null, null);
} else {
// Post FF 3.0 wants the document as the second argument.
var newTab = chromeWin.openNewTabWith(
url, safeContentWin.document, null, null, null, null);
}

// Source:
// http://mxr.mozilla.org/mozilla-central/source/browser/base/content/browser.js#4448
var newWindow = chromeWin.gBrowser
Expand Down

0 comments on commit 8cd7382

Please sign in to comment.