From 6770b5e366c28c7b2378bef29c5817a45eb45214 Mon Sep 17 00:00:00 2001 From: Ruben Rodriguez Date: Tue, 22 Dec 2015 18:00:51 -0600 Subject: Updated LibreJS from 6.0.10 pre-release to 6.0.10 final --- .../jid1-KtlZuoiikVfFew@jetpack/icon.png | Bin 0 -> 1604 bytes .../jid1-KtlZuoiikVfFew@jetpack/install.rdf | 23 +- .../pathfinder/examples/test/package.json | 16 +- .../pathfinder/lib/scriptish/convert-2-regexp.js | 46 ++-- .../pathfinder/lib/scriptish/greasemonkey-api.js | 152 +++++++------- .../lib/scriptish/userscript-header-parser.js | 62 +++--- .../pathfinder/lib/scriptish/userscript-sandbox.js | 46 ++-- .../node_modules/pathfinder/lib/userscript.js | 232 ++++++++++----------- 8 files changed, 288 insertions(+), 289 deletions(-) create mode 100644 data/extensions/jid1-KtlZuoiikVfFew@jetpack/icon.png (limited to 'data/extensions/jid1-KtlZuoiikVfFew@jetpack') diff --git a/data/extensions/jid1-KtlZuoiikVfFew@jetpack/icon.png b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/icon.png new file mode 100644 index 0000000..82ac632 Binary files /dev/null and b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/icon.png differ diff --git a/data/extensions/jid1-KtlZuoiikVfFew@jetpack/install.rdf b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/install.rdf index 812867c..92877cf 100644 --- a/data/extensions/jid1-KtlZuoiikVfFew@jetpack/install.rdf +++ b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/install.rdf @@ -10,28 +10,27 @@ GNU LibreJS is an add-on for Mozilla-based browsers (IceCat, Firefox, Abrowser, Iceweasel) that prevents the execution of nonfree nontrivial JavaScript as described in "The Javascript Trap": http://www.gnu.org/philosophy/javascript-trap.html Loic J. Duros - data/widget/images/librejs-64.png https://gnu.org/software/librejs/ data:text/xml,<placeholder/> 2 + {ec8030f7-c20a-464f-9b0e-13a3a9e97384} 38.0a1 43.0 - - + + - - - - {aa3c5121-dab2-40e2-81ca-7ea25febc110} - 21.0 - 39.0 - - + + + + {aa3c5121-dab2-40e2-81ca-7ea25febc110} + 21.0 + 39.0 + + - diff --git a/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/examples/test/package.json b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/examples/test/package.json index 9a5b737..73b3e94 100644 --- a/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/examples/test/package.json +++ b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/examples/test/package.json @@ -1,8 +1,8 @@ -{ - "name": "test", - "fullName": "test", - "author": "Erik Vold ", - "id": "superbgwo@erikvold.com", - "version": "0.0.1", - "dependencies": ["addon-kit", "api-utils", "userscripts", "vold-utils"] -} +{ + "name": "test", + "fullName": "test", + "author": "Erik Vold ", + "id": "superbgwo@erikvold.com", + "version": "0.0.1", + "dependencies": ["addon-kit", "api-utils", "userscripts", "vold-utils"] +} diff --git a/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/scriptish/convert-2-regexp.js b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/scriptish/convert-2-regexp.js index 9b79f30..d826e62 100644 --- a/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/scriptish/convert-2-regexp.js +++ b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/scriptish/convert-2-regexp.js @@ -1,23 +1,23 @@ -'use strict'; - -const RE_REGEXP = /^\/(.*)\/(i)?$/; -const RE_ESCAPE = /[{}()\[\]\\^$.?]/g; -const RE_WILD = /\*+/g; -const RE_TLD = /^\^[^\/]*(?:\/\/)?[^\/]*\\\.tld(?:\/.*)?\$$/; - -exports.convert2RegExp = function Scriptish_convert2RegExp(aPattern, aNoTLD, forceString) { - var s = aPattern.toString().trim(), m; - - // Already a regexp? - if (!forceString && (m = s.match(RE_REGEXP))) { - return new RegExp(m[1], m[2]); - } - - var res = "^" + s - .replace(RE_ESCAPE, "\\$&") - .replace(RE_WILD, ".*") - + "$"; - var regExp = new RegExp(res, "i"); - regExp.isTLD = !aNoTLD && RE_TLD.test(res); - return regExp; -} +'use strict'; + +const RE_REGEXP = /^\/(.*)\/(i)?$/; +const RE_ESCAPE = /[{}()\[\]\\^$.?]/g; +const RE_WILD = /\*+/g; +const RE_TLD = /^\^[^\/]*(?:\/\/)?[^\/]*\\\.tld(?:\/.*)?\$$/; + +exports.convert2RegExp = function Scriptish_convert2RegExp(aPattern, aNoTLD, forceString) { + var s = aPattern.toString().trim(), m; + + // Already a regexp? + if (!forceString && (m = s.match(RE_REGEXP))) { + return new RegExp(m[1], m[2]); + } + + var res = "^" + s + .replace(RE_ESCAPE, "\\$&") + .replace(RE_WILD, ".*") + + "$"; + var regExp = new RegExp(res, "i"); + regExp.isTLD = !aNoTLD && RE_TLD.test(res); + return regExp; +} diff --git a/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/scriptish/greasemonkey-api.js b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/scriptish/greasemonkey-api.js index e465883..2aa4b8f 100644 --- a/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/scriptish/greasemonkey-api.js +++ b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/scriptish/greasemonkey-api.js @@ -1,76 +1,76 @@ -'use strict'; - -var { Services } = require("services"); -var prefService = require("preferences-service"); -var tabs = require("tabs"); -var clipboard = require("clipboard"); -var {GM_xmlhttpRequester} = require("GM_xmlhttpRequester"); - -const NS_XHTML = "http://www.w3.org/1999/xhtml"; - -function GM_API(aScript, aURL, aWinID, aSafeWin, aUnsafeContentWin, aChromeWin) { - var document = aSafeWin.document; - var windowID = aWinID; - var xhr = new GM_xmlhttpRequester(aUnsafeContentWin, aURL, aScript); - - this.GM_addStyle = function GM_addStyle(css) { - var head = document.getElementsByTagName("head")[0]; - var style = document.createElement("style"); - if (head) { - style.textContent = css; - style.type = "text/css"; - head.appendChild(style); - } - return style; - }; - - // TODO: use simple storage - this.GM_getValue = function GM_getValue(name, defVal) { - return prefService.get(aScript.prefPrefix + name, defVal); - }; - this.GM_setValue = function GM_setValue(name, val) { - return prefService.set(aScript.prefPrefix + name, val); - }; - - this.GM_safeHTMLParser = function GM_safeHTMLParser(aHTMLStr) { - //if (!GM_apiLeakCheck("GM_safeHTMLParser")) return; - let doc = document.implementation.createDocument(NS_XHTML, "html", null); - let body = document.createElementNS(NS_XHTML, "body"); - doc.documentElement.appendChild(body); - body.appendChild(Services.suhtml.parseFragment(aHTMLStr, false, null, body)); - return doc; - } - - this.GM_xmlhttpRequest = function GM_xmlhttpRequest() { - //if (!GM_apiLeakCheck("GM_xmlhttpRequest")) return; - return xhr.contentStartRequest.apply(xhr, arguments); - }; -}; -exports.GM_API = GM_API; - -GM_API.prototype.GM_openInTab = - function GM_openInTab(aURL, aLoadInBackground, aReuse) { - if (aReuse) { - for each (var tab in tabs) { - if (tab.url == aURL) { - if (!aLoadInBackground) - tab.activate(); - return; - } - } - } - - tabs.open({ - url: aURL, - inBackground: aLoadInBackground - }); -}; - -GM_API.prototype.GM_setClipboard = function GM_setClipboard(aData, aType) { - return clipboard.set(aData, aType); -}; - -GM_API.prototype.GM_generateUUID = function GM_generateUUID() ( - Services.uuid.generateUUID().toString()); - -GM_API.prototype.GM_registerMenuCommand = function() {}; +'use strict'; + +var { Services } = require("services"); +var prefService = require("preferences-service"); +var tabs = require("tabs"); +var clipboard = require("clipboard"); +var {GM_xmlhttpRequester} = require("GM_xmlhttpRequester"); + +const NS_XHTML = "http://www.w3.org/1999/xhtml"; + +function GM_API(aScript, aURL, aWinID, aSafeWin, aUnsafeContentWin, aChromeWin) { + var document = aSafeWin.document; + var windowID = aWinID; + var xhr = new GM_xmlhttpRequester(aUnsafeContentWin, aURL, aScript); + + this.GM_addStyle = function GM_addStyle(css) { + var head = document.getElementsByTagName("head")[0]; + var style = document.createElement("style"); + if (head) { + style.textContent = css; + style.type = "text/css"; + head.appendChild(style); + } + return style; + }; + + // TODO: use simple storage + this.GM_getValue = function GM_getValue(name, defVal) { + return prefService.get(aScript.prefPrefix + name, defVal); + }; + this.GM_setValue = function GM_setValue(name, val) { + return prefService.set(aScript.prefPrefix + name, val); + }; + + this.GM_safeHTMLParser = function GM_safeHTMLParser(aHTMLStr) { + //if (!GM_apiLeakCheck("GM_safeHTMLParser")) return; + let doc = document.implementation.createDocument(NS_XHTML, "html", null); + let body = document.createElementNS(NS_XHTML, "body"); + doc.documentElement.appendChild(body); + body.appendChild(Services.suhtml.parseFragment(aHTMLStr, false, null, body)); + return doc; + } + + this.GM_xmlhttpRequest = function GM_xmlhttpRequest() { + //if (!GM_apiLeakCheck("GM_xmlhttpRequest")) return; + return xhr.contentStartRequest.apply(xhr, arguments); + }; +}; +exports.GM_API = GM_API; + +GM_API.prototype.GM_openInTab = + function GM_openInTab(aURL, aLoadInBackground, aReuse) { + if (aReuse) { + for each (var tab in tabs) { + if (tab.url == aURL) { + if (!aLoadInBackground) + tab.activate(); + return; + } + } + } + + tabs.open({ + url: aURL, + inBackground: aLoadInBackground + }); +}; + +GM_API.prototype.GM_setClipboard = function GM_setClipboard(aData, aType) { + return clipboard.set(aData, aType); +}; + +GM_API.prototype.GM_generateUUID = function GM_generateUUID() ( + Services.uuid.generateUUID().toString()); + +GM_API.prototype.GM_registerMenuCommand = function() {}; diff --git a/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/scriptish/userscript-header-parser.js b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/scriptish/userscript-header-parser.js index 41f7ffd..c74e120 100644 --- a/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/scriptish/userscript-header-parser.js +++ b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/scriptish/userscript-header-parser.js @@ -1,31 +1,31 @@ -'use strict'; - -exports.parse = function(aSource) { - var headers = {}; - var foundMeta = false; - var line; - - // do not 'optimize' by reusing this reg exp! it should not be reused! - var metaRegExp = /\/\/[ \t]*(?:==(\/?UserScript)==|\@(\S+)(?:[ \t]+([^\r\f\n]+))?)/g; - - // read one line at a time looking for start meta delimiter or EOF - while (line = metaRegExp.exec(aSource)) { - if (line[1]) { - if ("userscript" == line[1].toLowerCase()) { - foundMeta = true; // start - continue; - } else { - break; // done - } - } - if (!foundMeta) continue; - - var header = line[2].toLowerCase(); - var value = line[3]; - - if (!headers[header]) headers[header] = [value]; - else headers[header].push(value); - } - - return headers; -}; +'use strict'; + +exports.parse = function(aSource) { + var headers = {}; + var foundMeta = false; + var line; + + // do not 'optimize' by reusing this reg exp! it should not be reused! + var metaRegExp = /\/\/[ \t]*(?:==(\/?UserScript)==|\@(\S+)(?:[ \t]+([^\r\f\n]+))?)/g; + + // read one line at a time looking for start meta delimiter or EOF + while (line = metaRegExp.exec(aSource)) { + if (line[1]) { + if ("userscript" == line[1].toLowerCase()) { + foundMeta = true; // start + continue; + } else { + break; // done + } + } + if (!foundMeta) continue; + + var header = line[2].toLowerCase(); + var value = line[3]; + + if (!headers[header]) headers[header] = [value]; + else headers[header].push(value); + } + + return headers; +}; diff --git a/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/scriptish/userscript-sandbox.js b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/scriptish/userscript-sandbox.js index 1c92066..45f1f1a 100644 --- a/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/scriptish/userscript-sandbox.js +++ b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/scriptish/userscript-sandbox.js @@ -1,24 +1,24 @@ -'use strict'; - -var { Cc, Ci, Cu } = require('chrome'); -var {GM_API} = require("./greasemonkey-api"); - -exports.createSandbox = function createSandbox(safeWin, userScript, aURL) { - var script = userScript.source; - var sandbox = new Cu.Sandbox(safeWin); - sandbox.window = safeWin; - sandbox.document = sandbox.window.document; - sandbox.__proto__ = safeWin; - var api = new GM_API(userScript, aURL, null, safeWin, safeWin.wrappedJSObject); - - for (var key in api) { - sandbox[key] = api[key]; - } - - return sandbox; -}; - -exports.evalInSandbox = function(code, sandbox, jsVersion) { - jsVersion = jsVersion || "1.8"; - Cu.evalInSandbox("(function(){"+code+"})();", sandbox, jsVersion); +'use strict'; + +var { Cc, Ci, Cu } = require('chrome'); +var {GM_API} = require("./greasemonkey-api"); + +exports.createSandbox = function createSandbox(safeWin, userScript, aURL) { + var script = userScript.source; + var sandbox = new Cu.Sandbox(safeWin); + sandbox.window = safeWin; + sandbox.document = sandbox.window.document; + sandbox.__proto__ = safeWin; + var api = new GM_API(userScript, aURL, null, safeWin, safeWin.wrappedJSObject); + + for (var key in api) { + sandbox[key] = api[key]; + } + + return sandbox; +}; + +exports.evalInSandbox = function(code, sandbox, jsVersion) { + jsVersion = jsVersion || "1.8"; + Cu.evalInSandbox("(function(){"+code+"})();", sandbox, jsVersion); }; \ No newline at end of file diff --git a/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/userscript.js b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/userscript.js index 9890200..6ba0c7a 100644 --- a/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/userscript.js +++ b/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/lib/userscript.js @@ -1,116 +1,116 @@ -'use strict'; - -var file = require("sdk/io/file"); -var url = require("sdk/url"); - -var convert2RegExp = require("./scriptish/convert-2-regexp").convert2RegExp; -var userscriptParser = require("./scriptish/userscript-header-parser").parse; -var manager = require("./scriptish/userscript-manager"); - -const JSVersions = ['1.6', '1.7', '1.8'/*, '1.8.1'*/]; - -var UserScript = exports.UserScript = function UserScript(aURL) { - var script = new Script(aURL); - manager.register(script); - - return { - destory: function() { - manager.unregister(script); - }, - get enabled() script.enabled, - set enabled(aVal) script.enabled = !!aVal - }; -} - -function Script(aURL) { - this._url = url.URL(aURL); - this._filepath = url.toFilename(aURL); - this._source = file.read(this._filepath); - var header = userscriptParser(this._source); - - this._name = (header.name && header.name[0]) || Script.parseScriptName(aURL); - this._namespace = (header.namespace && header.namespace[0]) || this.url.host; - this._description = (header.description && header.description[0]) || ""; - this.enabled = true; - this._includes = (header.include || []).map(convert2RegExp); - this._excludes = (header.exclude || []).map(convert2RegExp); - this._requires = (header.require || []); - this._resources = (header.resource || []); - if (header.jsversion) { - for (var i = header.jsversion.length - 1; ~i; i--) { - let val = header.jsversion[i]; - if (~JSVersions.indexOf(val)) { - this.jsversion = val; - break; - } - } - } -} - -Script.prototype = { - get prefPrefix () { - return ["greasemonkey.scriptvals.", - this._namespace, - "/", - this._name, - "."].join(""); - }, - - // TODO: actually implement this! - matchesDomain: function() { - return true; - }, - - matchesURL: function(url) { - var test = function(pattern) { - return pattern.test(url); - } - - return this.enabled - && this._includes.some(test) - && !this._excludes.some(test); - }, - - _changed: function(event, data) { - if(this._config) { - this._config._changed(this, event, data); - } - }, - - get name() { return this._name; }, - get namespace() { return this._namespace; }, - get description() { return this._description; }, - - get enabled() { return this._enabled; }, - set enabled(enabled) { - this._enabled = enabled; - this._changed("edit-enabled", enabled); - }, - - get includes() { return this._includes.concat(); }, - get excludes() { return this._excludes.concat(); }, - addInclude: function(url) { - this._includes.push(url); - this._changed("edit-include-add", url); - }, - removeIncludeAt: function(index) { - this._includes.splice(index, 1); - this._changed("edit-include-remove", index); - }, - addExclude: function(url) { - this._excludes.push(url); - this._changed("edit-exclude-add", url); - }, - removeExcludeAt: function(index) { - this._excludes.splice(index, 1); - this._changed("edit-exclude-remove", index); - }, - - get requires() { return this._requires.concat(); }, - get resources() { return this._resources.concat(); }, - get unwrap() { return this._unwrap; } -}; - - -Script.parseScriptName = function(aURL) (( - /\/([^\/]+)\.user(?:-\d+)?\.js(?:[\?#].*)?$/.test(aURL || "")) ? RegExp.$1 : ""); +'use strict'; + +var file = require("sdk/io/file"); +var url = require("sdk/url"); + +var convert2RegExp = require("./scriptish/convert-2-regexp").convert2RegExp; +var userscriptParser = require("./scriptish/userscript-header-parser").parse; +var manager = require("./scriptish/userscript-manager"); + +const JSVersions = ['1.6', '1.7', '1.8'/*, '1.8.1'*/]; + +var UserScript = exports.UserScript = function UserScript(aURL) { + var script = new Script(aURL); + manager.register(script); + + return { + destory: function() { + manager.unregister(script); + }, + get enabled() script.enabled, + set enabled(aVal) script.enabled = !!aVal + }; +} + +function Script(aURL) { + this._url = url.URL(aURL); + this._filepath = url.toFilename(aURL); + this._source = file.read(this._filepath); + var header = userscriptParser(this._source); + + this._name = (header.name && header.name[0]) || Script.parseScriptName(aURL); + this._namespace = (header.namespace && header.namespace[0]) || this.url.host; + this._description = (header.description && header.description[0]) || ""; + this.enabled = true; + this._includes = (header.include || []).map(convert2RegExp); + this._excludes = (header.exclude || []).map(convert2RegExp); + this._requires = (header.require || []); + this._resources = (header.resource || []); + if (header.jsversion) { + for (var i = header.jsversion.length - 1; ~i; i--) { + let val = header.jsversion[i]; + if (~JSVersions.indexOf(val)) { + this.jsversion = val; + break; + } + } + } +} + +Script.prototype = { + get prefPrefix () { + return ["greasemonkey.scriptvals.", + this._namespace, + "/", + this._name, + "."].join(""); + }, + + // TODO: actually implement this! + matchesDomain: function() { + return true; + }, + + matchesURL: function(url) { + var test = function(pattern) { + return pattern.test(url); + } + + return this.enabled + && this._includes.some(test) + && !this._excludes.some(test); + }, + + _changed: function(event, data) { + if(this._config) { + this._config._changed(this, event, data); + } + }, + + get name() { return this._name; }, + get namespace() { return this._namespace; }, + get description() { return this._description; }, + + get enabled() { return this._enabled; }, + set enabled(enabled) { + this._enabled = enabled; + this._changed("edit-enabled", enabled); + }, + + get includes() { return this._includes.concat(); }, + get excludes() { return this._excludes.concat(); }, + addInclude: function(url) { + this._includes.push(url); + this._changed("edit-include-add", url); + }, + removeIncludeAt: function(index) { + this._includes.splice(index, 1); + this._changed("edit-include-remove", index); + }, + addExclude: function(url) { + this._excludes.push(url); + this._changed("edit-exclude-add", url); + }, + removeExcludeAt: function(index) { + this._excludes.splice(index, 1); + this._changed("edit-exclude-remove", index); + }, + + get requires() { return this._requires.concat(); }, + get resources() { return this._resources.concat(); }, + get unwrap() { return this._unwrap; } +}; + + +Script.parseScriptName = function(aURL) (( + /\/([^\/]+)\.user(?:-\d+)?\.js(?:[\?#].*)?$/.test(aURL || "")) ? RegExp.$1 : ""); -- cgit v1.2.3