diff options
author | Ruben Rodriguez <ruben@gnu.org> | 2018-09-13 20:39:48 -0400 |
---|---|---|
committer | Ruben Rodriguez <ruben@gnu.org> | 2018-09-13 21:02:13 -0400 |
commit | d26b319fd6f98517cc3421f10bf18698b953e4d2 (patch) | |
tree | bc70c4e472a2eaf514d411dba5067d530e5bbea9 /data/extensions/spyblock@gnu.org/chrome/content/ui/ext | |
parent | c3b304c51a3386ea09527a479a883253ea35243a (diff) |
Updated extensions list for v60
Diffstat (limited to 'data/extensions/spyblock@gnu.org/chrome/content/ui/ext')
-rw-r--r-- | data/extensions/spyblock@gnu.org/chrome/content/ui/ext/common.js | 124 | ||||
-rw-r--r-- | data/extensions/spyblock@gnu.org/chrome/content/ui/ext/content.js | 82 |
2 files changed, 0 insertions, 206 deletions
diff --git a/data/extensions/spyblock@gnu.org/chrome/content/ui/ext/common.js b/data/extensions/spyblock@gnu.org/chrome/content/ui/ext/common.js deleted file mode 100644 index 296c00f..0000000 --- a/data/extensions/spyblock@gnu.org/chrome/content/ui/ext/common.js +++ /dev/null @@ -1,124 +0,0 @@ -/* - * This file is part of Adblock Plus <https://adblockplus.org/>, - * Copyright (C) 2006-2017 eyeo GmbH - * - * Adblock Plus is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. - * - * Adblock Plus 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 Adblock Plus. If not, see <http://www.gnu.org/licenses/>. - */ - -(function(global) -{ - const Cu = Components.utils; - - let {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); - - if (!global.ext) - global.ext = {}; - - var wrapperSymbol = Symbol("ext-wrapper"); - - function wrapFrames(frames) - { - if (!frames.length) - return null; - - // We have frames as an array, non-Firefox code expects url and parent - // properties however. - Object.defineProperty(frames, "url", { - enumerable: true, - get: () => new URL(frames[0].location) - }); - - Object.defineProperty(frames, "parent", { - enumerable: true, - get: () => wrapFrames(frames.slice(1)) - }); - - return frames; - } - - var EventTarget = global.ext._EventTarget = function(port, windowID) - { - this._port = port; - this._windowID = windowID; - this.addListener((payload, sender, resolve) => - { - if (payload.type) - { - let result = this._port._dispatch(payload.type, payload, sender); - if (typeof result != "undefined") - resolve(result); - } - }); - }; - EventTarget.prototype = { - addListener: function(listener) - { - var wrapper = (message, sender) => - { - if (this._windowID && this._windowID != message.targetID) - return undefined; - - return new Promise((resolve, reject) => - { - var sender = {}; - if (message.senderID) - { - // We will only get here on the background side so we can access - // the Page object. - const Page = require("ext_background").Page; - sender.page = new Page(message.senderID); - } - if (message.frames) - sender.frame = wrapFrames(message.frames); - if (!listener(message.payload, sender, resolve)) - resolve(undefined); - }); - }; - listener[wrapperSymbol] = wrapper; - this._port.on("ext_message", wrapper); - }, - - removeListener: function(listener) - { - if (listener[wrapperSymbol]) - this._port.off("ext_message", listener[wrapperSymbol]); - } - }; - - let pageName = "global"; - if (typeof location !== "undefined") - pageName = location.pathname.replace(/.*\//, "").replace(/\..*?$/, ""); - - let stringBundle = Services.strings.createBundle( - "chrome://adblockplus/locale/" + pageName + ".properties?" + Math.random()); - - global.ext.i18n = { - getMessage(key, args) - { - try { - return stringBundle.GetStringFromName(key); - } - catch(e) - { - // Don't report errors for special strings, these are expected to be - // missing. - if (key[0] != "@") - Cu.reportError(e); - return ""; - } - } - }; - - if (typeof exports == "object") - exports = global.ext; -})(this); diff --git a/data/extensions/spyblock@gnu.org/chrome/content/ui/ext/content.js b/data/extensions/spyblock@gnu.org/chrome/content/ui/ext/content.js deleted file mode 100644 index 366325a..0000000 --- a/data/extensions/spyblock@gnu.org/chrome/content/ui/ext/content.js +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is part of Adblock Plus <https://adblockplus.org/>, - * Copyright (C) 2006-2017 eyeo GmbH - * - * Adblock Plus is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. - * - * Adblock Plus 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 Adblock Plus. If not, see <http://www.gnu.org/licenses/>. - */ - -(function(global) -{ - const Cc = Components.classes; - const Ci = Components.interfaces; - const Cu = Components.utils; - - var Services = Cu.import("resource://gre/modules/Services.jsm", {}).Services; - - function require(/**String*/ module) - { - var result = {}; - result.wrappedJSObject = result; - Services.obs.notifyObservers(result, "adblockplus-require", module); - return result.exports; - } - - function getOuterWindowID() - { - if (!getOuterWindowID.result) - { - getOuterWindowID.result = window.QueryInterface(Ci.nsIInterfaceRequestor) - .getInterface(Ci.nsIDOMWindowUtils) - .outerWindowID; - } - return getOuterWindowID.result; - } - - const Port = require("messaging").Port; - - if (!global.ext) - global.ext = {}; - - /* Message passing */ - var port = new Port(Cc["@mozilla.org/childprocessmessagemanager;1"] - .getService(Ci.nsIMessageSender)); - window.addEventListener("unload", function() - { - try - { - port.emit("ext_disconnect", getOuterWindowID()); - } - catch (e) - { - // This is expected to fail if Adblock Plus was disabled/uninstalled with - // the page still open. - } - port.disconnect(); - }, false); - - global.ext.onMessage = new global.ext._EventTarget(port, getOuterWindowID()); - global.ext.backgroundPage = { - sendMessage: function(payload, responseCallback) - { - var message = { - senderID: getOuterWindowID(), - payload - }; - if (typeof responseCallback == "function") - port.emitWithResponse("ext_message", message).then(responseCallback); - else - port.emit("ext_message", message); - } - }; - -})(this); |