[Pkg-mozext-commits] [adblock-plus] 287/464: Take the custom SpiderMonkey client out of the loop, same results can be achieved with the default JavaScript shell

David Prévot taffit at moszumanska.debian.org
Tue Jul 22 20:44:26 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository adblock-plus.

commit aeb5f25b26eb139638af46f6cb6d1a1952a99722
Author: Wladimir Palant <trev at adblockplus.org>
Date:   Mon Aug 27 18:51:24 2012 +0200

    Take the custom SpiderMonkey client out of the loop, same results can be achieved with the default JavaScript shell
---
 Makefile       |  4 ++--
 abp_rewrite.py |  6 +++---
 jshydra.js     | 41 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 46 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 33c7993..17bfa3e 100644
--- a/Makefile
+++ b/Makefile
@@ -28,11 +28,11 @@ clean:
 -include $(wildcard .deps/*.pp)
 
 TESTS := $(notdir $(wildcard autotest/test_*.js))
-check:: jshydra$(BIN_SUFFIX)
+check::
 	@cd autotest && for f in $(TESTS); do \
 		eval $$(cat $$f | sed -e '/^\/\/ [A-Za-z]*:/!q' -e 's+^// \([A-Za-z]*\): \(.*\)$$+export \1="\2"+'); \
 		echo -n "$$Name... "; \
-		../jshydra$(BIN_SUFFIX) $$f $$Arguments > .$$f.out 2>&1; \
+		../mozilla/js/src/shell/js$(BIN_SUFFIX) ../jshydra.js $$f $$Arguments > .$$f.out 2>&1; \
 		if diff -w -q ".$$f.out" "$$f.expected" >/dev/null 2>&1; then \
 			echo ' passed!'; \
 		else \
diff --git a/abp_rewrite.py b/abp_rewrite.py
index fbbcecc..b25168b 100644
--- a/abp_rewrite.py
+++ b/abp_rewrite.py
@@ -23,10 +23,10 @@ def doRewrite():
     basedir = '.'
 
   if os.name == 'nt':
-    application = os.path.join(basedir, 'jshydra.exe')
+    application = os.path.join(basedir, 'mozilla', 'js', 'src', 'shell', 'js.exe')
   else:
-    application = os.path.join(basedir, 'jshydra')
-  command = [application, os.path.join(basedir, 'scripts', 'abprewrite.js'), '--trueast', '--arg', 'module=true']
+    application = os.path.join(basedir, 'mozilla', 'js', 'src', 'shell', 'js')
+  command = [application, os.path.join(basedir, 'jshydra.js'), os.path.join(basedir, 'scripts', 'abprewrite.js'), '--arg', 'module=true']
   for module in ('filterNotifier', 'filterClasses', 'subscriptionClasses', 'filterStorage', 'elemHide', 'matcher', 'filterListener', 'synchronizer'):
     sourceFile = os.path.join(sourceDir, 'lib', module + '.js')
     if not os.path.exists(sourceFile):
diff --git a/jshydra.js b/jshydra.js
new file mode 100644
index 0000000..7fcb1b1
--- /dev/null
+++ b/jshydra.js
@@ -0,0 +1,41 @@
+var include = function(file)
+{
+  if (typeof include.dirStack == "undefined")
+    include.dirStack = [];
+
+  if (include.dirStack.length && !/^([a-zA-Z]:)?[\/\\]/.test(file))
+    file = include.dirStack[include.dirStack.length - 1] + "/../" + file;
+
+  include.dirStack.push(file);
+  try
+  {
+    load(file);
+  }
+  finally
+  {
+    include.dirStack.pop();
+  }
+}
+var _print = print;
+
+(function(scriptArgs)
+{
+  let scriptArg = "";
+  for (var i = 0; i < scriptArgs.length; i++)
+  {
+    if (scriptArgs[i] == "--trueast")
+      scriptArgs.splice(i--, 1);
+    else if (scriptArgs[i] == "--arg" && i < scriptArgs.length - 1)
+    {
+      scriptArg = scriptArgs[i + 1];
+      scriptArgs.splice(i--, 2);
+    }
+  }
+
+  if (!scriptArgs.length)
+    throw Error("No script to execute");
+  include(scriptArgs[0]);
+
+  for (var i = 1; i < scriptArgs.length; i++)
+    process_js(Reflect.parse(read(scriptArgs[i])), scriptArgs[i], scriptArg);
+})(arguments);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git



More information about the Pkg-mozext-commits mailing list