Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Closes #511 GM_openInTab now ~works for Fennec (all args besides aURL…

… are ignored atm)
  • Loading branch information...
commit 2a8d44ca780bfef958f1eb74015a727dbdab8e1f 1 parent 0b59ff5
@erikvold erikvold authored
View
6 extension/content/e10s/browser.js
@@ -10,6 +10,7 @@
lazyUtil(global, "installUri");
lazyUtil(global, "getScriptHeader");
lazyUtil(global, "notification");
+ lazyUtil(global, "openInTab");
var $ = function(id) document.getElementById(id);
@@ -91,6 +92,11 @@
return Scriptish_getScriptHeader(Scriptish_config.getScriptById(json.id), json.key, json.localVal);
});
+ mm.addMessageListener("Scriptish:OpenInTab", function({json}) {
+ json.push(global);
+ return Scriptish_openInTab.apply(null, json);
+ });
+
mm.loadFrameScript(
"chrome://scriptish/content/e10s/browser-content.js",
true); // no delay loading frame script
View
14 extension/modules/api.js
@@ -3,7 +3,7 @@ var EXPORTED_SYMBOLS = ["GM_API", "GM_apiSafeCallback"];
const Cu = Components.utils;
Cu.import("resource://scriptish/constants.js");
-lazyImport(this, "resource://scriptish/logging.js", ["Scriptish_logError", "Scriptish_logScriptError"]);
+lazyImport(this, "resource://scriptish/logging.js", ["Scriptish_logError", "Scriptish_logScriptError", "Scriptish_log"]);
lazyImport(this, "resource://scriptish/utils/Scriptish_evalInSandbox.js", ["Scriptish_evalInSandbox_filename"]);
lazyImport(this, "resource://scriptish/utils/Scriptish_injectScripts.js", ["Scriptish_injectScripts_filename"]);
@@ -169,7 +169,17 @@ function GM_API(options) {
this.GM_openInTab = function GM_openInTab(aURL, aLoadInBackground, aReuse) {
if (!GM_apiLeakCheck("GM_openInTab")) return;
- return Scriptish_openInTab(aURL, aLoadInBackground, aReuse, aChromeWin);
+
+ if (options.global && options.global.sendSyncMessage) {
+ // TODO: implement aReuse for Fennec
+ options.global.sendAsyncMessage("Scriptish:OpenInTab", [
+ aURL, aLoadInBackground, false]);
+ }
+ else {
+ Scriptish_openInTab(aURL, aLoadInBackground, aReuse, aChromeWin);
+ }
+
+ return undefined; // can't return window object b/c of e10s, don't bother
}
this.GM_xmlhttpRequest = function GM_xmlhttpRequest() {
View
5 extension/modules/utils/Scriptish_openInTab.js
@@ -7,6 +7,11 @@ lazyImport(this, "resource://scriptish/scriptish.js", ["Scriptish"]);
function Scriptish_openInTab(aURL, aLoadInBackground, aReuse, aChromeWin) {
aChromeWin = aChromeWin || Scriptish.getMostRecentWindow();
+ if ("Fennec" == Services.appinfo.name) {
+ aChromeWin.Browser.addTab(aURL);
+ return;
+ }
+
// Try to reuse an existing tab
if (aReuse) {
let browserEnumerator = Services.wm.getEnumerator("navigator:browser");
Please sign in to comment.
Something went wrong with that request. Please try again.