Merge f-t to m-c, a=merge

This commit is contained in:
Phil Ringnalda 2015-03-29 16:30:56 -07:00
commit 57b9648d9a
8 changed files with 102 additions and 22 deletions

View File

@ -17,6 +17,7 @@ let ReadingListUI = {
MESSAGES: [
"ReadingList:GetVisibility",
"ReadingList:ToggleVisibility",
"ReadingList:ShowIntro",
],
/**
@ -222,6 +223,14 @@ let ReadingListUI = {
this.toggleSidebar();
break;
}
case "ReadingList:ShowIntro": {
if (this.enabled && !Preferences.get("browser.readinglist.introShown", false)) {
Preferences.set("browser.readinglist.introShown", true);
this.showSidebar();
}
break;
}
}
},

View File

@ -7,8 +7,11 @@
* reader-able content, and that ReadingList button can open and close
* its Sidebar UI.
*/
const READER_PREF = "reader.parse-on-load.enabled";
const READING_LIST_PREF = "browser.readinglist.enabled";
const TEST_PREFS = [
["reader.parse-on-load.enabled", true],
["browser.readinglist.enabled", true],
["browser.readinglist.introShown", false],
];
const TEST_PATH = "http://example.com/browser/browser/base/content/test/general/";
@ -16,16 +19,19 @@ let readerButton = document.getElementById("reader-mode-button");
add_task(function* () {
registerCleanupFunction(function() {
Services.prefs.clearUserPref(READER_PREF);
Services.prefs.clearUserPref(READING_LIST_PREF);
// Reset test prefs.
TEST_PREFS.forEach(([name, value]) => {
Services.prefs.clearUserPref(name);
});
while (gBrowser.tabs.length > 1) {
gBrowser.removeCurrentTab();
}
});
// Enable the reader mode and ReadingList buttons.
Services.prefs.setBoolPref(READER_PREF, true);
Services.prefs.setBoolPref(READING_LIST_PREF, true);
// Set required test prefs.
TEST_PREFS.forEach(([name, value]) => {
Services.prefs.setBoolPref(name, value);
});
let tab = gBrowser.selectedTab = gBrowser.addTab();
is_element_hidden(readerButton, "Reader mode button is not present on a new tab");
@ -36,6 +42,7 @@ add_task(function* () {
yield promiseWaitForCondition(() => !readerButton.hidden);
is_element_visible(readerButton, "Reader mode button is present on a reader-able page");
// Switch page into reader mode.
readerButton.click();
yield promiseTabLoadEvent(tab);
@ -46,33 +53,31 @@ add_task(function* () {
is(gURLBar.value, readerUrl, "gURLBar value is about:reader URL");
is(gURLBar.textValue, url.substring("http://".length), "gURLBar is displaying original article URL");
// Readinglist button should be present, and status should be "closed".
// Readinglist button should be present, and status should be "openned", as the
// first time in readerMode opens the Sidebar ReadingList as a feature introduction.
let listButton;
yield promiseWaitForCondition(() =>
listButton = gBrowser.contentDocument.getElementById("list-button"));
is_element_visible(listButton, "List button is present on a reader-able page");
yield promiseWaitForCondition(() => !listButton.classList.contains("on"));
ok(!listButton.classList.contains("on"),
"List button should not indicate SideBar-ReadingList open.");
ok(!ReadingListUI.isSidebarOpen,
"The ReadingListUI should not indicate SideBar-ReadingList open.");
// After we click ReadingList button, status should be "open".
listButton.click();
yield promiseWaitForCondition(() => listButton.classList.contains("on"));
ok(listButton.classList.contains("on"),
"List button should now indicate SideBar-ReadingList open.");
"List button should indicate SideBar-ReadingList open.");
ok(ReadingListUI.isSidebarOpen,
"The ReadingListUI should now indicate SideBar-ReadingList open.");
"The ReadingListUI should indicate SideBar-ReadingList open.");
// Now close the sidebar.
// Now close the Sidebar ReadingList.
listButton.click();
yield promiseWaitForCondition(() => !listButton.classList.contains("on"));
ok(!ReadingListUI.isSidebarOpen, "The sidebar should be closed.");
ok(!listButton.classList.contains("on"),
"List button should now indicate SideBar-ReadingList closed.");
ok(!ReadingListUI.isSidebarOpen,
"The ReadingListUI should now indicate SideBar-ReadingList closed.");
// Switch page back out of reader mode.
readerButton.click();
yield promiseTabLoadEvent(tab);
is(gBrowser.selectedBrowser.currentURI.spec, url, "Original page loaded after clicking active reader mode button");
is(gBrowser.selectedBrowser.currentURI.spec, url,
"Original page loaded after clicking active reader mode button");
// Load a new tab that is NOT reader-able.
let newTab = gBrowser.selectedTab = gBrowser.addTab();

View File

@ -304,6 +304,9 @@ user_pref("browser.tabs.remote.autostart.1", false);
// Don't forceably kill content processes after a timeout
user_pref("dom.ipc.tabs.shutdownTimeoutSecs", 0);
// Avoid performing Readinglist Intro during tests.
user_pref("browser.readinglist.introShown", true);
// Don't let PAC generator to set PAC, as mochitest framework has its own PAC
// rules during testing.
user_pref("network.proxy.pac_generator", false);

View File

@ -26,8 +26,12 @@ function SignonsStartup() {
// filter the table if requested by caller
if (window.arguments &&
window.arguments[0] &&
window.arguments[0].filterString)
window.arguments[0].filterString) {
setFilter(window.arguments[0].filterString);
Services.telemetry.getHistogramById("PWMGR_MANAGE_OPENED").add(1);
} else {
Services.telemetry.getHistogramById("PWMGR_MANAGE_OPENED").add(0);
}
FocusFilterBox();
}
@ -154,6 +158,7 @@ function DeleteAllSignons() {
signonsTreeView._filterSet.length ? signonsTreeView._filterSet : signons,
deletedSignons, "removeSignon", "removeAllSignons");
FinalizeSignonDeletions(syncNeeded);
Services.telemetry.getHistogramById("PWMGR_MANAGE_DELETED_ALL").add(1);
}
function TogglePasswordVisible() {
@ -170,6 +175,7 @@ function TogglePasswordVisible() {
Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService)
.notifyObservers(null, "passwordmgr-password-toggle-complete", null);
Services.telemetry.getHistogramById("PWMGR_MANAGE_VISIBILITY_TOGGLED").add(showingPasswords);
}
function AskUserShowPasswords() {
@ -186,6 +192,7 @@ function AskUserShowPasswords() {
function FinalizeSignonDeletions(syncNeeded) {
for (var s=0; s<deletedSignons.length; s++) {
passwordmanager.removeLogin(deletedSignons[s]);
Services.telemetry.getHistogramById("PWMGR_MANAGE_DELETED").add(1);
}
// If the deletion has been performed in a filtered view, reflect the deletion in the unfiltered table.
// See bug 405389.
@ -357,6 +364,7 @@ function CopyPassword() {
var row = document.getElementById("signonsTree").currentIndex;
var password = signonsTreeView.getCellText(row, {id : "passwordCol" });
clipboard.copyString(password, document);
Services.telemetry.getHistogramById("PWMGR_MANAGE_COPIED_PASSWORD").add(1);
}
function CopyUsername() {
@ -366,6 +374,7 @@ function CopyUsername() {
var row = document.getElementById("signonsTree").currentIndex;
var username = signonsTreeView.getCellText(row, {id : "userCol" });
clipboard.copyString(username);
Services.telemetry.getHistogramById("PWMGR_MANAGE_COPIED_USERNAME").add(1);
}
function UpdateCopyPassword() {

View File

@ -4,6 +4,8 @@
/*** =================== INITIALISATION CODE =================== ***/
Components.utils.import("resource://gre/modules/Services.jsm");
var kObserverService;
// interface variables
@ -169,6 +171,7 @@ function HandleTreeColumnClick(sortFunction, event) {
}
sortFunction(sortField);
Services.telemetry.getKeyedHistogramById("PWMGR_MANAGE_SORTED").add(sortField);
}
function SortTree(tree, view, table, column, lastSortColumn, lastSortAscending, updateSelection) {

View File

@ -294,6 +294,14 @@ AboutReader.prototype = {
UITelemetry.addEvent("share.1", "list", null);
},
/**
* To help introduce ReadingList, we want to automatically
* open the Desktop sidebar the first time ReaderMode is used.
*/
_showListIntro: function() {
this._mm.sendAsyncMessage("ReadingList:ShowIntro");
},
/**
* Toggle ReadingList Sidebar visibility. SidebarUI will trigger
* _updateListButtonStyle().
@ -717,7 +725,9 @@ AboutReader.prototype = {
this._updateImageMargins();
this._requestReadingListStatus();
this._showListIntro();
this._requestFavicon();
this._doc.body.classList.add("loaded");
},
_hideContent: function Reader_hideContent() {

View File

@ -7618,6 +7618,43 @@
"n_values" : 20,
"description": "The result of auto-filling a login form. See http://mzl.la/1Mbs6jL for bucket descriptions."
},
"PWMGR_MANAGE_COPIED_PASSWORD": {
"expires_in_version": "never",
"kind": "count",
"description": "Count of passwords copied from the password management interface"
},
"PWMGR_MANAGE_COPIED_USERNAME": {
"expires_in_version": "never",
"kind": "count",
"description": "Count of usernames copied from the password management interface"
},
"PWMGR_MANAGE_DELETED": {
"expires_in_version": "never",
"kind": "count",
"description": "Count of passwords deleted from the password management interface (including via Remove All)"
},
"PWMGR_MANAGE_DELETED_ALL": {
"expires_in_version": "never",
"kind": "count",
"description": "Count of times that Remove All was used from the password management interface"
},
"PWMGR_MANAGE_OPENED": {
"expires_in_version": "never",
"kind": "enumerated",
"n_values" : 5,
"description": "Accumulates how the password management interface was opened. (0=Preferences, 1=Page Info)"
},
"PWMGR_MANAGE_SORTED": {
"expires_in_version": "never",
"keyed": true,
"kind": "count",
"description": "Reports the column that logins are sorted by"
},
"PWMGR_MANAGE_VISIBILITY_TOGGLED": {
"expires_in_version": "never",
"kind": "boolean",
"description": "Whether the visibility of passwords was toggled (0=Hide, 1=Show)"
},
"PWMGR_NUM_PASSWORDS_PER_HOSTNAME": {
"expires_in_version": "never",
"kind": "linear",

View File

@ -9,6 +9,10 @@ body {
margin-right: auto;
}
body.loaded {
transition: color 0.4s, background-color 0.4s;
}
.light,
.light-button {
color: #333333;