Bug 476430: Disable third-party add-ons by default and offer them to the user. r=Unfocused, r=robstrong
This commit is contained in:
Родитель
2b3ff83d59
Коммит
ea87cb4f00
|
@ -74,6 +74,11 @@ pref("extensions.blocklist.itemURL", "https://addons.mozilla.org/%LOCALE%/%APP%/
|
|||
|
||||
pref("extensions.update.autoUpdateDefault", true);
|
||||
|
||||
// Disable add-ons installed into the shared user and shared system areas by
|
||||
// default. This does not include the application directory. See the SCOPE
|
||||
// constants in AddonManager.jsm for values to use here
|
||||
pref("extensions.autoDisableScopes", 10);
|
||||
|
||||
// Dictionary download preference
|
||||
pref("browser.dictionaries.download.url", "https://addons.mozilla.org/%LOCALE%/firefox/dictionaries/");
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
|||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/AddonManager.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "NetUtil", function() {
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
@ -399,6 +400,21 @@ BrowserGlue.prototype = {
|
|||
// been warned about them yet, open the plugins update page.
|
||||
if (Services.prefs.getBoolPref(PREF_PLUGINS_NOTIFYUSER))
|
||||
this._showPluginUpdatePage();
|
||||
|
||||
// For any add-ons that were installed disabled and can be enabled offer
|
||||
// them to the user
|
||||
var win = this.getMostRecentBrowserWindow();
|
||||
var browser = win.gBrowser;
|
||||
var changedIDs = AddonManager.getStartupChanges(AddonManager.STARTUP_CHANGE_INSTALLED);
|
||||
AddonManager.getAddonsByIDs(changedIDs, function(aAddons) {
|
||||
aAddons.forEach(function(aAddon) {
|
||||
// If the add-on isn't user disabled or can't be enabled then skip it
|
||||
if (!aAddon.userDisabled || !(aAddon.permissions & AddonManager.PERM_CAN_ENABLE))
|
||||
return;
|
||||
|
||||
browser.selectedTab = browser.addTab("about:newaddon?id=" + aAddon.id);
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
_onQuitRequest: function BG__onQuitRequest(aCancelQuit, aQuitType) {
|
||||
|
|
|
@ -90,6 +90,8 @@ static RedirEntry kRedirMap[] = {
|
|||
nsIAboutModule::ALLOW_SCRIPT },
|
||||
{ "addons", "chrome://mozapps/content/extensions/extensions.xul",
|
||||
nsIAboutModule::ALLOW_SCRIPT },
|
||||
{ "newaddon", "chrome://mozapps/content/extensions/newaddon.xul",
|
||||
nsIAboutModule::ALLOW_SCRIPT },
|
||||
{ "support", "chrome://global/content/aboutSupport.xhtml",
|
||||
nsIAboutModule::ALLOW_SCRIPT }
|
||||
};
|
||||
|
|
|
@ -212,6 +212,7 @@ const mozilla::Module::ContractIDEntry kDocShellContracts[] = {
|
|||
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "neterror", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
|
||||
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "memory", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
|
||||
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "addons", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
|
||||
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "newaddon", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
|
||||
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "support", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
|
||||
{ NS_URI_LOADER_CONTRACTID, &kNS_URI_LOADER_CID },
|
||||
{ NS_DOCUMENTLOADER_SERVICE_CONTRACTID, &kNS_DOCUMENTLOADER_SERVICE_CID },
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<!ENTITY title "Install Add-on">
|
||||
<!ENTITY intro "Another program on your computer would like to modify
|
||||
&brandShortName; with the following add-on:">
|
||||
<!ENTITY warning "Install add-ons only from authors whom you trust.">
|
||||
<!ENTITY allow "Allow this installation">
|
||||
<!ENTITY later "You can always change your mind at any time by going
|
||||
to the Add-ons Manager.">
|
||||
<!ENTITY continue "Continue">
|
||||
<!ENTITY restartMessage "You must restart &brandShortName; to finish installing this add-on.">
|
||||
<!ENTITY restartButton "Restart &brandShortName;">
|
||||
<!ENTITY cancelButton "Cancel">
|
|
@ -0,0 +1,6 @@
|
|||
#LOCALIZATION NOTE (name) %1$S is the add-on name, %2$S is the add-on version
|
||||
name=%1$S %2$S
|
||||
#LOCALIZATION NOTE (author) %S is the author of the add-on
|
||||
author=By %S
|
||||
#LOCALIZATION NOTE (location) %S is the path the add-on is installed in
|
||||
location=Location: %S
|
|
@ -85,6 +85,8 @@
|
|||
locale/@AB_CD@/mozapps/extensions/about.dtd (%chrome/mozapps/extensions/about.dtd)
|
||||
locale/@AB_CD@/mozapps/extensions/update.dtd (%chrome/mozapps/extensions/update.dtd)
|
||||
locale/@AB_CD@/mozapps/extensions/update.properties (%chrome/mozapps/extensions/update.properties)
|
||||
locale/@AB_CD@/mozapps/extensions/newaddon.dtd (%chrome/mozapps/extensions/newaddon.dtd)
|
||||
locale/@AB_CD@/mozapps/extensions/newaddon.properties (%chrome/mozapps/extensions/newaddon.properties)
|
||||
locale/@AB_CD@/mozapps/handling/handling.dtd (%chrome/mozapps/handling/handling.dtd)
|
||||
locale/@AB_CD@/mozapps/handling/handling.properties (%chrome/mozapps/handling/handling.properties)
|
||||
locale/@AB_CD@/mozapps/plugins/plugins.dtd (%chrome/mozapps/plugins/plugins.dtd)
|
||||
|
|
|
@ -0,0 +1,162 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Extension Manager UI.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* the Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Dave Townsend <dtownsend@oxymoronical.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/AddonManager.jsm");
|
||||
|
||||
var gAddon = null;
|
||||
|
||||
// If the user enables the add-on through some other UI close this window
|
||||
var EnableListener = {
|
||||
onEnabling: function(aAddon) {
|
||||
if (aAddon.id == gAddon.id)
|
||||
window.close();
|
||||
}
|
||||
}
|
||||
AddonManager.addAddonListener(EnableListener);
|
||||
|
||||
function initialize() {
|
||||
// About URIs don't implement nsIURL so we have to find the query string
|
||||
// manually
|
||||
let spec = document.documentURIObject.spec;
|
||||
let pos = spec.indexOf("?");
|
||||
let query = "";
|
||||
if (pos >= 0)
|
||||
query = spec.substring(pos + 1);
|
||||
|
||||
let bundle = Services.strings.createBundle("chrome://mozapps/locale/extensions/newaddon.properties");
|
||||
|
||||
// Just assume the query is "id=<id>"
|
||||
let id = query.substring(3);
|
||||
if (!id) {
|
||||
window.close();
|
||||
return;
|
||||
}
|
||||
|
||||
AddonManager.getAddonByID(id, function(aAddon) {
|
||||
// If the add-on doesn't exist or it is already enabled or it cannot be
|
||||
// enabled then this UI is useless, just close it. This shouldn't normally
|
||||
// happen unless session restore restores the tab
|
||||
if (!aAddon || !aAddon.userDisabled ||
|
||||
!(aAddon.permissions & AddonManager.PERM_CAN_ENABLE)) {
|
||||
window.close();
|
||||
return;
|
||||
}
|
||||
|
||||
gAddon = aAddon;
|
||||
|
||||
document.getElementById("addon-info").setAttribute("type", aAddon.type);
|
||||
|
||||
let icon = document.getElementById("icon");
|
||||
if (aAddon.icon64URL)
|
||||
icon.src = aAddon.icon64URL;
|
||||
else if (aAddon.iconURL)
|
||||
icon.src = aAddon.iconURL;
|
||||
|
||||
let name = bundle.formatStringFromName("name", [aAddon.name, aAddon.version],
|
||||
2);
|
||||
document.getElementById("name").value = name
|
||||
|
||||
if (aAddon.creator) {
|
||||
let creator = bundle.formatStringFromName("author", [aAddon.creator], 1);
|
||||
document.getElementById("author").value = creator;
|
||||
} else {
|
||||
document.getElementById("author").hidden = true;
|
||||
}
|
||||
|
||||
let uri = "getResourceURI" in aAddon ? aAddon.getResourceURI() : null;
|
||||
let locationLabel = document.getElementById("location");
|
||||
if (uri instanceof Ci.nsIFileURL) {
|
||||
let location = bundle.formatStringFromName("location", [uri.file.path], 1);
|
||||
locationLabel.value = location;
|
||||
locationLabel.setAttribute("tooltiptext", location);
|
||||
} else {
|
||||
document.getElementById("location").hidden = true;
|
||||
}
|
||||
|
||||
var event = document.createEvent("Events");
|
||||
event.initEvent("AddonDisplayed", true, true);
|
||||
document.dispatchEvent(event);
|
||||
});
|
||||
}
|
||||
|
||||
function unload() {
|
||||
AddonManager.removeAddonListener(EnableListener);
|
||||
}
|
||||
|
||||
function continueClicked() {
|
||||
AddonManager.removeAddonListener(EnableListener);
|
||||
|
||||
if (document.getElementById("allow").checked) {
|
||||
gAddon.userDisabled = false;
|
||||
|
||||
if (gAddon.pendingOperations & AddonManager.PENDING_ENABLE) {
|
||||
document.getElementById("allow").disabled = true;
|
||||
document.getElementById("buttonDeck").selectedPanel = document.getElementById("restartPanel");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
window.close();
|
||||
}
|
||||
|
||||
function restartClicked() {
|
||||
let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"].
|
||||
createInstance(Ci.nsISupportsPRBool);
|
||||
Services.obs.notifyObservers(cancelQuit, "quit-application-requested",
|
||||
"restart");
|
||||
if (cancelQuit.data)
|
||||
return; // somebody canceled our quit request
|
||||
|
||||
window.close();
|
||||
|
||||
let appStartup = Components.classes["@mozilla.org/toolkit/app-startup;1"].
|
||||
getService(Components.interfaces.nsIAppStartup);
|
||||
appStartup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
|
||||
}
|
||||
|
||||
function cancelClicked() {
|
||||
gAddon.userDisabled = true;
|
||||
AddonManager.addAddonListener(EnableListener);
|
||||
|
||||
document.getElementById("allow").disabled = false;
|
||||
document.getElementById("buttonDeck").selectedPanel = document.getElementById("continuePanel");
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is the Extension Manager UI.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- the Mozilla Foundation.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2011
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
- Dave Townsend <dtownsend@oxymoronical.com>
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mozapps/skin/extensions/newaddon.css"?>
|
||||
|
||||
<!DOCTYPE page [
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
|
||||
%brandDTD;
|
||||
<!ENTITY % newaddonDTD SYSTEM "chrome://mozapps/locale/extensions/newaddon.dtd">
|
||||
%newaddonDTD;
|
||||
]>
|
||||
|
||||
<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xhtml="http://www.w3.org/1999/xhtml" title="&title;"
|
||||
disablefastfind="true" id="addon-page" onload="initialize()"
|
||||
onunload="unload()" role="application" align="stretch" pack="stretch">
|
||||
|
||||
<xhtml:link rel="shortcut icon" style="display: none"
|
||||
href="chrome://mozapps/skin/extensions/extensionGeneric-16.png"/>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mozapps/content/extensions/newaddon.js"/>
|
||||
|
||||
<scrollbox id="addon-scrollbox" align="center">
|
||||
<spacer id="spacer-start"/>
|
||||
|
||||
<vbox id="addon-container" class="main-content">
|
||||
<description>&intro;</description>
|
||||
|
||||
<hbox id="addon-info">
|
||||
<image id="icon"/>
|
||||
<vbox flex="1">
|
||||
<label id="name"/>
|
||||
<label id="author"/>
|
||||
<label id="location" crop="end"/>
|
||||
</vbox>
|
||||
</hbox>
|
||||
|
||||
<hbox id="warning">
|
||||
<image id="warning-icon"/>
|
||||
<description flex="1">&warning;</description>
|
||||
</hbox>
|
||||
|
||||
<checkbox id="allow" label="&allow;"/>
|
||||
<description id="later">&later;</description>
|
||||
|
||||
<deck id="buttonDeck">
|
||||
<hbox id="continuePanel">
|
||||
<button id="continue-button" label="&continue;"
|
||||
oncommand="continueClicked()"/>
|
||||
</hbox>
|
||||
<hbox id="restartPanel">
|
||||
<spacer id="restartSpacer"/>
|
||||
<description id="restartMessage" flex="1">&restartMessage;</description>
|
||||
<button id="restart-button" label="&restartButton;" oncommand="restartClicked()"/>
|
||||
<button id="cancel-button" label="&cancelButton;" oncommand="cancelClicked()"/>
|
||||
</hbox>
|
||||
</deck>
|
||||
</vbox>
|
||||
|
||||
<spacer id="spacer-end"/>
|
||||
</scrollbox>
|
||||
</page>
|
|
@ -18,4 +18,6 @@ toolkit.jar:
|
|||
* content/mozapps/extensions/update.js (content/update.js)
|
||||
* content/mozapps/extensions/eula.xul (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/setting.xml (content/setting.xml)
|
||||
|
|
|
@ -98,6 +98,7 @@ _TEST_FILES = \
|
|||
browser_bug623950.js \
|
||||
browser_updatessl.js \
|
||||
browser_installssl.js \
|
||||
browser_newaddon.js \
|
||||
$(NULL)
|
||||
|
||||
_TEST_RESOURCES = \
|
||||
|
|
|
@ -0,0 +1,186 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
// Tests the new add-on tab
|
||||
|
||||
var gProvider;
|
||||
|
||||
function loadPage(aURL, aCallback) {
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.loadURI(aURL);
|
||||
gBrowser.addEventListener("AddonDisplayed", function(event) {
|
||||
gBrowser.removeEventListener("AddonDisplayed", arguments.callee, false);
|
||||
|
||||
aCallback(gBrowser.selectedTab);
|
||||
});
|
||||
}
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
gProvider = new MockProvider();
|
||||
|
||||
gProvider.createAddons([{
|
||||
id: "addon1@tests.mozilla.org",
|
||||
name: "Test 1",
|
||||
version: "5.3",
|
||||
userDisabled: true,
|
||||
operationsRequiringRestart: AddonManager.OP_NEEDS_RESTART_NONE
|
||||
}, {
|
||||
id: "addon2@tests.mozilla.org",
|
||||
name: "Test 2",
|
||||
version: "7.1",
|
||||
creator: "Dave Townsend",
|
||||
userDisabled: true
|
||||
}]);
|
||||
|
||||
run_next_test();
|
||||
}
|
||||
|
||||
function end_test() {
|
||||
finish();
|
||||
}
|
||||
|
||||
// Tests that ignoring a restartless add-on works
|
||||
add_test(function() {
|
||||
loadPage("about:newaddon?id=addon1@tests.mozilla.org", function(aTab) {
|
||||
var doc = aTab.linkedBrowser.contentDocument;
|
||||
is(doc.getElementById("name").value, "Test 1 5.3", "Should say the right name");
|
||||
|
||||
is_element_hidden(doc.getElementById("author"), "Should be no author displayed");
|
||||
is_element_hidden(doc.getElementById("location"), "Should be no location displayed");
|
||||
|
||||
is(doc.getElementById("buttonDeck").selectedPanel, doc.getElementById("continuePanel"),
|
||||
"Should be showing the right buttons");
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(doc.getElementById("continue-button"),
|
||||
{}, aTab.linkedBrowser.contentWindow);
|
||||
|
||||
is(gBrowser.tabs.length, 1, "Page should have been closed");
|
||||
|
||||
AddonManager.getAddonByID("addon1@tests.mozilla.org", function(aAddon) {
|
||||
ok(aAddon.userDisabled, "Add-on should not have been enabled");
|
||||
|
||||
ok(!aAddon.isActive, "Add-on should not be running");
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Tests that enabling a restartless add-on works
|
||||
add_test(function() {
|
||||
loadPage("about:newaddon?id=addon1@tests.mozilla.org", function(aTab) {
|
||||
var doc = aTab.linkedBrowser.contentDocument;
|
||||
is(doc.getElementById("name").value, "Test 1 5.3", "Should say the right name");
|
||||
|
||||
is_element_hidden(doc.getElementById("author"), "Should be no author displayed");
|
||||
is_element_hidden(doc.getElementById("location"), "Should be no location displayed");
|
||||
|
||||
is(doc.getElementById("buttonDeck").selectedPanel, doc.getElementById("continuePanel"),
|
||||
"Should be showing the right buttons");
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(doc.getElementById("allow"),
|
||||
{}, aTab.linkedBrowser.contentWindow);
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(doc.getElementById("continue-button"),
|
||||
{}, aTab.linkedBrowser.contentWindow);
|
||||
|
||||
is(gBrowser.tabs.length, 1, "Page should have been closed");
|
||||
|
||||
AddonManager.getAddonByID("addon1@tests.mozilla.org", function(aAddon) {
|
||||
ok(!aAddon.userDisabled, "Add-on should now have been enabled");
|
||||
|
||||
ok(aAddon.isActive, "Add-on should now be running");
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Tests that ignoring a non-restartless add-on works
|
||||
add_test(function() {
|
||||
loadPage("about:newaddon?id=addon2@tests.mozilla.org", function(aTab) {
|
||||
var doc = aTab.linkedBrowser.contentDocument;
|
||||
is(doc.getElementById("name").value, "Test 2 7.1", "Should say the right name");
|
||||
|
||||
is_element_visible(doc.getElementById("author"), "Should be an author displayed");
|
||||
is(doc.getElementById("author").value, "By Dave Townsend", "Should have the right author");
|
||||
is_element_hidden(doc.getElementById("location"), "Should be no location displayed");
|
||||
|
||||
is(doc.getElementById("buttonDeck").selectedPanel, doc.getElementById("continuePanel"),
|
||||
"Should be showing the right buttons");
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(doc.getElementById("continue-button"),
|
||||
{}, aTab.linkedBrowser.contentWindow);
|
||||
|
||||
is(gBrowser.tabs.length, 1, "Page should have been closed");
|
||||
|
||||
AddonManager.getAddonByID("addon2@tests.mozilla.org", function(aAddon) {
|
||||
ok(aAddon.userDisabled, "Add-on should not have been enabled");
|
||||
|
||||
ok(!aAddon.isActive, "Add-on should not be running");
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Tests that enabling a non-restartless add-on works
|
||||
add_test(function() {
|
||||
loadPage("about:newaddon?id=addon2@tests.mozilla.org", function(aTab) {
|
||||
var doc = aTab.linkedBrowser.contentDocument;
|
||||
is(doc.getElementById("name").value, "Test 2 7.1", "Should say the right name");
|
||||
|
||||
is_element_visible(doc.getElementById("author"), "Should be an author displayed");
|
||||
is(doc.getElementById("author").value, "By Dave Townsend", "Should have the right author");
|
||||
is_element_hidden(doc.getElementById("location"), "Should be no location displayed");
|
||||
|
||||
is(doc.getElementById("buttonDeck").selectedPanel, doc.getElementById("continuePanel"),
|
||||
"Should be showing the right buttons");
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(doc.getElementById("allow"),
|
||||
{}, aTab.linkedBrowser.contentWindow);
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(doc.getElementById("continue-button"),
|
||||
{}, aTab.linkedBrowser.contentWindow);
|
||||
|
||||
is(doc.getElementById("buttonDeck").selectedPanel, doc.getElementById("restartPanel"),
|
||||
"Should be showing the right buttons");
|
||||
|
||||
AddonManager.getAddonByID("addon2@tests.mozilla.org", function(aAddon) {
|
||||
ok(!aAddon.userDisabled, "Add-on should now have been enabled");
|
||||
|
||||
ok(!aAddon.isActive, "Add-on should not be running");
|
||||
|
||||
ok(doc.getElementById("allow").disabled, "Should have disabled checkbox");
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(doc.getElementById("cancel-button"),
|
||||
{}, aTab.linkedBrowser.contentWindow);
|
||||
|
||||
is(doc.getElementById("buttonDeck").selectedPanel, doc.getElementById("continuePanel"),
|
||||
"Should be showing the right buttons");
|
||||
|
||||
ok(!doc.getElementById("allow").disabled, "Should have enabled checkbox");
|
||||
|
||||
ok(aAddon.userDisabled, "Add-on should not have been enabled");
|
||||
|
||||
ok(!aAddon.isActive, "Add-on should not be running");
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(doc.getElementById("allow"),
|
||||
{}, aTab.linkedBrowser.contentWindow);
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(doc.getElementById("continue-button"),
|
||||
{}, aTab.linkedBrowser.contentWindow);
|
||||
|
||||
ok(aAddon.userDisabled, "Add-on should not have been enabled");
|
||||
|
||||
ok(!aAddon.isActive, "Add-on should not be running");
|
||||
|
||||
is(gBrowser.tabs.length, 1, "Page should have been closed");
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
});
|
||||
});
|
|
@ -627,6 +627,10 @@ MockProvider.prototype = {
|
|||
}
|
||||
if (!addon.optionsType && !!addon.optionsURL)
|
||||
addon.optionsType = AddonManager.OPTIONS_TYPE_DIALOG;
|
||||
|
||||
// Make sure the active state matches the passed in properties
|
||||
addon.isActive = addon.shouldBeActive;
|
||||
|
||||
this.addAddon(addon);
|
||||
newAddons.push(addon);
|
||||
}, this);
|
||||
|
|
|
@ -0,0 +1,136 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Extension Manager UI.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* the Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Dave Townsend <dtownsend@oxymoronical.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@import url("chrome://global/skin/inContentUI.css");
|
||||
|
||||
#addon-page {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#addon-scrollbox {
|
||||
overflow: auto;
|
||||
-moz-box-orient: vertical;
|
||||
-moz-box-flex: 1;
|
||||
}
|
||||
|
||||
#spacer-start {
|
||||
-moz-box-flex: 1;
|
||||
}
|
||||
|
||||
#spacer-end {
|
||||
-moz-box-flex: 3;
|
||||
}
|
||||
|
||||
#addon-container {
|
||||
max-width: 600px;
|
||||
margin: 20px;
|
||||
padding: 30px 90px;
|
||||
}
|
||||
|
||||
#addon-info {
|
||||
-moz-box-align: start;
|
||||
margin: 25px 10px;
|
||||
}
|
||||
|
||||
#icon {
|
||||
-moz-margin-end: 10px;
|
||||
list-style-image: url("chrome://mozapps/skin/extensions/extensionGeneric.png");
|
||||
}
|
||||
|
||||
.addon-info[type="theme"] #icon {
|
||||
list-style-image: url("chrome://mozapps/skin/extensions/themeGeneric.png");
|
||||
}
|
||||
|
||||
.addon-info[type="locale"] #icon {
|
||||
list-style-image: url("chrome://mozapps/skin/extensions/localeGeneric.png");
|
||||
}
|
||||
|
||||
.addon-info[type="plugin"] #icon {
|
||||
list-style-image: url("chrome://mozapps/skin/plugins/pluginGeneric.png");
|
||||
}
|
||||
|
||||
#name {
|
||||
font-size: 130%;
|
||||
}
|
||||
|
||||
#author {
|
||||
color: GrayText;
|
||||
}
|
||||
|
||||
#location {
|
||||
color: GrayText;
|
||||
}
|
||||
|
||||
#warning {
|
||||
margin-bottom: 25px;
|
||||
-moz-box-align: start;
|
||||
}
|
||||
|
||||
#warning-icon {
|
||||
list-style-image: url("chrome://mozapps/skin/extensions/alerticon-warning.png");
|
||||
width: 16px;
|
||||
height: 15px;
|
||||
-moz-margin-end: 5px;
|
||||
}
|
||||
|
||||
#allow {
|
||||
-moz-margin-start: 84px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
#continuePanel,
|
||||
#restartPanel {
|
||||
margin-top: 25px;
|
||||
-moz-box-pack: end;
|
||||
-moz-box-align: end;
|
||||
}
|
||||
|
||||
#continuePanel {
|
||||
-moz-box-pack: end;
|
||||
}
|
||||
|
||||
#restartMessage {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#restartSpacer {
|
||||
-moz-box-flex: 1;
|
||||
}
|
||||
|
||||
#later {
|
||||
color: GrayText;
|
||||
}
|
|
@ -27,6 +27,7 @@ toolkit.jar:
|
|||
+ skin/classic/mozapps/extensions/stripes-error.png (extensions/stripes-error.png)
|
||||
+ skin/classic/mozapps/extensions/stripes-info-positive.png (extensions/stripes-info-positive.png)
|
||||
+ skin/classic/mozapps/extensions/stripes-info-negative.png (extensions/stripes-info-negative.png)
|
||||
+ skin/classic/mozapps/extensions/newaddon.css (extensions/newaddon.css)
|
||||
+ skin/classic/mozapps/passwordmgr/key.png (passwordmgr/key.png)
|
||||
+ skin/classic/mozapps/passwordmgr/key-16.png (passwordmgr/key-16.png)
|
||||
+ skin/classic/mozapps/passwordmgr/key-64.png (passwordmgr/key-64.png)
|
||||
|
|
|
@ -0,0 +1,138 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Extension Manager UI.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* the Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Dave Townsend <dtownsend@oxymoronical.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
%include ../../global/shared.inc
|
||||
|
||||
@import url("chrome://global/skin/inContentUI.css");
|
||||
|
||||
#addon-page {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#addon-scrollbox {
|
||||
overflow: auto;
|
||||
-moz-box-orient: vertical;
|
||||
-moz-box-flex: 1;
|
||||
}
|
||||
|
||||
#spacer-start {
|
||||
-moz-box-flex: 1;
|
||||
}
|
||||
|
||||
#spacer-end {
|
||||
-moz-box-flex: 3;
|
||||
}
|
||||
|
||||
#addon-container {
|
||||
max-width: 600px;
|
||||
margin: 20px;
|
||||
padding: 30px 90px;
|
||||
}
|
||||
|
||||
#addon-info {
|
||||
-moz-box-align: start;
|
||||
margin: 25px 10px;
|
||||
}
|
||||
|
||||
#icon {
|
||||
-moz-margin-end: 10px;
|
||||
list-style-image: url("chrome://mozapps/skin/extensions/extensionGeneric.png");
|
||||
}
|
||||
|
||||
.addon-info[type="theme"] #icon {
|
||||
list-style-image: url("chrome://mozapps/skin/extensions/themeGeneric.png");
|
||||
}
|
||||
|
||||
.addon-info[type="locale"] #icon {
|
||||
list-style-image: url("chrome://mozapps/skin/extensions/localeGeneric.png");
|
||||
}
|
||||
|
||||
.addon-info[type="plugin"] #icon {
|
||||
list-style-image: url("chrome://mozapps/skin/plugins/pluginGeneric.png");
|
||||
}
|
||||
|
||||
#name {
|
||||
font-size: 130%;
|
||||
}
|
||||
|
||||
#author {
|
||||
color: GrayText;
|
||||
}
|
||||
|
||||
#location {
|
||||
color: GrayText;
|
||||
}
|
||||
|
||||
#warning {
|
||||
margin-bottom: 25px;
|
||||
-moz-box-align: start;
|
||||
}
|
||||
|
||||
#warning-icon {
|
||||
list-style-image: url("chrome://mozapps/skin/extensions/alerticon-warning.png");
|
||||
width: 16px;
|
||||
height: 15px;
|
||||
-moz-margin-end: 5px;
|
||||
}
|
||||
|
||||
#allow {
|
||||
-moz-margin-start: 84px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
#continuePanel,
|
||||
#restartPanel {
|
||||
margin-top: 25px;
|
||||
-moz-box-align: center;
|
||||
-moz-box-pack: end;
|
||||
}
|
||||
|
||||
#continuePanel {
|
||||
-moz-box-pack: end;
|
||||
}
|
||||
|
||||
#restartMessage {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#restartSpacer {
|
||||
-moz-box-flex: 1;
|
||||
}
|
||||
|
||||
#later {
|
||||
color: GrayText;
|
||||
}
|
|
@ -42,6 +42,7 @@ toolkit.jar:
|
|||
skin/classic/mozapps/extensions/update.css (extensions/update.css)
|
||||
skin/classic/mozapps/extensions/eula.css (extensions/eula.css)
|
||||
skin/classic/mozapps/extensions/blocklist.css (extensions/blocklist.css)
|
||||
* skin/classic/mozapps/extensions/newaddon.css (extensions/newaddon.css)
|
||||
skin/classic/mozapps/passwordmgr/key.png (passwordmgr/key.png)
|
||||
skin/classic/mozapps/passwordmgr/key-16.png (passwordmgr/key-16.png)
|
||||
skin/classic/mozapps/passwordmgr/key-64.png (passwordmgr/key-64.png)
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
%define WINSTRIPE_AERO
|
||||
%include newaddon.css
|
||||
%undef WINSTRIPE_AERO
|
|
@ -0,0 +1,160 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Extension Manager UI.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* the Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Dave Townsend <dtownsend@oxymoronical.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@import url("chrome://global/skin/inContentUI.css");
|
||||
|
||||
#addon-page {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#addon-scrollbox {
|
||||
overflow: auto;
|
||||
-moz-box-orient: vertical;
|
||||
-moz-box-flex: 1;
|
||||
}
|
||||
|
||||
#spacer-start {
|
||||
-moz-box-flex: 1;
|
||||
}
|
||||
|
||||
#spacer-end {
|
||||
-moz-box-flex: 3;
|
||||
}
|
||||
|
||||
#addon-container {
|
||||
max-width: 600px;
|
||||
margin: 20px;
|
||||
padding: 30px 90px;
|
||||
}
|
||||
|
||||
#addon-info {
|
||||
-moz-box-align: start;
|
||||
margin: 25px 10px;
|
||||
}
|
||||
|
||||
#icon {
|
||||
-moz-margin-end: 10px;
|
||||
list-style-image: url("chrome://mozapps/skin/extensions/extensionGeneric.png");
|
||||
}
|
||||
|
||||
.addon-info[type="theme"] #icon {
|
||||
list-style-image: url("chrome://mozapps/skin/extensions/themeGeneric.png");
|
||||
}
|
||||
|
||||
.addon-info[type="locale"] #icon {
|
||||
list-style-image: url("chrome://mozapps/skin/extensions/localeGeneric.png");
|
||||
}
|
||||
|
||||
.addon-info[type="plugin"] #icon {
|
||||
list-style-image: url("chrome://mozapps/skin/plugins/pluginGeneric.png");
|
||||
}
|
||||
|
||||
#name {
|
||||
font-size: 130%;
|
||||
}
|
||||
|
||||
#author {
|
||||
color: GrayText;
|
||||
}
|
||||
|
||||
#location {
|
||||
color: GrayText;
|
||||
}
|
||||
|
||||
#warning {
|
||||
margin-bottom: 25px;
|
||||
-moz-box-align: start;
|
||||
}
|
||||
|
||||
#warning-icon {
|
||||
list-style-image: url("chrome://mozapps/skin/extensions/alerticon-warning.png");
|
||||
width: 16px;
|
||||
height: 15px;
|
||||
-moz-margin-end: 5px;
|
||||
}
|
||||
|
||||
#allow {
|
||||
-moz-margin-start: 84px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
#continuePanel,
|
||||
#restartPanel {
|
||||
margin-top: 25px;
|
||||
-moz-box-pack: end;
|
||||
-moz-box-align: center;
|
||||
}
|
||||
|
||||
#continuePanel {
|
||||
-moz-box-pack: end;
|
||||
}
|
||||
|
||||
#restartMessage {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#restartSpacer {
|
||||
-moz-box-flex: 1;
|
||||
}
|
||||
|
||||
#later {
|
||||
color: GrayText;
|
||||
}
|
||||
|
||||
.addon-control {
|
||||
-moz-appearance: none;
|
||||
color: black;
|
||||
padding: 0 5px;
|
||||
background: -moz-linear-gradient(rgba(251, 252, 253, 0.95), rgba(246, 247, 248, 0) 49%,
|
||||
rgba(211, 212, 213, 0.45) 51%, rgba(225, 226, 229, 0.3));
|
||||
background-clip: padding-box;
|
||||
border-radius: 3px;
|
||||
border: 1px solid rgba(31, 64, 100, 0.4);
|
||||
border-top-color: rgba(31, 64, 100, 0.3);
|
||||
box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25) inset,
|
||||
0 0 2px 1px rgba(255, 255, 255, 0.25) inset;
|
||||
}
|
||||
|
||||
.addon-control:active:hover {
|
||||
background-color: rgba(61, 76, 92, 0.2);
|
||||
border-color: rgba(39, 53, 68, 0.5);
|
||||
box-shadow: 0 0 3px 1px rgba(39, 53, 68, 0.2) inset;
|
||||
}
|
||||
|
||||
.addon-control > .button-box {
|
||||
padding: 1px;
|
||||
}
|
|
@ -42,6 +42,7 @@ toolkit.jar:
|
|||
skin/classic/mozapps/extensions/alerticon-info-positive.png (extensions/alerticon-info-positive.png)
|
||||
skin/classic/mozapps/extensions/alerticon-info-negative.png (extensions/alerticon-info-negative.png)
|
||||
skin/classic/mozapps/extensions/eula.css (extensions/eula.css)
|
||||
* skin/classic/mozapps/extensions/newaddon.css (extensions/newaddon.css)
|
||||
skin/classic/mozapps/handling/handling.css (handling/handling.css)
|
||||
skin/classic/mozapps/passwordmgr/key.png (passwordmgr/key.png)
|
||||
skin/classic/mozapps/passwordmgr/key-16.png (passwordmgr/key-16.png)
|
||||
|
@ -117,6 +118,7 @@ toolkit.jar:
|
|||
skin/classic/aero/mozapps/extensions/alerticon-info-positive.png (extensions/alerticon-info-positive.png)
|
||||
skin/classic/aero/mozapps/extensions/alerticon-info-negative.png (extensions/alerticon-info-negative.png)
|
||||
skin/classic/aero/mozapps/extensions/eula.css (extensions/eula.css)
|
||||
* skin/classic/aero/mozapps/extensions/newaddon.css (extensions/newaddon-aero.css)
|
||||
skin/classic/aero/mozapps/handling/handling.css (handling/handling.css)
|
||||
skin/classic/aero/mozapps/passwordmgr/key.png (passwordmgr/key.png)
|
||||
skin/classic/aero/mozapps/passwordmgr/key-16.png (passwordmgr/key-16.png)
|
||||
|
|
Загрузка…
Ссылка в новой задаче