51 lines
2.5 KiB
Diff
51 lines
2.5 KiB
Diff
From 1668cb41f53ed2bad116a876f615fe133e7fb314 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Jerry=20Lundstr=C3=B6m?= <lundstrom.jerry@gmail.com>
|
|
Date: Wed, 12 Aug 2015 11:07:25 +0200
|
|
Subject: [PATCH] Update supported Gecko version to 40.*. Fix 'Sandbox must
|
|
subsume sandboxPrototype' error by supplying the content window as prototype
|
|
if the Gecko version is 40 or above.
|
|
|
|
---
|
|
src/application.ini | 2 +-
|
|
src/modules/slLauncher.jsm | 11 ++++++++---
|
|
2 files changed, 9 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/src/application.ini b/src/application.ini
|
|
index 46f151a..4fb267b 100644
|
|
--- src/application.ini
|
|
+++ src/application.ini
|
|
@@ -8,4 +8,4 @@ Copyright=Copyright 2012-2015 Laurent Jouanneau & Innophi
|
|
|
|
[Gecko]
|
|
MinVersion=17.0.0
|
|
-MaxVersion=39.*
|
|
+MaxVersion=40.*
|
|
diff --git a/src/modules/slLauncher.jsm b/src/modules/slLauncher.jsm
|
|
index e49e811..72e4004 100644
|
|
--- src/modules/slLauncher.jsm
|
|
+++ src/modules/slLauncher.jsm
|
|
@@ -22,6 +22,10 @@ const fileHandler = Cc["@mozilla.org/network/protocol;1?name=file"]
|
|
.getService(Ci.nsIFileProtocolHandler)
|
|
const systemPrincipal = Cc['@mozilla.org/systemprincipal;1']
|
|
.createInstance(Ci.nsIPrincipal)
|
|
+const appInfo = Cc["@mozilla.org/xre/app-info;1"]
|
|
+ .getService(Ci.nsIXULAppInfo);
|
|
+const versionComparator = Cc["@mozilla.org/xpcom/version-comparator;1"]
|
|
+ .getService(Ci.nsIVersionComparator);
|
|
|
|
/**
|
|
* this function retrieves various informations
|
|
@@ -92,9 +96,10 @@ var slLauncher = {
|
|
// prepare the sandbox to execute coffee script injected with injectJs
|
|
coffeeScriptSandbox = Cu.Sandbox(contentWindow,
|
|
{
|
|
- 'sandboxName': 'coffeescript',
|
|
- 'sandboxPrototype': {},
|
|
- 'wantXrays': true
|
|
+ sandboxName: 'coffeescript',
|
|
+ // XULrunner 40.0 and above handles sandboxPrototype different then before
|
|
+ sandboxPrototype: versionComparator.compare(appInfo.platformVersion, '40') < 0 ? {} : contentWindow,
|
|
+ wantXrays: true
|
|
});
|
|
let src = slUtils.readChromeFile("resource://slimerjs/coffee-script/extras/coffee-script.js");
|
|
Cu.evalInSandbox('var CoffeeScript;', coffeeScriptSandbox, 'ECMAv5', 'slLauncher::launchMainScript', 1);
|