Subject: | problem compiling with JS_SetBranchCallback() |
Am I the only one who found to have problem testing the package, as it
does not find a good object reference for JS_SetBranchCallback()
?
I run this this over a "debian" distro with "mozjs":
ii libmozjs-dev 1.9.1.8-6
Development files for the Mozilla SpiderMonkey
JavaScript library
ii libmozjs2d 1.9.1.8-6
The Mozilla SpiderMonkey JavaScript library
ii libmozjs2d-dbg 1.9.1.8-6
Development files for the Mozilla SpiderMonkey
JavaScript library
I have attached a naive patch to fix, but not really fully tested, and
invite more experienced users to improve no end.
Subject: | JavaScript-SpiderMonkey-0.19_0.19.0.diff |
Only in JavaScript-SpiderMonkey-0.19-NOhIIa: blib
Only in JavaScript-SpiderMonkey-0.19-NOhIIa: Makefile
Only in JavaScript-SpiderMonkey-0.19-NOhIIa: Makefile.old
diff -u -r JavaScript-SpiderMonkey-0.19-0m8Tve/Makefile.PL JavaScript-SpiderMonkey-0.19-NOhIIa/Makefile.PL
--- JavaScript-SpiderMonkey-0.19-0m8Tve/Makefile.PL 2007-06-08 20:03:08.000000000 +0100
+++ JavaScript-SpiderMonkey-0.19-NOhIIa/Makefile.PL 2010-03-28 18:45:45.000000000 +0100
@@ -105,6 +105,9 @@
my $JS_DEFINE;
my $E4X = 0;
my $JS_THREADSAFE = 0;
+#CPM100328
+$E4X = 1;
+$JS_THREADSAFE = 1;
## Get options from command line
GetOptions(
Only in JavaScript-SpiderMonkey-0.19-NOhIIa: Makefile.PL~
Only in JavaScript-SpiderMonkey-0.19-NOhIIa: pm_to_blib
Only in JavaScript-SpiderMonkey-0.19-NOhIIa: SpiderMonkey.bs
Only in JavaScript-SpiderMonkey-0.19-NOhIIa: SpiderMonkey.c
Only in JavaScript-SpiderMonkey-0.19-NOhIIa: SpiderMonkey.o
diff -u -r JavaScript-SpiderMonkey-0.19-0m8Tve/SpiderMonkey.pm JavaScript-SpiderMonkey-0.19-NOhIIa/SpiderMonkey.pm
--- JavaScript-SpiderMonkey-0.19-0m8Tve/SpiderMonkey.pm 2007-09-05 13:00:17.000000000 +0100
+++ JavaScript-SpiderMonkey-0.19-NOhIIa/SpiderMonkey.pm 2010-03-28 20:22:22.000000000 +0100
@@ -80,7 +80,7 @@
require Exporter;
require DynaLoader;
-our $VERSION = '0.19';
+our $VERSION = '0.19.0';
our @ISA = qw(Exporter DynaLoader);
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
Only in JavaScript-SpiderMonkey-0.19-NOhIIa: SpiderMonkey.pm~
diff -u -r JavaScript-SpiderMonkey-0.19-0m8Tve/SpiderMonkey.xs JavaScript-SpiderMonkey-0.19-NOhIIa/SpiderMonkey.xs
--- JavaScript-SpiderMonkey-0.19-0m8Tve/SpiderMonkey.xs 2007-06-08 20:03:08.000000000 +0100
+++ JavaScript-SpiderMonkey-0.19-NOhIIa/SpiderMonkey.xs 2010-03-28 19:52:59.000000000 +0100
@@ -217,13 +217,11 @@
report->linebuf);
sv_setpv(get_sv("@", TRUE), msg);
}
-
/* --------------------------------------------------------------------- */
static JSBool
BranchHandler(JSContext *cx, JSScript *script) {
/* --------------------------------------------------------------------- */
PJS_Context* pcx = (PJS_Context*) JS_GetContextPrivate(cx);
-
pcx->branch_count++;
if (pcx->branch_count > pcx->branch_max) {
return JS_FALSE;
@@ -694,10 +692,12 @@
######################################################################
CODE:
{
- PJS_Context* pcx = (PJS_Context *) JS_GetContextPrivate(cx);
- pcx->branch_count = 0;
- pcx->branch_max = max_branch_operations;
- JS_SetBranchCallback(cx, BranchHandler);
+ PJS_Context* pcx = (PJS_Context *) JS_GetContextPrivate(cx);
+ pcx->branch_count = 0;
+ pcx->branch_max = max_branch_operations;
+#CPM100328 JS_SetBranchCallback(cx, BranchHandler); naive replacement...
+#JS_SetOperationLimit(cx, max_branch_operations);
+ JS_SetOperationCallback(cx, (JSOperationCallback)BranchHandler);
}
OUTPUT:
Only in JavaScript-SpiderMonkey-0.19-NOhIIa: SpiderMonkey.xs~