(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i * * This file is part of GNU LibreJS. * * GNU LibreJS is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * GNU LibreJS is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU LibreJS. If not, see . */ /** Singleton to handle external licenses, e.g. WebLabels */ "use strict"; let licensesByLabel = new Map(); let licensesByUrl = new Map(); { let {licenses} = require("../license_definitions"); let mapByLabel = (label, license) => licensesByLabel.set(label.toUpperCase(), license); for (let [id, l] of Object.entries(licenses)) { let {identifier, canonicalUrl, licenseName} = l; if (identifier) { mapByLabel(identifier, l); } else { l.identifier = id; } if (id !== identifier) { mapByLabel(id, l); } if (licenseName) { mapByLabel(licenseName, l); } if (Array.isArray(canonicalUrl)) { for (let url of canonicalUrl) { licensesByUrl.set(url, l); } } } } let cachedHrefs = new Map(); var ExternalLicenses = { purgeCache(tabId) { cachedHrefs.delete(tabId); }, async check(script) { let {url, tabId, frameId, documentUrl} = script; let tabCache = cachedHrefs.get(tabId); let frameCache = tabCache && tabCache.get(frameId); let cache = frameCache && frameCache.get(documentUrl); let scriptInfo = await browser.tabs.sendMessage(tabId, { action: "checkLicensedScript", url, cache, }, {frameId}); if (!(scriptInfo && scriptInfo.licenseLinks.length)) { return null; } scriptInfo.licenses = new Set(); scriptInfo.toString = function() { let licenseIds = [...this.licenses].map(l => l.identifier).sort().join(", "); return licenseIds ? `Free license${this.licenses.size > 1 ? "s" : ""} (${licenseIds})` : "Unknown license(s)"; } let match = (map, key) => { if (map.has(key)) { scriptInfo.licenses.add(map.get(key)); return true; } return false; }; for (let {label, url} of scriptInfo.licenseLinks) { match(licensesByLabel, label = label.trim().toUpperCase()) || match(licensesByUrl, url) || match(licensesByLabel, label.replace(/^GNU-|-(?:OR-LATER|ONLY)$/, '')); } scriptInfo.free = scriptInfo.licenses.size > 0; return scriptInfo; }, /** * moves / creates external license references before any script in the page * if needed, to have them ready when the first script load is triggered. * It also caches the external licens href by page URL, to help not actually * modify the rendered HTML but rather feed the content script on demand. * Returns true if the document has been actually modified, false otherwise. */ optimizeDocument(document, cachePointer) { let cache = {}; let {tabId, frameId, documentUrl} = cachePointer; let frameCache = cachedHrefs.get(tabId); if (!frameCache) { cachedHrefs.set(tabId, frameCache = new Map()); } frameCache.set(frameId, new Map([[documentUrl, cache]])); let link = document.querySelector(`link[rel="jslicense"], link[data-jslicense="1"], a[rel="jslicense"], a[data-jslicense="1"]`); if (link) { let href = link.getAttribute("href"); cache.webLabels = {href}; let move = () => !!document.head.insertBefore(link, document.head.firstChild); if (link.parentNode === document.head) { for (let node; node = link.previousElementSibling;) { if (node.tagName.toUpperCase() === "SCRIPT") { return move(); } } } else { // the reference is only in the body if (link.tagName.toUpperCase() === "A") { let newLink = document.createElement("link"); newLink.rel = "jslicense"; newLink.setAttribute("href", href); link = newLink; } return move(); } } return false; } }; module.exports = { ExternalLicenses }; },{"../license_definitions":10}],2:[function(require,module,exports){ /** * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript. * * Copyright (C) 2018 Giorgio Maone * * This file is part of GNU LibreJS. * * GNU LibreJS is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * GNU LibreJS is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU LibreJS. If not, see . */ /* A class to manage whitelist/blacklist operations */ let {ListStore} = require("../common/Storage"); class ListManager { constructor(whitelist, blacklist, builtInHashes) { this.lists = {whitelist, blacklist}; this.builtInHashes = new Set(builtInHashes); } static async move(fromList, toList, ...keys) { await Promise.all([fromList.remove(...keys), toList.store(...keys)]); } async whitelist(...keys) { await ListManager.move(this.lists.blacklist, this.lists.whitelist, ...keys); } async blacklist(...keys) { await ListManager.move(this.lists.whitelist, this.lists.blacklist, ...keys); } async forget(...keys) { await Promise.all(Object.values(this.lists).map(async l => await l.remove(...keys))); } /* key is a string representing either a URL or an optional path with a trailing (hash). Returns "blacklisted", "whitelisted" or defValue */ getStatus(key, defValue = "unknown") { let {blacklist, whitelist} = this.lists; let inline = ListStore.inlineItem(key); if (inline) { return blacklist.contains(inline) ? "blacklisted" : whitelist.contains(inline) ? "whitelisted" : defValue; } let match = key.match(/\(([^)]+)\)(?=[^()]*$)/); if (!match) { let url = ListStore.urlItem(key); let site = ListStore.siteItem(key); return (blacklist.contains(url) || ListManager.siteMatch(site, blacklist) ? "blacklisted" : whitelist.contains(url) || ListManager.siteMatch(site, whitelist) ? "whitelisted" : defValue ); } let [hashItem, srcHash] = match; // (hash), hash return blacklist.contains(hashItem) ? "blacklisted" : this.builtInHashes.has(srcHash) || whitelist.contains(hashItem) ? "whitelisted" : defValue; } /* Matches by whole site ("http://some.domain.com/*") supporting also wildcarded subdomains ("https://*.domain.com/*"). */ static siteMatch(url, list) { let site = ListStore.siteItem(url); if (list.contains(site)) { return site; } site = site.replace(/^([\w-]+:\/\/)?(\w)/, "$1*.$2"); for (;;) { if (list.contains(site)) { return site; } let oldKey = site; site = site.replace(/(?:\*\.)*\w+(?=\.)/, "*"); if (site === oldKey) { return null; } } } } module.exports = { ListManager }; },{"../common/Storage":5}],3:[function(require,module,exports){ /** * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript. * * Copyright (C) 2018 Giorgio Maone * * This file is part of GNU LibreJS. * * GNU LibreJS is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * GNU LibreJS is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU LibreJS. If not, see . */ /** This class parses HTTP response headers to extract both the MIME Content-type and the character set to be used, if specified, to parse textual data through a decoder. */ const BOM = [0xEF, 0xBB, 0xBF]; const DECODER_PARAMS = {stream: true}; class ResponseMetaData { constructor(request) { let {responseHeaders} = request; this.headers = {}; for (let h of responseHeaders) { if (/^\s*Content-(Type|Disposition)\s*$/i.test(h.name)) { let propertyName = h.name.split("-")[1].trim(); propertyName = `content${propertyName.charAt(0).toUpperCase()}${propertyName.substring(1).toLowerCase()}`; this[propertyName] = h.value; this.headers[propertyName] = h; } } this.computedCharset = ""; } get charset() { let charset = ""; if (this.contentType) { let m = this.contentType.match(/;\s*charset\s*=\s*(\S+)/); if (m) { charset = m[1]; } } Object.defineProperty(this, "charset", { value: charset, writable: false, configurable: true }); return this.computedCharset = charset; } decode(data) { let charset = this.charset; let decoder = this.createDecoder(); let text = decoder.decode(data, DECODER_PARAMS); if (!charset && /html/i.test(this.contentType)) { // missing HTTP charset, sniffing in content... if (data[0] === BOM[0] && data[1] === BOM[1] && data[2] === BOM[2]) { // forced UTF-8, nothing to do return text; } // let's try figuring out the charset from tags let parser = new DOMParser(); let doc = parser.parseFromString(text, "text/html"); let meta = doc.querySelectorAll('meta[charset], meta[http-equiv="content-type"], meta[content*="charset"]'); for (let m of meta) { charset = m.getAttribute("charset"); if (!charset) { let match = m.getAttribute("content").match(/;\s*charset\s*=\s*([\w-]+)/i) if (match) charset = match[1]; } if (charset) { decoder = this.createDecoder(charset, null); if (decoder) { this.computedCharset = charset; return decoder.decode(data, DECODER_PARAMS); } } } } return text; } createDecoder(charset = this.charset, def = "latin1") { if (charset) { try { return new TextDecoder(charset); } catch (e) { console.error(e); } } return def ? new TextDecoder(def) : null; } }; ResponseMetaData.UTF8BOM = new Uint8Array(BOM); module.exports = { ResponseMetaData }; },{}],4:[function(require,module,exports){ /** * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript. * * Copyright (C) 2018 Giorgio Maone * * This file is part of GNU LibreJS. * * GNU LibreJS is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * GNU LibreJS is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU LibreJS. If not, see . */ /** An abstraction layer over the StreamFilter API, allowing its clients to process only the "interesting" HTML and script requests and leaving the other alone */ let {ResponseMetaData} = require("./ResponseMetaData"); let listeners = new WeakMap(); let webRequestEvent = browser.webRequest.onHeadersReceived; class ResponseProcessor { static install(handler, types = ["main_frame", "sub_frame", "script"]) { if (listeners.has(handler)) return false; let listener = async request => await new ResponseTextFilter(request).process(handler); listeners.set(handler, listener); webRequestEvent.addListener( listener, {urls: [""], types}, ["blocking", "responseHeaders"] ); return true; } static uninstall(handler) { let listener = listeners.get(handler); if (listener) { webRequestEvent.removeListener(listener); } } } Object.assign(ResponseProcessor, { // control flow values to be returned by handler.pre() callbacks ACCEPT: {}, REJECT: {cancel: true}, CONTINUE: null }); class ResponseTextFilter { constructor(request) { this.request = request; let {type, statusCode} = request; let md = this.metaData = new ResponseMetaData(request); this.canProcess = // we want to process html documents and scripts only (statusCode < 300 || statusCode >= 400) && // skip redirections !md.disposition && // skip forced downloads (type === "script" || /\bhtml\b/i.test(md.contentType)); } async process(handler) { if (!this.canProcess) return ResponseProcessor.ACCEPT; let {metaData, request} = this; let response = {request, metaData}; // we keep it around allowing callbacks to store state if (typeof handler.pre === "function") { let res = await handler.pre(response); if (res) return res; if (handler.post) handler = handler.post; if (typeof handler !== "function") return ResponseProcessor.ACCEPT; } let {requestId, responseHeaders} = request; let filter = browser.webRequest.filterResponseData(requestId); let buffer = []; filter.ondata = event => { buffer.push(event.data); }; filter.onstop = async event => { // concatenate chunks let size = buffer.reduce((sum, chunk, n) => sum + chunk.byteLength, 0) let allBytes = new Uint8Array(size); let pos = 0; for (let chunk of buffer) { allBytes.set(new Uint8Array(chunk), pos); pos += chunk.byteLength; } buffer = null; // allow garbage collection if (allBytes.indexOf(0) !== -1) { console.debug("Warning: zeroes in bytestream, probable cached encoding mismatch.", request); if (request.type === "script") { console.debug("It's a script, trying to refetch it."); response.text = await (await fetch(request.url, {cache: "reload", credentials: "include"})).text(); } else { console.debug("It's a %s, trying to decode it as UTF-16.", request.type); response.text = new TextDecoder("utf-16be").decode(allBytes, {stream: true}); } } else { response.text = metaData.decode(allBytes); } let editedText = null; try { editedText = await handler(response); } catch(e) { console.error(e); } if (editedText !== null) { // we changed the content, let's re-encode let encoded = new TextEncoder().encode(editedText); // pre-pending the UTF-8 BOM will force the charset per HTML 5 specs allBytes = new Uint8Array(encoded.byteLength + 3); allBytes.set(ResponseMetaData.UTF8BOM, 0); // UTF-8 BOM allBytes.set(encoded, 3); } filter.write(allBytes); filter.close(); } return ResponseProcessor.ACCEPT; } } module.exports = { ResponseProcessor }; },{"./ResponseMetaData":3}],5:[function(require,module,exports){ /** * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript. * * Copyright (C) 2018 Giorgio Maone * * This file is part of GNU LibreJS. * * GNU LibreJS is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * GNU LibreJS is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU LibreJS. If not, see . */ /** A tiny wrapper around extensions storage API, supporting CSV serialization for retro-compatibility */ "use strict"; var Storage = { ARRAY: { async load(key, array = undefined) { if (array === undefined) { array = (await browser.storage.local.get(key))[key]; } return array ? new Set(array) : new Set(); }, async save(key, list) { return await browser.storage.local.set({[key]: [...list]}); }, }, CSV: { async load(key) { let csv = (await browser.storage.local.get(key))[key]; return csv ? new Set(csv.split(/\s*,\s*/)) : new Set(); }, async save(key, list) { return await browser.storage.local.set({[key]: [...list].join(",")}); } } }; /** A class to hold and persist blacklists and whitelists */ class ListStore { constructor(key, storage = Storage.ARRAY) { this.key = key; this.storage = storage; this.items = new Set(); browser.storage.onChanged.addListener(changes => { if (!this.saving && this.key in changes) { this.load(changes[this.key].newValue); } }); } static inlineItem(url) { // here we simplify and hash inline script references return url.startsWith("inline:") ? url : url.startsWith("view-source:") && url.replace(/^view-source:[\w-+]+:\/+([^/]+).*#line\d+/,"inline://$1#") .replace(/\n[^]*/, s => s.replace(/\s+/g, ' ').substring(0, 16) + "…" + hash(s.trim())); } static hashItem(hash) { return hash.startsWith("(") ? hash : `(${hash})`; } static urlItem(url) { let queryPos = url.indexOf("?"); return queryPos === -1 ? url : url.substring(0, queryPos); } static siteItem(url) { if (url.endsWith("/*")) return url; try { return `${new URL(url).origin}/*`; } catch (e) { return `${url}/*`; } } async save() { this._saving = true; try { return await this.storage.save(this.key, this.items); } finally { this._saving = false; } } async load(values = undefined) { try { this.items = await this.storage.load(this.key, values); } catch (e) { console.error(e); } return this.items; } async store(...items) { let size = this.items.size; let changed = false; for (let item of items) { if (size !== this.items.add(item).size) { changed = true; } } return changed && await this.save(); } async remove(...items) { let changed = false; for (let item of items) { if (this.items.delete(item)) { changed = true; } } return changed && await this.save(); } contains(item) { return this.items.has(item); } } function hash(source){ var shaObj = new jssha("SHA-256","TEXT") shaObj.update(source); return shaObj.getHash("HEX"); } if (typeof module === "object") { module.exports = { ListStore, Storage, hash }; var jssha = require('jssha'); } },{"jssha":16}],6:[function(require,module,exports){ /** * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript. * * Copyright (C) 2018 Giorgio Maone * * This file is part of GNU LibreJS. * * GNU LibreJS is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * GNU LibreJS is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU LibreJS. If not, see . */ "use strict"; var Test = (() => { const RUNNER_URL = browser.extension.getURL("/test/SpecRunner.html"); return { /* returns RUNNER_URL if it's a test-enabled build or an about:debugging temporary extension session, null otherwise */ async getURL() { let url = RUNNER_URL; try { await fetch(url); } catch (e) { url = null; } this.getURL = () => url; return url; }, async getTab(activate = false) { let url = await this.getURL(); let tab = url ? (await browser.tabs.query({url}))[0] || (await browser.tabs.create({url})) : null; if (tab && activate) { await browser.tabs.update(tab.id, {active: true}); } return tab; } }; })(); if (typeof module === "object") { module.exports = Test; } },{}],7:[function(require,module,exports){ module.exports=module.exports = { fname_data : { "WebGLShader": true, "WebGLShaderPrecisionFormat": true, "WebGLQuery": true, "WebGLRenderbuffer": true, "WebGLSampler": true, "WebGLUniformLocation": true, "WebGLFramebuffer": true, "WebGLProgram": true, "WebGLContextEvent": true, "WebGL2RenderingContext": true, "WebGLTexture": true, "WebGLRenderingContext": true, "WebGLVertexArrayObject": true, "WebGLActiveInfo": true, "WebGLTransformFeedback": true, "WebGLSync": true, "WebGLBuffer": true, "cat_svg": true, "SVGPoint": true, "SVGEllipseElement": true, "SVGRadialGradientElement": true, "SVGComponentTransferFunctionElement": true, "SVGPathSegCurvetoQuadraticAbs": true, "SVGAnimatedNumberList": true, "SVGPathSegCurvetoQuadraticSmoothRel": true, "SVGFEColorMatrixElement": true, "SVGPathSegLinetoHorizontalAbs": true, "SVGLinearGradientElement": true, "SVGStyleElement": true, "SVGPathSegMovetoRel": true, "SVGStopElement": true, "SVGPathSegLinetoRel": true, "SVGFEConvolveMatrixElement": true, "SVGAnimatedAngle": true, "SVGPathSegLinetoAbs": true, "SVGPreserveAspectRatio": true, "SVGFEOffsetElement": true, "SVGFEImageElement": true, "SVGFEDiffuseLightingElement": true, "SVGAnimatedNumber": true, "SVGTextElement": true, "SVGFESpotLightElement": true, "SVGFEMorphologyElement": true, "SVGAngle": true, "SVGScriptElement": true, "SVGFEDropShadowElement": true, "SVGPathSegArcRel": true, "SVGNumber": true, "SVGPathSegLinetoHorizontalRel": true, "SVGFEFuncBElement": true, "SVGClipPathElement": true, "SVGPathSeg": true, "SVGUseElement": true, "SVGPathSegArcAbs": true, "SVGPathSegCurvetoQuadraticSmoothAbs": true, "SVGRect": true, "SVGAnimatedPreserveAspectRatio": true, "SVGImageElement": true, "SVGAnimatedEnumeration": true, "SVGAnimatedLengthList": true, "SVGFEFloodElement": true, "SVGFECompositeElement": true, "SVGAElement": true, "SVGAnimatedBoolean": true, "SVGMaskElement": true, "SVGFilterElement": true, "SVGPathSegLinetoVerticalRel": true, "SVGAnimatedInteger": true, "SVGTSpanElement": true, "SVGMarkerElement": true, "SVGStringList": true, "SVGTransform": true, "SVGTitleElement": true, "SVGFEBlendElement": true, "SVGTextPositioningElement": true, "SVGFEFuncGElement": true, "SVGFEPointLightElement": true, "SVGAnimateElement": true, "SVGPolylineElement": true, "SVGDefsElement": true, "SVGPathSegList": true, "SVGAnimatedTransformList": true, "SVGPathSegClosePath": true, "SVGGradientElement": true, "SVGSwitchElement": true, "SVGViewElement": true, "SVGUnitTypes": true, "SVGPathSegMovetoAbs": true, "SVGSymbolElement": true, "SVGFEFuncAElement": true, "SVGAnimatedString": true, "SVGFEMergeElement": true, "SVGPathSegLinetoVerticalAbs": true, "SVGAnimationElement": true, "SVGPathSegCurvetoCubicAbs": true, "SVGLength": true, "SVGTextPathElement": true, "SVGPolygonElement": true, "SVGAnimatedRect": true, "SVGPathSegCurvetoCubicRel": true, "SVGFEFuncRElement": true, "SVGLengthList": true, "SVGTextContentElement": true, "SVGFETurbulenceElement": true, "SVGMatrix": true, "SVGZoomAndPan": true, "SVGMetadataElement": true, "SVGFEDistantLightElement": true, "SVGAnimateMotionElement": true, "SVGDescElement": true, "SVGPathSegCurvetoCubicSmoothRel": true, "SVGFESpecularLightingElement": true, "SVGFEGaussianBlurElement": true, "SVGFEComponentTransferElement": true, "SVGNumberList": true, "SVGTransformList": true, "SVGForeignObjectElement": true, "SVGRectElement": true, "SVGFEDisplacementMapElement": true, "SVGAnimateTransformElement": true, "SVGAnimatedLength": true, "SVGPointList": true, "SVGPatternElement": true, "SVGPathSegCurvetoCubicSmoothAbs": true, "SVGCircleElement": true, "SVGSetElement": true, "SVGFETileElement": true, "SVGMPathElement": true, "SVGFEMergeNodeElement": true, "SVGPathSegCurvetoQuadraticRel": true, "SVGElement": true, "SVGGraphicsElement": true, "SVGSVGElement": true, "SVGGElement": true, "SVGGeometryElement": true, "SVGPathElement": true, "SVGLineElement": true, "cat_html": true, "HTMLTimeElement": true, "HTMLPictureElement": true, "HTMLMenuItemElement": true, "HTMLFormElement": true, "HTMLOptionElement": true, "HTMLCanvasElement": true, "HTMLTableSectionElement": true, "HTMLSelectElement": true, "HTMLUListElement": true, "HTMLMetaElement": true, "HTMLLinkElement": true, "HTMLBaseElement": true, "HTMLDataListElement": true, "HTMLInputElement": true, "HTMLMeterElement": true, "HTMLSourceElement": true, "HTMLTrackElement": true, "HTMLTableColElement": true, "HTMLFieldSetElement": true, "HTMLDirectoryElement": true, "HTMLTableCellElement": true, "HTMLStyleElement": true, "HTMLAudioElement": true, "HTMLLegendElement": true, "HTMLOListElement": true, "HTMLEmbedElement": true, "HTMLQuoteElement": true, "HTMLMenuElement": true, "HTMLHeadElement": true, "HTMLUnknownElement": true, "HTMLBRElement": true, "HTMLProgressElement": true, "HTMLMediaElement": true, "HTMLFormControlsCollection": true, "HTMLCollection": true, "HTMLLIElement": true, "HTMLDetailsElement": true, "HTMLObjectElement": true, "HTMLHeadingElement": true, "HTMLTableCaptionElement": true, "HTMLPreElement": true, "HTMLAllCollection": true, "HTMLFrameSetElement": true, "HTMLFontElement": true, "HTMLFrameElement": true, "HTMLAnchorElement": true, "HTMLOptGroupElement": true, "HTMLVideoElement": true, "HTMLModElement": true, "HTMLBodyElement": true, "HTMLTableElement": true, "HTMLButtonElement": true, "HTMLTableRowElement": true, "HTMLAreaElement": true, "HTMLDataElement": true, "HTMLParamElement": true, "HTMLLabelElement": true, "HTMLTemplateElement": true, "HTMLOptionsCollection": true, "HTMLIFrameElement": true, "HTMLTitleElement": true, "HTMLMapElement": true, "HTMLOutputElement": true, "HTMLDListElement": true, "HTMLParagraphElement": true, "HTMLHRElement": true, "HTMLImageElement": true, "HTMLDocument": true, "HTMLElement": true, "HTMLScriptElement": true, "HTMLHtmlElement": true, "HTMLTextAreaElement": true, "HTMLDivElement": true, "HTMLSpanElement": true, "cat_css": true, "CSSStyleRule": true, "CSSFontFaceRule": true, "CSSPrimitiveValue": true, "CSSStyleDeclaration": true, "CSSStyleSheet": true, "CSSPageRule": true, "CSSSupportsRule": true, "CSSMozDocumentRule": true, "CSSKeyframeRule": true, "CSSGroupingRule": true, "CSS2Properties": true, "CSSFontFeatureValuesRule": true, "CSSRuleList": true, "CSSPseudoElement": true, "CSSMediaRule": true, "CSSCounterStyleRule": true, "CSSImportRule": true, "CSSTransition": true, "CSSAnimation": true, "CSSValue": true, "CSSNamespaceRule": true, "CSSRule": true, "CSS": true, "CSSKeyframesRule": true, "CSSConditionRule": true, "CSSValueList": true, "cat_event": true, "ondevicemotion": true, "ondeviceorientation": true, "onabsolutedeviceorientation": true, "ondeviceproximity": true, "onuserproximity": true, "ondevicelight": true, "onvrdisplayconnect": true, "onvrdisplaydisconnect": true, "onvrdisplayactivate": true, "onvrdisplaydeactivate": true, "onvrdisplaypresentchange": true, "onabort": true, "onblur": true, "onfocus": true, "onauxclick": true, "oncanplay": true, "oncanplaythrough": true, "onchange": true, "onclick": true, "onclose": true, "oncontextmenu": true, "ondblclick": true, "ondrag": true, "ondragend": true, "ondragenter": true, "ondragexit": true, "ondragleave": true, "ondragover": true, "ondragstart": true, "ondrop": true, "ondurationchange": true, "onemptied": true, "onended": true, "oninput": true, "oninvalid": true, "onkeydown": true, "onkeypress": true, "onkeyup": true, "onload": true, "onloadeddata": true, "onloadedmetadata": true, "onloadend": true, "onloadstart": true, "onmousedown": true, "onmouseenter": true, "onmouseleave": true, "onmousemove": true, "onmouseout": true, "onmouseover": true, "onmouseup": true, "onwheel": true, "onpause": true, "onplay": true, "onplaying": true, "onprogress": true, "onratechange": true, "onreset": true, "onresize": true, "onscroll": true, "onseeked": true, "onseeking": true, "onselect": true, "onshow": true, "onstalled": true, "onsubmit": true, "onsuspend": true, "ontimeupdate": true, "onvolumechange": true, "onwaiting": true, "onselectstart": true, "ontoggle": true, "onpointercancel": true, "onpointerdown": true, "onpointerup": true, "onpointermove": true, "onpointerout": true, "onpointerover": true, "onpointerenter": true, "onpointerleave": true, "ongotpointercapture": true, "onlostpointercapture": true, "onmozfullscreenchange": true, "onmozfullscreenerror": true, "onanimationcancel": true, "onanimationend": true, "onanimationiteration": true, "onanimationstart": true, "ontransitioncancel": true, "ontransitionend": true, "ontransitionrun": true, "ontransitionstart": true, "onwebkitanimationend": true, "onwebkitanimationiteration": true, "onwebkitanimationstart": true, "onwebkittransitionend": true, "onerror": false, "onafterprint": true, "onbeforeprint": true, "onbeforeunload": true, "onhashchange": true, "onlanguagechange": true, "onmessage": true, "onmessageerror": true, "onoffline": true, "ononline": true, "onpagehide": true, "onpageshow": true, "onpopstate": true, "onstorage": true, "onunload": true, "cat_rtc": true, "RTCDTMFSender": true, "RTCStatsReport": true, "RTCTrackEvent": true, "RTCDataChannelEvent": true, "RTCPeerConnectionIceEvent": true, "RTCCertificate": true, "RTCDTMFToneChangeEvent": true, "RTCPeerConnection": true, "RTCIceCandidate": true, "RTCRtpReceiver": true, "RTCRtpSender": true, "RTCSessionDescription": true, "cat_vr": true, "VRStageParameters": true, "VRFrameData": true, "VRDisplay": true, "VRDisplayEvent": true, "VRFieldOfView": true, "VRDisplayCapabilities": true, "VREyeParameters": true, "VRPose": true, "cat_dom": true, "DOMStringMap": true, "DOMRectReadOnly": true, "DOMException": true, "DOMRect": true, "DOMMatrix": true, "DOMMatrixReadOnly": true, "DOMPointReadOnly": true, "DOMPoint": true, "DOMQuad": true, "DOMRequest": true, "DOMParser": true, "DOMTokenList": true, "DOMStringList": true, "DOMImplementation": true, "DOMError": true, "DOMRectList": true, "DOMCursor": true, "cat_idb": true, "IDBFileRequest": true, "IDBTransaction": true, "IDBCursor": true, "IDBFileHandle": true, "IDBMutableFile": true, "IDBKeyRange": true, "IDBVersionChangeEvent": true, "IDBObjectStore": true, "IDBFactory": true, "IDBCursorWithValue": true, "IDBOpenDBRequest": true, "IDBRequest": true, "IDBIndex": true, "IDBDatabase": true, "cat_audio": true, "AudioContext": true, "AudioBuffer": true, "AudioBufferSourceNode": true, "Audio": true, "MediaElementAudioSourceNode": true, "AudioNode": true, "BaseAudioContext": true, "AudioListener": true, "MediaStreamAudioSourceNode": true, "OfflineAudioContext": true, "AudioDestinationNode": true, "AudioParam": true, "MediaStreamAudioDestinationNode": true, "OfflineAudioCompletionEvent": true, "AudioStreamTrack": true, "AudioScheduledSourceNode": true, "AudioProcessingEvent": true, "cat_gamepad": true, "GamepadButton": true, "GamepadHapticActuator": true, "GamepadAxisMoveEvent": true, "GamepadPose": true, "GamepadEvent": true, "Gamepad": true, "GamepadButtonEvent": true, "cat_media": true, "MediaKeys": true, "MediaKeyError": true, "MediaSource": true, "MediaDevices": true, "MediaKeyStatusMap": true, "MediaStreamTrackEvent": true, "MediaRecorder": true, "MediaQueryListEvent": true, "MediaStream": true, "MediaEncryptedEvent": true, "MediaStreamTrack": true, "MediaError": true, "MediaStreamEvent": true, "MediaQueryList": true, "MediaKeySystemAccess": true, "MediaDeviceInfo": true, "MediaKeySession": true, "MediaList": true, "MediaRecorderErrorEvent": true, "MediaKeyMessageEvent": true, "cat_event2": true, "SpeechSynthesisErrorEvent": true, "BeforeUnloadEvent": true, "CustomEvent": true, "PageTransitionEvent": true, "PopupBlockedEvent": true, "CloseEvent": true, "ProgressEvent": true, "MutationEvent": true, "MessageEvent": true, "FocusEvent": true, "TrackEvent": true, "DeviceMotionEvent": true, "TimeEvent": true, "PointerEvent": true, "UserProximityEvent": true, "StorageEvent": true, "DragEvent": true, "MouseScrollEvent": true, "EventSource": true, "PopStateEvent": true, "DeviceProximityEvent": true, "SpeechSynthesisEvent": true, "XMLHttpRequestEventTarget": true, "ClipboardEvent": true, "AnimationPlaybackEvent": true, "DeviceLightEvent": true, "BlobEvent": true, "MouseEvent": true, "WheelEvent": true, "InputEvent": true, "HashChangeEvent": true, "DeviceOrientationEvent": true, "CompositionEvent": true, "KeyEvent": true, "ScrollAreaEvent": true, "KeyboardEvent": true, "TransitionEvent": true, "ErrorEvent": true, "AnimationEvent": true, "FontFaceSetLoadEvent": true, "EventTarget": true, "captureEvents": true, "releaseEvents": true, "Event": true, "UIEvent": true, "cat_other": false, "undefined": false, "Array": false, "Boolean": false, "JSON": false, "Date": false, "Math": false, "Number": false, "String": false, "RegExp": false, "Error": false, "InternalError": false, "EvalError": false, "RangeError": false, "ReferenceError": false, "SyntaxError": false, "TypeError": false, "URIError": false, "ArrayBuffer": true, "Int8Array": true, "Uint8Array": true, "Int16Array": true, "Uint16Array": true, "Int32Array": true, "Uint32Array": true, "Float32Array": true, "Float64Array": true, "Uint8ClampedArray": true, "Proxy": true, "WeakMap": true, "Map": true, "Set": true, "DataView": false, "Symbol": false, "SharedArrayBuffer": true, "Intl": false, "TypedObject": true, "Reflect": true, "SIMD": true, "WeakSet": true, "Atomics": true, "Promise": true, "WebAssembly": true, "NaN": false, "Infinity": false, "isNaN": false, "isFinite": false, "parseFloat": false, "parseInt": false, "escape": false, "unescape": false, "decodeURI": false, "encodeURI": false, "decodeURIComponent": false, "encodeURIComponent": false, "uneval": false, "BatteryManager": true, "CanvasGradient": true, "TextDecoder": true, "Plugin": true, "PushManager": true, "ChannelMergerNode": true, "PerformanceResourceTiming": true, "ServiceWorker": true, "TextTrackCueList": true, "PerformanceEntry": true, "TextTrackList": true, "StyleSheet": true, "PerformanceMeasure": true, "DesktopNotificationCenter": true, "Comment": true, "DelayNode": true, "XPathResult": true, "CDATASection": true, "MessageChannel": true, "BiquadFilterNode": true, "SpeechSynthesisUtterance": true, "Crypto": true, "Navigator": true, "FileList": true, "URLSearchParams": false, "ServiceWorkerContainer": true, "ValidityState": true, "ProcessingInstruction": true, "AbortSignal": true, "FontFace": true, "FileReader": true, "Worker": true, "External": true, "ImageBitmap": true, "TimeRanges": true, "Option": true, "TextTrack": true, "Image": true, "AnimationTimeline": true, "VideoPlaybackQuality": true, "VTTCue": true, "Storage": true, "XPathExpression": true, "CharacterData": false, "TextMetrics": true, "AnimationEffectReadOnly": true, "PerformanceTiming": false, "PerformanceMark": true, "ImageBitmapRenderingContext": true, "Headers": true, "Range": false, "Rect": true, "AnimationEffectTimingReadOnly": true, "KeyframeEffect": true, "Permissions": true, "TextEncoder": true, "ImageData": true, "SpeechSynthesisVoice": true, "StorageManager": true, "TextTrackCue": true, "WebSocket": true, "DocumentType": true, "XPathEvaluator": true, "PerformanceNavigationTiming": true, "IdleDeadline": true, "FileSystem": true, "FileSystemFileEntry": true, "CacheStorage": true, "MimeType": true, "PannerNode": true, "NodeFilter": true, "StereoPannerNode": true, "console": false, "DynamicsCompressorNode": true, "PaintRequest": true, "RGBColor": true, "FontFaceSet": false, "PaintRequestList": true, "FileSystemEntry": true, "XMLDocument": false, "SourceBuffer": false, "Screen": true, "NamedNodeMap": false, "History": true, "Response": true, "AnimationEffectTiming": true, "ServiceWorkerRegistration": true, "CanvasRenderingContext2D": true, "ScriptProcessorNode": true, "FileSystemDirectoryReader": true, "MimeTypeArray": true, "CanvasCaptureMediaStream": true, "Directory": true, "mozRTCPeerConnection": true, "PerformanceObserverEntryList": true, "PushSubscriptionOptions": true, "Text": false, "IntersectionObserverEntry": true, "SubtleCrypto": true, "Animation": true, "DataTransfer": true, "TreeWalker": true, "XMLHttpRequest": true, "LocalMediaStream": true, "ConvolverNode": true, "WaveShaperNode": true, "DataTransferItemList": false, "Request": true, "SourceBufferList": false, "XSLTProcessor": true, "XMLHttpRequestUpload": true, "SharedWorker": true, "Notification": false, "DataTransferItem": true, "AnalyserNode": true, "mozRTCIceCandidate": true, "PerformanceObserver": true, "OfflineResourceList": true, "FileSystemDirectoryEntry": true, "DesktopNotification": false, "DataChannel": true, "IIRFilterNode": true, "ChannelSplitterNode": true, "File": true, "ConstantSourceNode": true, "CryptoKey": true, "GainNode": true, "AbortController": true, "Attr": true, "SpeechSynthesis": true, "PushSubscription": false, "XMLStylesheetProcessingInstruction": false, "NodeIterator": true, "VideoStreamTrack": true, "XMLSerializer": true, "CaretPosition": true, "FormData": true, "CanvasPattern": true, "mozRTCSessionDescription": true, "Path2D": true, "PerformanceNavigation": true, "URL": false, "PluginArray": true, "MutationRecord": true, "WebKitCSSMatrix": true, "PeriodicWave": true, "DocumentFragment": true, "DocumentTimeline": false, "ScreenOrientation": true, "BroadcastChannel": true, "PermissionStatus": true, "IntersectionObserver": true, "Blob": true, "MessagePort": true, "BarProp": true, "OscillatorNode": true, "Cache": true, "RadioNodeList": true, "KeyframeEffectReadOnly": true, "InstallTrigger": true, "Function": false, "Object": false, "eval": true, "Window": false, "close": false, "stop": false, "focus": false, "blur": false, "open": true, "alert": false, "confirm": false, "prompt": false, "print": false, "postMessage": true, "getSelection": true, "getComputedStyle": true, "matchMedia": true, "moveTo": false, "moveBy": false, "resizeTo": false, "resizeBy": false, "scroll": false, "scrollTo": false, "scrollBy": false, "requestAnimationFrame": true, "cancelAnimationFrame": true, "getDefaultComputedStyle": false, "scrollByLines": false, "scrollByPages": false, "sizeToContent": false, "updateCommands": true, "find": false, "dump": true, "setResizable": false, "requestIdleCallback": false, "cancelIdleCallback": false, "btoa": true, "atob": true, "setTimeout": true, "clearTimeout": true, "setInterval": true, "clearInterval": true, "createImageBitmap": true, "fetch": true, "self": true, "name": false, "history": true, "locationbar": true, "menubar": true, "personalbar": true, "scrollbars": true, "statusbar": true, "toolbar": true, "status": true, "closed": true, "frames": true, "length": false, "opener": true, "parent": true, "frameElement": true, "navigator": true, "external": true, "applicationCache": true, "screen": true, "innerWidth": true, "innerHeight": true, "scrollX": true, "pageXOffset": true, "scrollY": true, "pageYOffset": true, "screenX": true, "screenY": true, "outerWidth": true, "outerHeight": true, "performance": true, "mozInnerScreenX": true, "mozInnerScreenY": true, "devicePixelRatio": true, "scrollMaxX": true, "scrollMaxY": true, "fullScreen": false, "mozPaintCount": true, "sidebar": false, "crypto": true, "speechSynthesis": true, "localStorage": true, "origin": true, "isSecureContext": false, "indexedDB": true, "caches": true, "sessionStorage": true, "window": false, "document": true, "location": false, "top": false, "netscape": true, "Node": true, "Document": true, "Performance": false, "startProfiling": true, "stopProfiling": true, "pauseProfilers": true, "resumeProfilers": true, "dumpProfile": true, "getMaxGCPauseSinceClear": true, "clearMaxGCPauseAccumulator": true, "Location": true, "StyleSheetList": false, "Selection": false, "Element": true, "AnonymousContent": false, "MutationObserver": true, "NodeList": true, "StopIteration": true } }; },{}],8:[function(require,module,exports){ module.exports = { whitelist: {"jquery":[{"filename":"core.js","version":"3.3.1","hash":"6026ca247eaee2c88fa54964d77d2e76efc97a974a5695e3744cb38defb3d691"},{"filename":"jquery.js","version":"3.3.1","hash":"d8aa24ecc6cecb1a60515bc093f1c9da38a0392612d9ab8ae0f7f36e6eee1fad"},{"filename":"jquery.min.js","version":"3.3.1","hash":"160a426ff2894252cd7cebbdd6d6b7da8fcd319c65b70468f10b6690c45d02ef"},{"filename":"jquery.slim.js","version":"3.3.1","hash":"7cd5c914895c6b4e4120ed98e73875c6b4a12b7304fbf9586748fe0a1c57d830"},{"filename":"jquery.slim.min.js","version":"3.3.1","hash":"dde76b9b2b90d30eb97fc81f06caa8c338c97b688cea7d2729c88f529f32fbb1"},{"filename":"core.js","version":"3.3.0","hash":"58db1cc9582b20320c552043b5880b40c8eaec3e6d4b46994222862a049330a1"},{"filename":"jquery.js","version":"3.3.0","hash":"4c5592b8326dea44be86e57ebd59725758ccdddc0675e356a9ece14f15c1fd7f"},{"filename":"jquery.min.js","version":"3.3.0","hash":"453432f153a63654fa6f63c846eaf7ee9e8910165413ba3cc0f80cbeed7c302e"},{"filename":"jquery.slim.js","version":"3.3.0","hash":"ec89a3d1f2cab57e4d144092d6e9a8429ecd0b594482be270536ac366ee004b6"},{"filename":"jquery.slim.min.js","version":"3.3.0","hash":"00c83723bc9aefa38b3c3f4cf8c93b92aac0dbd1d49ff16e1817d3ffd51ff65b"},{"filename":"core.js","version":"3.2.1","hash":"052b1b5ec0c4ae78aafc7a6e8542c5a2bf31d42a40dac3cfc102e512812b8bed"},{"filename":"jquery.js","version":"3.2.1","hash":"0d9027289ffa5d9f6c8b4e0782bb31bbff2cef5ee3708ccbcb7a22df9128bb21"},{"filename":"jquery.min.js","version":"3.2.1","hash":"87083882cc6015984eb0411a99d3981817f5dc5c90ba24f0940420c5548d82de"},{"filename":"jquery.slim.js","version":"3.2.1","hash":"b40f32d17aa2c27a7098e225dd218070597646fc478c0f2aa74fb5b821a64668"},{"filename":"jquery.slim.min.js","version":"3.2.1","hash":"9365920887b11b33a3dc4ba28a0f93951f200341263e3b9cefd384798e4be398"},{"filename":"core.js","version":"3.2.0","hash":"7c5c8f96ac182ed4d2c9ac74fda37941745f2793814fbd8b28624a9a720f9d39"},{"filename":"jquery.js","version":"3.2.0","hash":"c0f149348165558e3d07e0ae008ac3afddf65d26fa264dc9d4cdb6337136ca54"},{"filename":"jquery.min.js","version":"3.2.0","hash":"2405bdf4c255a4904671bcc4b97938033d39b3f5f20dd068985a8d94cde273e2"},{"filename":"jquery.slim.js","version":"3.2.0","hash":"f18ac10930e84233b80814f5595bcc1f6ffad74047d038d997114e08880aec03"},{"filename":"jquery.slim.min.js","version":"3.2.0","hash":"a8b02fd240408a170764b2377efdd621329e46c517dbb85deaea4105ad0c4a8c"},{"filename":"core.js","version":"3.1.1","hash":"4a4dec7ca8f2567b4327c82b873c8d7dd774f74b9009d2ff65431a8154693dea"},{"filename":"jquery.js","version":"3.1.1","hash":"d7a71d3dd740e95755227ba6446a3a21b8af6c4444f29ec2411dc7cd306e10b0"},{"filename":"jquery.min.js","version":"3.1.1","hash":"85556761a8800d14ced8fcd41a6b8b26bf012d44a318866c0d81a62092efd9bf"},{"filename":"jquery.slim.js","version":"3.1.1","hash":"e62fe6437d3433befd3763950eb975ea56e88705cd51dccbfd1d9a5545f25d60"},{"filename":"jquery.slim.min.js","version":"3.1.1","hash":"fd222b36abfc87a406283b8da0b180e22adeb7e9327ac0a41c6cd5514574b217"},{"filename":"core.js","version":"3.1.0","hash":"55994528e7efe901e92a76761a54ba0c3ae3f1f8d1c3a4da9a23a3e4a06d0eaa"},{"filename":"jquery.js","version":"3.1.0","hash":"b25a2092f0752b754e933008f10213c55dd5ce93a791e355b0abed9182cc8df9"},{"filename":"jquery.min.js","version":"3.1.0","hash":"702b9e051e82b32038ffdb33a4f7eb5f7b38f4cf6f514e4182d8898f4eb0b7fb"},{"filename":"jquery.slim.js","version":"3.1.0","hash":"2faa690232fa8e0b5199f8ae8a0784139030348da91ff5fd2016cfc9a9c9799c"},{"filename":"jquery.slim.min.js","version":"3.1.0","hash":"711a568e848ec3929cc8839a64da388ba7d9f6d28f85861bea2e53f51495246f"},{"filename":"core.js","version":"3.0.0-rc1","hash":"11853583eb5ce8ab1aacc380430145de705cdfff0e72c54d3dca17d01466999b"},{"filename":"jquery.js","version":"3.0.0-rc1","hash":"65ded5fa34aa91b976dae0af5888ce4c06fed34271f3665b2924505b704025c7"},{"filename":"jquery.min.js","version":"3.0.0-rc1","hash":"df68e90250b9a60fc184ef194d1769d3af8aa67396cc064281cb77e2ef6bf876"},{"filename":"jquery.slim.js","version":"3.0.0-rc1","hash":"c96eeff335114aa55df0328bbe5f9202ed7a3266b6e81fcd357cd17837fa9756"},{"filename":"jquery.slim.min.js","version":"3.0.0-rc1","hash":"e92bbd6e77604b75e910952f20f3c95ce29050c7b1137dc1edddad000c236b5d"},{"filename":"jquery.js","version":"3.0.0-beta1","hash":"78f27c3d7cb5d766466703adc7f7ad7706b7fb05514eec39be0aa253449bd0f8"},{"filename":"jquery.min.js","version":"3.0.0-beta1","hash":"b72a0aa436a8a8965041beda30577232677ef6588bb933b5bebed2de02c04dc8"},{"filename":"jquery.slim.js","version":"3.0.0-beta1","hash":"4db510700e5773fc7065f36363affd4885c9d9ef257fd7757744f91ac9da5671"},{"filename":"jquery.slim.min.js","version":"3.0.0-beta1","hash":"4c369c555423651822c2f7772d5e0b9a56a2372a92657bd2a696fe539b24be9e"},{"filename":"jquery.js","version":"3.0.0-alpha1","hash":"10b3ccff4cf14cdb5e7c31b2d323be750a13125cea8ded9ca5c1da4150a69238"},{"filename":"jquery.min.js","version":"3.0.0-alpha1","hash":"19e065eaadf26f58c0e1081a2e0e64450eec2983eebb08f998ecaacac8642a47"},{"filename":"core.js","version":"3.0.0","hash":"bad41b5e9f7c6b952b3a840b84ce2e97e3029bd2b2773c58a69a33e73217d1e4"},{"filename":"jquery.js","version":"3.0.0","hash":"8eb3cb67ef2f0f1b76167135cef6570a409c79b23f0bc0ede71c9a4018f1408a"},{"filename":"jquery.min.js","version":"3.0.0","hash":"266bcea0bb58b26aa5b16c5aee60d22ccc1ae9d67daeb21db6bad56119c3447d"},{"filename":"jquery.slim.js","version":"3.0.0","hash":"1a9ea1a741fe03b6b1835b44ac2b9c59e39cdfc8abb64556a546c16528fc2828"},{"filename":"jquery.slim.min.js","version":"3.0.0","hash":"45fe0169d7f20adb2f1e63bcf4151971b62f34dbd9bce4f4f002df133bc2b03d"},{"filename":"jquery.js","version":"2.2.4","hash":"893e90f6230962e42231635df650f20544ad22affc3ee396df768eaa6bc5a6a2"},{"filename":"jquery.min.js","version":"2.2.4","hash":"05b85d96f41fff14d8f608dad03ab71e2c1017c2da0914d7c59291bad7a54f8e"},{"filename":"jquery.js","version":"2.2.3","hash":"95a5d6b46c9da70a89f0903e5fdc769a2c266a22a19fcb5598e5448a044db4fe"},{"filename":"jquery.min.js","version":"2.2.3","hash":"6b6de0d4db7876d1183a3edb47ebd3bbbf93f153f5de1ba6645049348628109a"},{"filename":"jquery.slim.js","version":"2.2.3","hash":"4db510700e5773fc7065f36363affd4885c9d9ef257fd7757744f91ac9da5671"},{"filename":"jquery.slim.min.js","version":"2.2.3","hash":"4c369c555423651822c2f7772d5e0b9a56a2372a92657bd2a696fe539b24be9e"},{"filename":"jquery.js","version":"2.2.2","hash":"e3fcd40aa8aad24ab1859232a781b41a4f803ad089b18d53034d24e4296c6581"},{"filename":"jquery.min.js","version":"2.2.2","hash":"dfa729d82a3effadab1000181cb99108f232721e3b0af74cfae4c12704b35a32"},{"filename":"jquery.slim.js","version":"2.2.2","hash":"4db510700e5773fc7065f36363affd4885c9d9ef257fd7757744f91ac9da5671"},{"filename":"jquery.slim.min.js","version":"2.2.2","hash":"4c369c555423651822c2f7772d5e0b9a56a2372a92657bd2a696fe539b24be9e"},{"filename":"jquery.js","version":"2.2.1","hash":"78d714ccede3b2fd179492ef7851246c1f1b03bfc2ae83693559375e99a7c077"},{"filename":"jquery.min.js","version":"2.2.1","hash":"82f420005cd31fab6b4ab016a07d623e8f5773de90c526777de5ba91e9be3b4d"},{"filename":"jquery.slim.js","version":"2.2.1","hash":"4db510700e5773fc7065f36363affd4885c9d9ef257fd7757744f91ac9da5671"},{"filename":"jquery.slim.min.js","version":"2.2.1","hash":"4c369c555423651822c2f7772d5e0b9a56a2372a92657bd2a696fe539b24be9e"},{"filename":"jquery.js","version":"2.2.0","hash":"a18aa92dea997bd71eb540d5f931620591e9dee27e5f817978bb385bab924d21"},{"filename":"jquery.min.js","version":"2.2.0","hash":"8a102873a33f24f7eb22221e6b23c4f718e29f85168ecc769a35bfaed9b12cce"},{"filename":"jquery.js","version":"2.1.4","hash":"b2215cce5830e2350b9d420271d9bd82340f664c3f60f0ea850f7e9c0392704e"},{"filename":"jquery.min.js","version":"2.1.4","hash":"22642f202577f0ba2f22cbe56b6cf291a09374487567cd3563e0d2a29f75c0c5"},{"filename":"jquery.js","version":"2.1.3","hash":"828cbbcacb430f9c5b5d27fe9302f8795eb338f2421010f5141882125226f94f"},{"filename":"jquery.min.js","version":"2.1.3","hash":"2051d61446d4dbffb03727031022a08c84528ab44d203a7669c101e5fbdd5515"},{"filename":"jquery.js","version":"2.1.2","hash":"07cb07bdfba40ceff869b329eb48eeede41740ba6ce833dd3830bd0af49e4898"},{"filename":"jquery.min.js","version":"2.1.2","hash":"64c51d974a342e9df3ed548082a4ad7816d407b8c36b67356dde9e487b819cbe"},{"filename":"jquery.js","version":"2.1.1-rc2","hash":"dc0083a233768ed8554d770d9d4eed91c0e27de031b3d9cbdcecabc034265010"},{"filename":"jquery.min.js","version":"2.1.1-rc2","hash":"293c9966a4fea0fed0adc1aae242bb37e428e649337dcab65d9af5934a7cc775"},{"filename":"jquery.js","version":"2.1.1-rc1","hash":"5adbbda8312291291162ab054df8927291426dbfb550099945ece85b49707290"},{"filename":"jquery.min.js","version":"2.1.1-rc1","hash":"d246298c351558d4847d237bb2d052f22001ca24ea4a32c28de378c95af523c8"},{"filename":"jquery.js","version":"2.1.1-beta1","hash":"e96b9e8d7a12b381d2ed1efd785faef3c7bad0ea03edf42fb15c9fde533e761f"},{"filename":"jquery.min.js","version":"2.1.1-beta1","hash":"5aed44447956d7933861d56003dbd0f95504d79e19d094edacbe4a55e6cf8736"},{"filename":"jquery.js","version":"2.1.1","hash":"140ff438eaaede046f1ceba27579d16dc980595709391873fa9bf74d7dbe53ac"},{"filename":"jquery.min.js","version":"2.1.1","hash":"c0d4098bc8b34c6f87a3d7723988ae81214a53a0bb4a1d4d36a67640f98ed079"},{"filename":"jquery.js","version":"2.1.0-rc1","hash":"88d96de8ccf65e57a3f28134616e3abfe0af2b3712302beb0a73f77f6b873fd0"},{"filename":"jquery.min.js","version":"2.1.0-rc1","hash":"11f94218bacdd4dbdc5c1736ca7aa1f27bb9632bc0a1696175b408da8dcf16b3"},{"filename":"jquery.js","version":"2.1.0-beta3","hash":"8eb83f00967dd0e18877b71349f5a3641b1046a1667c54e602a5682ac0f07ab9"},{"filename":"jquery.min.js","version":"2.1.0-beta3","hash":"7ebd0c0a5a088da45a5ec48f4379dbe457129f2cbe434f2e045ef838136746a9"},{"filename":"jquery.js","version":"2.1.0-beta2","hash":"97efd5af482f4e74c37c04970421fdbd17388fd605d992a2aa0077d388b32b6d"},{"filename":"jquery.min.js","version":"2.1.0-beta2","hash":"22966516a31e64225df5e08e35f0fadb27d29a8fb2618ddca17ec171215fc323"},{"filename":"jquery.js","version":"2.1.0","hash":"0fa7752926a95e3ab6b5f67a21ef40628ce4447c81ddf4f6cacf663b6fb85af7"},{"filename":"jquery.min.js","version":"2.1.0","hash":"f284353a7cc4d97f6fe20a5155131bd43587a0f1c98a56eeaf52cff72910f47d"},{"filename":"jquery.js","version":"2.0.3","hash":"9427fe2df51f7d4c6bf35f96d19169714d0b432b99dc18f41760d0342c538122"},{"filename":"jquery.min.js","version":"2.0.3","hash":"a57b5242b9a9adc4c1ef846c365147b89c472b9cd770face331efcb965346b25"},{"filename":"jquery.js","version":"2.0.2","hash":"d2ed0720108a75db0d53248ba8e36332658064c4189714d16c0f117efb42016d"},{"filename":"jquery.min.js","version":"2.0.2","hash":"9d7d1c727e1cd32745764098a76e5d3d5fb7acd3b6527c5aacd85b7c6f8ce341"},{"filename":"jquery.js","version":"2.0.1","hash":"820fb338fe8c7478a1b820e2708b4fd306a68825de1194803e7a93fbc2177a16"},{"filename":"jquery.min.js","version":"2.0.1","hash":"4e1354fc542b617c58cbba3aeb5116a528cf08bb1299f5dc7f3bc77a3b902b68"},{"filename":"jquery.js","version":"2.0.0","hash":"896e379d334cf0b16c78d9962a1579147156d4a72355032fce0de5f673d4e287"},{"filename":"jquery.min.js","version":"2.0.0","hash":"d482871a5e948cb4884fa0972ea98a81abca057b6bd3f8c995a18c12487e761c"},{"filename":"jquery.js","version":"1.12.4","hash":"430f36f9b5f21aae8cc9dca6a81c4d3d84da5175eaedcf2fdc2c226302cb3575"},{"filename":"jquery.min.js","version":"1.12.4","hash":"668b046d12db350ccba6728890476b3efee53b2f42dbb84743e5e9f1ae0cc404"},{"filename":"jquery.js","version":"1.12.3","hash":"d5732912d03878a5cd3695dc275a6630fb3c255fa7c0b744ab08897824049327"},{"filename":"jquery.min.js","version":"1.12.3","hash":"69a3831c082fc105b56c53865cc797fa90b83d920fb2f9f6875b00ad83a18174"},{"filename":"jquery.slim.js","version":"1.12.3","hash":"4db510700e5773fc7065f36363affd4885c9d9ef257fd7757744f91ac9da5671"},{"filename":"jquery.slim.min.js","version":"1.12.3","hash":"4c369c555423651822c2f7772d5e0b9a56a2372a92657bd2a696fe539b24be9e"},{"filename":"jquery.js","version":"1.12.2","hash":"5540b2af46570795610626e8d8391356176ca639b1520c4319a2d0c7ba9bef16"},{"filename":"jquery.min.js","version":"1.12.2","hash":"95914789b5f3307a3718679e867d61b9d4c03f749cd2e2970570331d7d6c8ed9"},{"filename":"jquery.slim.js","version":"1.12.2","hash":"4db510700e5773fc7065f36363affd4885c9d9ef257fd7757744f91ac9da5671"},{"filename":"jquery.slim.min.js","version":"1.12.2","hash":"4c369c555423651822c2f7772d5e0b9a56a2372a92657bd2a696fe539b24be9e"},{"filename":"jquery.js","version":"1.12.1","hash":"56e843a66b2bf7188ac2f4c81df61608843ce144bd5aa66c2df4783fba85e8ef"},{"filename":"jquery.min.js","version":"1.12.1","hash":"2359d383bf2d4ab65ebf7923bdf74ce40e4093f6e58251b395a64034b3c39772"},{"filename":"jquery.slim.js","version":"1.12.1","hash":"4db510700e5773fc7065f36363affd4885c9d9ef257fd7757744f91ac9da5671"},{"filename":"jquery.slim.min.js","version":"1.12.1","hash":"4c369c555423651822c2f7772d5e0b9a56a2372a92657bd2a696fe539b24be9e"},{"filename":"jquery.js","version":"1.12.0","hash":"c85537acad72f0d7d409dfc1e2d2daa59032f71d29642a8b64b9852f70166fbb"},{"filename":"jquery.min.js","version":"1.12.0","hash":"5f1ab65fe2ad6b381a1ae036716475bf78c9b2e309528cf22170c1ddeefddcbf"},{"filename":"jquery.js","version":"1.11.3","hash":"2065aecca0fb9b0567358d352ed5f1ab72fce139bf449b4d09805f5d9c3725ed"},{"filename":"jquery.min.js","version":"1.11.3","hash":"aec3d419d50f05781a96f223e18289aeb52598b5db39be82a7b71dc67d6a7947"},{"filename":"jquery.js","version":"1.11.2","hash":"58c27035b7a2e589df397e5d7e05424b90b8c1aaaf73eff47d5ed6daecb70f25"},{"filename":"jquery.min.js","version":"1.11.2","hash":"d4ec583c7604001f87233d1fe0076cbd909f15a5f8c6b4c3f5dd81b462d79d32"},{"filename":"jquery.js","version":"1.11.1-rc2","hash":"648dbce0f3731ebce091c283b52f60b100d73807501eea1a99f7b23140bfcefa"},{"filename":"jquery.min.js","version":"1.11.1-rc2","hash":"06d766022172da3774651a3ccfeef893185f9ba46823bcbfcba744ab5e25a4bf"},{"filename":"jquery.js","version":"1.11.1-rc1","hash":"8241d4982de8a6fea3e0ebc47e99445337675a777054c09221f670adb3748995"},{"filename":"jquery.min.js","version":"1.11.1-rc1","hash":"a581c274adebdbc44022e45d9febf0b92c572481c58bfe562b3d74d5e8972c5a"},{"filename":"jquery.js","version":"1.11.1-beta1","hash":"0aab28e2fd1f61b6282132553325bd890fef40989b698311c5b00b7b38a1e19d"},{"filename":"jquery.min.js","version":"1.11.1-beta1","hash":"99ec4d1ab56cf49ee4c202cc41509ada5eeb334694815f75675792433828a527"},{"filename":"jquery.js","version":"1.11.1","hash":"3029834a820c79c154c377f52e2719fc3ff2a27600a07ae089ea7fde9087f6bc"},{"filename":"jquery.min.js","version":"1.11.1","hash":"540bc6dec1dd4b92ea4d3fb903f69eabf6d919afd48f4e312b163c28cff0f441"},{"filename":"jquery.js","version":"1.11.0-rc1","hash":"84792d2b1ab8a2d57dcc113abb910b4c31dda357a7acd3b46ed282dd03f15d25"},{"filename":"jquery.min.js","version":"1.11.0-rc1","hash":"5f58804382f5258bb6b187c1b5af1ec0b8ccbe2c904a5163580371352ca63424"},{"filename":"jquery.js","version":"1.11.0-beta3","hash":"847a61382a55d0c0e5244d0621f1e0674292dee6b850640c669fd1516ec9f4f5"},{"filename":"jquery.min.js","version":"1.11.0-beta3","hash":"51fc79c1828a885f3776e35d56a22895e3656d014b502b869bd05f891bd91602"},{"filename":"jquery.js","version":"1.11.0","hash":"ce0343e1d6f489768eeefe022c12181c6a0822e756239851310acf076d23d10c"},{"filename":"jquery.min.js","version":"1.11.0","hash":"b294e973896f8f874e90a8eb1a8908ac790980d034c4c4bdf0fc3d37b8abf682"},{"filename":"jquery.js","version":"1.10.2","hash":"8ade6740a1d3cfedf81e28d9250929341207b23a55f1be90ccc26cf6d98e052a"},{"filename":"jquery.min.js","version":"1.10.2","hash":"89a15e9c40bc6b14809f236ee8cd3ed1ea42393c1f6ca55c7855cd779b3f922e"},{"filename":"jquery.js","version":"1.10.1","hash":"ebaded49db62a60060caa2577f2a4ec1ff68726bc40861bc65d977abeb64fa7d"},{"filename":"jquery.min.js","version":"1.10.1","hash":"8bf150f6b29d6c9337de6c945a8f63c929b203442040688878bc2753fe13e007"},{"filename":"jquery.js","version":"1.10.0","hash":"8aa0f84b5331efcc3cb72c7d504c2bc6ebd861da003d72c33df99ce650d4531d"},{"filename":"jquery.min.js","version":"1.10.0","hash":"1e80de36726582824df3f9a7eb6ecdfe9827fc5a7c69f597b1502ebc13950ecd"},{"filename":"jquery.js","version":"1.9.1","hash":"7bd80d06c01c0340c1b9159b9b4a197db882ca18cbac8e9b9aa025e68f998d40"},{"filename":"jquery.min.js","version":"1.9.1","hash":"c12f6098e641aaca96c60215800f18f5671039aecf812217fab3c0d152f6adb4"},{"filename":"jquery.js","version":"1.9.0","hash":"4d7b01c2f6043bcee83a33d0f627dc6fbc27dc8aeb5bdd5d863e84304b512ef3"},{"filename":"jquery.min.js","version":"1.9.0","hash":"7fa0d5c3f538c76f878e012ac390597faecaabfe6fb9d459b919258e76c5df8e"},{"filename":"jquery.js","version":"1.8.3","hash":"756d7dfac4a35bb57543f677283d6c682e8d704e5350884b27325badd2b3c4a7"},{"filename":"jquery.min.js","version":"1.8.3","hash":"61c6caebd23921741fb5ffe6603f16634fca9840c2bf56ac8201e9264d6daccf"},{"filename":"jquery.js","version":"1.8.2","hash":"ba8f203a9ebbe5771f49bcbe0804079240c7225f4be6ab424769bfbfb35ebc35"},{"filename":"jquery.min.js","version":"1.8.2","hash":"f23d4b309b72743aa8afe1f8c98a25b3ee31246fa572c66d9d8cb1982cae4fbc"},{"filename":"jquery.js","version":"1.8.1","hash":"7614fc75c4fcf6f32f7307f37550440e12adefb9289226acb79020c66faeffea"},{"filename":"jquery.min.js","version":"1.8.1","hash":"a1305347219d673cc973172494248e557ce8eccaf65af995c07c9d7daed4475d"},{"filename":"jquery-1.8.0.js","version":"1.8.0","hash":"04ee795a1a5a908ee339e145ae6c6b394d1dc0d971fd0896e3cb776660adba2e"},{"filename":"jquery-1.8.0.min.js","version":"1.8.0","hash":"d73e2e1bff9c55b85284ff287cb20dc29ad9165ec09091a0597b61199f330805"},{"filename":"jquery.js","version":"1.8.0","hash":"04ee795a1a5a908ee339e145ae6c6b394d1dc0d971fd0896e3cb776660adba2e"},{"filename":"jquery.min.js","version":"1.8.0","hash":"d73e2e1bff9c55b85284ff287cb20dc29ad9165ec09091a0597b61199f330805"},{"filename":"jquery.min.js","version":"1.7.2","hash":"47b68dce8cb6805ad5b3ea4d27af92a241f4e29a5c12a274c852e4346a0500b4"},{"filename":"jquery.min.js","version":"1.7.1","hash":"88171413fc76dda23ab32baa17b11e4fff89141c633ece737852445f1ba6c1bd"},{"filename":"jquery.min.js","version":"1.7","hash":"ff4e4975ef403004f8fe8e59008db7ad47f54b10d84c72eb90e728d1ec9157ce"},{"filename":"jquery.js","version":"1.6.4","hash":"54964f8b580ad795a962fb27066715d3281ae1ad13a28bf8aedd5d8859ebae37"},{"filename":"jquery.min.js","version":"1.6.4","hash":"951d6bae39eb172f57a88bd686f7a921cf060fd21f59648f0d20b6a8f98fc5a5"},{"filename":"jquery.js","version":"1.6.3","hash":"9baa10e1c5630c3dcd9bb46bf00913cc94b3855d58c9459ae9848339c566e97b"},{"filename":"jquery.min.js","version":"1.6.3","hash":"d3f3779f5113da6da957c4d81481146a272c31aefe0d3e4b64414fd686fd9744"},{"filename":"jquery.js","version":"1.6.2","hash":"a57292619d14eb8cbd923bde9f28cf994ac66abc48f7c975b769328ff33bddc9"},{"filename":"jquery.min.js","version":"1.6.2","hash":"fefb084f14120d777c7857ba78603e8531a0778b2e639df7622513c70567afa0"},{"filename":"jquery.js","version":"1.6.1","hash":"0eef76a9583a6c7a1eb764d33fe376bfe1861df79fab82c2c3f5d16183e82016"},{"filename":"jquery.min.js","version":"1.6.1","hash":"c784376960f3163dc760bc019e72e5fed78203745a5510c69992a39d1d8fe776"},{"filename":"jquery.js","version":"1.5.1","hash":"e2ea0a6ca6b984a9405a759d24cf3c51eb3164e5c43e95c3e9a59b316be7b3b9"},{"filename":"jquery.min.js","version":"1.5.1","hash":"764b9e9f3ad386aaa5cdeae9368353994de61c0bede087c8f7e3579cb443de3b"},{"filename":"jquery.js","version":"1.4.4","hash":"b31cd094af7950b3a461dc78161fd2faf01faa9d0ed8c1c072790f83ab26d482"},{"filename":"jquery.min.js","version":"1.4.4","hash":"517364f2d45162fb5037437b5b6cb953d00d9b2b3b79ba87d9fe57ea6ee6070c"},{"filename":"jquery.js","version":"1.4.3","hash":"0e3303a3a0cec95ebc8c3cc3e19fc71c99487faa286b05d01a3eb8cca4d90bc7"},{"filename":"jquery.min.js","version":"1.4.3","hash":"f800b399e5c7a5254fc66bb407117fe38dbde0528780e68c9f7c87d299f8486a"},{"filename":"jquery.js","version":"1.4.2","hash":"95c023c80dfe0d30304c58244878995061f87801a66daa5d6bf4f2512be0e6f9"},{"filename":"jquery.min.js","version":"1.4.2","hash":"e23a2a4e2d7c2b41ebcdd8ffc0679df7140eb7f52e1eebabf827a88182643c59"},{"filename":"jquery.js","version":"1.4.1","hash":"9edc9f813781eca2aad6de78ef85cdbe92ee32bb0a56791be4da0fa7b472c1d8"},{"filename":"jquery.min.js","version":"1.4.1","hash":"2cec78f739fbddfed852cd7934d2530e7cc4c8f14b38673b03ba5fb880ad4cc7"},{"filename":"jquery.js","version":"1.4.0","hash":"882927b9aadb2504b5c6a823bd8c8c516f21dec6e441fe2c8fa228e35951bcc8"},{"filename":"jquery.min.js","version":"1.4.0","hash":"89abaf1e2471b00525b0694048e179c0f39a2674e3bcb34460ea6bc4801882be"},{"filename":"jquery.js","version":"1.3.2","hash":"74537639fa585509395c0d3b9a5601dd1e4ca036961c53dc5ab0e87386aa9be1"},{"filename":"jquery.min.js","version":"1.3.2","hash":"c8370a2d050359e9d505acc411e6f457a49b21360a21e6cbc9229bad3a767899"},{"filename":"jquery.js","version":"1.3.1","hash":"0ae058559b3e65d6cc5674fe3ff01581da5ae62387bb0dfa2923997a52093a06"},{"filename":"jquery.min.js","version":"1.3.1","hash":"17ec1f16efac893b9bd89bba5f13cb1e0bf938bdc9cece6cae3ed77f18fa6fd7"},{"filename":"jquery.js","version":"1.3.0","hash":"a7756f21ff6c558f983d5376072174af546e8d07f8bebe1e6f760b2f4b53012d"},{"filename":"jquery.min.js","version":"1.3.0","hash":"900191a443115d8b48a9d68d3062e8b3d7129727951b8617465b485baf253006"},{"filename":"jquery.js","version":"1.2.6","hash":"3cc5c121471323b25de45fcab48631d4a09c78e76af21c10d747352682605587"},{"filename":"jquery.min.js","version":"1.2.6","hash":"d548530775a6286f49ba66e0715876b4ec5985966b0291c21568fecfc4178e8d"},{"filename":"jquery.js","version":"1.2.3","hash":"d977fc32dd4bdb0479604abf078f1045b0e922666313f2f42cd71ce7835e0061"},{"filename":"jquery.min.js","version":"1.2.3","hash":"f1c4a0a7b5dead231fc9b42f06965a036ab7a2a788768847eb81e1528d6402ad"}]} }; },{}],9:[function(require,module,exports){ /** * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript. * * * Copyright (C) 2018 Nathan Nichols * * This file is part of GNU LibreJS. * * GNU LibreJS is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * GNU LibreJS is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU LibreJS. If not, see . */ var data = require("./license_definitions.js"); var match_utils = require("./pattern_utils.js").patternUtils; var licStartLicEndRe = /@licstartThefollowingistheentirelicensenoticefortheJavaScriptcodeinthis(?:page|file)(.*)?@licendTheaboveistheentirelicensenoticefortheJavaScriptcodeinthis(?:page|file)/mi; /** * stripLicenseToRegexp * * Removes all non-alphanumeric characters except for the * special tokens, and replace the text values that are * hardcoded in license_definitions.js * */ var stripLicenseToRegexp = function (license) { var max = license.licenseFragments.length; var item; for (var i = 0; i < max; i++) { item = license.licenseFragments[i]; item.regex = match_utils.removeNonalpha(item.text); item.regex = new RegExp( match_utils.replaceTokens(item.regex), ''); } return license; }; var license_regexes = []; var init = function(){ console.log("initializing regexes"); for (var item in data.licenses) { license_regexes.push(stripLicenseToRegexp(data.licenses[item])); } //console.log(license_regexes); } module.exports.init = init; /** * * Takes in the declaration that has been preprocessed and * tests it against regexes in our table. */ var search_table = function(stripped_comment){ var stripped = match_utils.removeNonalpha(stripped_comment); //stripped = stripped.replaceTokens(stripped_comment); //console.log("Looking up license"); //console.log(stripped); for (license in data.licenses) { frag = data.licenses[license].licenseFragments; max_i = data.licenses[license].licenseFragments.length; for (i = 0; i < max_i; i++) { if (frag[i].regex.test(stripped)) { //console.log(data.licenses[license].licenseName); return data.licenses[license].licenseName; } } } console.log("No global license found."); return false; } /** * Takes the "first comment available on the page" * returns true for "free" and false for anything else */ var check = function(license_text){ //console.log("checking..."); //console.log(license_text); if(license_text === undefined || license_text === null || license_text == ""){ //console.log("Was not an inline script"); return false; } // remove whitespace var stripped = match_utils.removeWhitespace(license_text); // Search for @licstart/@licend // This assumes that there isn't anything before the comment var matches = stripped.match(licStartLicEndRe); if(matches == null){ return false; } var declaration = matches[0]; return search_table(declaration); }; module.exports.check = check; },{"./license_definitions.js":10,"./pattern_utils.js":17}],10:[function(require,module,exports){ /** * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript. * * * Copyright (C) 2011, 2012, 2013, 2014 Loic J. Duros * Copyright (C) 2014, 2015 Nik Nyby * * This file is part of GNU LibreJS. * * GNU LibreJS is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * GNU LibreJS is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU LibreJS. If not, see . */ exports.types = { SHORT: 'short', LAZY: 'lazy', FULL: 'full' }; var type = exports.types; /** * List of all the licenses. * Currently only short substrings are used with regex. * * The licenses are indexed by their "Identifier", which, when possible, * corresponds to their identifier as specified by SPDX here: * https://spdx.org/licenses/ */ exports.licenses = { 'CC0-1.0': { licenseName: 'Creative Commons CC0 1.0 Universal', identifier: 'CC0-1.0', canonicalUrl: [ 'http://creativecommons.org/publicdomain/zero/1.0/legalcode', 'magnet:?xt=urn:btih:90dc5c0be029de84e523b9b3922520e79e0e6f08&dn=cc0.txt' ], licenseFragments: [] }, 'GPL-2.0': { licenseName: 'GNU General Public License (GPL) version 2', identifier: 'GPL-2.0', canonicalUrl: [ 'http://www.gnu.org/licenses/gpl-2.0.html', 'magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt' ], licenseFragments: [{text: " is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.", type: type.SHORT}, {text:"Alternatively, the contents of this file may be used under the terms of either the GNU General Public License Version 2 or later (the \"GPL\"), or the GNU Lesser General Public License Version 2.1 or later (the \"LGPL\"), in which case the provisions of the GPL or the LGPL are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of either the GPL or the LGPL, and not to allow others to use your version of this file under the terms of the MPL, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by the GPL or the LGPL. If you do not delete the provisions above, a recipient may use your version of this file under the terms of any one of the MPL, the GPL or the LGPL.", type: type.SHORT}] }, 'GPL-3.0': { licenseName: 'GNU General Public License (GPL) version 3', identifier: 'GPL-3.0', canonicalUrl: [ 'http://www.gnu.org/licenses/gpl-3.0.html', 'magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt' ], licenseFragments: [ {text: " is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License (GNU GPL) as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. The code is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. As additional permission under GNU GPL version 3 section 7, you may distribute non-source (e.g., minimized or compacted) forms of that code without the copy of the GNU GPL normally required by section 4, provided you include this license notice and a URL through which recipients can access the Corresponding Source.", type: type.SHORT}, {text: " is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.", type: type.SHORT}] }, 'GNU-All-Permissive': { licenseName: 'GNU All-Permissive License', licenseFragments: [{text: "Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty.", type: type.SHORT}] }, 'Apache-2.0': { licenseName: 'Apache License, Version 2.0', identifier: 'Apache-2.0', canonicalUrl: [ 'http://www.apache.org/licenses/LICENSE-2.0', 'magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7&dn=apache-2.0.txt' ], licenseFragments: [{text: "Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0", type: type.SHORT}] }, 'LGPL-2.1': { licenseName: 'GNU Lesser General Public License, version 2.1', identifier: 'LGPL-2.1', canonicalUrl: [ 'http://www.gnu.org/licenses/lgpl-2.1.html', 'magnet:?xt=urn:btih:5de60da917303dbfad4f93fb1b985ced5a89eac2&dn=lgpl-2.1.txt' ], licenseFragments: [{text: " is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.", type: type.SHORT}] }, 'LGPL-3.0': { licenseName: 'GNU Lesser General Public License, version 3', identifier: 'LGPL-3.0', canonicalUrl: [ 'http://www.gnu.org/licenses/lgpl-3.0.html', 'magnet:?xt=urn:btih:0ef1b8170b3b615170ff270def6427c317705f85&dn=lgpl-3.0.txt' ], licenseFragments: [{text: " is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.", type: type.SHORT}] }, 'AGPL-3.0': { licenseName: 'GNU AFFERO GENERAL PUBLIC LICENSE version 3', identifier: 'AGPL-3.0', canonicalUrl: [ 'http://www.gnu.org/licenses/agpl-3.0.html', 'magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt' ], licenseFragments: [{text: " is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.", type: type.SHORT}] }, 'BSL-1.0': { licenseName: 'Boost Software License 1.0', identifier: 'BSL-1.0', canonicalUrl: [ 'http://www.boost.org/LICENSE_1_0.txt', 'magnet:?xt=urn:btih:89a97c535628232f2f3888c2b7b8ffd4c078cec0&dn=Boost-1.0.txt' ], licenseFragments: [{text: "Boost Software License Permission is hereby granted, free of charge, to any person or organization obtaining a copy of the software and accompanying documentation covered by this license (the \"Software\") to use, reproduce, display, distribute, execute, and transmit the Software, and to prepare derivative works of the Software, and to permit third-parties to whom the Software is furnished to do so, all subject to the following", type: type.SHORT}] }, 'BSD-3-Clause': { licenseName: "BSD 3-Clause License", identifier: 'BSD-3-Clause', canonicalUrl: [ 'http://opensource.org/licenses/BSD-3-Clause', 'magnet:?xt=urn:btih:c80d50af7d3db9be66a4d0a86db0286e4fd33292&dn=bsd-3-clause.txt' ], licenseFragments: [{text: "Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.", type: type.SHORT}] }, 'BSD-2-Clause': { licenseName: "BSD 2-Clause License", identifier: 'BSD-2-Clause', licenseFragments: [{text: "Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.", type: type.SHORT}] }, 'EPL-1.0': { licenseName: "Eclipse Public License Version 1.0", identifier: "EPL-1.0", canonicalUrl: [ "http://www.eclipse.org/legal/epl-v10.html", "magnet:?xt=urn:btih:4c6a2ad0018cd461e9b0fc44e1b340d2c1828b22&dn=epl-1.0.txt" ], licenseFragments: [ { text: "THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (\"AGREEMENT\"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.", type: type.SHORT } ] }, 'MPL-2.0': { licenseName: 'Mozilla Public License Version 2.0', identifier: 'MPL-2.0', canonicalUrl: [ 'http://www.mozilla.org/MPL/2.0', 'magnet:?xt=urn:btih:3877d6d54b3accd4bc32f8a48bf32ebc0901502a&dn=mpl-2.0.txt' ], licenseFragments: [{text: "This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.", type: type.SHORT }] }, 'Expat': { licenseName: 'Expat License (sometimes called MIT Licensed)', identifier: 'Expat', canonicalUrl: [ 'http://www.jclark.com/xml/copying.txt', 'magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt' ], licenseFragments: [{text: "Copyright Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.", type: type.SHORT}] }, 'UPL': { licenseName: 'Universal Permissive License', identifier: 'UPL-1.0', canonicalUrl: [ 'magnet:?xt=urn:btih:5305d91886084f776adcf57509a648432709a7c7&dn=x11.txt' ], licenseFragments: [{ text: "The Universal Permissive License (UPL), Version 1.0", type: type.SHORT }] }, 'X11': { licenseName: 'X11 License', identifier: 'X11', canonicalUrl: [ 'magnet:?xt=urn:btih:5305d91886084f776adcf57509a648432709a7c7&dn=x11.txt' ], licenseFragments: [{text: "Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.", type: type.SHORT}] }, 'XFree86-1.1': { licenseName: "XFree86 1.1 License", identifier: 'XFree86-1.1', canonicalUrl: [ 'http://www.xfree86.org/3.3.6/COPYRIGHT2.html#3', 'http://www.xfree86.org/current/LICENSE4.html', 'magnet:?xt=urn:btih:12f2ec9e8de2a3b0002a33d518d6010cc8ab2ae9&dn=xfree86.txt' ], licenseFragments: [{text: "All rights reserved.\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n1. Redistributions of source code must retain the above copyright notice, this list of conditions, and the following disclaimer.\n2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution, and in the same place and form as other copyright, license and disclaimer information.\n3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: \"This product includes software developed by The XFree86 Project, Inc (http://www.xfree86.org/) and its contributors\", in the same place and form as other third-party acknowledgments. Alternately, this acknowledgment may appear in the software itself, in the same form and location as other such third-party acknowledgments.4. Except as contained in this notice, the name of The XFree86 Project, Inc shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The XFree86 Project, Inc.", type: type.SHORT} ] }, 'FreeBSD': { licenseName: "FreeBSD License", identifier: 'FreeBSD', canonicalUrl: [ 'http://www.freebsd.org/copyright/freebsd-license.html', 'magnet:?xt=urn:btih:87f119ba0b429ba17a44b4bffcab33165ebdacc0&dn=freebsd.txt' ], licenseFragments: [{text: "Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\nRedistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n\nRedistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.", type: type.SHORT}] }, 'ISC': { licenseName: "The ISC License", identifier: 'ISC', canonicalUrl: [ 'https://www.isc.org/downloads/software-support-policy/isc-license/', 'magnet:?xt=urn:btih:b8999bbaf509c08d127678643c515b9ab0836bae&dn=ISC.txt' ], licenseFragments: [{text: "Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.", type: type.SHORT}, {text: "Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.", type: type.SHORT}] }, 'jQueryTools': { licenseName: "jQuery Tools", licenseFragments: [{ text: 'NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.', type: type.SHORT }] }, 'Artistic-2.0': { licenseName: "Artistic License 2.0", identifier: 'Artistic-2.0', canonicalUrl: [ "http://www.perlfoundation.org/artistic_license_2_0", "magnet:?xt=urn:btih:54fd2283f9dbdf29466d2df1a98bf8f65cafe314&dn=artistic-2.0.txt" ], licenseFragments: [] }, 'PublicDomain': { licenseName: "Public Domain", canonicalUrl: [ 'magnet:?xt=urn:btih:e95b018ef3580986a04669f1b5879592219e2a7a&dn=public-domain.txt' ], licenseFragments: [] }, 'CPAL-1.0': { licenseName: 'Common Public Attribution License Version 1.0 (CPAL)', identifier: 'CPAL-1.0', canonicalUrl: [ 'http://opensource.org/licenses/cpal_1.0', 'magnet:?xt=urn:btih:84143bc45939fc8fa42921d619a95462c2031c5c&dn=cpal-1.0.txt' ], licenseFragments: [ { text: 'The contents of this file are subject to the Common Public Attribution License Version 1.0', type: type.SHORT }, { text: 'The term "External Deployment" means the use, distribution, or communication of the Original Code or Modifications in any way such that the Original Code or Modifications may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Code or Modifications as a distribution under section 3.1 and make Source Code available under Section 3.2.', type: type.SHORT } ] }, 'WTFPL': { licenseName: 'Do What The F*ck You Want To Public License (WTFPL)', identifier: 'WTFPL', canonicalUrl: [ 'http://www.wtfpl.net/txt/copying/', 'magnet:?xt=urn:btih:723febf9f6185544f57f0660a41489c7d6b4931b&dn=wtfpl.txt' ], licenseFragments: [ { text: 'DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE', type: type.SHORT }, { text: '0. You just DO WHAT THE FUCK YOU WANT TO.', type: type.SHORT } ] }, 'Unlicense': { licenseName: 'Unlicense', identifier: 'Unlicense', canonicalUrl: [ 'http://unlicense.org/UNLICENSE', 'magnet:?xt=urn:btih:5ac446d35272cc2e4e85e4325b146d0b7ca8f50c&dn=unlicense.txt' ], licenseFragments: [ { text: 'This is free and unencumbered software released into the public domain.', type: type.SHORT }, ] } }; },{}],11:[function(require,module,exports){ module.exports=module.exports = { licenses: { 'Apache-2.0':{ 'Name': 'Apache 2.0', 'URL': 'http://www.apache.org/licenses/LICENSE-2.0', 'Magnet link': 'magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7&dn=apache-2.0.txt' }, 'Artistic-2.0':{ 'Name': 'Artistic 2.0', 'URL': 'http://www.perlfoundation.org/artistic_license_2_0', 'Magnet link': 'magnet:?xt=urn:btih:54fd2283f9dbdf29466d2df1a98bf8f65cafe314&dn=artistic-2.0.txt' }, 'Boost':{ 'Name': 'Boost', 'URL': 'http://www.boost.org/LICENSE_1_0.txt', 'Magnet link': 'magnet:?xt=urn:btih:89a97c535628232f2f3888c2b7b8ffd4c078cec0&dn=Boost-1.0.txt' }, 'CPAL-1.0':{ 'Name': 'CPAL 1.0', 'URL': 'http://opensource.org/licenses/cpal_1.0', 'Magnet link': 'magnet:?xt=urn:btih:84143bc45939fc8fa42921d619a95462c2031c5c&dn=cpal-1.0.txt' }, 'CC0-1.0':{ 'Name': 'CC0 1.0', 'URL': 'http://creativecommons.org/publicdomain/zero/1.0/legalcode', 'Magnet link': 'magnet:?xt=urn:btih:90dc5c0be029de84e523b9b3922520e79e0e6f08&dn=cc0.txt' }, 'CC-BY-SA-1.0':{ 'Name': 'CC-BY-SA 1.0', 'URL': 'https://creativecommons.org/licenses/by-sa/1.0/', 'Magnet link': '' }, 'CC-BY-SA-2.0':{ 'Name': 'CC-BY-SA 2.0', 'URL': 'https://creativecommons.org/licenses/by-sa/2.0/', 'Magnet link': '' }, 'CC-BY-SA-2.5':{ 'Name': 'CC-BY-SA 2.5', 'URL': 'https://creativecommons.org/licenses/by-sa/2.5/', 'Magnet link': '' }, 'CC-BY-SA-3.0':{ 'Name': 'CC-BY-SA 3.0', 'URL': 'https://creativecommons.org/licenses/by-sa/3.0/', 'Magnet link': '' }, 'CC-BY-SA-4.0':{ 'Name': 'CC-BY-SA 4.0', 'URL': 'https://creativecommons.org/licenses/by-sa/4.0/', 'Magnet link': '' }, 'CC-BY-1.0':{ 'Name': 'CC-BY 1.0', 'URL': 'https://creativecommons.org/licenses/by/1.0/', 'Magnet link': '' }, 'CC-BY-2.0':{ 'Name': 'CC-BY 2.0', 'URL': 'https://creativecommons.org/licenses/by/2.0/', 'Magnet link': '' }, 'CC-BY-2.5':{ 'Name': 'CC-BY 2.5', 'URL': 'https://creativecommons.org/licenses/by/2.5/', 'Magnet link': '' }, 'CC-BY-3.0':{ 'Name': 'CC-BY 3.0', 'URL': 'https://creativecommons.org/licenses/by/3.0/', 'Magnet link': '' }, 'CC-BY-4.0':{ 'Name': 'CC-BY 4.0', 'URL': 'https://creativecommons.org/licenses/by/4.0/', 'Magnet link': '' }, 'EPL-1.0':{ 'Name': 'EPL 1.0', 'URL': 'http://www.eclipse.org/legal/epl-v10.html', 'Magnet link': 'magnet:?xt=urn:btih:4c6a2ad0018cd461e9b0fc44e1b340d2c1828b22&dn=epl-1.0.txt' }, 'Expat':{ 'Name': 'Expat', 'URL': 'http://www.jclark.com/xml/copying.txt', 'Magnet link': 'magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt' }, 'MIT':{ 'Name': 'Expat', 'URL': 'http://www.jclark.com/xml/copying.txt', 'Magnet link': 'magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt' }, 'X11':{ 'Name': 'X11', 'URL': 'http://www.xfree86.org/3.3.6/COPYRIGHT2.html#3', 'Magnet link': 'magnet:?xt=urn:btih:5305d91886084f776adcf57509a648432709a7c7&dn=x11.txt' }, 'GPL-2.0':{ 'Name': 'GPL 2.0', 'URL': 'http://www.gnu.org/licenses/gpl-2.0.html', 'Magnet link': 'magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt' }, 'GPL-3.0':{ 'Name': 'GPL 3.0', 'URL': 'http://www.gnu.org/licenses/gpl-3.0.html', 'Magnet link': 'magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt' }, 'LGPL-2.1':{ 'Name': 'LGPL 2.1', 'URL': 'http://www.gnu.org/licenses/lgpl-2.1.html', 'Magnet link': 'magnet:?xt=urn:btih:5de60da917303dbfad4f93fb1b985ced5a89eac2&dn=lgpl-2.1.txt' }, 'LGPL-3.0':{ 'Name': 'LGPL 3.0', 'URL': 'http://www.gnu.org/licenses/lgpl-3.0.html', 'Magnet link': 'magnet:?xt=urn:btih:0ef1b8170b3b615170ff270def6427c317705f85&dn=lgpl-3.0.txt' }, 'AGPL-3.0':{ 'Name': 'AGPL 3.0', 'URL': 'http://www.gnu.org/licenses/agpl-3.0.html', 'Magnet link': 'magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt' }, 'GPL-2.0-only':{ 'Name': 'GPL 2.0', 'URL': 'http://www.gnu.org/licenses/gpl-2.0.html', 'Magnet link': '' }, 'GPL-3.0-only':{ 'Name': 'GPL 3.0', 'URL': 'http://www.gnu.org/licenses/gpl-3.0.html', 'Magnet link': '' }, 'LGPL-2.1-only':{ 'Name': 'LGPL 2.1', 'URL': 'http://www.gnu.org/licenses/lgpl-2.1.html', 'Magnet link': '' }, 'LGPL-3.0-only':{ 'Name': 'LGPL 3.0', 'URL': 'http://www.gnu.org/licenses/lgpl-3.0.html', 'Magnet link': '' }, 'AGPL-3.0-only':{ 'Name': 'AGPL 3.0', 'URL': 'http://www.gnu.org/licenses/agpl-3.0.html', 'Magnet link': '' }, 'GPL-2.0-or-later':{ 'Name': 'GPL 2.0 or later', 'URL': 'http://www.gnu.org/licenses/gpl-2.0.html', 'Magnet link': 'magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt' }, 'GPL-3.0-or-later':{ 'Name': 'GPL 3.0 or later', 'URL': 'http://www.gnu.org/licenses/gpl-3.0.html', 'Magnet link': 'magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt' }, 'LGPL-2.1-or-later':{ 'Name': 'LGPL 2.1 or later', 'URL': 'http://www.gnu.org/licenses/lgpl-2.1.html', 'Magnet link': 'magnet:?xt=urn:btih:5de60da917303dbfad4f93fb1b985ced5a89eac2&dn=lgpl-2.1.txt' }, 'LGPL-3.0-or-later':{ 'Name': 'LGPL 3.0 or later', 'URL': 'http://www.gnu.org/licenses/lgpl-3.0.html', 'Magnet link': 'magnet:?xt=urn:btih:0ef1b8170b3b615170ff270def6427c317705f85&dn=lgpl-3.0.txt' }, 'AGPL-3.0-or-later':{ 'Name': 'AGPL 3.0 or later', 'URL': 'http://www.gnu.org/licenses/agpl-3.0.html', 'Magnet link': 'magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt' }, 'ISC':{ 'Name': 'ISC', 'URL': 'https://www.isc.org/downloads/software-support-policy/isc-license/', 'Magnet link': 'magnet:?xt=urn:btih:b8999bbaf509c08d127678643c515b9ab0836bae&dn=ISC.txt' }, 'MPL-2.0':{ 'Name': 'MPL 2.0', 'URL': 'http://www.mozilla.org/MPL/2.0', 'Magnet link': 'magnet:?xt=urn:btih:3877d6d54b3accd4bc32f8a48bf32ebc0901502a&dn=mpl-2.0.txt' }, 'UPL-1.0': { 'Name': 'UPL 1.0', 'URL': 'https://oss.oracle.com/licenses/upl/', 'Magnet link': 'magnet:?xt=urn:btih:478974f4d41c3fa84c4befba25f283527fad107d&dn=upl-1.0.txt' }, 'WTFPL': { 'Name': 'WTFPL', 'URL': 'http://www.wtfpl.net/txt/copying/', 'Magnet link': 'magnet:?xt=urn:btih:723febf9f6185544f57f0660a41489c7d6b4931b&dn=wtfpl.txt' }, 'Unlicense':{ 'Name': 'Unlicense', 'URL': 'http://unlicense.org/UNLICENSE', 'Magnet link': 'magnet:?xt=urn:btih:5ac446d35272cc2e4e85e4325b146d0b7ca8f50c&dn=unlicense.txt' }, 'FreeBSD':{ 'Name': 'FreeBSD', 'URL': 'http://www.freebsd.org/copyright/freebsd-license.html', 'Magnet link': 'magnet:?xt=urn:btih:87f119ba0b429ba17a44b4bffcab33165ebdacc0&dn=freebsd.txt' }, 'BSD-2-Clause':{ 'Name': 'FreeBSD (BSD-2-Clause)', 'URL': 'http://www.freebsd.org/copyright/freebsd-license.html', 'Magnet link': '' }, 'BSD-3-Clause':{ 'Name': 'Modified BSD (BSD-3-Clause)', 'URL': 'http://opensource.org/licenses/BSD-3-Clause', 'Magnet link': 'magnet:?xt=urn:btih:c80d50af7d3db9be66a4d0a86db0286e4fd33292&dn=bsd-3-clause.txt' }, 'XFree86-1.1':{ 'Name': 'XFree86 1.1', 'URL': 'http://www.xfree86.org/current/LICENSE4.html', 'Magnet link': 'magnet:?xt=urn:btih:12f2ec9e8de2a3b0002a33d518d6010cc8ab2ae9&dn=xfree86.txt' } } }; },{}],12:[function(require,module,exports){ /** * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript. * * * Copyright (C) 2017, 2018 Nathan Nichols * Copyright (C) 2018 Ruben Rodriguez * * This file is part of GNU LibreJS. * * GNU LibreJS is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * GNU LibreJS is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU LibreJS. If not, see . */ var acorn = require('acorn'); var acornLoose = require('acorn-loose'); var legacy_license_lib = require("./legacy_license_check.js"); var {ResponseProcessor} = require("./bg/ResponseProcessor"); var {Storage, ListStore, hash} = require("./common/Storage"); var {ListManager} = require("./bg/ListManager"); var {ExternalLicenses} = require("./bg/ExternalLicenses"); console.log("main_background.js"); /** * If this is true, it evaluates entire scripts instead of returning as soon as it encounters a violation. * * Also, it controls whether or not this part of the code logs to the console. * */ var DEBUG = false; // debug the JS evaluation var PRINT_DEBUG = false; // Everything else var time = Date.now(); function dbg_print(a,b){ if(PRINT_DEBUG == true){ console.log("Time spent so far: " + (Date.now() - time)/1000 + " seconds"); if(b === undefined){ console.log(a); } else{ console.log(a,b); } } } /* NONTRIVIAL THINGS: - Fetch - XMLhttpRequest - eval() - ? JAVASCRIPT CAN BE FOUND IN: - Event handlers (onclick, onload, onsubmit, etc.) - - WAYS TO DETERMINE PASS/FAIL: - "// @license [magnet link] [identifier]" then "// @license-end" (may also use /* comments) - Automatic whitelist: (http://bzr.savannah.gnu.org/lh/librejs/dev/annotate/head:/data/script_libraries/script-libraries.json_ */ var licenses = require("./licenses.json").licenses; // These are objects that it will search for in an initial regex pass over non-free scripts. var reserved_objects = [ //"document", //"window", "fetch", "XMLHttpRequest", "chrome", // only on chrome "browser", // only on firefox "eval" ]; // Generates JSON key for local storage function get_storage_key(script_name,src_hash){ return script_name; } /* * * Called when something changes the persistent data of the add-on. * * The only things that should need to change this data are: * a) The "Whitelist this page" button * b) The options screen * * When the actual blocking is implemented, this will need to comminicate * with its code to update accordingly * */ function options_listener(changes, area){ // The cache must be flushed when settings are changed // TODO: See if this can be minimized function flushed(){ dbg_print("cache flushed"); } //var flushingCache = browser.webRequest.handlerBehaviorChanged(flushed); dbg_print("Items updated in area" + area +": "); var changedItems = Object.keys(changes); var changed_items = ""; for (var i = 0; i < changedItems.length; i++){ var item = changedItems[i]; changed_items += item + ","; } dbg_print(changed_items); } var activeMessagePorts = {}; var activityReports = {}; async function createReport(initializer) { if (!(initializer && (initializer.url || initializer.tabId))) { throw new Error("createReport() needs an URL or a tabId at least"); } let template = { "accepted": [], "blocked": [], "blacklisted": [], "whitelisted": [], "unknown": [], }; template = Object.assign(template, initializer); let [url] = (template.url || (await browser.tabs.get(initializer.tabId)).url).split("#"); template.url = url; template.site = ListStore.siteItem(url); template.siteStatus = listManager.getStatus(template.site); let list = {"whitelisted": whitelist, "blacklisted": blacklist}[template.siteStatus]; if (list) { template.listedSite = ListManager.siteMatch(template.site, list); } return template; } /** * Executes the "Display this report in new tab" function * by opening a new tab with whatever HTML is in the popup * at the moment. */ async function openReportInTab(data) { let popupURL = await browser.browserAction.getPopup({}); let tab = await browser.tabs.create({url: `${popupURL}#fromTab=${data.tabId}`}); activityReports[tab.id] = await createReport(data); } /** * * Clears local storage (the persistent data) * */ function debug_delete_local(){ browser.storage.local.clear(); dbg_print("Local storage cleared"); } /** * * Prints local storage (the persistent data) as well as the temporary popup object * */ function debug_print_local(){ function storage_got(items){ console.log("%c Local storage: ", 'color: red;'); for(var i in items){ console.log("%c "+i+" = "+items[i], 'color: blue;'); } } console.log("%c Variable 'activityReports': ", 'color: red;'); console.log(activityReports); browser.storage.local.get(storage_got); } /** * * * Sends a message to the content script that sets the popup entries for a tab. * * var example_blocked_info = { * "accepted": [["REASON 1","SOURCE 1"],["REASON 2","SOURCE 2"]], * "blocked": [["REASON 1","SOURCE 1"],["REASON 2","SOURCE 2"]], * "url": "example.com" * } * * NOTE: This WILL break if you provide inconsistent URLs to it. * Make sure it will use the right URL when refering to a certain script. * */ async function updateReport(tabId, oldReport, updateUI = false){ let {url} = oldReport; let newReport = await createReport({url, tabId}); for (let property of Object.keys(oldReport)) { let entries = oldReport[property]; if (!Array.isArray(entries)) continue; let defValue = property === "accepted" || property === "blocked" ? property : "unknown"; for (let script of entries) { let status = listManager.getStatus(script[0], defValue); if (Array.isArray(newReport[status])) newReport[status].push(script); } } activityReports[tabId] = newReport; if (browser.sessions) browser.sessions.setTabValue(tabId, url, newReport); dbg_print(newReport); if (updateUI && activeMessagePorts[tabId]) { dbg_print(`[TABID: ${tabId}] Sending script blocking report directly to browser action.`); activeMessagePorts[tabId].postMessage({show_info: newReport}); } } /** * * This is what you call when a page gets changed to update the info box. * * Sends a message to the content script that adds a popup entry for a tab. * * The action argument is an object with two properties: one named either * "accepted","blocked", "whitelisted", "blacklisted" or "unknown", whose value * is the array [scriptName, reason], and another named "url". Example: * action = { * "accepted": ["jquery.js (someHash)","Whitelisted by user"], * "url": "https://example.com/js/jquery.js" * } * * Returns either "whitelisted, "blacklisted", "blocked", "accepted" or "unknown" * * NOTE: This WILL break if you provide inconsistent URLs to it. * Make sure it will use the right URL when refering to a certain script. * */ async function addReportEntry(tabId, scriptHashOrUrl, action) { let report = activityReports[tabId]; if (!report) report = activityReports[tabId] = await createReport({tabId}); let type, actionValue; for (type of ["accepted", "blocked", "whitelisted", "blacklisted"]) { if (type in action) { actionValue = action[type]; break; } } if (!actionValue) { console.debug("Something wrong with action", action); return ""; } // Search unused data for the given entry function isNew(entries, item) { for (let e of entries) { if (e[0] === item) return false; } return true; } let entryType; let scriptName = actionValue[0]; try { entryType = listManager.getStatus(scriptName, type); let entries = report[entryType]; if(isNew(entries, scriptName)){ dbg_print(activityReports); dbg_print(activityReports[tabId]); dbg_print(entryType); entries.push(actionValue); } } catch (e) { console.error("action %o, type %s, entryType %s", action, type, entryType, e); entryType = "unknown"; } if (activeMessagePorts[tabId]) { try { activeMessagePorts[tabId].postMessage({show_info: report}); } catch(e) { } } if (browser.sessions) browser.sessions.setTabValue(tabId, report.url, report); updateBadge(tabId, report); return entryType; } function get_domain(url){ var domain = url.replace('http://','').replace('https://','').split(/[/?#]/)[0]; if(url.indexOf("http://") == 0){ domain = "http://" + domain; } else if(url.indexOf("https://") == 0){ domain = "https://" + domain; } domain = domain + "/"; domain = domain.replace(/ /g,""); return domain; } /** * * This is the callback where the content scripts of the browser action will contact the background script. * */ var portFromCS; async function connected(p) { if(p.name === "contact_finder"){ // style the contact finder panel await browser.tabs.insertCSS(p.sender.tab.id, { file: "/content/dialog.css", cssOrigin: "user", matchAboutBlank: true, allFrames: true }); // Send a message back with the relevant settings p.postMessage(await browser.storage.local.get(["prefs_subject", "prefs_body"])); return; } p.onMessage.addListener(async function(m) { var update = false; var contact_finder = false; for (let action of ["whitelist", "blacklist", "forget"]) { if (m[action]) { let [key] = m[action]; if (m.site) { key = ListStore.siteItem(m.site); } else { key = ListStore.inlineItem(key) || key; } await listManager[action](key); update = true; } } if(m.report_tab){ openReportInTab(m.report_tab); } // a debug feature if(m["printlocalstorage"] !== undefined){ console.log("Print local storage"); debug_print_local(); } // invoke_contact_finder if(m["invoke_contact_finder"] !== undefined){ contact_finder = true; await injectContactFinder(); } // a debug feature (maybe give the user an option to do this?) if(m["deletelocalstorage"] !== undefined){ console.log("Delete local storage"); debug_delete_local(); } let tabs = await browser.tabs.query({active: true, currentWindow: true}); if(contact_finder){ let tab = tabs.pop(); dbg_print(`[TABID:${tab.id}] Injecting contact finder`); //inject_contact_finder(tabs[0]["id"]); } if (update || m.update && activityReports[m.tabId]) { let tabId = "tabId" in m ? m.tabId : tabs.pop().id; dbg_print(`%c updating tab ${tabId}`, "color: red;"); activeMessagePorts[tabId] = p; await updateReport(tabId, activityReports[tabId], true); } else { for(let tab of tabs) { if(activityReports[tab.id]){ // If we have some data stored here for this tabID, send it dbg_print(`[TABID: ${tab.id}] Sending stored data associated with browser action'`); p.postMessage({"show_info": activityReports[tab.id]}); } else{ // create a new entry let report = activityReports[tab.id] = await createReport({"url": tab.url, tabId: tab.id}); p.postMessage({show_info: report}); dbg_print(`[TABID: ${tab.id}] No data found, creating a new entry for this window.`); } } } }); } /** * The callback for tab closings. * * Delete the info we are storing about this tab if there is any. * */ function delete_removed_tab_info(tab_id, remove_info){ dbg_print("[TABID:"+tab_id+"]"+"Deleting stored info about closed tab"); if(activityReports[tab_id] !== undefined){ delete activityReports[tab_id]; } if(activeMessagePorts[tab_id] !== undefined){ delete activeMessagePorts[tab_id]; } ExternalLicenses.purgeCache(tab_id); } /** * Called when the tab gets updated / activated * * Here we check if new tab's url matches activityReports[tabId].url, and if * it doesn't we use the session cached value (if any). * */ async function onTabUpdated(tabId, changedInfo, tab) { let [url] = tab.url.split("#"); let report = activityReports[tabId]; if (!(report && report.url === url)) { let cache = browser.sessions && await browser.sessions.getTabValue(tabId, url) || null; // on session restore tabIds may change if (cache && cache.tabId !== tabId) cache.tabId = tabId; updateBadge(tabId, activityReports[tabId] = cache); } } async function onTabActivated({tabId}) { await onTabUpdated(tabId, {}, await browser.tabs.get(tabId)); } /* *********************************************************************************************** */ var fname_data = require("./fname_data.json").fname_data; //************************this part can be tested in the HTML file index.html's script test.js**************************** function full_evaluate(script){ var res = true; if(script === undefined || script == ""){ return [true,"Harmless null script"]; } var ast = acornLoose.parse(script).body[0]; var flag = false; var amtloops = 0; var loopkeys = {"for":true,"if":true,"while":true,"switch":true}; var operators = {"||":true,"&&":true,"=":true,"==":true,"++":true,"--":true,"+=":true,"-=":true,"*":true}; try{ var tokens = acorn.tokenizer(script); }catch(e){ console.warn("Tokenizer could not be initiated (probably invalid code)"); return [false,"Tokenizer could not be initiated (probably invalid code)"]; } try{ var toke = tokens.getToken(); }catch(e){ console.log(script); console.log(e); console.warn("couldn't get first token (probably invalid code)"); console.warn("Continuing evaluation"); } /** * Given the end of an identifer token, it tests for bracket suffix notation */ function being_called(end){ var i = 0; while(script.charAt(end+i).match(/\s/g) !== null){ i++; if(i >= script.length-1){ return false; } } return script.charAt(end+i) == "("; } /** * Given the end of an identifer token, it tests for parentheses */ function is_bsn(end){ var i = 0; while(script.charAt(end+i).match(/\s/g) !== null){ i++; if(i >= script.length-1){ return false; } } return script.charAt(end+i) == "["; } var error_count = 0; var defines_functions = false; while(toke !== undefined && toke.type != acorn.tokTypes.eof){ if(toke.type.keyword !== undefined){ //dbg_print("Keyword:"); //dbg_print(toke); // This type of loop detection ignores functional loop alternatives and ternary operators if(toke.type.keyword == "function"){ dbg_print("%c NOTICE: Function declaration.","color:green"); defines_functions = true; } if(loopkeys[toke.type.keyword] !== undefined){ amtloops++; if(amtloops > 3){ dbg_print("%c NONTRIVIAL: Too many loops/conditionals.","color:red"); if(DEBUG == false){ return [false,"NONTRIVIAL: Too many loops/conditionals."]; } } } }else if(toke.value !== undefined && operators[toke.value] !== undefined){ // It's just an operator. Javascript doesn't have operator overloading so it must be some // kind of primitive (I.e. a number) }else if(toke.value !== undefined){ var status = fname_data[toke.value]; if(status === true){ // is the identifier banned? dbg_print("%c NONTRIVIAL: nontrivial token: '"+toke.value+"'","color:red"); if(DEBUG == false){ return [false,"NONTRIVIAL: nontrivial token: '"+toke.value+"'"]; } }else if(status === false){// is the identifier not banned? // Is there bracket suffix notation? if(is_bsn(toke.end)){ dbg_print("%c NONTRIVIAL: Bracket suffix notation on variable '"+toke.value+"'","color:red"); if(DEBUG == false){ return [false,"%c NONTRIVIAL: Bracket suffix notation on variable '"+toke.value+"'"]; } } }else if(status === undefined){// is the identifier user defined? // Is there bracket suffix notation? if(is_bsn(toke.end)){ dbg_print("%c NONTRIVIAL: Bracket suffix notation on variable '"+toke.value+"'","color:red"); if(DEBUG == false){ return [false,"NONTRIVIAL: Bracket suffix notation on variable '"+toke.value+"'"]; } } }else{ dbg_print("trivial token:"+toke.value); } } // If not a keyword or an identifier it's some kind of operator, field parenthesis, brackets try{ toke = tokens.getToken(); }catch(e){ dbg_print("Denied script because it cannot be parsed."); return [false,"NONTRIVIAL: Cannot be parsed. This could mean it is a 404 error."]; } } dbg_print("%cAppears to be trivial.","color:green;"); if (defines_functions === true) return [true,"Script appears to be trivial but defines functions."]; else return [true,"Script appears to be trivial."]; } //**************************************************************************************************** /** * This is the entry point for full code evaluation. * * Performs the initial pass on code to see if it needs to be completely parsed * * This can only determine if a script is bad, not if it's good * * If it passes the intitial pass, it runs the full pass and returns the result * It returns an array of [flag (boolean, false if "bad"), reason (string, human readable report)] * */ function evaluate(script,name){ function reserved_object_regex(object){ var arith_operators = "\\+\\-\\*\\/\\%\\="; var scope_chars = "\{\}\]\[\(\)\,"; var trailing_chars = "\s*"+"\(\.\["; return new RegExp("(?:[^\\w\\d]|^|(?:"+arith_operators+"))"+object+'(?:\\s*?(?:[\\;\\,\\.\\(\\[])\\s*?)',"g"); } reserved_object_regex("window"); var all_strings = new RegExp('".*?"'+"|'.*?'","gm"); var ml_comment = /\/\*([\s\S]+?)\*\//g; var il_comment = /\/\/.+/gm; var bracket_pairs = /\[.+?\]/g; var temp = script.replace(/'.+?'+/gm,"'string'"); temp = temp.replace(/".+?"+/gm,'"string"'); temp = temp.replace(ml_comment,""); temp = temp.replace(il_comment,""); dbg_print("%c ------evaluation results for "+ name +"------","color:white"); dbg_print("Script accesses reserved objects?"); var flag = true; var reason = "" // This is where individual "passes" are made over the code for(var i = 0; i < reserved_objects.length; i++){ var res = reserved_object_regex(reserved_objects[i]).exec(temp); if(res != null){ dbg_print("%c fail","color:red;"); flag = false; reason = "Script uses a reserved object (" + reserved_objects[i] + ")"; } } if(flag){ dbg_print("%c pass","color:green;"); } else{ return [flag,reason]; } return full_evaluate(script); } function validateLicense(matches) { if (!(Array.isArray(matches) && matches.length >= 4)){ return [false, "Malformed or unrecognized license tag."]; } let [all, tag, first, second] = matches; for (let key in licenses){ // Match by id on first or second parameter, ignoring case if (key.toLowerCase() === first.toLowerCase() || key.toLowerCase() === second.toLowerCase()) { return [true, `Recognized license: "${licenses[key]['Name']}" `]; } // Match by link on first parameter (legacy) if (licenses[key]["Magnet link"] === first.replace("&","&") || licenses[key]["URL"] === first.replace("&","&")) { return [true, `Recognized license: "${licenses[key]['Name']}".`]; } } return [false, `Unrecognized license tag: "${all}"`]; } /** * * Evaluates the content of a script (license, if it is non-trivial) * * Returns * [ * true (accepted) or false (denied), * edited content, * reason text * ] */ function license_read(scriptSrc, name, external = false){ let license = legacy_license_lib.check(scriptSrc); if (license){ return [true, scriptSrc, `Licensed under: ${license}`]; } if (listManager.builtInHashes.has(hash(scriptSrc))){ return [true, scriptSrc, "Common script known to be free software."]; } let editedSrc = ""; let uneditedSrc = scriptSrc.trim(); let reason = uneditedSrc ? "" : "Empty source."; let partsDenied = false; let partsAccepted = false; function checkTriviality(s) { if (!s.trim()) { return true; // empty, ignore it } let [trivial, message] = external ? [false, "External script with no known license"] : evaluate(s, name); if (trivial) { partsAccepted = true; editedSrc += s; } else { partsDenied = true; if (s.startsWith("javascript:")) editedSrc += `# LIBREJS BLOCKED: ${message}`; else editedSrc += `/*\nLIBREJS BLOCKED: ${message}\n*/`; } reason += `\n${message}`; return trivial; } while (uneditedSrc) { let openingMatch = /\/[\/\*]\s*?(@license)\s+(\S+)\s+(\S+)\s*$/mi.exec(uneditedSrc); if (!openingMatch) { // no license found, check for triviality checkTriviality(uneditedSrc); break; } let openingIndex = openingMatch.index; if (openingIndex) { // let's check the triviality of the code before the license tag, if any checkTriviality(uneditedSrc.substring(0, openingIndex)); } // let's check the actual license uneditedSrc = uneditedSrc.substring(openingIndex); let closureMatch = /\/([*/])\s*@license-end\b[^*/\n]*/i.exec(uneditedSrc); if (!closureMatch) { let msg = "ERROR: @license with no @license-end"; return [false, `\n/*\n ${msg} \n*/\n`, msg]; } let closureEndIndex = closureMatch.index + closureMatch[0].length; let commentEndOffset = uneditedSrc.substring(closureEndIndex).indexOf(closureMatch[1] === "*" ? "*/" : "\n"); if (commentEndOffset !== -1) { closureEndIndex += commentEndOffset; } let [licenseOK, message] = validateLicense(openingMatch); if(licenseOK) { editedSrc += uneditedSrc.substr(0, closureEndIndex); partsAccepted = true; } else { editedSrc += `\n/*\n${message}\n*/\n`; partsDenied = true; } reason += `\n${message}`; // trim off everything we just evaluated uneditedSrc = uneditedSrc.substring(closureEndIndex).trim(); } if(partsDenied) { if (partsAccepted) { reason = `Some parts of the script have been disabled (check the source for details).\n^--- ${reason}`; } return [false, editedSrc, reason]; } return [true, scriptSrc, reason]; } /* *********************************************************************************************** */ // TODO: Test if this script is being loaded from another domain compared to activityReports[tabid]["url"] /** * Asynchronous function, returns the final edited script as a string, * or an array containing it and the index, if the latter !== -1 */ async function get_script(response, url, tabId = -1, whitelisted = false, index = -1) { function result(scriptSource) { return index === -1 ? scriptSource : [scriptSource, index]; } let scriptName = url.split("/").pop(); if (whitelisted) { if (tabId !== -1) { let site = ListManager.siteMatch(url, whitelist); // Accept without reading script, it was explicitly whitelisted let reason = site ? `All ${site} whitelisted by user` : "Address whitelisted by user"; addReportEntry(tabId, url, {"whitelisted": [site || url, reason], url}); } if (response.startsWith("javascript:")) return result(response); else return result(`/* LibreJS: script whitelisted by user preference. */\n${response}`); } let [verdict, editedSource, reason] = license_read(response, scriptName, index === -2); if (tabId < 0) { return result(verdict ? response : editedSource); } let sourceHash = hash(response); let domain = get_domain(url); let report = activityReports[tabId] || (activityReports[tabId] = await createReport({tabId})); updateBadge(tabId, report, !verdict); let category = await addReportEntry(tabId, sourceHash, {"url": domain, [verdict ? "accepted" : "blocked"]: [url, reason]}); switch(category) { case "blacklisted": editedSource = `/* LibreJS: script ${category} by user. */`; return result(response.startsWith("javascript:") ? `javascript:void(${encodeURIComponent(editedSource)})` : editedSource); case "whitelisted": return result(response.startsWith("javascript:") ? response : `/* LibreJS: script ${category} by user. */\n${response}`); default: let scriptSource = verdict ? response : editedSource; return result(response.startsWith("javascript:") ? (verdict ? scriptSource : `javascript:void(/* ${scriptSource} */)`) : `/* LibreJS: script ${category}. */\n${scriptSource}` ); } } function updateBadge(tabId, report = null, forceRed = false) { let blockedCount = report ? report.blocked.length + report.blacklisted.length : 0; let [text, color] = blockedCount > 0 || forceRed ? [blockedCount && blockedCount.toString() || "!" , "red"] : ["✓", "green"] let {browserAction} = browser; if ("setBadgeText" in browserAction) { browserAction.setBadgeText({text, tabId}); browserAction.setBadgeBackgroundColor({color, tabId}); } else { // Mobile browserAction.setTitle({title: `LibreJS (${text})`, tabId}); } } function blockGoogleAnalytics(request) { let {url} = request; let res = {}; if (url === 'https://www.google-analytics.com/analytics.js' || /^https:\/\/www\.google\.com\/analytics\/[^#]/.test(url) ) { res.cancel = true; } return res; } async function blockBlacklistedScripts(request) { let {url, tabId, documentUrl} = request; url = ListStore.urlItem(url); let status = listManager.getStatus(url); if (status !== "blacklisted") return {}; let blacklistedSite = ListManager.siteMatch(url, blacklist); await addReportEntry(tabId, url, {url: documentUrl, "blacklisted": [url, /\*/.test(blacklistedSite) ? `User blacklisted ${blacklistedSite}` : "Blacklisted by user"]}); return {cancel: true}; } /** * This listener gets called as soon as we've got all the HTTP headers, can guess * content type and encoding, and therefore correctly parse HTML documents * and external script inclusions in search of non-free JavaScript */ var ResponseHandler = { /** * Enforce white/black lists for url/site early (hashes will be handled later) */ async pre(response) { let {request} = response; let {url, type, tabId, frameId, documentUrl} = request; let fullUrl = url; url = ListStore.urlItem(url); let site = ListStore.siteItem(url); let blacklistedSite = ListManager.siteMatch(site, blacklist); let blacklisted = blacklistedSite || blacklist.contains(url); let topUrl = type === "sub_frame" && request.frameAncestors && request.frameAncestors.pop() || documentUrl; if (blacklisted) { if (type === "script") { // this shouldn't happen, because we intercept earlier in blockBlacklistedScripts() return ResponseProcessor.REJECT; } if (type === "main_frame") { // we handle the page change here too, since we won't call edit_html() activityReports[tabId] = await createReport({url: fullUrl, tabId}); // Go on without parsing the page: it was explicitly blacklisted let reason = blacklistedSite ? `All ${blacklistedSite} blacklisted by user` : "Address blacklisted by user"; await addReportEntry(tabId, url, {"blacklisted": [blacklistedSite || url, reason], url: fullUrl}); } // use CSP to restrict JavaScript execution in the page request.responseHeaders.unshift({ name: `Content-security-policy`, value: `script-src 'none';` }); return {responseHeaders: request.responseHeaders}; // let's skip the inline script parsing, since we block by CSP } else { let whitelistedSite = ListManager.siteMatch(site, whitelist); let whitelisted = response.whitelisted = whitelistedSite || whitelist.contains(url); if (type === "script") { if (whitelisted) { // accept the script and stop processing addReportEntry(tabId, url, {url: topUrl, "whitelisted": [url, whitelistedSite ? `User whitelisted ${whitelistedSite}` : "Whitelisted by user"]}); return ResponseProcessor.ACCEPT; } else { let scriptInfo = await ExternalLicenses.check({url: fullUrl, tabId, frameId, documentUrl}); if (scriptInfo) { let verdict, ret; let msg = scriptInfo.toString(); if (scriptInfo.free) { verdict = "accepted"; ret = ResponseProcessor.ACCEPT; } else { verdict = "blocked"; ret = ResponseProcessor.REJECT; } addReportEntry(tabId, url, {url, [verdict]: [url, msg]}); return ret; } } } } // it's a page (it's too early to report) or an unknown script: // let's keep processing return ResponseProcessor.CONTINUE; }, /** * Here we do the heavylifting, analyzing unknown scripts */ async post(response) { let {type} = response.request; let handle_it = type === "script" ? handle_script : handle_html; return await handle_it(response, response.whitelisted); } } /** * Here we handle external script requests */ async function handle_script(response, whitelisted){ let {text, request} = response; let {url, tabId, frameId} = request; url = ListStore.urlItem(url); let edited = await get_script(text, url, tabId, whitelisted, -2); return Array.isArray(edited) ? edited[0] : edited; } /** * Serializes HTMLDocument objects including the root element and * the DOCTYPE declaration */ function doc2HTML(doc) { let s = doc.documentElement.outerHTML; if (doc.doctype) { let dt = doc.doctype; let sDoctype = `\n${s}`; } return s; } /** * Shortcut to create a correctly namespaced DOM HTML elements */ function createHTMLElement(doc, name) { return doc.createElementNS("http://www.w3.org/1999/xhtml", name); } /** * Replace any element with a span having the same content (useful to force * NOSCRIPT elements to visible the same way as NoScript and uBlock do) */ function forceElement(doc, element) { let replacement = createHTMLElement(doc, "span"); replacement.innerHTML = element.innerHTML; element.replaceWith(replacement); return replacement; } /** * Forces displaying any element having the "data-librejs-display" attribute and *