diff options
Diffstat (limited to 'toolkit/mozapps/webextensions')
23 files changed, 33 insertions, 1265 deletions
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 @@ -<?xml version="1.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/. --> - -<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> -<?xml-stylesheet href="chrome://mozapps/skin/extensions/about.css" type="text/css"?> - -<!DOCTYPE dialog SYSTEM "chrome://mozapps/locale/extensions/about.dtd"> - -<dialog id="genericAbout" - xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" - onload="init();" - buttons="accept" - buttoniconaccept="close" - onaccept="close();"> - - <script type="application/javascript" src="chrome://mozapps/content/extensions/about.js"/> - <script type="application/javascript" src="chrome://global/content/contentAreaUtils.js"/> - - <stringbundleset id="aboutSet"> - <stringbundle id="extensionsStrings" src="chrome://mozapps/locale/extensions/extensions.properties"/> - </stringbundleset> - - <vbox id="clientBox" flex="1"> - <hbox class="basic-info"> - <vbox pack="center"> - <image id="extensionIcon"/> - </vbox> - <vbox flex="1"> - <label id="extensionName"/> - <label id="extensionVersion" crop="end"/> - </vbox> - </hbox> - <description id="extensionDescription" class="boxIndent"/> - - <separator id="groove" class="groove"/> - - <vbox id="extensionDetailsBox" flex="1"> - <label id="extensionCreatorLabel" class="sectionTitle">&creator.label;</label> - <hbox id="creatorBox" class="boxIndent"> - <label id="extensionCreator" flex="1" crop="end"/> - <label id="extensionHomepage" onclick="if (event.button == 0) { loadHomepage(event); }" - class="text-link" value="&homepage.label;"/> - </hbox> - - <label id="extensionDevelopers" class="sectionTitle">&developers.label;</label> - <vbox flex="1" id="developersBox" class="boxIndent"/> - <label id="extensionTranslators" class="sectionTitle">&translators.label;</label> - <vbox flex="1" id="translatorsBox" class="boxIndent"/> - <label id="extensionContributors" class="sectionTitle">&contributors.label;</label> - <vbox flex="1" id="contributorsBox" class="boxIndent"/> - </vbox> - </vbox> - -</dialog> diff --git a/toolkit/mozapps/webextensions/content/blocklist.css b/toolkit/mozapps/webextensions/content/blocklist.css deleted file mode 100644 index cb48005a2..000000000 --- a/toolkit/mozapps/webextensions/content/blocklist.css +++ /dev/null @@ -1,11 +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/. */ - -.hardBlockedAddon { - -moz-binding: url("chrome://mozapps/content/extensions/blocklist.xml#hardblockedaddon"); -} - -.softBlockedAddon { - -moz-binding: url("chrome://mozapps/content/extensions/blocklist.xml#softblockedaddon"); -} diff --git a/toolkit/mozapps/webextensions/content/blocklist.xml b/toolkit/mozapps/webextensions/content/blocklist.xml deleted file mode 100644 index 74474392f..000000000 --- a/toolkit/mozapps/webextensions/content/blocklist.xml +++ /dev/null @@ -1,58 +0,0 @@ -<?xml version="1.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/. --> - -<!DOCTYPE bindings [ - <!ENTITY % blocklistDTD SYSTEM "chrome://mozapps/locale/extensions/blocklist.dtd" > - %blocklistDTD; -]> - -<bindings id="blocklistBindings" - xmlns="http://www.mozilla.org/xbl" - xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" - xmlns:xbl="http://www.mozilla.org/xbl"> - - <binding id="hardblockedaddon"> - <content align="start"> - <xul:image xbl:inherits="src=icon"/> - <xul:vbox flex="1"> - <xul:hbox class="addon-name-version"> - <xul:label class="addonName" crop="end" xbl:inherits="value=name"/> - <xul:label class="addonVersion" xbl:inherits="value=version"/> - </xul:hbox> - <xul:hbox> - <xul:spacer flex="1"/> - <xul:label class="blockedLabel" value="&blocklist.blocked.label;"/> - </xul:hbox> - </xul:vbox> - </content> - </binding> - - <binding id="softblockedaddon"> - <content align="start"> - <xul:image xbl:inherits="src=icon"/> - <xul:vbox flex="1"> - <xul:hbox class="addon-name-version"> - <xul:label class="addonName" crop="end" xbl:inherits="value=name"/> - <xul:label class="addonVersion" xbl:inherits="value=version"/> - </xul:hbox> - <xul:hbox> - <xul:spacer flex="1"/> - <xul:checkbox class="disableCheckbox" checked="true" label="&blocklist.checkbox.label;"/> - </xul:hbox> - </xul:vbox> - </content> - <implementation> - <field name="_checkbox"> - document.getAnonymousElementByAttribute(this, "class", "disableCheckbox") - </field> - <property name="checked" readonly="true"> - <getter> - return this._checkbox.checked; - </getter> - </property> - </implementation> - </binding> -</bindings> diff --git a/toolkit/mozapps/webextensions/content/blocklist.xul b/toolkit/mozapps/webextensions/content/blocklist.xul deleted file mode 100644 index 240d9e4e1..000000000 --- a/toolkit/mozapps/webextensions/content/blocklist.xul +++ /dev/null @@ -1,46 +0,0 @@ -<?xml version="1.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/. --> - -<?xml-stylesheet href="chrome://global/skin/"?> -<?xml-stylesheet href="chrome://mozapps/skin/extensions/blocklist.css"?> -<?xml-stylesheet href="chrome://mozapps/content/extensions/blocklist.css"?> - -<!DOCTYPE dialog [ -<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd"> -%brandDTD; -<!ENTITY % extensionsDTD SYSTEM "chrome://mozapps/locale/extensions/blocklist.dtd"> -%extensionsDTD; -]> - -<dialog windowtype="Addons:Blocklist" title="&blocklist.title;" align="stretch" - xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" - onload="init();" ondialogaccept="return finish(true)" - ondialogcancel="return finish(false)" - buttons="accept,cancel" style="&blocklist.style;" - buttonlabelaccept="&blocklist.accept.label;" - buttonaccesskeyaccept="&blocklist.accept.accesskey;"> - - <script type="application/javascript" src="chrome://global/content/globalOverlay.js"/> - <script type="application/javascript" src="chrome://mozapps/content/extensions/blocklist.js"/> - - <hbox align="stretch" flex="1"> - <vbox pack="start"> - <image class="error-icon"/> - </vbox> - <vbox flex="1"> - <label>&blocklist.summary;</label> - <separator class="thin"/> - <richlistbox id="addonList" flex="1"/> - <separator class="thin"/> - <description id="bothMessage" hidden="true" class="bold">&blocklist.softandhard;</description> - <description id="hardBlockMessage" hidden="true" class="bold">&blocklist.hardblocked;</description> - <description id="softBlockMessage" hidden="true" class="bold">&blocklist.softblocked;</description> - <hbox pack="start"> - <label id="moreInfo" class="text-link" value="&blocklist.moreinfo;"/> - </hbox> - </vbox> - </hbox> -</dialog> diff --git a/toolkit/mozapps/webextensions/content/eula.xul b/toolkit/mozapps/webextensions/content/eula.xul deleted file mode 100644 index 10e657951..000000000 --- a/toolkit/mozapps/webextensions/content/eula.xul +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.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/. --> - -<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> -<?xml-stylesheet href="chrome://mozapps/skin/extensions/eula.css" type="text/css"?> - -<!DOCTYPE window [ -<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd"> -%brandDTD; -<!ENTITY % extensionsDTD SYSTEM "chrome://mozapps/locale/extensions/extensions.dtd"> -%extensionsDTD; -]> - -<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" - title="&eula.title;" width="&eula.width;" height="&eula.height;" - buttons="accept,cancel" buttonlabelaccept="&eula.accept;" - ondialogaccept="window.arguments[0].accepted = true" - onload="Startup();"> - - <script type="application/javascript" src="chrome://mozapps/content/extensions/eula.js"/> - - <stringbundleset id="extensionsSet"> - <stringbundle id="extensionsStrings" src="chrome://mozapps/locale/extensions/extensions.properties"/> - </stringbundleset> - - <hbox id="heading-container"> - <image id="icon"/> - <label id="heading" flex="1"/> - </hbox> - - <textbox id="eula" multiline="true" readonly="true" flex="1"/> -</dialog> diff --git a/toolkit/mozapps/webextensions/content/gmpPrefs.xul b/toolkit/mozapps/webextensions/content/gmpPrefs.xul deleted file mode 100644 index ea7ee92fa..000000000 --- a/toolkit/mozapps/webextensions/content/gmpPrefs.xul +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.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/. --> - -<!-- This is intentionally empty and a dummy to let the GMPProvider - have a preferences button in the list view. --> diff --git a/toolkit/mozapps/webextensions/content/list.xul b/toolkit/mozapps/webextensions/content/list.xul deleted file mode 100644 index 65efeb6a2..000000000 --- a/toolkit/mozapps/webextensions/content/list.xul +++ /dev/null @@ -1,44 +0,0 @@ -<?xml version="1.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/. --> - -<?xml-stylesheet href="chrome://global/skin/"?> - -<dialog id="addonList" windowtype="Addons:List" - xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" - onunload="shutdown();" - buttons="accept,cancel" onload="init();"> - - <script type="application/javascript" src="chrome://global/content/globalOverlay.js"/> - <script type="application/javascript" - src="chrome://mozapps/content/extensions/list.js"/> - - <stringbundle id="extensionsBundle" - src="chrome://mozapps/locale/extensions/extensions.properties"/> - <stringbundle id="brandBundle" - src="chrome://branding/locale/brand.properties"/> - - <hbox align="start"> - <vbox> - <image id="infoIcon"/> - </vbox> - <vbox class="spaced" style="min-width: 20em; max-width: 40em"> - <label id="message1" class="spaced" hidden="true"/> - <separator class="thin"/> - <tree id="addonsTree" rows="6" hidecolumnpicker="true" hidden="true" class="spaced"> - <treecols style="max-width: 25em;"> - <treecol flex="1" id="nameColumn" hideheader="true"/> - </treecols> - <treechildren id="addonsChildren"/> - </tree> - <label id="message2" class="spaced" hidden="true"/> - <label class="bold spaced" id="message3" hidden="true"/> - <hbox id="moreInfoBox" hidden="true"> - <label id="moreInfo" class="text-link spaced"/> - <spacer flex="1"/> - </hbox> - </vbox> - </hbox> -</dialog> diff --git a/toolkit/mozapps/webextensions/content/pluginPrefs.xul b/toolkit/mozapps/webextensions/content/pluginPrefs.xul deleted file mode 100644 index c3fdbfa5b..000000000 --- a/toolkit/mozapps/webextensions/content/pluginPrefs.xul +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.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/. --> - -<!DOCTYPE window SYSTEM "chrome://pluginproblem/locale/pluginproblem.dtd"> - -<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> - <setting type="control" title="&plugin.file;"> - <label class="text-list" id="pluginLibraries"/> - </setting> - <setting type="control" title="&plugin.mimeTypes;"> - <label class="text-list" id="pluginMimeTypes"/> - </setting> - <setting type="bool" pref="dom.ipc.plugins.flash.disable-protected-mode" - inverted="true" title="&plugin.flashProtectedMode.label;" - id="pluginEnableProtectedMode" - learnmore="https://support.mozilla.org/kb/flash-protected-mode-settings" /> -</vbox> diff --git a/toolkit/mozapps/webextensions/content/updateinfo.xsl b/toolkit/mozapps/webextensions/content/updateinfo.xsl deleted file mode 100644 index 5fcccd6d7..000000000 --- a/toolkit/mozapps/webextensions/content/updateinfo.xsl +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- 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/. --> - -<xsl:stylesheet version="1.0" xmlns:xhtml="http://www.w3.org/1999/xhtml" - xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> - - <!-- Any elements not otherwise specified will be stripped but the contents - will be displayed. All attributes are stripped from copied elements. --> - - <!-- Block these elements and their contents --> - <xsl:template match="xhtml:head|xhtml:script|xhtml:style"> - </xsl:template> - - <!-- Allowable styling elements --> - <xsl:template match="xhtml:b|xhtml:i|xhtml:em|xhtml:strong|xhtml:u|xhtml:q|xhtml:sub|xhtml:sup|xhtml:code"> - <xsl:copy><xsl:apply-templates/></xsl:copy> - </xsl:template> - - <!-- Allowable block formatting elements --> - <xsl:template match="xhtml:h1|xhtml:h2|xhtml:h3|xhtml:p|xhtml:div|xhtml:blockquote|xhtml:pre"> - <xsl:copy><xsl:apply-templates/></xsl:copy> - </xsl:template> - - <!-- Allowable list formatting elements --> - <xsl:template match="xhtml:ul|xhtml:ol|xhtml:li|xhtml:dl|xhtml:dt|xhtml:dd"> - <xsl:copy><xsl:apply-templates/></xsl:copy> - </xsl:template> - - <!-- These elements are copied and their contents dropped --> - <xsl:template match="xhtml:br|xhtml:hr"> - <xsl:copy/> - </xsl:template> - - <!-- The root document --> - <xsl:template match="/"> - <xhtml:body><xsl:apply-templates/></xhtml:body> - </xsl:template> - -</xsl:stylesheet> diff --git a/toolkit/mozapps/webextensions/content/xpinstallConfirm.css b/toolkit/mozapps/webextensions/content/xpinstallConfirm.css deleted file mode 100644 index 583facfec..000000000 --- a/toolkit/mozapps/webextensions/content/xpinstallConfirm.css +++ /dev/null @@ -1,8 +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/. */ - -installitem { - -moz-binding: url("chrome://mozapps/content/xpinstall/xpinstallItem.xml#installitem"); - display: -moz-box; -} diff --git a/toolkit/mozapps/webextensions/content/xpinstallConfirm.xul b/toolkit/mozapps/webextensions/content/xpinstallConfirm.xul deleted file mode 100644 index f1c29eb73..000000000 --- a/toolkit/mozapps/webextensions/content/xpinstallConfirm.xul +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.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/. --> - -<?xml-stylesheet href="chrome://mozapps/content/xpinstall/xpinstallConfirm.css" type="text/css"?> -<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> -<?xml-stylesheet href="chrome://mozapps/skin/xpinstall/xpinstallConfirm.css" type="text/css"?> - -<!DOCTYPE dialog SYSTEM "chrome://mozapps/locale/xpinstall/xpinstallConfirm.dtd"> - -<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" - id="xpinstallConfirm" title="&dialog.title;" style="&dialog.style;" - windowtype="Addons:Install" - onload="XPInstallConfirm.init()" - ondialogaccept="return XPInstallConfirm.onOK();" - ondialogcancel="return XPInstallConfirm.onCancel();"> - - <script src="chrome://mozapps/content/xpinstall/xpinstallConfirm.js" type="application/javascript"/> - - <stringbundle id="xpinstallConfirmStrings" - src="chrome://mozapps/locale/xpinstall/xpinstallConfirm.properties"/> - - <vbox flex="1" id="dialogContentBox"> - <hbox id="xpinstallheader" align="start"> - <image class="alert-icon"/> - <vbox flex="1"> - <description class="warning">&warningPrimary.label;</description> - <description>&warningSecondary.label;</description> - </vbox> - </hbox> - <label id="itemWarningIntro"/> - <vbox id="itemList" class="listbox" flex="1" style="overflow: auto;"/> - </vbox> - -</dialog> diff --git a/toolkit/mozapps/webextensions/content/xpinstallItem.xml b/toolkit/mozapps/webextensions/content/xpinstallItem.xml deleted file mode 100644 index 5146af84f..000000000 --- a/toolkit/mozapps/webextensions/content/xpinstallItem.xml +++ /dev/null @@ -1,51 +0,0 @@ -<?xml version="1.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/. --> - - -<!DOCTYPE bindings SYSTEM "chrome://mozapps/locale/xpinstall/xpinstallConfirm.dtd"> - -<bindings id="xpinstallItemBindings" - xmlns="http://www.mozilla.org/xbl" - xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" - xmlns:xbl="http://www.mozilla.org/xbl"> - - <binding id="installitem"> - <resources> - <stylesheet src="chrome://mozapps/skin/xpinstall/xpinstallConfirm.css"/> - </resources> - <content> - <xul:hbox flex="1"> - <xul:vbox align="center" pack="center" class="xpinstallIconContainer"> - <xul:image class="xpinstallItemIcon" xbl:inherits="src=icon"/> - </xul:vbox> - <xul:vbox flex="1" pack="center"> - <xul:hbox class="xpinstallItemNameRow" align="center"> - <xul:label class="xpinstallItemName" xbl:inherits="value=name" crop="right"/> - <xul:label class="xpinstallItemSigned" xbl:inherits="value=cert,signed"/> - </xul:hbox> - <xul:hbox class="xpinstallItemDetailsRow" align="center"> - <xul:textbox class="xpinstallItemURL" xbl:inherits="value=url" flex="1" readonly="true" crop="right"/> - </xul:hbox> - </xul:vbox> - </xul:hbox> - </content> - <implementation> - <property name="name" onset="this.setAttribute('name', val); return val;" - onget="return this.getAttribute('name');"/> - <property name="cert" onset="this.setAttribute('cert', val); return val;" - onget="return this.getAttribute('cert');"/> - <property name="signed" onset="this.setAttribute('signed', val); return val;" - onget="return this.getAttribute('signed');"/> - <property name="url" onset="this.setAttribute('url', val); return val;" - onget="return this.getAttribute('url');"/> - <property name="icon" onset="this.setAttribute('icon', val); return val;" - onget="return this.getAttribute('icon');"/> - <property name="type" onset="this.setAttribute('type', val); return val;" - onget="return this.getAttribute('type');"/> - </implementation> - </binding> - -</bindings> - diff --git a/toolkit/mozapps/webextensions/internal/AddonUpdateChecker.jsm b/toolkit/mozapps/webextensions/internal/AddonUpdateChecker.jsm index bdd3a81e7..78b52d21a 100644 --- a/toolkit/mozapps/webextensions/internal/AddonUpdateChecker.jsm +++ b/toolkit/mozapps/webextensions/internal/AddonUpdateChecker.jsm @@ -26,6 +26,12 @@ const XMLURI_PARSE_ERROR = "http://www.mozilla.org/newlayout/xml/parsererror. const PREF_UPDATE_REQUIREBUILTINCERTS = "extensions.update.requireBuiltInCerts"; +#ifdef MOZ_PHOENIX +const PREF_EM_MIN_COMPAT_PLATFORM_VERSION = "extensions.minCompatiblePlatformVersion"; +const FIREFOX_ID = "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}" +const FIREFOX_APPCOMPATVERSION = "56.9" +#endif + Components.utils.import("resource://gre/modules/Services.jsm"); Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); @@ -446,6 +452,7 @@ function parseRDFManifest(aId, aUpdateKey, aRequest, aManifestData) { * @throws if the update manifest is invalid in any way */ function parseJSONManifest(aId, aUpdateKey, aRequest, aManifestData) { +#ifdef MOZ_PHOENIX if (aUpdateKey) throw Components.Exception("Update keys are not supported for JSON update manifests"); @@ -515,10 +522,10 @@ function parseJSONManifest(aId, aUpdateKey, aRequest, aManifestData) { let app = getProperty(applications, "gecko", "object"); let appEntry = { - id: TOOLKIT_ID, + id: FIREFOX_ID, minVersion: getProperty(app, "strict_min_version", "string", - AddonManagerPrivate.webExtensionsMinPlatformVersion), - maxVersion: "*", + Services.prefs.getCharPref(PREF_EM_MIN_COMPAT_PLATFORM_VERSION)), + maxVersion: FIREFOX_APPCOMPATVERSION, }; let result = { @@ -539,7 +546,6 @@ function parseJSONManifest(aId, aUpdateKey, aRequest, aManifestData) { } appEntry.maxVersion = getProperty(app, "strict_max_version", "string"); - result.strictCompatibility = appEntry.maxVersion != "*"; } else if ("advisory_max_version" in app) { appEntry.maxVersion = getProperty(app, "advisory_max_version", "string"); } @@ -551,6 +557,9 @@ function parseJSONManifest(aId, aUpdateKey, aRequest, aManifestData) { results.push(result); } return results; +#else + throw Components.Exception("This application does not support JSON update manifests"); +#endif } /** diff --git a/toolkit/mozapps/webextensions/internal/ProductAddonChecker.jsm b/toolkit/mozapps/webextensions/internal/ProductAddonChecker.jsm deleted file mode 100644 index f98dd2a94..000000000 --- a/toolkit/mozapps/webextensions/internal/ProductAddonChecker.jsm +++ /dev/null @@ -1,467 +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/. */ - -"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 <addons> 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/webextensions/internal/SpellCheckDictionaryBootstrap.js b/toolkit/mozapps/webextensions/internal/SpellCheckDictionaryBootstrap.js deleted file mode 100644 index f4f557fc2..000000000 --- a/toolkit/mozapps/webextensions/internal/SpellCheckDictionaryBootstrap.js +++ /dev/null @@ -1,17 +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/. */ - -var hunspell, dir; - -function startup(data) { - hunspell = Components.classes["@mozilla.org/spellchecker/engine;1"] - .getService(Components.interfaces.mozISpellCheckingEngine); - dir = data.installPath.clone(); - dir.append("dictionaries"); - hunspell.addDirectory(dir); -} - -function shutdown() { - hunspell.removeDirectory(dir); -} diff --git a/toolkit/mozapps/webextensions/internal/moz.build b/toolkit/mozapps/webextensions/internal/moz.build index 28c34f8c9..e3b54ed3b 100644 --- a/toolkit/mozapps/webextensions/internal/moz.build +++ b/toolkit/mozapps/webextensions/internal/moz.build @@ -5,17 +5,16 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. EXTRA_JS_MODULES.addons += [ + '../../extensions/internal/ProductAddonChecker.jsm', + '../../extensions/internal/SpellCheckDictionaryBootstrap.js', 'AddonLogging.jsm', 'AddonRepository.jsm', 'AddonRepository_SQLiteMigrator.jsm', - 'AddonUpdateChecker.jsm', 'APIExtensionBootstrap.js', 'Content.js', 'E10SAddonsRollout.jsm', 'GMPProvider.jsm', 'LightweightThemeImageOptimizer.jsm', - 'ProductAddonChecker.jsm', - 'SpellCheckDictionaryBootstrap.js', 'WebExtensionBootstrap.js', 'XPIProvider.jsm', 'XPIProviderUtils.js', @@ -33,4 +32,5 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android': EXTRA_PP_JS_MODULES.addons += [ 'AddonConstants.jsm', + 'AddonUpdateChecker.jsm', ] diff --git a/toolkit/mozapps/webextensions/jar.mn b/toolkit/mozapps/webextensions/jar.mn index 77cbf32eb..6da7dc893 100644 --- a/toolkit/mozapps/webextensions/jar.mn +++ b/toolkit/mozapps/webextensions/jar.mn @@ -9,27 +9,27 @@ toolkit.jar: content/mozapps/extensions/extensions.css (content/extensions.css) * content/mozapps/extensions/extensions.js (content/extensions.js) * content/mozapps/extensions/extensions.xml (content/extensions.xml) - content/mozapps/extensions/updateinfo.xsl (content/updateinfo.xsl) - content/mozapps/extensions/about.xul (content/about.xul) + content/mozapps/extensions/updateinfo.xsl (../extensions/content/updateinfo.xsl) + content/mozapps/extensions/about.xul (../extensions/content/about.xul) content/mozapps/extensions/about.js (content/about.js) - content/mozapps/extensions/list.xul (content/list.xul) + content/mozapps/extensions/list.xul (../extensions/content/list.xul) content/mozapps/extensions/list.js (content/list.js) - content/mozapps/extensions/blocklist.xul (content/blocklist.xul) + content/mozapps/extensions/blocklist.xul (../extensions/content/blocklist.xul) content/mozapps/extensions/blocklist.js (content/blocklist.js) - content/mozapps/extensions/blocklist.css (content/blocklist.css) - content/mozapps/extensions/blocklist.xml (content/blocklist.xml) + content/mozapps/extensions/blocklist.css (../extensions/content/blocklist.css) + content/mozapps/extensions/blocklist.xml (../extensions/content/blocklist.xml) * content/mozapps/extensions/update.xul (content/update.xul) content/mozapps/extensions/update.js (content/update.js) - content/mozapps/extensions/eula.xul (content/eula.xul) + content/mozapps/extensions/eula.xul (../extensions/content/eula.xul) content/mozapps/extensions/eula.js (content/eula.js) content/mozapps/extensions/newaddon.xul (content/newaddon.xul) content/mozapps/extensions/newaddon.js (content/newaddon.js) - content/mozapps/extensions/pluginPrefs.xul (content/pluginPrefs.xul) - content/mozapps/extensions/gmpPrefs.xul (content/gmpPrefs.xul) - content/mozapps/extensions/OpenH264-license.txt (content/OpenH264-license.txt) + content/mozapps/extensions/pluginPrefs.xul (../extensions/content/pluginPrefs.xul) + content/mozapps/extensions/gmpPrefs.xul (../extensions/content/gmpPrefs.xul) + content/mozapps/extensions/OpenH264-license.txt (../extensions/content/OpenH264-license.txt) #endif content/mozapps/extensions/setting.xml (content/setting.xml) - content/mozapps/xpinstall/xpinstallConfirm.xul (content/xpinstallConfirm.xul) + content/mozapps/xpinstall/xpinstallConfirm.xul (../extensions/content/xpinstallConfirm.xul) content/mozapps/xpinstall/xpinstallConfirm.js (content/xpinstallConfirm.js) - content/mozapps/xpinstall/xpinstallConfirm.css (content/xpinstallConfirm.css) - content/mozapps/xpinstall/xpinstallItem.xml (content/xpinstallItem.xml) + content/mozapps/xpinstall/xpinstallConfirm.css (../extensions/content/xpinstallConfirm.css) + content/mozapps/xpinstall/xpinstallItem.xml (../extensions/content/xpinstallItem.xml) diff --git a/toolkit/mozapps/webextensions/moz.build b/toolkit/mozapps/webextensions/moz.build index 30152676a..d039ac68c 100644 --- a/toolkit/mozapps/webextensions/moz.build +++ b/toolkit/mozapps/webextensions/moz.build @@ -10,10 +10,10 @@ DIRS += ['internal'] TEST_DIRS += ['test'] XPIDL_SOURCES += [ - 'amIAddonManager.idl', - 'amIAddonPathService.idl', - 'amIWebInstaller.idl', - 'amIWebInstallListener.idl', + '../extensions/amIAddonManager.idl', + '../extensions/amIAddonPathService.idl', + '../extensions/amIWebInstaller.idl', + '../extensions/amIWebInstallListener.idl', ] XPIDL_MODULE = 'extensions' |