diff options
author | Nik Nyby <nikolas@gnu.org> | 2015-06-19 19:12:18 -0400 |
---|---|---|
committer | Nik Nyby <nikolas@gnu.org> | 2015-10-22 21:32:33 -0400 |
commit | a7f7dba18dc59d5807512ddc1c0206a279c7dab2 (patch) | |
tree | 4b4c4ee762b1bfd4250fea5cc5173e38f4cf28b3 /lib | |
parent | 7228a1f02c983490fb0b5375eb6ebcb0938a63c3 (diff) | |
download | librejsxul-a7f7dba18dc59d5807512ddc1c0206a279c7dab2.tar.lz librejsxul-a7f7dba18dc59d5807512ddc1c0206a279c7dab2.tar.xz librejsxul-a7f7dba18dc59d5807512ddc1c0206a279c7dab2.zip |
more jpm compat
Diffstat (limited to 'lib')
23 files changed, 68 insertions, 58 deletions
diff --git a/lib/html_script_finder/dom_handler.js b/lib/html_script_finder/dom_handler.js index a56f668..e16f673 100644 --- a/lib/html_script_finder/dom_handler.js +++ b/lib/html_script_finder/dom_handler.js @@ -40,7 +40,7 @@ const reasons = scriptProperties.reasons; var urlHandler = require("../url_handler/url_handler"); -var WebLabelFinder = require(".//web_labels/js_web_labels").WebLabelFinder; +var WebLabelFinder = require("./web_labels/js_web_labels").WebLabelFinder; // object model for script entries. var scriptObject = require("./dom_handler/script_object"); diff --git a/lib/html_script_finder/dom_handler/dom_checker.js b/lib/html_script_finder/dom_handler/dom_checker.js index 7f02c3f..b4d27b2 100644 --- a/lib/html_script_finder/dom_handler/dom_checker.js +++ b/lib/html_script_finder/dom_handler/dom_checker.js @@ -38,17 +38,18 @@ const reasons = scriptProperties.reasons; // ensure xhr won't create an infinite loop // with html content. var urlTester = require("../url_seen_tester").urlSeenTester; -var urlHandler = require("url_handler/url_handler"); +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/web_labels/js_web_labels.js b/lib/html_script_finder/web_labels/js_web_labels.js index 510852b..e428d41 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 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) { diff --git a/lib/http_observer/allowed_referrers.js b/lib/http_observer/allowed_referrers.js index 39374c9..06d860b 100644 --- a/lib/http_observer/allowed_referrers.js +++ b/lib/http_observer/allowed_referrers.js @@ -20,7 +20,7 @@ * along with GNU LibreJS. If not, see <http://www.gnu.org/licenses/>. */ -var prefChange = require("addon_management/prefchange"); +var prefChange = require("../addon_management/prefchange"); var allowed = {}; diff --git a/lib/js_checker/free_checker.js b/lib/js_checker/free_checker.js index 71a262e..be190e2 100644 --- a/lib/js_checker/free_checker.js +++ b/lib/js_checker/free_checker.js @@ -20,16 +20,16 @@ * along with GNU LibreJS. If not, see <http://www.gnu.org/licenses/>. */ -var licenses = require('js_checker/license_definitions'); +var licenses = require('./license_definitions'); var simpleStorage = require("sdk/simple-storage"); const LAZY = licenses.types.LAZY; var licenseRegex = []; -const END_OF_SCRIPT = require('html_script_finder/bug_fix').END_OF_SCRIPT; -const types = require("js_checker/constant_types"); +const END_OF_SCRIPT = require('../html_script_finder/bug_fix').END_OF_SCRIPT; +const types = require("./constant_types"); const token = types.token; -var patternUtils = require('js_checker/pattern_utils').patternUtils; +var patternUtils = require('./pattern_utils').patternUtils; var licStartLicEndRe = /@licstartThefollowingistheentirelicensenoticefortheJavaScriptcodeinthis(?:page|file)(.*)?@licendTheaboveistheentirelicensenoticefortheJavaScriptcodeinthis(?:page|file)/mi; var licenseMagnet = /.*@license ?(magnet\:\?xt=urn\:btih\:[0-9A-Za-z]+).*/; diff --git a/lib/js_checker/nontrivial_checker.js b/lib/js_checker/nontrivial_checker.js index 6a22992..1c79a2a 100644 --- a/lib/js_checker/nontrivial_checker.js +++ b/lib/js_checker/nontrivial_checker.js @@ -19,7 +19,7 @@ * You should have received a copy of the GNU General Public License * along with GNU LibreJS. If not, see <http://www.gnu.org/licenses/>. */ -const types = require("js_checker/constant_types"); +const types = require("./constant_types"); // constants from Narcissus for function types. const DECLARED_FORM = 0, EXPRESSED_FORM = 1, STATEMENT_FORM = 2; diff --git a/lib/js_checker/privacy_checker.js b/lib/js_checker/privacy_checker.js index f39e0b7..fe0fa8a 100644 --- a/lib/js_checker/privacy_checker.js +++ b/lib/js_checker/privacy_checker.js @@ -20,8 +20,8 @@ * along with GNU LibreJS. If not, see <http://www.gnu.org/licenses/>. */ -const privacyThreatJs = require('js_checker/privacy_threat_definitions.js'); -const patternUtils = require('js_checker/pattern_utils').patternUtils; +const privacyThreatJs = require('./privacy_threat_definitions.js'); +const patternUtils = require('./pattern_utils').patternUtils; exports.privacyCheck = { checkScriptPrivacyThreat: function (currentScript) { diff --git a/lib/js_load_observer/js_load_observer.js b/lib/js_load_observer/js_load_observer.js index 7b73ec6..a9a6efa 100644 --- a/lib/js_load_observer/js_load_observer.js +++ b/lib/js_load_observer/js_load_observer.js @@ -25,10 +25,12 @@ var {Cc, Ci, Cu, Cm, Cr} = require("chrome"); var observerService = Cc["@mozilla.org/observer-service;1"] .getService(Ci.nsIObserverService); -var acceptedScripts = require("script_entries/accepted_scripts").acceptedScripts; -var allowedRef = require('http_observer/allowed_referrers').allowedReferrers; +var acceptedScripts = require("../script_entries/accepted_scripts") + .acceptedScripts; +var allowedRef = require('../http_observer/allowed_referrers') + .allowedReferrers; -var urlHandler = require("url_handler/url_handler"); +var urlHandler = require("../url_handler/url_handler"); var ScriptAnalyzer = function() { // the URL of the current page. diff --git a/lib/parser/narcissus_worker.js b/lib/parser/narcissus_worker.js index a25e279..e9829b4 100644 --- a/lib/parser/narcissus_worker.js +++ b/lib/parser/narcissus_worker.js @@ -31,7 +31,7 @@ var NarcissusWorker = function() { var that = this; this.worker.onmessage = function(e) { - var jsChecker = require("js_checker/js_checker"); + var jsChecker = require("../js_checker/js_checker"); console.debug('onmessage', e.data.hash); try { diff --git a/lib/pref_observer/pref_observer.js b/lib/pref_observer/pref_observer.js index d066c2f..2c5e360 100644 --- a/lib/pref_observer/pref_observer.js +++ b/lib/pref_observer/pref_observer.js @@ -20,7 +20,7 @@ */ var {Cc, Ci} = require("chrome"); -const httpObserver = require("http_observer/http_request_observer"); +const httpObserver = require("../http_observer/http_request_observer"); // https://developer.mozilla.org/en-US/Add-ons/Code_snippets/Preferences#Using_preference_observers var prefObserver = { diff --git a/lib/script_entries/accepted_scripts.js b/lib/script_entries/accepted_scripts.js index c732f31..bac11f0 100644 --- a/lib/script_entries/accepted_scripts.js +++ b/lib/script_entries/accepted_scripts.js @@ -20,7 +20,7 @@ * along with GNU LibreJS. If not, see <http://www.gnu.org/licenses/>. */ -var allScripts = require('script_entries/all_scripts').allScripts; +var allScripts = require('./all_scripts').allScripts; var AcceptedScripts = function() { this.scripts = {}; diff --git a/lib/script_entries/all_scripts.js b/lib/script_entries/all_scripts.js index 2028864..c27a410 100644 --- a/lib/script_entries/all_scripts.js +++ b/lib/script_entries/all_scripts.js @@ -20,7 +20,7 @@ * along with GNU LibreJS. If not, see <http://www.gnu.org/licenses/>. */ -var crypto = require('script_entries/crypto'); +var crypto = require('./crypto'); var AllScripts = function() { this.scripts = {}; diff --git a/lib/script_entries/dryrun_scripts.js b/lib/script_entries/dryrun_scripts.js index 87ec482..a15b0b2 100644 --- a/lib/script_entries/dryrun_scripts.js +++ b/lib/script_entries/dryrun_scripts.js @@ -20,8 +20,8 @@ * along with GNU LibreJS. If not, see <http://www.gnu.org/licenses/>. */ -var allScripts = require('script_entries/all_scripts').allScripts; -const urlHandler = require('url_handler/url_handler'); +var allScripts = require('./all_scripts').allScripts; +const urlHandler = require('../url_handler/url_handler'); exports.dryRunScripts = { scripts: {}, diff --git a/lib/script_entries/free_libraries.js b/lib/script_entries/free_libraries.js index e7b9a3f..ac1a664 100644 --- a/lib/script_entries/free_libraries.js +++ b/lib/script_entries/free_libraries.js @@ -29,7 +29,8 @@ var scriptsCached = require("./scripts_cache").scriptsCached; // find the json database path. -var dbContents = require("sdk/self").data.load("script_libraries/script-libraries.json"); +var dbContents = require("sdk/self").data.load( + "../script_libraries/script-libraries.json"); const AUTHOR_REASON = "This script has been tagged as free software by LibreJS authors."; diff --git a/lib/script_entries/removed_scripts.js b/lib/script_entries/removed_scripts.js index b7544e9..2a3b1d3 100644 --- a/lib/script_entries/removed_scripts.js +++ b/lib/script_entries/removed_scripts.js @@ -20,8 +20,8 @@ * along with GNU LibreJS. If not, see <http://www.gnu.org/licenses/>. */ -var allScripts = require('script_entries/all_scripts').allScripts; -const urlHandler = require('url_handler/url_handler'); +var allScripts = require('./all_scripts').allScripts; +const urlHandler = require('../url_handler/url_handler'); var RemovedScripts = function() { this.scripts = {}; diff --git a/lib/settings/settings_tab.js b/lib/settings/settings_tab.js index 976714a..07be87f 100644 --- a/lib/settings/settings_tab.js +++ b/lib/settings/settings_tab.js @@ -21,8 +21,9 @@ */ const tabs = require("sdk/tabs"); const data = require("sdk/self").data; -const storage = require("settings/storage").librejsStorage; -const scriptsCached = require("script_entries/scripts_cache").scriptsCached; +const storage = require("./storage").librejsStorage; +const scriptsCached = require("../script_entries/scripts_cache") + .scriptsCached; exports.settingsManager = settingsManager; diff --git a/lib/ui/notification.js b/lib/ui/notification.js index da4b7d5..c49b083 100644 --- a/lib/ui/notification.js +++ b/lib/ui/notification.js @@ -24,7 +24,7 @@ // is running to inform the user it is indeed busy working. const timer = require("sdk/timers"); const self = require("sdk/self"); -const isDisplayNotifications = require("addon_management/prefchange") +const isDisplayNotifications = require("../addon_management/prefchange") .isDisplayNotifications; exports.createCriticalNotification = function (text) { diff --git a/lib/url_handler/node_url.js b/lib/url_handler/node_url.js index 71d31a6..47779f1 100644 --- a/lib/url_handler/node_url.js +++ b/lib/url_handler/node_url.js @@ -19,7 +19,7 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -var punycode = require('url_handler/node_punycode'); +var punycode = require('./node_punycode'); exports.parse = urlParse; exports.resolve = urlResolve; @@ -92,7 +92,7 @@ var protocolPattern = /^([a-z0-9.+-]+:)/i, 'gopher:': true, 'file:': true }, - querystring = require('url_handler/node_querystring'); + querystring = require('./node_querystring'); function urlParse(url, parseQueryString, slashesDenoteHost) { if (url && typeof(url) === 'object' && url instanceof Url) return url; diff --git a/lib/url_handler/url_handler.js b/lib/url_handler/url_handler.js index 5117190..234dff5 100644 --- a/lib/url_handler/url_handler.js +++ b/lib/url_handler/url_handler.js @@ -29,7 +29,7 @@ // node.js url module. Makes it easier to resolve // urls in that datauri loaded dom -var nodeJsUrl = require("url_handler/node_url"); +var nodeJsUrl = require("./node_url"); var urlUtils = { getFragment: function (url) { |