Backed out changeset b99b5f178405 (bug 1206133)

This commit is contained in:
Sebastian Hengst 2016-09-10 23:40:28 +02:00
Родитель a1fdfe5891
Коммит b1f5d631f7
9 изменённых файлов: 20 добавлений и 75 удалений

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

@ -41,11 +41,7 @@ add_task(function* shift_left_click_test() {
// Wait for the initial browser to load. // Wait for the initial browser to load.
let browser = win.gBrowser.selectedBrowser; let browser = win.gBrowser.selectedBrowser;
let destinationURL = "http://" + TEST_VALUE + "/"; yield BrowserTestUtils.browserLoaded(browser);
yield Promise.all([
BrowserTestUtils.browserLoaded(browser),
BrowserTestUtils.waitForLocationChange(win.gBrowser, destinationURL)
]);
info("URL should be loaded in a new window"); info("URL should be loaded in a new window");
is(gURLBar.value, "", "Urlbar reverted to original value"); is(gURLBar.value, "", "Urlbar reverted to original value");

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

@ -45,15 +45,12 @@ add_task(function* testAddOnBeforeCreatedWidget() {
try { try {
widgetNode.click(); widgetNode.click();
let tempPanel = document.getElementById("customizationui-widget-panel");
let panelShownPromise = promisePanelElementShown(window, tempPanel);
let shownTimeout = setTimeout(() => viewShownDeferred.reject("Panel not shown within 20s"), 20000); let shownTimeout = setTimeout(() => viewShownDeferred.reject("Panel not shown within 20s"), 20000);
yield viewShownDeferred.promise; yield viewShownDeferred.promise;
yield panelShownPromise;
clearTimeout(shownTimeout); clearTimeout(shownTimeout);
ok(true, "Found view shown"); ok(true, "Found view shown");
let tempPanel = document.getElementById("customizationui-widget-panel");
let panelHiddenPromise = promisePanelElementHidden(window, tempPanel); let panelHiddenPromise = promisePanelElementHidden(window, tempPanel);
tempPanel.hidePopup(); tempPanel.hidePopup();
yield panelHiddenPromise; yield panelHiddenPromise;

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

@ -82,11 +82,9 @@ var showSidebarPopup = Task.async(function*() {
let button = document.getElementById("sidebar-button"); let button = document.getElementById("sidebar-button");
let subview = document.getElementById("PanelUI-sidebar"); let subview = document.getElementById("PanelUI-sidebar");
let popupShownPromise = BrowserTestUtils.waitForEvent(document, "popupshown");
let subviewShownPromise = subviewShown(subview); let subviewShownPromise = subviewShown(subview);
EventUtils.synthesizeMouseAtCenter(button, {}); EventUtils.synthesizeMouseAtCenter(button, {});
return Promise.all([subviewShownPromise, popupShownPromise]); return subviewShownPromise;
}); });
// Check the sidebar widget shows the default items // Check the sidebar widget shows the default items

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

@ -297,34 +297,6 @@ this.BrowserTestUtils = {
}); });
}, },
/**
* Waits for onLocationChange.
*
* @param {tabbrowser} tabbrowser
* The tabbrowser to wait for the location change on.
* @param {string} url
* The string URL to look for. The URL must match the URL in the
* location bar exactly.
* @return {Promise}
* @resolves When onLocationChange fires.
*/
waitForLocationChange(tabbrowser, url) {
return new Promise((resolve, reject) => {
let progressListener = {
onLocationChange(aBrowser) {
if ((url && aBrowser.currentURI.spec != url) ||
(!url && aBrowser.currentURI.spec == "about:blank")) {
return;
}
tabbrowser.removeTabsProgressListener(progressListener);
resolve();
},
};
tabbrowser.addTabsProgressListener(progressListener);
});
},
/** /**
* Waits for the next browser window to open and be fully loaded. * Waits for the next browser window to open and be fully loaded.
* *

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

@ -38,8 +38,7 @@ add_task(function* test_fill() {
yield promiseAnchorShown; yield promiseAnchorShown;
let promiseShown = BrowserTestUtils.waitForEvent(PopupNotifications.panel, let promiseShown = BrowserTestUtils.waitForEvent(PopupNotifications.panel,
"popupshown"); "Shown");
anchor.click(); anchor.click();
yield promiseShown; yield promiseShown;
@ -48,14 +47,9 @@ add_task(function* test_fill() {
"list.childNodes.length === 1"); "list.childNodes.length === 1");
// The button will be focused after the "transitionend" event. // The button will be focused after the "transitionend" event.
let details = document.getElementById("login-fill-details");
let promiseListFocus = BrowserTestUtils.waitForEvent(list, "focus");
let promiseSubviewHidden = BrowserTestUtils.waitForEvent(details,
"transitionend",
true,
e => e.target == details);
list.focus(); list.focus();
yield Promise.all([promiseListFocus, promiseSubviewHidden]); yield new Promise(resolve => executeSoon(resolve));
let details = document.getElementById("login-fill-details");
let promiseSubview = BrowserTestUtils.waitForEvent(details, let promiseSubview = BrowserTestUtils.waitForEvent(details,
"transitionend", true, "transitionend", true,
e => e.target == details); e => e.target == details);

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

@ -38,8 +38,7 @@ add_task(function* test_save_change() {
// Submit the form in the content page with the credentials from the test // Submit the form in the content page with the credentials from the test
// case. This will cause the doorhanger notification to be displayed. // case. This will cause the doorhanger notification to be displayed.
let promiseShown = BrowserTestUtils.waitForEvent(PopupNotifications.panel, let promiseShown = BrowserTestUtils.waitForEvent(PopupNotifications.panel,
"popupshown", "Shown");
(event) => event.target == PopupNotifications.panel);
yield ContentTask.spawn(browser, { username, password }, yield ContentTask.spawn(browser, { username, password },
function* ({ username, password }) { function* ({ username, password }) {
let doc = content.document; let doc = content.document;
@ -48,15 +47,13 @@ add_task(function* test_save_change() {
doc.getElementById("form-basic").submit(); doc.getElementById("form-basic").submit();
}); });
yield promiseShown; yield promiseShown;
let notificationElement = PopupNotifications.panel.childNodes[0];
// Style flush to make sure binding is attached
notificationElement.querySelector("#password-notification-password").clientTop;
let notificationElement = PopupNotifications.panel.childNodes[0];
// Check the actual content of the popup notification. // Check the actual content of the popup notification.
Assert.equal(notificationElement.querySelector("#password-notification-username") Assert.equal(notificationElement.querySelector("#password-notification-username")
.value, username); .getAttribute("value"), username);
Assert.equal(notificationElement.querySelector("#password-notification-password") Assert.equal(notificationElement.querySelector("#password-notification-password")
.value, password); .getAttribute("value"), password);
// Simulate the action on the notification to request the login to be // Simulate the action on the notification to request the login to be
// saved, and wait for the data to be updated or saved based on the type // saved, and wait for the data to be updated or saved based on the type

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

@ -19,8 +19,7 @@ add_task(function* test_empty_password() {
// Submit the form in the content page with the credentials from the test // Submit the form in the content page with the credentials from the test
// case. This will cause the doorhanger notification to be displayed. // case. This will cause the doorhanger notification to be displayed.
let promiseShown = BrowserTestUtils.waitForEvent(PopupNotifications.panel, let promiseShown = BrowserTestUtils.waitForEvent(PopupNotifications.panel,
"popupshown", "popupshown");
(event) => event.target == PopupNotifications.panel);
yield ContentTask.spawn(browser, null, yield ContentTask.spawn(browser, null,
function* () { function* () {
let doc = content.document; let doc = content.document;
@ -62,8 +61,7 @@ add_task(function* test_toggle_password() {
// Submit the form in the content page with the credentials from the test // Submit the form in the content page with the credentials from the test
// case. This will cause the doorhanger notification to be displayed. // case. This will cause the doorhanger notification to be displayed.
let promiseShown = BrowserTestUtils.waitForEvent(PopupNotifications.panel, let promiseShown = BrowserTestUtils.waitForEvent(PopupNotifications.panel,
"popupshown", "popupshown");
(event) => event.target == PopupNotifications.panel);
yield ContentTask.spawn(browser, null, yield ContentTask.spawn(browser, null,
function* () { function* () {
let doc = content.document; let doc = content.document;
@ -100,8 +98,7 @@ add_task(function* test_checkbox_disabled_if_has_master_password() {
// Submit the form in the content page with the credentials from the test // Submit the form in the content page with the credentials from the test
// case. This will cause the doorhanger notification to be displayed. // case. This will cause the doorhanger notification to be displayed.
let promiseShown = BrowserTestUtils.waitForEvent(PopupNotifications.panel, let promiseShown = BrowserTestUtils.waitForEvent(PopupNotifications.panel,
"popupshown", "popupshown");
(event) => event.target == PopupNotifications.panel);
LoginTestUtils.masterPassword.enable(); LoginTestUtils.masterPassword.enable();

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

@ -78,8 +78,7 @@ add_task(function* test_edit_password() {
// Submit the form in the content page with the credentials from the test // Submit the form in the content page with the credentials from the test
// case. This will cause the doorhanger notification to be displayed. // case. This will cause the doorhanger notification to be displayed.
let promiseShown = BrowserTestUtils.waitForEvent(PopupNotifications.panel, let promiseShown = BrowserTestUtils.waitForEvent(PopupNotifications.panel,
"popupshown", "popupshown");
(event) => event.target == PopupNotifications.panel);
yield ContentTask.spawn(browser, testCase, yield ContentTask.spawn(browser, testCase,
function* (testCase) { function* (testCase) {
let doc = content.document; let doc = content.document;
@ -88,20 +87,18 @@ add_task(function* test_edit_password() {
doc.getElementById("form-basic").submit(); doc.getElementById("form-basic").submit();
}); });
yield promiseShown; yield promiseShown;
let notificationElement = PopupNotifications.panel.childNodes[0];
// Style flush to make sure binding is attached
notificationElement.querySelector("#password-notification-password").clientTop;
let notificationElement = PopupNotifications.panel.childNodes[0];
// Modify the username in the dialog if requested. // Modify the username in the dialog if requested.
if (testCase.usernameChangedTo) { if (testCase.usernameChangedTo) {
notificationElement.querySelector("#password-notification-username") notificationElement.querySelector("#password-notification-username")
.value = testCase.usernameChangedTo; .setAttribute("value", testCase.usernameChangedTo);
} }
// Modify the password in the dialog if requested. // Modify the password in the dialog if requested.
if (testCase.passwordChangedTo) { if (testCase.passwordChangedTo) {
notificationElement.querySelector("#password-notification-password") notificationElement.querySelector("#password-notification-password")
.value = testCase.passwordChangedTo; .setAttribute("value", testCase.passwordChangedTo);
} }
// We expect a modifyLogin notification if the final username used by the // We expect a modifyLogin notification if the final username used by the

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

@ -69,8 +69,7 @@ add_task(function* test_edit_username() {
// Submit the form in the content page with the credentials from the test // Submit the form in the content page with the credentials from the test
// case. This will cause the doorhanger notification to be displayed. // case. This will cause the doorhanger notification to be displayed.
let promiseShown = BrowserTestUtils.waitForEvent(PopupNotifications.panel, let promiseShown = BrowserTestUtils.waitForEvent(PopupNotifications.panel,
"popupshown", "Shown");
(event) => event.target == PopupNotifications.panel);
yield ContentTask.spawn(browser, testCase.usernameInPage, yield ContentTask.spawn(browser, testCase.usernameInPage,
function* (usernameInPage) { function* (usernameInPage) {
let doc = content.document; let doc = content.document;
@ -79,14 +78,12 @@ add_task(function* test_edit_username() {
doc.getElementById("form-basic").submit(); doc.getElementById("form-basic").submit();
}); });
yield promiseShown; yield promiseShown;
let notificationElement = PopupNotifications.panel.childNodes[0];
// Style flush to make sure binding is attached
notificationElement.querySelector("#password-notification-password").clientTop;
let notificationElement = PopupNotifications.panel.childNodes[0];
// Modify the username in the dialog if requested. // Modify the username in the dialog if requested.
if (testCase.usernameChangedTo) { if (testCase.usernameChangedTo) {
notificationElement.querySelector("#password-notification-username") notificationElement.querySelector("#password-notification-username")
.value = testCase.usernameChangedTo; .setAttribute("value", testCase.usernameChangedTo);
} }
// We expect a modifyLogin notification if the final username used by the // We expect a modifyLogin notification if the final username used by the