Backed out changeset 5a5243c9e021

--HG--
extra : rebase_source : 2f6b3e6d7f98f5117acf677d2d487e6b0fc5a922
This commit is contained in:
Dão Gottwald 2015-04-08 19:25:11 +02:00
parent edb7f6086e
commit eb1c9b7e08

View File

@ -5,7 +5,6 @@
const TESTROOT = "http://example.com/browser/toolkit/mozapps/extensions/test/xpinstall/";
const TESTROOT2 = "http://example.org/browser/toolkit/mozapps/extensions/test/xpinstall/";
const SECUREROOT = "https://example.com/browser/toolkit/mozapps/extensions/test/xpinstall/";
const XPINSTALL_URL = "chrome://mozapps/content/xpinstall/xpinstallConfirm.xul";
const PREF_INSTALL_REQUIREBUILTINCERTS = "extensions.install.requireBuiltInCerts";
const PROGRESS_NOTIFICATION = "addon-progress";
@ -87,52 +86,6 @@ function wait_for_notification_close(aCallback) {
}, false);
}
function wait_for_install_dialog(aCallback) {
if (Preferences.get("xpinstall.customConfirmationUI", false)) {
wait_for_notification("addon-install-confirmation", function(aPanel) {
aCallback();
return;
});
}
info("Waiting for install dialog");
Services.wm.addListener({
onOpenWindow: function(aXULWindow) {
info("Install dialog opened, waiting for focus");
Services.wm.removeListener(this);
var domwindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindow);
waitForFocus(function() {
info("Saw install dialog");
is(domwindow.document.location.href, XPINSTALL_URL, "Should have seen the right window open");
// Override the countdown timer on the accept button
var button = domwindow.document.documentElement.getButton("accept");
button.disabled = false;
aCallback();
}, domwindow);
},
onCloseWindow: function(aXULWindow) {
},
onWindowTitleChange: function(aXULWindow, aNewTitle) {
}
});
}
function accept_install_dialog() {
if (Preferences.get("xpinstall.customConfirmationUI", false)) {
document.getElementById("addon-install-confirmation-accept").click();
} else {
let win = Services.wm.getMostRecentWindow("Addons:Install");
win.document.documentElement.acceptDialog();
}
}
function wait_for_single_notification(aCallback) {
function inner_waiter() {
info("Waiting for single notification");
@ -212,7 +165,7 @@ function test_blocked_install() {
"Should have seen the right message");
// Wait for the install confirmation dialog
wait_for_install_dialog(function() {
wait_for_notification("addon-install-confirmation", function(aPanel) {
// Wait for the complete notification
wait_for_notification("addon-install-complete", function(aPanel) {
let notification = aPanel.childNodes[0];
@ -230,7 +183,7 @@ function test_blocked_install() {
});
});
accept_install_dialog();
document.getElementById("addon-install-confirmation-accept").click();
});
// Click on Allow
@ -255,7 +208,7 @@ function test_whitelisted_install() {
gBrowser.selectedTab = originalTab;
// Wait for the install confirmation dialog
wait_for_install_dialog(function() {
wait_for_notification("addon-install-confirmation", function(aPanel) {
is(gBrowser.selectedTab, tab,
"tab selected in response to the addon-install-confirmation notification");
@ -277,7 +230,7 @@ function test_whitelisted_install() {
});
});
accept_install_dialog();
document.getElementById("addon-install-confirmation-accept").click();
});
});
@ -378,7 +331,7 @@ function test_restartless() {
// Wait for the progress notification
wait_for_progress_notification(function(aPanel) {
// Wait for the install confirmation dialog
wait_for_install_dialog(function() {
wait_for_notification("addon-install-confirmation", function(aPanel) {
// Wait for the complete notification
wait_for_notification("addon-install-complete", function(aPanel) {
let notification = aPanel.childNodes[0];
@ -399,7 +352,7 @@ function test_restartless() {
});
});
accept_install_dialog();
document.getElementById("addon-install-confirmation-accept").click();
});
});
@ -417,7 +370,7 @@ function test_multiple() {
// Wait for the progress notification
wait_for_progress_notification(function(aPanel) {
// Wait for the install confirmation dialog
wait_for_install_dialog(function() {
wait_for_notification("addon-install-confirmation", function(aPanel) {
// Wait for the complete notification
wait_for_notification("addon-install-complete", function(aPanel) {
let notification = aPanel.childNodes[0];
@ -440,7 +393,7 @@ function test_multiple() {
});
});
accept_install_dialog();
document.getElementById("addon-install-confirmation-accept").click();
});
});
@ -459,7 +412,7 @@ function test_url() {
// Wait for the progress notification
wait_for_progress_notification(function(aPanel) {
// Wait for the install confirmation dialog
wait_for_install_dialog(function() {
wait_for_notification("addon-install-confirmation", function(aPanel) {
// Wait for the complete notification
wait_for_notification("addon-install-complete", function(aPanel) {
let notification = aPanel.childNodes[0];
@ -477,7 +430,7 @@ function test_url() {
});
});
accept_install_dialog();
document.getElementById("addon-install-confirmation-accept").click();
});
});
@ -546,7 +499,7 @@ function test_reload() {
// Wait for the progress notification
wait_for_progress_notification(function(aPanel) {
// Wait for the install confirmation dialog
wait_for_install_dialog(function() {
wait_for_notification("addon-install-confirmation", function(aPanel) {
// Wait for the complete notification
wait_for_notification("addon-install-complete", function(aPanel) {
let notification = aPanel.childNodes[0];
@ -581,7 +534,7 @@ function test_reload() {
gBrowser.loadURI(TESTROOT2 + "enabled.html");
});
accept_install_dialog();
document.getElementById("addon-install-confirmation-accept").click();
});
});
@ -599,7 +552,7 @@ function test_theme() {
// Wait for the progress notification
wait_for_progress_notification(function(aPanel) {
// Wait for the install confirmation dialog
wait_for_install_dialog(function() {
wait_for_notification("addon-install-confirmation", function(aPanel) {
// Wait for the complete notification
wait_for_notification("addon-install-complete", function(aPanel) {
let notification = aPanel.childNodes[0];
@ -624,7 +577,7 @@ function test_theme() {
});
});
accept_install_dialog();
document.getElementById("addon-install-confirmation-accept").click();
});
});
@ -677,7 +630,7 @@ function test_renotify_installed() {
// Wait for the progress notification
wait_for_progress_notification(function(aPanel) {
// Wait for the install confirmation dialog
wait_for_install_dialog(function() {
wait_for_notification("addon-install-confirmation", function(aPanel) {
// Wait for the complete notification
wait_for_notification("addon-install-complete", function(aPanel) {
// Dismiss the notification
@ -687,7 +640,7 @@ function test_renotify_installed() {
// Wait for the progress notification
wait_for_progress_notification(function(aPanel) {
// Wait for the install confirmation dialog
wait_for_install_dialog(function() {
wait_for_notification("addon-install-confirmation", function(aPanel) {
info("Timeouts after this probably mean bug 589954 regressed");
// Wait for the complete notification
@ -702,7 +655,7 @@ function test_renotify_installed() {
});
});
accept_install_dialog();
document.getElementById("addon-install-confirmation-accept").click();
});
});
@ -714,7 +667,7 @@ function test_renotify_installed() {
aPanel.hidePopup();
});
accept_install_dialog();
document.getElementById("addon-install-confirmation-accept").click();
});
});