Bug 566194 - safe mode / security & compatibility check status are not exposed in new addon manager UI. r=dtownsend, a=blocking-beta6

This commit is contained in:
Blair McBride 2010-09-02 11:40:20 +12:00
Родитель bb9eb60571
Коммит edf74f7438
15 изменённых файлов: 523 добавлений и 222 удалений

Просмотреть файл

@ -13,6 +13,15 @@
<!ENTITY cmd.back.tooltip "Go back one page">
<!ENTITY cmd.forward.tooltip "Go forward one page">
<!-- global warnings -->
<!ENTITY warning.safemode.label "All add-ons have been disabled by safe mode.">
<!ENTITY warning.checkcompatibility.label "Add-on compatibility checking is disabled. You may have incompatible add-ons.">
<!ENTITY warning.checkcompatibility.enable.label "Enable">
<!ENTITY warning.checkcompatibility.enable.tooltip "Enable add-on compatibility checking">
<!ENTITY warning.updatesecurity.label "Add-on update security checking is disabled. You may be compromised by updates.">
<!ENTITY warning.updatesecurity.enable.label "Enable">
<!ENTITY warning.updatesecurity.enable.tooltip "Enable add-on update security checking">
<!-- categories / views -->
<!ENTITY view.search.label "Search">
<!ENTITY view.discover.label "Get Add-ons">

Просмотреть файл

@ -123,3 +123,10 @@ xhtml|link {
.view-pane:not(#updates-view) .addon .relnotes-toggle {
display: none;
}
#addons-page:not([warning]) .global-warning,
#addons-page:not([warning="safemode"]) .global-warning-safemode,
#addons-page:not([warning="checkcompatibility"]) .global-warning-checkcompatibility,
#addons-page:not([warning="updatesecurity"]) .global-warning-updatesecurity {
display: none;
}

Просмотреть файл

@ -51,6 +51,10 @@ Cu.import("resource://gre/modules/AddonRepository.jsm");
const PREF_DISCOVERURL = "extensions.webservice.discoverURL";
const PREF_MAXRESULTS = "extensions.getAddons.maxResults";
const PREF_BACKGROUND_UPDATE = "extensions.update.enabled";
const PREF_CHECK_COMPATIBILITY = "extensions.checkCompatibility";
const PREF_CHECK_UPDATE_SECURITY = "extensions.checkUpdateSecurity";
const BRANCH_REGEXP = /^([^\.]+\.[0-9]+[a-z]*).*/gi;
const LOADING_MSG_DELAY = 100;
@ -142,6 +146,7 @@ function loadView(aViewId) {
var gEventManager = {
_listeners: {},
_installListeners: [],
checkCompatibilityPref: "",
initialize: function() {
var self = this;
@ -164,9 +169,20 @@ var gEventManager = {
});
AddonManager.addInstallListener(this);
AddonManager.addAddonListener(this);
var version = Services.appinfo.version.replace(BRANCH_REGEXP, "$1");
this.checkCompatibilityPref = PREF_CHECK_COMPATIBILITY + "." + version;
Services.prefs.addObserver(this.checkCompatibilityPref, this, false);
Services.prefs.addObserver(PREF_CHECK_UPDATE_SECURITY, this, false);
this.refreshGlobalWarning();
},
shutdown: function() {
Services.prefs.removeObserver(this.checkCompatibilityPref, this);
Services.prefs.removeObserver(PREF_CHECK_UPDATE_SECURITY, this);
AddonManager.removeInstallListener(this);
AddonManager.removeAddonListener(this);
},
@ -244,6 +260,49 @@ var gEventManager = {
Cu.reportError(e);
}
}
},
refreshGlobalWarning: function() {
var page = document.getElementById("addons-page");
if (Services.appinfo.inSafeMode) {
page.setAttribute("warning", "safemode");
return;
}
var checkUpdateSecurity = true;
var checkUpdateSecurityDefault = true;
try {
checkUpdateSecurity = Services.prefs.getBoolPref(PREF_CHECK_UPDATE_SECURITY);
} catch(e) { }
try {
var defaultBranch = Services.prefs.getDefaultBranch("");
checkUpdateSecurityDefault = defaultBranch.getBoolPref(PREF_CHECK_UPDATE_SECURITY);
} catch(e) { }
if (checkUpdateSecurityDefault && !checkUpdateSecurity) {
page.setAttribute("warning", "updatesecurity");
return;
}
var checkCompatibility = true;
try {
checkCompatibility = Services.prefs.getBoolPref(this.checkCompatibilityPref);
} catch(e) { }
if (!checkCompatibility) {
page.setAttribute("warning", "checkcompatibility");
return;
}
page.removeAttribute("warning");
},
observe: function(aSubject, aTopic, aData) {
switch (aData) {
case this.checkCompatibilityPref:
case PREF_CHECK_UPDATE_SECURITY:
this.refreshGlobalWarning();
break;
}
}
};
@ -440,6 +499,20 @@ var gViewController = {
}
},
cmd_enableCheckCompatibility: {
isEnabled: function() true,
doCommand: function() {
Services.prefs.clearUserPref(gEventManager.checkCompatibilityPref);
}
},
cmd_enableUpdateSecurity: {
isEnabled: function() true,
doCommand: function() {
Services.prefs.clearUserPref(PREF_CHECK_UPDATE_SECURITY);
}
},
cmd_goToDiscoverPane: {
isEnabled: function() {
return gDiscoverView.enabled;

Просмотреть файл

@ -98,6 +98,8 @@
<command id="cmd_installFromFile"/>
<command id="cmd_back"/>
<command id="cmd_forward"/>
<command id="cmd_enableCheckCompatibility"/>
<command id="cmd_enableUpdateSecurity"/>
</commandset>
<!-- view commands - these act on the selected addon -->
@ -234,7 +236,26 @@
tooltiptext="&search.filter2.available.tooltip;"/>
</radiogroup>
</hbox>
<hbox class="view-header" pack="end">
<hbox class="view-header global-warning-container">
<!-- global warnings -->
<hbox class="global-warning">
<image class="warning-icon"/>
<label class="global-warning-safemode"
value="&warning.safemode.label;"/>
<label class="global-warning-checkcompatibility"
value="&warning.checkcompatibility.label;"/>
<button class="button-link global-warning-checkcompatibility"
label="&warning.checkcompatibility.enable.label;"
tooltiptext="&warning.checkcompatibility.enable.tooltip;"
command="cmd_enableCheckCompatibility"/>
<label class="global-warning-updatesecurity"
value="&warning.updatesecurity.label;"/>
<button class="button-link global-warning-updatesecurity"
label="&warning.updatesecurity.enable.label;"
tooltiptext="&warning.updatesecurity.enable.tooltip;"
command="cmd_enableUpdateSecurity"/>
</hbox>
<spacer flex="1"/>
<hbox id="search-sorters" class="sort-controls"
showrelevance="true" sortby="relevancescore" ascending="false"/>
</hbox>
@ -255,7 +276,26 @@
<!-- list view -->
<vbox id="list-view" flex="1" class="view-pane">
<hbox class="view-header" pack="end">
<hbox class="view-header global-warning-container">
<!-- global warnings -->
<hbox class="global-warning">
<image class="warning-icon"/>
<label class="global-warning-safemode"
value="&warning.safemode.label;"/>
<label class="global-warning-checkcompatibility"
value="&warning.checkcompatibility.label;"/>
<button class="button-link global-warning-checkcompatibility"
label="&warning.checkcompatibility.enable.label;"
tooltiptext="&warning.checkcompatibility.enable.tooltip;"
command="cmd_enableCheckCompatibility"/>
<label class="global-warning-updatesecurity"
value="&warning.updatesecurity.label;"/>
<button class="button-link global-warning-updatesecurity"
label="&warning.updatesecurity.enable.label;"
tooltiptext="&warning.updatesecurity.enable.tooltip;"
command="cmd_enableUpdateSecurity"/>
</hbox>
<spacer flex="1"/>
<hbox id="list-sorters" class="sort-controls" sortby="name"
ascending="true"/>
</hbox>
@ -272,7 +312,26 @@
<!-- updates view -->
<vbox id="updates-view" flex="1" class="view-pane">
<hbox class="view-header" pack="end">
<hbox class="view-header global-warning-container">
<!-- global warnings -->
<hbox class="global-warning">
<image class="warning-icon"/>
<label class="global-warning-safemode"
value="&warning.safemode.label;"/>
<label class="global-warning-checkcompatibility"
value="&warning.checkcompatibility.label;"/>
<button class="button-link global-warning-checkcompatibility"
label="&warning.checkcompatibility.enable.label;"
tooltiptext="&warning.checkcompatibility.enable.tooltip;"
command="cmd_enableCheckCompatibility"/>
<label class="global-warning-updatesecurity"
value="&warning.updatesecurity.label;"/>
<button class="button-link global-warning-updatesecurity"
label="&warning.updatesecurity.enable.label;"
tooltiptext="&warning.updatesecurity.enable.tooltip;"
command="cmd_enableUpdateSecurity"/>
</hbox>
<spacer flex="1"/>
<hbox id="updates-sorters" class="sort-controls" sortby="dateUpdated"
ascending="false"/>
</hbox>
@ -292,7 +351,26 @@
</vbox>
<!-- detail view -->
<scrollbox id="detail-view" flex="1" class="view-pane addon-view" orient="horizontal" pack="stretch" align="start">
<vbox id="detail-view" flex="1" class="view-pane">
<!-- global warnings -->
<hbox class="global-warning-container global-warning" pack="start">
<image class="warning-icon"/>
<label class="global-warning-safemode"
value="&warning.safemode.label;"/>
<label class="global-warning-checkcompatibility"
value="&warning.checkcompatibility.label;"/>
<button class="button-link global-warning-checkcompatibility"
label="&warning.checkcompatibility.enable.label;"
tooltiptext="&warning.checkcompatibility.enable.tooltip;"
command="cmd_enableCheckCompatibility"/>
<label class="global-warning-updatesecurity"
value="&warning.updatesecurity.label;"/>
<button class="button-link global-warning-updatesecurity"
label="&warning.updatesecurity.enable.label;"
tooltiptext="&warning.updatesecurity.enable.tooltip;"
command="cmd_enableUpdateSecurity"/>
</hbox>
<scrollbox flex="1" class="addon-view" orient="horizontal" pack="stretch" align="start">
<spacer flex="1"/>
<!-- "loading" splash screen -->
<hbox class="loading" flex="1">
@ -437,6 +515,7 @@
</vbox>
<spacer flex="1"/>
</scrollbox>
</vbox>
</deck>

Просмотреть файл

@ -75,6 +75,7 @@ _TEST_FILES = \
browser_backgroundupdate_menuitem.js \
browser_recentupdates.js \
browser_manualupdates.js \
browser_globalwarnings.js \
redirect.sjs \
releaseNotes.xhtml \
$(NULL)

Просмотреть файл

@ -0,0 +1,65 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Bug 566194 - safe mode / security & compatibility check status are not exposed in new addon manager UI
function test() {
waitForExplicitFinish();
run_next_test();
}
function end_test() {
finish();
}
add_test(function() {
info("Testing compatibility checking warning");
var version = Services.appinfo.version.replace(/^([^\.]+\.[0-9]+[a-z]*).*/gi, "$1");
var pref = "extensions.checkCompatibility." + version;
info("Setting " + pref + " pref to false")
Services.prefs.setBoolPref(pref, false);
open_manager(null, function(aWindow) {
var label = aWindow.document.querySelector("#list-view label.global-warning-checkcompatibility");
is_element_visible(label, "Check Compatibility warning label should be visible");
var button = aWindow.document.querySelector("#list-view button.global-warning-checkcompatibility");
is_element_visible(button, "Check Compatibility warning button should be visible");
info("Clicking 'Enable' button");
EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
is(Services.prefs.prefHasUserValue(pref), false, "Check Compatability pref should be cleared");
is_element_hidden(label, "Check Compatibility warning label should be hidden");
is_element_hidden(button, "Check Compatibility warning button should be hidden");
close_manager(aWindow, function() {
run_next_test();
});
});
});
add_test(function() {
info("Testing update security checking warning");
var pref = "extensions.checkUpdateSecurity";
info("Setting " + pref + " pref to false")
Services.prefs.setBoolPref(pref, false);
open_manager(null, function(aWindow) {
var label = aWindow.document.querySelector("#list-view label.global-warning-updatesecurity");
is_element_visible(label, "Check Update Security warning label should be visible");
var button = aWindow.document.querySelector("#list-view button.global-warning-updatesecurity");
is_element_visible(button, "Check Update Security warning button should be visible");
info("Clicking 'Enable' button");
EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
is(Services.prefs.prefHasUserValue(pref), false, "Check Update Security pref should be cleared");
is_element_hidden(label, "Check Update Security warning label should be hidden");
is_element_hidden(button, "Check Update Security warning button should be hidden");
close_manager(aWindow, function() {
run_next_test();
});
});
});

Просмотреть файл

@ -83,6 +83,46 @@
list-style-image: url("moz-icon://stock/gtk-go-forward-rtl?size=toolbar&state=disabled");
}
/*** global warnings ***/
.global-warning {
-moz-box-align: center;
margin: 0 8px;
color: #916D15;
text-shadow: #FFFFFF 1px 1px 1px;
font-weight: bold;
}
#addons-page[warning] .global-warning-container {
background-color: rgba(255, 255, 0, 0.1);
background-image: url("chrome://mozapps/skin/extensions/warning-stripes.png");
background-repeat: repeat-x;
}
/*** notification icons ***/
.warning-icon {
list-style-image: url("chrome://global/skin/icons/warning-16.png");
width: 16px;
height: 16px;
margin: 3px 0;
}
.error-icon {
list-style-image: url("chrome://global/skin/icons/error-16.png");
width: 16px;
height: 16px;
margin: 3px 0;
}
.pending-icon,
.info-icon {
list-style-image: url("chrome://global/skin/icons/information-16.png");
width: 16px;
height: 16px;
margin: 3px 0;
}
/*** category selector ***/
#categories {
@ -379,28 +419,6 @@
color: #4F7939;
}
.warning-icon {
list-style-image: url("chrome://global/skin/icons/warning-16.png");
width: 16px;
height: 16px;
margin: 3px 0;
}
.error-icon {
list-style-image: url("chrome://global/skin/icons/error-16.png");
width: 16px;
height: 16px;
margin: 3px 0;
}
.pending-icon,
.info-icon {
list-style-image: url("chrome://global/skin/icons/information-16.png");
width: 16px;
height: 16px;
margin: 3px 0;
}
.addon-view[notification="warning"] {
background-image: -moz-linear-gradient(rgba(255, 255, 0, 0.2), rgba(255, 255, 0, 0.1));
}
@ -518,15 +536,15 @@
opacity: 0.6;
}
#detail-view > .loading {
#detail-view .loading {
opacity: 0;
}
#detail-view:not([loading]) > .loading {
#detail-view:not([loading]) .loading {
visibility: collapse;
}
#detail-view[loading-extended] > .loading {
#detail-view[loading-extended] .loading {
-moz-box-align: center;
-moz-box-pack: center;
opacity: 1;
@ -534,7 +552,7 @@
-moz-transition-duration: 1s;
}
#detail-view > .loading > image {
#detail-view .loading > image {
list-style-image: url("chrome://global/skin/icons/loading_16.png");
}

Двоичные данные
toolkit/themes/gnomestripe/mozapps/extensions/warning-stripes.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.1 KiB

Просмотреть файл

@ -25,6 +25,7 @@ toolkit.jar:
+ skin/classic/mozapps/extensions/pause.png (extensions/pause.png)
+ skin/classic/mozapps/extensions/utilities.png (extensions/utilities.png)
+ skin/classic/mozapps/extensions/heart.png (extensions/heart.png)
+ skin/classic/mozapps/extensions/warning-stripes.png (extensions/warning-stripes.png)
+ skin/classic/mozapps/passwordmgr/key.png (passwordmgr/key.png)
+ skin/classic/mozapps/plugins/notifyPluginBlocked.png (plugins/pluginBlocked-16.png)
+ skin/classic/mozapps/plugins/notifyPluginCrashed.png (plugins/pluginGeneric-16.png)

Просмотреть файл

@ -96,6 +96,46 @@
background-image: @toolbarbuttonInactiveBackgroundImage@;
}
/*** global warnings ***/
.global-warning {
-moz-box-align: center;
margin: 0 8px;
color: #916D15;
text-shadow: #FFFFFF 1px 1px 1px;
font-weight: bold;
}
#addons-page[warning] .global-warning-container {
background-color: rgba(255, 255, 0, 0.1);
background-image: url("chrome://mozapps/skin/extensions/warning-stripes.png");
background-repeat: repeat-x;
}
/*** notification icons ***/
.warning-icon {
list-style-image: url("chrome://global/skin/icons/warning-16.png");
width: 16px;
height: 16px;
margin: 3px 0;
}
.error-icon {
list-style-image: url("chrome://global/skin/icons/error-16.png");
width: 16px;
height: 16px;
margin: 3px 0;
}
.pending-icon,
.info-icon {
list-style-image: url("chrome://global/skin/icons/information-16.png");
width: 16px;
height: 16px;
margin: 3px 0;
}
/*** category selector ***/
#categories {
@ -392,28 +432,6 @@
color: #4F7939;
}
.warning-icon {
list-style-image: url("chrome://global/skin/icons/warning-16.png");
width: 16px;
height: 16px;
margin: 3px 0;
}
.error-icon {
list-style-image: url("chrome://global/skin/icons/error-16.png");
width: 16px;
height: 16px;
margin: 3px 0;
}
.pending-icon,
.info-icon {
list-style-image: url("chrome://global/skin/icons/information-16.png");
width: 16px;
height: 16px;
margin: 3px 0;
}
.addon-view[notification="warning"] {
background-image: -moz-linear-gradient(rgba(255, 255, 0, 0.2), rgba(255, 255, 0, 0.1));
}
@ -542,15 +560,15 @@
opacity: 0.6;
}
#detail-view > .loading {
#detail-view .loading {
opacity: 0;
}
#detail-view:not([loading]) > .loading {
#detail-view:not([loading]) .loading {
visibility: collapse;
}
#detail-view[loading-extended] > .loading {
#detail-view[loading-extended] .loading {
-moz-box-align: center;
-moz-box-pack: center;
opacity: 1;
@ -558,7 +576,7 @@
-moz-transition-duration: 1s;
}
#detail-view > .loading > image {
#detail-view .loading > image {
list-style-image: url("chrome://global/skin/icons/loading_16.png");
}

Двоичные данные
toolkit/themes/pinstripe/mozapps/extensions/warning-stripes.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.1 KiB

Просмотреть файл

@ -28,6 +28,7 @@ toolkit.jar:
skin/classic/mozapps/extensions/utilities.png (extensions/utilities.png)
skin/classic/mozapps/extensions/heart.png (extensions/heart.png)
skin/classic/mozapps/extensions/navigation.png (extensions/navigation.png)
skin/classic/mozapps/extensions/warning-stripes.png (extensions/warning-stripes.png)
skin/classic/mozapps/extensions/about.css (extensions/about.css)
* skin/classic/mozapps/extensions/extensions.css (extensions/extensions.css)
skin/classic/mozapps/extensions/update.css (extensions/update.css)

Просмотреть файл

@ -63,6 +63,55 @@
-moz-image-region: rect(0, 36px, 18px, 18px);
}
/*** global warnings ***/
.global-warning {
-moz-box-align: center;
padding: 0 8px;
color: #916D15;
font-weight: bold;
}
.global-warning,
.global-warning .button-link {
text-shadow: #FFFFFF 1px 1px 1px;
}
#addons-page[warning] .global-warning-container {
background-color: rgba(255, 255, 0, 0.1);
background-image: url("chrome://mozapps/skin/extensions/warning-stripes.png");
background-repeat: repeat-x;
}
#detail-view .global-warning {
padding: 4px 12px;
border-bottom: 1px solid #A8A8A8;
}
/*** notification icons ***/
.warning-icon {
list-style-image: url("chrome://global/skin/icons/warning-16.png");
width: 16px;
height: 16px;
margin: 3px 0;
}
.error-icon {
list-style-image: url("chrome://global/skin/icons/error-16.png");
width: 16px;
height: 16px;
margin: 3px 0;
}
.pending-icon,
.info-icon {
list-style-image: url("chrome://global/skin/icons/information-16.png");
width: 16px;
height: 16px;
margin: 3px 0;
}
/*** category selector ***/
#categories {
@ -359,28 +408,6 @@
color: #4F7939;
}
.warning-icon {
list-style-image: url("chrome://global/skin/icons/warning-16.png");
width: 16px;
height: 16px;
margin: 3px 0;
}
.error-icon {
list-style-image: url("chrome://global/skin/icons/error-16.png");
width: 16px;
height: 16px;
margin: 3px 0;
}
.pending-icon,
.info-icon {
list-style-image: url("chrome://global/skin/icons/information-16.png");
width: 16px;
height: 16px;
margin: 3px 0;
}
.addon-view[notification="warning"] {
background-image: -moz-linear-gradient(rgba(255, 255, 0, 0.2), rgba(255, 255, 0, 0.1));
}
@ -509,15 +536,15 @@
opacity: 0.6;
}
#detail-view > .loading {
#detail-view .loading {
opacity: 0;
}
#detail-view:not([loading]) > .loading {
#detail-view:not([loading]) .loading {
visibility: collapse;
}
#detail-view[loading-extended] > .loading {
#detail-view[loading-extended] .loading {
-moz-box-align: center;
-moz-box-pack: center;
opacity: 1;
@ -525,7 +552,7 @@
-moz-transition-duration: 1s;
}
#detail-view > .loading > image {
#detail-view .loading > image {
list-style-image: url("chrome://global/skin/icons/loading_16.png");
}

Двоичные данные
toolkit/themes/winstripe/mozapps/extensions/warning-stripes.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.1 KiB

Просмотреть файл

@ -34,6 +34,7 @@ toolkit.jar:
skin/classic/mozapps/extensions/utilities.png (extensions/utilities.png)
skin/classic/mozapps/extensions/heart.png (extensions/heart.png)
skin/classic/mozapps/extensions/navigation.png (extensions/navigation.png)
skin/classic/mozapps/extensions/warning-stripes.png (extensions/warning-stripes.png)
skin/classic/mozapps/extensions/eula.css (extensions/eula.css)
skin/classic/mozapps/handling/handling.css (handling/handling.css)
skin/classic/mozapps/passwordmgr/key.png (passwordmgr/key.png)
@ -99,6 +100,7 @@ toolkit.jar:
skin/classic/aero/mozapps/extensions/utilities.png (extensions/utilities.png)
skin/classic/aero/mozapps/extensions/heart.png (extensions/heart.png)
skin/classic/aero/mozapps/extensions/navigation.png (extensions/navigation.png)
skin/classic/aero/mozapps/extensions/warning-stripes.png (extensions/warning-stripes.png)
skin/classic/aero/mozapps/extensions/eula.css (extensions/eula.css)
skin/classic/aero/mozapps/handling/handling.css (handling/handling.css)
skin/classic/aero/mozapps/passwordmgr/key.png (passwordmgr/key-aero.png)