diff --git a/platform/chromium/manifest.json b/platform/chromium/manifest.json index ef45cf66343e3..d3daff37f97e1 100644 --- a/platform/chromium/manifest.json +++ b/platform/chromium/manifest.json @@ -31,8 +31,7 @@ "author": "All Nano Adblocker and uBlock Origin contributors", "background": { - "page": "background.html", - "persistent": true + "page": "background.html" }, "content_scripts": [ { diff --git a/platform/chromium/vapi.js b/platform/chromium/vapi.js index f716ccfe268b1..f622940412751 100644 --- a/platform/chromium/vapi.js +++ b/platform/chromium/vapi.js @@ -54,15 +54,3 @@ if ( } /******************************************************************************/ - -// Patch 2017-12-14: See how compatible Edge is -if ( - navigator.userAgent.includes('Edge') && - typeof browser === 'object' && - typeof edge === 'undefined' -) { - window.edge = chrome; - chrome = browser; -} - -/******************************************************************************/ diff --git a/platform/edge/manifest.json b/platform/edge/manifest.json new file mode 100644 index 0000000000000..ef45cf66343e3 --- /dev/null +++ b/platform/edge/manifest.json @@ -0,0 +1,73 @@ +{ + "manifest_version": 2, + + "name": "Nano Adblocker", + "version": "1.0.0.13", + + "commands": { + "launch-element-zapper": { + "description": "__MSG_popupTipZapper__" + }, + "launch-element-picker": { + "description": "__MSG_popupTipPicker__" + }, + "launch-logger": { + "description": "__MSG_popupTipLog__" + } + }, + "default_locale": "en", + "description": "Just another adblocker", + "icons": { + "128": "img/128_on.png" + }, + + "browser_action": { + "default_icon": { + "128": "img/browsericons/128_on.png" + }, + "default_title": "Nano Adblocker", + "default_popup": "popup.html" + }, + + "author": "All Nano Adblocker and uBlock Origin contributors", + "background": { + "page": "background.html", + "persistent": true + }, + "content_scripts": [ + { + "matches": ["http://*/*", "https://*/*"], + "js": ["/js/vapi.js", "/js/vapi-client.js", "/js/contentscript.js"], + "run_at": "document_start", + "all_frames": true + }, + { + "matches": ["http://*/*", "https://*/*"], + "js": ["/js/scriptlets/subscriber.js"], + "run_at": "document_idle", + "all_frames": false + } + ], + "incognito": "split", + "minimum_chrome_version": "45.0", + "optional_permissions": ["file:///*"], + "options_page": "dashboard.html", + "options_ui": { + "page": "options_ui.html" + }, + "permissions": [ + "contextMenus", + "privacy", + "storage", + "tabs", + "unlimitedStorage", + "webNavigation", + "webRequest", + "webRequestBlocking", + "" + ], + "short_name": "Nano", + "storage": { + "managed_schema": "managed_storage.json" + } +} diff --git a/platform/edge/vapi.js b/platform/edge/vapi.js new file mode 100644 index 0000000000000..77a38abe7cd04 --- /dev/null +++ b/platform/edge/vapi.js @@ -0,0 +1,62 @@ +/******************************************************************************* + + uBlock Origin - a browser extension to block requests. + Copyright (C) 2017 The uBlock Origin authors + + This program 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. + + This program 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 this program. If not, see {http://www.gnu.org/licenses/}. + + Home: https://github.com/gorhill/uBlock +*/ + +'use strict'; + +/* global HTMLDocument, XMLDocument */ + +// For background page, auxiliary pages, and content scripts. + +/******************************************************************************/ + +// https://bugzilla.mozilla.org/show_bug.cgi?id=1408996#c9 +var vAPI = window.vAPI; // jshint ignore:line + +// https://github.com/chrisaljoudi/uBlock/issues/464 +// https://github.com/chrisaljoudi/uBlock/issues/1528 +// A XMLDocument can be a valid HTML document. + +// https://github.com/gorhill/uBlock/issues/1124 +// Looks like `contentType` is on track to be standardized: +// https://dom.spec.whatwg.org/#concept-document-content-type + +// https://forums.lanik.us/viewtopic.php?f=64&t=31522 +// Skip text/plain documents. + +if ( + (document instanceof HTMLDocument || + document instanceof XMLDocument && + document.createElement('div') instanceof HTMLDivElement + ) && + (/^image\/|^text\/plain/.test(document.contentType || '') === false) +) { + vAPI = window.vAPI = vAPI instanceof Object && vAPI.uBO === true + ? vAPI + : { uBO: true }; +} + +/******************************************************************************/ + +// Patch 2017-12-14: See how compatible Edge is +window.edge = chrome || {}; +window.chrome = browser; + +/******************************************************************************/