diff options
Diffstat (limited to 'lib/html_script_finder')
-rw-r--r-- | lib/html_script_finder/dom_handler.js | 29 | ||||
-rw-r--r-- | lib/html_script_finder/dom_handler/attributes.js | 5 | ||||
-rw-r--r-- | lib/html_script_finder/dom_handler/dom_checker.js | 18 | ||||
-rw-r--r-- | lib/html_script_finder/dom_handler/dom_gatherer.js | 21 | ||||
-rw-r--r-- | lib/html_script_finder/dom_handler/request.js | 7 | ||||
-rw-r--r-- | lib/html_script_finder/dom_handler/script_object.js | 8 | ||||
-rw-r--r-- | lib/html_script_finder/html_parser.js | 2 | ||||
-rw-r--r-- | lib/html_script_finder/web_labels/js_web_labels.js | 13 | ||||
-rw-r--r-- | lib/html_script_finder/web_labels/script_hash_worker.js | 7 |
9 files changed, 56 insertions, 54 deletions
diff --git a/lib/html_script_finder/dom_handler.js b/lib/html_script_finder/dom_handler.js index c57c945..e16f673 100644 --- a/lib/html_script_finder/dom_handler.js +++ b/lib/html_script_finder/dom_handler.js @@ -32,33 +32,32 @@ var {Cc, Ci, Cu, Cm, Cr} = require("chrome"); -var scriptProperties = - require("html_script_finder/dom_handler/script_properties"); +var scriptProperties = require("./dom_handler/script_properties"); const scriptTypes = scriptProperties.scriptTypes; const statusTypes = scriptProperties.statusTypes; const reasons = scriptProperties.reasons; -var urlHandler = require("url_handler/url_handler"); +var urlHandler = require("../url_handler/url_handler"); -var WebLabelFinder = - require("html_script_finder/web_labels/js_web_labels").WebLabelFinder; +var WebLabelFinder = require("./web_labels/js_web_labels").WebLabelFinder; // object model for script entries. -var scriptObject = require("html_script_finder/dom_handler/script_object"); +var scriptObject = require("./dom_handler/script_object"); -var privacyChecker = require("js_checker/privacy_checker").privacyCheck; -var jsChecker = require("js_checker/js_checker"); -const types = require("js_checker/constant_types"); +var privacyChecker = require("../js_checker/privacy_checker").privacyCheck; +var jsChecker = require("../js_checker/js_checker"); +const types = require("../js_checker/constant_types"); var checkTypes = types.checkTypes; var stripCDATAOpen = /<\!\[CDATA\[/gi; var stripCDATAClose = /]]>/g; -var isDryRun = require("addon_management/prefchange").isDryRun; -var allowedRef = require('http_observer/allowed_referrers').allowedReferrers; -var attributeHelpers = require("html_script_finder/dom_handler/attributes"); +var isDryRun = require("../addon_management/prefchange").isDryRun; +var allowedRef = require('../http_observer/allowed_referrers') + .allowedReferrers; +var attributeHelpers = require("./dom_handler/attributes"); // javascript:* var jsInAttrRe = attributeHelpers.jsInAttrRe; @@ -66,10 +65,8 @@ var jsInAttrRe = attributeHelpers.jsInAttrRe; // the list of all available event attributes var intrinsicEvents = attributeHelpers.intrinsicEvents; -var domGatherer = - require("html_script_finder/dom_handler/dom_gatherer").domGatherer; -var domChecker = - require("html_script_finder/dom_handler/dom_checker").domChecker; +var domGatherer = require("./dom_handler/dom_gatherer").domGatherer; +var domChecker = require("./dom_handler/dom_checker").domChecker; /** * The DomHandler object takes a whole document, diff --git a/lib/html_script_finder/dom_handler/attributes.js b/lib/html_script_finder/dom_handler/attributes.js index 796e718..ac603fe 100644 --- a/lib/html_script_finder/dom_handler/attributes.js +++ b/lib/html_script_finder/dom_handler/attributes.js @@ -21,9 +21,8 @@ */ // object model for script entries. -var scriptObject = require("html_script_finder/dom_handler/script_object"); - -var scriptProperties = require("html_script_finder/dom_handler/script_properties"); +var scriptObject = require("./script_object"); +var scriptProperties = require("./script_properties"); const scriptTypes = scriptProperties.scriptTypes; diff --git a/lib/html_script_finder/dom_handler/dom_checker.js b/lib/html_script_finder/dom_handler/dom_checker.js index 6a98d61..b4d27b2 100644 --- a/lib/html_script_finder/dom_handler/dom_checker.js +++ b/lib/html_script_finder/dom_handler/dom_checker.js @@ -30,25 +30,26 @@ var {Cc, Ci, Cu, Cm, Cr} = require("chrome"); var timer = require("sdk/timers"); -var scriptProperties = require("html_script_finder/dom_handler/script_properties"); +var scriptProperties = require("./script_properties"); const scriptTypes = scriptProperties.scriptTypes; const statusTypes = scriptProperties.statusTypes; const reasons = scriptProperties.reasons; // ensure xhr won't create an infinite loop // with html content. -var urlTester = require("html_script_finder/url_seen_tester").urlSeenTester; -var urlHandler = require("url_handler/url_handler"); +var urlTester = require("../url_seen_tester").urlSeenTester; +var urlHandler = require("../../url_handler/url_handler"); -var privacyChecker = require("js_checker/privacy_checker").privacyCheck; -var jsChecker = require("js_checker/js_checker"); +var privacyChecker = require("../../js_checker/privacy_checker").privacyCheck; +var jsChecker = require("../../js_checker/js_checker"); -const types = require("js_checker/constant_types"); +const types = require("../../js_checker/constant_types"); var checkTypes = types.checkTypes; var stripCDATAOpen = /<\!\[CDATA\[/gi; var stripCDATAClose = /]]>/g; -const getHash = require("script_entries/scripts_cache").scriptsCached.getHash; +const getHash = require("../../script_entries/scripts_cache") + .scriptsCached.getHash; var DomChecker = function() { // reference to domHandler instance @@ -452,8 +453,7 @@ DomChecker.prototype.xhr = function(script, responseCallback) { urlTester.addUrl(url); // request module. Compatible with Https-Everywhere. - require('html_script_finder/dom_handler/request') - .request(script, responseCallback).request(); + require('./request').request(script, responseCallback).request(); } catch (x) { console.debug('error', x, x.lineNumber, x.fileName); responseCallback(script, false); diff --git a/lib/html_script_finder/dom_handler/dom_gatherer.js b/lib/html_script_finder/dom_handler/dom_gatherer.js index 7bb2569..ce29cf6 100644 --- a/lib/html_script_finder/dom_handler/dom_gatherer.js +++ b/lib/html_script_finder/dom_handler/dom_gatherer.js @@ -20,18 +20,19 @@ * along with GNU LibreJS. If not, see <http://www.gnu.org/licenses/>. */ -var scriptProperties = require("html_script_finder/dom_handler/script_properties"); +var scriptProperties = require("./script_properties"); const scriptTypes = scriptProperties.scriptTypes; -const scriptsCached = require("script_entries/scripts_cache").scriptsCached; +const scriptsCached = require("../../script_entries/scripts_cache") + .scriptsCached; const statusTypes = scriptProperties.statusTypes; // object model for script entries. -var scriptObject = require("html_script_finder/dom_handler/script_object"); +var scriptObject = require("./script_object"); -var urlHandler = require("url_handler/url_handler"); +var urlHandler = require("../../url_handler/url_handler"); -var attributeHelpers = require("html_script_finder/dom_handler/attributes"); +var attributeHelpers = require("./attributes"); // javascript:* var jsInAttrRe = attributeHelpers.jsInAttrRe; @@ -39,9 +40,9 @@ var jsInAttrRe = attributeHelpers.jsInAttrRe; // the list of all available event attributes var intrinsicEvents = attributeHelpers.intrinsicEvents; -var privacyChecker = require("js_checker/privacy_checker").privacyCheck; +var privacyChecker = require("../../js_checker/privacy_checker").privacyCheck; -const types = require("js_checker/constant_types"); +const types = require("../../js_checker/constant_types"); var checkTypes = types.checkTypes; @@ -246,8 +247,10 @@ DomGatherer.prototype.gatherScriptsContent = function() { // using else if since script text is // ignored if src attribute is set. // adding this.narcissusBugFixLibreJS to fix comment bug. - var bugfix = require('html_script_finder/bug_fix').narcissusBugFixLibreJS; - currentScript = stripHtmlCommentsInScript(this.d.domScripts[i].text + bugfix); + var bugfix = require('../../html_script_finder/bug_fix') + .narcissusBugFixLibreJS; + currentScript = stripHtmlCommentsInScript( + this.d.domScripts[i].text + bugfix); scriptEntry = scriptObject.Script( {'type': scriptTypes.INLINE, diff --git a/lib/html_script_finder/dom_handler/request.js b/lib/html_script_finder/dom_handler/request.js index a008295..f25ba8f 100644 --- a/lib/html_script_finder/dom_handler/request.js +++ b/lib/html_script_finder/dom_handler/request.js @@ -28,9 +28,10 @@ var {XPCOMUtils} = Cu.import("resource://gre/modules/XPCOMUtils.jsm"); // ensure xhr won't create an infinite loop // with html content. -var urlTester = require("html_script_finder/url_seen_tester").urlSeenTester; -var urlHandler = require("url_handler/url_handler"); -const scriptsCached = require("script_entries/scripts_cache").scriptsCached; +var urlTester = require("../url_seen_tester").urlSeenTester; +var urlHandler = require("../../url_handler/url_handler"); +const scriptsCached = require("../../script_entries/scripts_cache") + .scriptsCached; var Request = function() { this.url = null; diff --git a/lib/html_script_finder/dom_handler/script_object.js b/lib/html_script_finder/dom_handler/script_object.js index 83ae073..64468b4 100644 --- a/lib/html_script_finder/dom_handler/script_object.js +++ b/lib/html_script_finder/dom_handler/script_object.js @@ -20,11 +20,13 @@ * along with GNU LibreJS. If not, see <http://www.gnu.org/licenses/>. */ -var removedScripts = require("script_entries/removed_scripts").removedScripts; +var removedScripts = require("../../script_entries/removed_scripts") + .removedScripts; -var acceptedScripts = require("script_entries/accepted_scripts") +var acceptedScripts = require("../../script_entries/accepted_scripts") .acceptedScripts; -var dryRunScripts = require("script_entries/dryrun_scripts").dryRunScripts; +var dryRunScripts = require("../../script_entries/dryrun_scripts") + .dryRunScripts; var Script = function(props) { // can be an attribute, an inline script, diff --git a/lib/html_script_finder/html_parser.js b/lib/html_script_finder/html_parser.js index a2bae80..ab36eaf 100644 --- a/lib/html_script_finder/html_parser.js +++ b/lib/html_script_finder/html_parser.js @@ -80,7 +80,7 @@ var {Cc, Ci, Cu} = require("chrome"); -var domHandlerModule = require("html_script_finder/dom_handler"); +var domHandlerModule = require("./dom_handler"); const PR_UINT32_MAX = 2147483647; diff --git a/lib/html_script_finder/web_labels/js_web_labels.js b/lib/html_script_finder/web_labels/js_web_labels.js index 510852b..0cb64bf 100644 --- a/lib/html_script_finder/web_labels/js_web_labels.js +++ b/lib/html_script_finder/web_labels/js_web_labels.js @@ -22,19 +22,18 @@ // node.js url module. Makes it easier to resolve // urls in that datauri loaded dom -var urlHandler = require("url_handler/url_handler"); +var urlHandler = require("../../url_handler/url_handler"); var {Cc, Ci, Cu, Cm, Cr} = require("chrome"); var data = require("sdk/self").data; // license definitions, we are using canonical urls and license // identifiers. -var licenses = require('js_checker/license_definitions').licenses; +var licenses = require('../../js_checker/license_definitions').licenses; -var getLicenseList = require('html_script_finder/web_labels/find_js_labels') - .getLicenseList; -const types = require("js_checker/constant_types"); +var getLicenseList = require('./find_js_labels').getLicenseList; +const types = require("../../js_checker/constant_types"); -const addToCache = require("html_script_finder/web_labels/script_hash_worker") +const addToCache = require("./script_hash_worker") .addToCache; // keep web labels in memory so that they can be checked even when they @@ -175,7 +174,7 @@ WebLabelFinder.prototype.isLicenseFree = function( var found = false; // Check if we can look up this license by its identifier. - var identifier = lic.licenses[i]['licenseName']; + var identifier = lic.licenses[i].licenseName; if (typeof identifier !== 'undefined' && typeof licenses[identifier] !== 'undefined' ) { diff --git a/lib/html_script_finder/web_labels/script_hash_worker.js b/lib/html_script_finder/web_labels/script_hash_worker.js index 92ffb82..4ed9d21 100644 --- a/lib/html_script_finder/web_labels/script_hash_worker.js +++ b/lib/html_script_finder/web_labels/script_hash_worker.js @@ -20,9 +20,10 @@ * along with GNU LibreJS. If not, see <http://www.gnu.org/licenses/>. */ -const types = require("js_checker/constant_types"); -const scriptsCached = require("script_entries/scripts_cache").scriptsCached; -const xhr = require('html_script_finder/dom_handler/dom_checker').xhr; +const types = require("../../js_checker/constant_types"); +const scriptsCached = require("../../script_entries/scripts_cache") + .scriptsCached; +const xhr = require('../dom_handler/dom_checker').xhr; const timers = require("sdk/timers"); exports.addToCache = function (lic, delay, jsWebLabelsURL, callback) { |