New package: slimerjs-0.9.6

This commit is contained in:
Eivind Uggedal 2015-08-14 08:26:51 +00:00
parent b0fc92900f
commit 8d13533e46
2 changed files with 78 additions and 0 deletions

View File

@ -0,0 +1,51 @@
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);

27
srcpkgs/slimerjs/template Normal file
View File

@ -0,0 +1,27 @@
# Template file for 'slimerjs'
pkgname=slimerjs
version=0.9.6
revision=1
noarch=yes
wrksrc=$pkgname-RELEASE_$version
hostmakedepends="zip"
depends="bash firefox<=4.0"
short_desc="A scriptable browser for Firefox"
maintainer="Eivind Uggedal <eivind@uggedal.com>"
license="MPL-2.0, BSD"
homepage="https://slimerjs.org"
distfiles="https://github.com/laurentj/$pkgname/archive/RELEASE_${version}.tar.gz"
checksum=6c0b36c2ed21351e7dd26140e452af5f98877d1071021d164b97daf39f9fe55c
do_build() {
./buildpackage.sh --no-bin
}
do_install() {
local dist=_dist/$pkgname-$version
mkdir -p $DESTDIR/usr/{bin,share/$pkgname}
vcopy "$dist/$pkgname $dist/*.ja $dist/*.ini $dist/chrome" \
usr/share/$pkgname
ln -s ../share/$pkgname/$pkgname $DESTDIR/usr/bin/$pkgname
vlicense LICENSE
}