From 258eb6ee9ccefc8a6353a73c6389b042054a36fe Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Mon, 28 May 2018 13:27:14 -0400 Subject: [WebExAM] Deduplicate toolkit/mozapps/webextensions --- .../extensions/internal/ProductAddonChecker.jsm | 467 +++++++++++++++++++++ toolkit/mozapps/extensions/internal/moz.build | 2 +- toolkit/mozapps/webextensions/amIAddonManager.idl | 29 -- .../mozapps/webextensions/amIAddonPathService.idl | 37 -- .../webextensions/amIWebInstallListener.idl | 134 ------ toolkit/mozapps/webextensions/amIWebInstaller.idl | 82 ---- .../webextensions/content/OpenH264-license.txt | 59 --- toolkit/mozapps/webextensions/content/about.xul | 57 --- .../mozapps/webextensions/content/blocklist.css | 11 - .../mozapps/webextensions/content/blocklist.xml | 58 --- .../mozapps/webextensions/content/blocklist.xul | 46 -- toolkit/mozapps/webextensions/content/eula.xul | 35 -- toolkit/mozapps/webextensions/content/gmpPrefs.xul | 8 - toolkit/mozapps/webextensions/content/list.xul | 44 -- .../mozapps/webextensions/content/pluginPrefs.xul | 20 - .../mozapps/webextensions/content/updateinfo.xsl | 41 -- .../webextensions/content/xpinstallConfirm.css | 8 - .../webextensions/content/xpinstallConfirm.xul | 37 -- .../webextensions/content/xpinstallItem.xml | 51 --- .../webextensions/internal/ProductAddonChecker.jsm | 467 --------------------- .../internal/SpellCheckDictionaryBootstrap.js | 17 - toolkit/mozapps/webextensions/internal/moz.build | 4 +- toolkit/mozapps/webextensions/jar.mn | 26 +- toolkit/mozapps/webextensions/moz.build | 8 +- 24 files changed, 487 insertions(+), 1261 deletions(-) create mode 100644 toolkit/mozapps/extensions/internal/ProductAddonChecker.jsm delete mode 100644 toolkit/mozapps/webextensions/amIAddonManager.idl delete mode 100644 toolkit/mozapps/webextensions/amIAddonPathService.idl delete mode 100644 toolkit/mozapps/webextensions/amIWebInstallListener.idl delete mode 100644 toolkit/mozapps/webextensions/amIWebInstaller.idl delete mode 100644 toolkit/mozapps/webextensions/content/OpenH264-license.txt delete mode 100644 toolkit/mozapps/webextensions/content/about.xul delete mode 100644 toolkit/mozapps/webextensions/content/blocklist.css delete mode 100644 toolkit/mozapps/webextensions/content/blocklist.xml delete mode 100644 toolkit/mozapps/webextensions/content/blocklist.xul delete mode 100644 toolkit/mozapps/webextensions/content/eula.xul delete mode 100644 toolkit/mozapps/webextensions/content/gmpPrefs.xul delete mode 100644 toolkit/mozapps/webextensions/content/list.xul delete mode 100644 toolkit/mozapps/webextensions/content/pluginPrefs.xul delete mode 100644 toolkit/mozapps/webextensions/content/updateinfo.xsl delete mode 100644 toolkit/mozapps/webextensions/content/xpinstallConfirm.css delete mode 100644 toolkit/mozapps/webextensions/content/xpinstallConfirm.xul delete mode 100644 toolkit/mozapps/webextensions/content/xpinstallItem.xml delete mode 100644 toolkit/mozapps/webextensions/internal/ProductAddonChecker.jsm delete mode 100644 toolkit/mozapps/webextensions/internal/SpellCheckDictionaryBootstrap.js (limited to 'toolkit') diff --git a/toolkit/mozapps/extensions/internal/ProductAddonChecker.jsm b/toolkit/mozapps/extensions/internal/ProductAddonChecker.jsm new file mode 100644 index 000000000..f98dd2a94 --- /dev/null +++ b/toolkit/mozapps/extensions/internal/ProductAddonChecker.jsm @@ -0,0 +1,467 @@ +/* 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/. */ + +"use strict"; + +const { classes: Cc, interfaces: Ci, utils: Cu } = Components; + +const LOCAL_EME_SOURCES = [{ + "id": "gmp-eme-adobe", + "src": "chrome://global/content/gmp-sources/eme-adobe.json" +}, { + "id": "gmp-gmpopenh264", + "src": "chrome://global/content/gmp-sources/openh264.json" +}, { + "id": "gmp-widevinecdm", + "src": "chrome://global/content/gmp-sources/widevinecdm.json" +}]; + +this.EXPORTED_SYMBOLS = [ "ProductAddonChecker" ]; + +Cu.importGlobalProperties(["XMLHttpRequest"]); + +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); +Cu.import("resource://gre/modules/Services.jsm"); +Cu.import("resource://gre/modules/Task.jsm"); +Cu.import("resource://gre/modules/Log.jsm"); +Cu.import("resource://gre/modules/CertUtils.jsm"); +/* globals checkCert, BadCertHandler*/ +Cu.import("resource://gre/modules/FileUtils.jsm"); +Cu.import("resource://gre/modules/NetUtil.jsm"); +Cu.import("resource://gre/modules/osfile.jsm"); + +/* globals GMPPrefs */ +XPCOMUtils.defineLazyModuleGetter(this, "GMPPrefs", + "resource://gre/modules/GMPUtils.jsm"); + +/* globals OS */ + +XPCOMUtils.defineLazyModuleGetter(this, "UpdateUtils", + "resource://gre/modules/UpdateUtils.jsm"); + +XPCOMUtils.defineLazyModuleGetter(this, "ServiceRequest", + "resource://gre/modules/ServiceRequest.jsm"); + +// This exists so that tests can override the XHR behaviour for downloading +// the addon update XML file. +var CreateXHR = function() { + return Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]. + createInstance(Ci.nsISupports); +} + +var logger = Log.repository.getLogger("addons.productaddons"); + +/** + * Number of milliseconds after which we need to cancel `downloadXML`. + * + * Bug 1087674 suggests that the XHR we use in `downloadXML` may + * never terminate in presence of network nuisances (e.g. strange + * antivirus behavior). This timeout is a defensive measure to ensure + * that we fail cleanly in such case. + */ +const TIMEOUT_DELAY_MS = 20000; +// Chunk size for the incremental downloader +const DOWNLOAD_CHUNK_BYTES_SIZE = 300000; +// Incremental downloader interval +const DOWNLOAD_INTERVAL = 0; +// How much of a file to read into memory at a time for hashing +const HASH_CHUNK_SIZE = 8192; + +/** + * Gets the status of an XMLHttpRequest either directly or from its underlying + * channel. + * + * @param request + * The XMLHttpRequest. + * @return an integer status value. + */ +function getRequestStatus(request) { + let status = null; + try { + status = request.status; + } + catch (e) { + } + + if (status != null) { + return status; + } + + return request.channel.QueryInterface(Ci.nsIRequest).status; +} + +/** + * Downloads an XML document from a URL optionally testing the SSL certificate + * for certain attributes. + * + * @param url + * The url to download from. + * @param allowNonBuiltIn + * Whether to trust SSL certificates without a built-in CA issuer. + * @param allowedCerts + * The list of certificate attributes to match the SSL certificate + * against or null to skip checks. + * @return a promise that resolves to the DOM document downloaded or rejects + * with a JS exception in case of error. + */ +function downloadXML(url, allowNonBuiltIn = false, allowedCerts = null) { + return new Promise((resolve, reject) => { + let request = CreateXHR(); + // This is here to let unit test code override XHR + if (request.wrappedJSObject) { + request = request.wrappedJSObject; + } + request.open("GET", url, true); + request.channel.notificationCallbacks = new BadCertHandler(allowNonBuiltIn); + // Prevent the request from reading from the cache. + request.channel.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE; + // Prevent the request from writing to the cache. + request.channel.loadFlags |= Ci.nsIRequest.INHIBIT_CACHING; + // Use conservative TLS settings. See bug 1325501. + // TODO move to ServiceRequest. + if (request.channel instanceof Ci.nsIHttpChannelInternal) { + request.channel.QueryInterface(Ci.nsIHttpChannelInternal).beConservative = true; + } + request.timeout = TIMEOUT_DELAY_MS; + + request.overrideMimeType("text/xml"); + // The Cache-Control header is only interpreted by proxies and the + // final destination. It does not help if a resource is already + // cached locally. + request.setRequestHeader("Cache-Control", "no-cache"); + // HTTP/1.0 servers might not implement Cache-Control and + // might only implement Pragma: no-cache + request.setRequestHeader("Pragma", "no-cache"); + + let fail = (event) => { + let request = event.target; + let status = getRequestStatus(request); + let message = "Failed downloading XML, status: " + status + ", reason: " + event.type; + logger.warn(message); + let ex = new Error(message); + ex.status = status; + reject(ex); + }; + + let success = (event) => { + logger.info("Completed downloading document"); + let request = event.target; + + try { + checkCert(request.channel, allowNonBuiltIn, allowedCerts); + } catch (ex) { + logger.error("Request failed certificate checks: " + ex); + ex.status = getRequestStatus(request); + reject(ex); + return; + } + + resolve(request.responseXML); + }; + + request.addEventListener("error", fail, false); + request.addEventListener("abort", fail, false); + request.addEventListener("timeout", fail, false); + request.addEventListener("load", success, false); + + logger.info("sending request to: " + url); + request.send(null); + }); +} + +function downloadJSON(uri) { + logger.info("fetching config from: " + uri); + return new Promise((resolve, reject) => { + let xmlHttp = new ServiceRequest({mozAnon: true}); + + xmlHttp.onload = function(aResponse) { + resolve(JSON.parse(this.responseText)); + }; + + xmlHttp.onerror = function(e) { + reject("Fetching " + uri + " results in error code: " + e.target.status); + }; + + xmlHttp.open("GET", uri); + xmlHttp.overrideMimeType("application/json"); + xmlHttp.send(); + }); +} + + +/** + * Parses a list of add-ons from a DOM document. + * + * @param document + * The DOM document to parse. + * @return null if there is no element otherwise an object containing + * an array of the addons listed and a field notifying whether the + * fallback was used. + */ +function parseXML(document) { + // Check that the root element is correct + if (document.documentElement.localName != "updates") { + throw new Error("got node name: " + document.documentElement.localName + + ", expected: updates"); + } + + // Check if there are any addons elements in the updates element + let addons = document.querySelector("updates:root > addons"); + if (!addons) { + return null; + } + + let results = []; + let addonList = document.querySelectorAll("updates:root > addons > addon"); + for (let addonElement of addonList) { + let addon = {}; + + for (let name of ["id", "URL", "hashFunction", "hashValue", "version", "size"]) { + if (addonElement.hasAttribute(name)) { + addon[name] = addonElement.getAttribute(name); + } + } + addon.size = Number(addon.size) || undefined; + + results.push(addon); + } + + return { + usedFallback: false, + gmpAddons: results + }; +} + +/** + * If downloading from the network fails (AUS server is down), + * load the sources from local build configuration. + */ +function downloadLocalConfig() { + + if (!GMPPrefs.get(GMPPrefs.KEY_UPDATE_ENABLED, true)) { + logger.info("Updates are disabled via media.gmp-manager.updateEnabled"); + return Promise.resolve({usedFallback: true, gmpAddons: []}); + } + + return Promise.all(LOCAL_EME_SOURCES.map(conf => { + return downloadJSON(conf.src).then(addons => { + + let platforms = addons.vendors[conf.id].platforms; + let target = Services.appinfo.OS + "_" + UpdateUtils.ABI; + let details = null; + + while (!details) { + if (!(target in platforms)) { + // There was no matching platform so return false, this addon + // will be filtered from the results below + logger.info("no details found for: " + target); + return false; + } + // Field either has the details of the binary or is an alias + // to another build target key that does + if (platforms[target].alias) { + target = platforms[target].alias; + } else { + details = platforms[target]; + } + } + + logger.info("found plugin: " + conf.id); + return { + "id": conf.id, + "URL": details.fileUrl, + "hashFunction": addons.hashFunction, + "hashValue": details.hashValue, + "version": addons.vendors[conf.id].version, + "size": details.filesize + }; + }); + })).then(addons => { + + // Some filters may not match this platform so + // filter those out + addons = addons.filter(x => x !== false); + + return { + usedFallback: true, + gmpAddons: addons + }; + }); +} + +/** + * Downloads file from a URL using XHR. + * + * @param url + * The url to download from. + * @return a promise that resolves to the path of a temporary file or rejects + * with a JS exception in case of error. + */ +function downloadFile(url) { + return new Promise((resolve, reject) => { + let xhr = new XMLHttpRequest(); + xhr.onload = function(response) { + logger.info("downloadXHR File download. status=" + xhr.status); + if (xhr.status != 200 && xhr.status != 206) { + reject(Components.Exception("File download failed", xhr.status)); + return; + } + Task.spawn(function* () { + let f = yield OS.File.openUnique(OS.Path.join(OS.Constants.Path.tmpDir, "tmpaddon")); + let path = f.path; + logger.info(`Downloaded file will be saved to ${path}`); + yield f.file.close(); + yield OS.File.writeAtomic(path, new Uint8Array(xhr.response)); + return path; + }).then(resolve, reject); + }; + + let fail = (event) => { + let request = event.target; + let status = getRequestStatus(request); + let message = "Failed downloading via XHR, status: " + status + ", reason: " + event.type; + logger.warn(message); + let ex = new Error(message); + ex.status = status; + reject(ex); + }; + xhr.addEventListener("error", fail); + xhr.addEventListener("abort", fail); + + xhr.responseType = "arraybuffer"; + try { + xhr.open("GET", url); + // Use conservative TLS settings. See bug 1325501. + // TODO move to ServiceRequest. + if (xhr.channel instanceof Ci.nsIHttpChannelInternal) { + xhr.channel.QueryInterface(Ci.nsIHttpChannelInternal).beConservative = true; + } + xhr.send(null); + } catch (ex) { + reject(ex); + } + }); +} + +/** + * Convert a string containing binary values to hex. + */ +function binaryToHex(input) { + let result = ""; + for (let i = 0; i < input.length; ++i) { + let hex = input.charCodeAt(i).toString(16); + if (hex.length == 1) { + hex = "0" + hex; + } + result += hex; + } + return result; +} + +/** + * Calculates the hash of a file. + * + * @param hashFunction + * The type of hash function to use, must be supported by nsICryptoHash. + * @param path + * The path of the file to hash. + * @return a promise that resolves to hash of the file or rejects with a JS + * exception in case of error. + */ +var computeHash = Task.async(function*(hashFunction, path) { + let file = yield OS.File.open(path, { existing: true, read: true }); + try { + let hasher = Cc["@mozilla.org/security/hash;1"]. + createInstance(Ci.nsICryptoHash); + hasher.initWithString(hashFunction); + + let bytes; + do { + bytes = yield file.read(HASH_CHUNK_SIZE); + hasher.update(bytes, bytes.length); + } while (bytes.length == HASH_CHUNK_SIZE); + + return binaryToHex(hasher.finish(false)); + } + finally { + yield file.close(); + } +}); + +/** + * Verifies that a downloaded file matches what was expected. + * + * @param properties + * The properties to check, `size` and `hashFunction` with `hashValue` + * are supported. Any properties missing won't be checked. + * @param path + * The path of the file to check. + * @return a promise that resolves if the file matched or rejects with a JS + * exception in case of error. + */ +var verifyFile = Task.async(function*(properties, path) { + if (properties.size !== undefined) { + let stat = yield OS.File.stat(path); + if (stat.size != properties.size) { + throw new Error("Downloaded file was " + stat.size + " bytes but expected " + properties.size + " bytes."); + } + } + + if (properties.hashFunction !== undefined) { + let expectedDigest = properties.hashValue.toLowerCase(); + let digest = yield computeHash(properties.hashFunction, path); + if (digest != expectedDigest) { + throw new Error("Hash was `" + digest + "` but expected `" + expectedDigest + "`."); + } + } +}); + +const ProductAddonChecker = { + /** + * Downloads a list of add-ons from a URL optionally testing the SSL + * certificate for certain attributes. + * + * @param url + * The url to download from. + * @param allowNonBuiltIn + * Whether to trust SSL certificates without a built-in CA issuer. + * @param allowedCerts + * The list of certificate attributes to match the SSL certificate + * against or null to skip checks. + * @return a promise that resolves to an object containing the list of add-ons + * and whether the local fallback was used, or rejects with a JS + * exception in case of error. + */ + getProductAddonList: function(url, allowNonBuiltIn = false, allowedCerts = null) { + if (!GMPPrefs.get(GMPPrefs.KEY_UPDATE_ENABLED, true)) { + logger.info("Updates are disabled via media.gmp-manager.updateEnabled"); + return Promise.resolve({usedFallback: true, gmpAddons: []}); + } + + return downloadXML(url, allowNonBuiltIn, allowedCerts) + .then(parseXML) + .catch(downloadLocalConfig); + }, + + /** + * Downloads an add-on to a local file and checks that it matches the expected + * file. The caller is responsible for deleting the temporary file returned. + * + * @param addon + * The addon to download. + * @return a promise that resolves to the temporary file downloaded or rejects + * with a JS exception in case of error. + */ + downloadAddon: Task.async(function*(addon) { + let path = yield downloadFile(addon.URL); + try { + yield verifyFile(addon, path); + return path; + } + catch (e) { + yield OS.File.remove(path); + throw e; + } + }) +} diff --git a/toolkit/mozapps/extensions/internal/moz.build b/toolkit/mozapps/extensions/internal/moz.build index efcd2af21..337df3104 100644 --- a/toolkit/mozapps/extensions/internal/moz.build +++ b/toolkit/mozapps/extensions/internal/moz.build @@ -5,12 +5,12 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. EXTRA_JS_MODULES.addons += [ - '../../webextensions/internal/ProductAddonChecker.jsm', 'AddonLogging.jsm', 'AddonRepository_SQLiteMigrator.jsm', 'Content.js', 'GMPProvider.jsm', 'LightweightThemeImageOptimizer.jsm', + 'ProductAddonChecker.jsm', 'SpellCheckDictionaryBootstrap.js', ] diff --git a/toolkit/mozapps/webextensions/amIAddonManager.idl b/toolkit/mozapps/webextensions/amIAddonManager.idl deleted file mode 100644 index 58a58b62d..000000000 --- a/toolkit/mozapps/webextensions/amIAddonManager.idl +++ /dev/null @@ -1,29 +0,0 @@ -/* 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/. */ - -#include "nsISupports.idl" - -interface nsIURI; - -/** - * A service to make some AddonManager functionality available to C++ callers. - * Javascript callers should still use AddonManager.jsm directly. - */ -[scriptable, function, uuid(7b45d82d-7ad5-48d7-9b05-f32eb9818cd4)] -interface amIAddonManager : nsISupports -{ - /** - * Synchronously map a URI to the corresponding Addon ID. - * - * Mappable URIs are limited to in-application resources belonging to the - * add-on, such as Javascript compartments, XUL windows, XBL bindings, etc. - * but do not include URIs from meta data, such as the add-on homepage. - * - * @param aURI - * The nsIURI to map - * @return - * true if the URI has been mapped successfully to an Addon ID - */ - boolean mapURIToAddonID(in nsIURI aURI, out AUTF8String aID); -}; diff --git a/toolkit/mozapps/webextensions/amIAddonPathService.idl b/toolkit/mozapps/webextensions/amIAddonPathService.idl deleted file mode 100644 index 9c9197a61..000000000 --- a/toolkit/mozapps/webextensions/amIAddonPathService.idl +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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/. */ - -#include "nsISupports.idl" - -interface nsIURI; - -/** - * This service maps file system paths where add-ons reside to the ID - * of the add-on. Paths are added by the add-on manager. They can - * looked up by anyone. - */ -[scriptable, uuid(fcd9e270-dfb1-11e3-8b68-0800200c9a66)] -interface amIAddonPathService : nsISupports -{ - /** - * Given a path to a file, return the ID of the add-on that the file belongs - * to. Returns an empty string if there is no add-on there. Note that if an - * add-on is located at /a/b/c, then looking up the path /a/b/c/d will return - * that add-on. - */ - AString findAddonId(in AString path); - - /** - * Call this function to inform the service that the given file system path is - * associated with the given add-on ID. - */ - void insertPath(in AString path, in AString addonId); - - /** - * Given a URI to a file, return the ID of the add-on that the file belongs - * to. Returns an empty string if there is no add-on there. - */ - AString mapURIToAddonId(in nsIURI aURI); -}; diff --git a/toolkit/mozapps/webextensions/amIWebInstallListener.idl b/toolkit/mozapps/webextensions/amIWebInstallListener.idl deleted file mode 100644 index eed108097..000000000 --- a/toolkit/mozapps/webextensions/amIWebInstallListener.idl +++ /dev/null @@ -1,134 +0,0 @@ -/* 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/. */ - -#include "nsISupports.idl" - -interface nsIDOMElement; -interface nsIURI; -interface nsIVariant; - -/** - * amIWebInstallInfo is used by the default implementation of - * amIWebInstallListener to communicate with the running application and allow - * it to warn the user about blocked installs and start the installs running. - */ -[scriptable, uuid(fa0b47a3-f819-47ac-bc66-4bd1d7f67b1d)] -interface amIWebInstallInfo : nsISupports -{ - readonly attribute nsIDOMElement browser; - readonly attribute nsIURI originatingURI; - readonly attribute nsIVariant installs; - - /** - * Starts all installs. - */ - void install(); -}; - -/** - * The registered amIWebInstallListener is used to notify about new installs - * triggered by websites. The default implementation displays a confirmation - * dialog when add-ons are ready to install and uses the observer service to - * notify when installations are blocked. - */ -[scriptable, uuid(d9240d4b-6b3a-4cad-b402-de6c93337e0c)] -interface amIWebInstallListener : nsISupports -{ - /** - * Called when installation by websites is currently disabled. - * - * @param aBrowser - * The browser that triggered the installs - * @param aUri - * The URI of the site that triggered the installs - * @param aInstalls - * The AddonInstalls that were blocked - * @param aCount - * The number of AddonInstalls - */ - void onWebInstallDisabled(in nsIDOMElement aBrowser, in nsIURI aUri, - [array, size_is(aCount)] in nsIVariant aInstalls, - [optional] in uint32_t aCount); - - /** - * Called when the website is not allowed to directly prompt the user to - * install add-ons. - * - * @param aBrowser - * The browser that triggered the installs - * @param aUri - * The URI of the site that triggered the installs - * @param aInstalls - * The AddonInstalls that were blocked - * @param aCount - * The number of AddonInstalls - * @return true if the caller should start the installs - */ - boolean onWebInstallBlocked(in nsIDOMElement aBrowser, in nsIURI aUri, - [array, size_is(aCount)] in nsIVariant aInstalls, - [optional] in uint32_t aCount); - - /** - * Called when a website wants to ask the user to install add-ons. - * - * @param aBrowser - * The browser that triggered the installs - * @param aUri - * The URI of the site that triggered the installs - * @param aInstalls - * The AddonInstalls that were requested - * @param aCount - * The number of AddonInstalls - * @return true if the caller should start the installs - */ - boolean onWebInstallRequested(in nsIDOMElement aBrowser, in nsIURI aUri, - [array, size_is(aCount)] in nsIVariant aInstalls, - [optional] in uint32_t aCount); -}; - -[scriptable, uuid(a80b89ad-bb1a-4c43-9cb7-3ae656556f78)] -interface amIWebInstallListener2 : nsISupports -{ - /** - * Called when a non-same-origin resource attempted to initiate an install. - * Installs will have already been cancelled and cannot be restarted. - * - * @param aBrowser - * The browser that triggered the installs - * @param aUri - * The URI of the site that triggered the installs - * @param aInstalls - * The AddonInstalls that were blocked - * @param aCount - * The number of AddonInstalls - */ - boolean onWebInstallOriginBlocked(in nsIDOMElement aBrowser, in nsIURI aUri, - [array, size_is(aCount)] in nsIVariant aInstalls, - [optional] in uint32_t aCount); -}; - -/** - * amIWebInstallPrompt is used, if available, by the default implementation of - * amIWebInstallInfo to display a confirmation UI to the user before running - * installs. - */ -[scriptable, uuid(386906f1-4d18-45bf-bc81-5dcd68e42c3b)] -interface amIWebInstallPrompt : nsISupports -{ - /** - * Get a confirmation that the user wants to start the installs. - * - * @param aBrowser - * The browser that triggered the installs - * @param aUri - * The URI of the site that triggered the installs - * @param aInstalls - * The AddonInstalls that were requested - * @param aCount - * The number of AddonInstalls - */ - void confirm(in nsIDOMElement aBrowser, in nsIURI aUri, - [array, size_is(aCount)] in nsIVariant aInstalls, - [optional] in uint32_t aCount); -}; diff --git a/toolkit/mozapps/webextensions/amIWebInstaller.idl b/toolkit/mozapps/webextensions/amIWebInstaller.idl deleted file mode 100644 index 6c5ebca67..000000000 --- a/toolkit/mozapps/webextensions/amIWebInstaller.idl +++ /dev/null @@ -1,82 +0,0 @@ -/* 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/. */ - -#include "nsISupports.idl" - -interface nsIDOMElement; -interface nsIVariant; -interface nsIURI; - -/** - * A callback function used to notify webpages when a requested install has - * ended. - * - * NOTE: This is *not* the same as InstallListener. - */ -[scriptable, function, uuid(bb22f5c0-3ca1-48f6-873c-54e87987700f)] -interface amIInstallCallback : nsISupports -{ - /** - * Called when an install completes or fails. - * - * @param aUrl - * The url of the add-on being installed - * @param aStatus - * 0 if the install was successful or negative if not - */ - void onInstallEnded(in AString aUrl, in int32_t aStatus); -}; - - -/** - * This interface is used to allow webpages to start installing add-ons. - */ -[scriptable, uuid(658d6c09-15e0-4688-bee8-8551030472a9)] -interface amIWebInstaller : nsISupports -{ - /** - * Checks if installation is enabled for a webpage. - * - * @param aMimetype - * The mimetype for the add-on to be installed - * @param referer - * The URL of the webpage trying to install an add-on - * @return true if installation is enabled - */ - boolean isInstallEnabled(in AString aMimetype, in nsIURI aReferer); - - /** - * Installs an array of add-ons at the request of a webpage - * - * @param aMimetype - * The mimetype for the add-ons - * @param aBrowser - * The browser installing the add-ons. - * @param aReferer - * The URI for the webpage installing the add-ons - * @param aUris - * The URIs of add-ons to be installed - * @param aHashes - * The hashes for the add-ons to be installed - * @param aNames - * The names for the add-ons to be installed - * @param aIcons - * The icons for the add-ons to be installed - * @param aCallback - * An optional callback to notify about installation success and - * failure - * @param aInstallCount - * An optional argument including the number of add-ons to install - * @return true if the installation was successfully started - */ - boolean installAddonsFromWebpage(in AString aMimetype, - in nsIDOMElement aBrowser, - in nsIURI aReferer, - [array, size_is(aInstallCount)] in wstring aUris, - [array, size_is(aInstallCount)] in wstring aHashes, - [array, size_is(aInstallCount)] in wstring aNames, - [array, size_is(aInstallCount)] in wstring aIcons, - [optional] in amIInstallCallback aCallback, - [optional] in uint32_t aInstallCount); -}; diff --git a/toolkit/mozapps/webextensions/content/OpenH264-license.txt b/toolkit/mozapps/webextensions/content/OpenH264-license.txt deleted file mode 100644 index ad37989b8..000000000 --- a/toolkit/mozapps/webextensions/content/OpenH264-license.txt +++ /dev/null @@ -1,59 +0,0 @@ -------------------------------------------------------- -About The Cisco-Provided Binary of OpenH264 Video Codec -------------------------------------------------------- - -Cisco provides this program under the terms of the BSD license. - -Additionally, this binary is licensed under Cisco’s AVC/H.264 Patent Portfolio License from MPEG LA, at no cost to you, provided that the requirements and conditions shown below in the AVC/H.264 Patent Portfolio sections are met. - -As with all AVC/H.264 codecs, you may also obtain your own patent license from MPEG LA or from the individual patent owners, or proceed at your own risk. Your rights from Cisco under the BSD license are not affected by this choice. - -For more information on the OpenH264 binary licensing, please see the OpenH264 FAQ found at http://www.openh264.org/faq.html#binary - -A corresponding source code to this binary program is available under the same BSD terms, which can be found at http://www.openh264.org - ------------ -BSD License ------------ - -Copyright © 2014 Cisco Systems, Inc. - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -2. 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. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ------------------------------------------ -AVC/H.264 Patent Portfolio License Notice ------------------------------------------ - -The binary form of this Software is distributed by Cisco under the AVC/H.264 Patent Portfolio License from MPEG LA, and is subject to the following requirements, which may or may not be applicable to your use of this software: - -THIS PRODUCT IS LICENSED UNDER THE AVC PATENT PORTFOLIO LICENSE FOR THE PERSONAL USE OF A CONSUMER OR OTHER USES IN WHICH IT DOES NOT RECEIVE REMUNERATION TO (i) ENCODE VIDEO IN COMPLIANCE WITH THE AVC STANDARD (“AVC VIDEO”) AND/OR (ii) DECODE AVC VIDEO THAT WAS ENCODED BY A CONSUMER ENGAGED IN A PERSONAL ACTIVITY AND/OR WAS OBTAINED FROM A VIDEO PROVIDER LICENSED TO PROVIDE AVC VIDEO. NO LICENSE IS GRANTED OR SHALL BE IMPLIED FOR ANY OTHER USE. ADDITIONAL INFORMATION MAY BE OBTAINED FROM MPEG LA, L.L.C. SEE HTTP://WWW.MPEGLA.COM - -Accordingly, please be advised that content providers and broadcasters using AVC/H.264 in their service may be required to obtain a separate use license from MPEG LA, referred to as "(b) sublicenses" in the SUMMARY OF AVC/H.264 LICENSE TERMS from MPEG LA found at http://www.openh264.org/mpegla - ---------------------------------------------- -AVC/H.264 Patent Portfolio License Conditions ---------------------------------------------- - -In addition, the Cisco-provided binary of this Software is licensed under Cisco's license from MPEG LA only if the following conditions are met: - -1. The Cisco-provided binary is separately downloaded to an end user’s device, and not integrated into or combined with third party software prior to being downloaded to the end user’s device; - -2. The end user must have the ability to control (e.g., to enable, disable, or re-enable) the use of the Cisco-provided binary; - -3. Third party software, in the location where end users can control the use of the Cisco-provided binary, must display the following text: - - "OpenH264 Video Codec provided by Cisco Systems, Inc." - -4. Any third-party software that makes use of the Cisco-provided binary must reproduce all of the above text, as well as this last condition, in the EULA and/or in another location where licensing information is to be presented to the end user. - - - - v1.0 diff --git a/toolkit/mozapps/webextensions/content/about.xul b/toolkit/mozapps/webextensions/content/about.xul deleted file mode 100644 index 6effcf37a..000000000 --- a/toolkit/mozapps/webextensions/content/about.xul +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - -