[Pkg-mozext-commits] [adblock-plus] 296/464: Rewrite more unit tests; fixed source code link in the header of resulting files
David Prévot
taffit at moszumanska.debian.org
Tue Jul 22 20:44:27 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 f929b5bb4110f196637d48a1bc7890cfa859dc6f
Author: Wladimir Palant <trev at adblockplus.org>
Date: Tue Aug 28 14:41:19 2012 +0200
Rewrite more unit tests; fixed source code link in the header of resulting files
---
abp_rewrite.py | 6 +++---
scripts/abprewrite.js | 49 ++++++++++++++++++++++++++++++-------------------
2 files changed, 33 insertions(+), 22 deletions(-)
diff --git a/abp_rewrite.py b/abp_rewrite.py
index 86874fe..d91aae7 100644
--- a/abp_rewrite.py
+++ b/abp_rewrite.py
@@ -27,7 +27,7 @@ def doRewrite():
application = os.path.join(basedir, 'mozilla', 'js', 'src', 'shell', 'js.exe')
else:
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']
+ command = [application, os.path.join(basedir, 'jshydra.js'), os.path.join(basedir, 'scripts', 'abprewrite.js'), '--arg', 'module=true source_repo=https://hg.adblockplus.org/adblockplus/']
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):
@@ -38,8 +38,8 @@ def doRewrite():
out = open(os.path.join(targetDir, 'lib', 'adblockplus.js'), 'wb')
subprocess.Popen(command, stdout=out).communicate()
- command = [application, os.path.join(basedir, 'jshydra.js'), os.path.join(basedir, 'scripts', 'abprewrite.js')]
- for test in ('domainRestrictions', 'filterClasses', 'subscriptionClasses', 'matcher'):
+ command = [application, os.path.join(basedir, 'jshydra.js'), os.path.join(basedir, 'scripts', 'abprewrite.js'), '--arg', 'source_repo=https://hg.adblockplus.org/adblockplustests/']
+ for test in ('domainRestrictions', 'filterClasses', 'filterNotifier', 'filterStorage', 'matcher', 'regexpFilters_matching', 'subscriptionClasses'):
sourceFile = os.path.join(testsDir, 'chrome', 'content', 'tests', test + '.js')
if not os.path.exists(sourceFile):
print 'Source file %s could not be found' % sourceFile
diff --git a/scripts/abprewrite.js b/scripts/abprewrite.js
index 20bb18a..2204c53 100644
--- a/scripts/abprewrite.js
+++ b/scripts/abprewrite.js
@@ -1,27 +1,11 @@
// This script rewrites AST to be compatible with JavaScript 1.5 and decompiles
// the modified tree then
-// Output license header and warning - do this only once, not each time a file
-// is being processed.
-_print('/*');
-_print(' * This Source Code is subject to the terms of the Mozilla Public License');
-_print(' * version 2.0 (the "License"). You can obtain a copy of the License at');
-_print(' * http://mozilla.org/MPL/2.0/.');
-_print(' */');
-_print();
-_print('//');
-_print('// This file has been generated automatically from Adblock Plus for Firefox');
-_print('// source code. DO NOT MODIFY, change the original source code instead.');
-_print('//');
-_print('// Relevant repositories:');
-_print('// * https://hg.adblockplus.org/adblockplus/');
-_print('// * https://hg.adblockplus.org/jshydra/');
-_print('//');
-_print();
-
include("../scripts/astDecompile.js");
include("../utils/beautify.js");
+let headerPrinted = false;
+
// See https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API for
// AST structure.
@@ -31,7 +15,8 @@ let options = {
varIndex: 0,
indent_size: 2,
preserve_newlines: false,
- brace_style: "expand-strict"
+ brace_style: "expand-strict",
+ source_repo: ""
};
let global = this;
@@ -464,6 +449,32 @@ process_js = function(ast, filename, args)
let match = /^(\w+)\s*=\s*(.*)/.exec(arg);
if (match && typeof options[match[1]] == "boolean")
options[match[1]] = (match[2] == "true");
+ else if (match && typeof options[match[1]] == "string")
+ options[match[1]] = match[2];
+ }
+
+ if (!headerPrinted)
+ {
+ // Output license header and warning - do this only once, not each time a file
+ // is being processed.
+ _print('/*');
+ _print(' * This Source Code is subject to the terms of the Mozilla Public License');
+ _print(' * version 2.0 (the "License"). You can obtain a copy of the License at');
+ _print(' * http://mozilla.org/MPL/2.0/.');
+ _print(' */');
+ _print();
+ _print('//');
+ _print('// This file has been generated automatically from Adblock Plus for Firefox');
+ _print('// source code. DO NOT MODIFY, change the original source code instead.');
+ _print('//');
+ _print('// Relevant repositories:');
+ if (options.source_repo)
+ _print('// * ' + options.source_repo);
+ _print('// * https://hg.adblockplus.org/jshydra/');
+ _print('//');
+ _print();
+
+ headerPrinted = true;
}
options.filename = filename.replace(/.*[\\\/]/, "").replace(/\.jsm?$/, "");
--
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