mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-28 21:28:55 +00:00
Bug 579540: Wait for focus before accepting extension installs. r=gavin, a=tests
This commit is contained in:
parent
37f448a515
commit
469511bfbb
@ -33,26 +33,21 @@ function wait_for_install_dialog(aCallback) {
|
||||
info("Waiting for install dialog");
|
||||
Services.wm.addListener({
|
||||
onOpenWindow: function(aXULWindow) {
|
||||
info("Install dialog opened, waiting for load");
|
||||
info("Install dialog opened, waiting for focus");
|
||||
Services.wm.removeListener(this);
|
||||
|
||||
var domwindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowInternal);
|
||||
domwindow.addEventListener("load", function() {
|
||||
domwindow.removeEventListener("load", arguments.callee, false);
|
||||
|
||||
waitForFocus(function() {
|
||||
info("Saw install dialog");
|
||||
is(domwindow.document.location.href, XPINSTALL_URL, "Should have seen the right window open");
|
||||
|
||||
// Allow other window load listeners to execute before passing to callback
|
||||
executeSoon(function() {
|
||||
info("Saw install dialog");
|
||||
// Override the countdown timer on the accept button
|
||||
var button = domwindow.document.documentElement.getButton("accept");
|
||||
button.disabled = false;
|
||||
// Override the countdown timer on the accept button
|
||||
var button = domwindow.document.documentElement.getButton("accept");
|
||||
button.disabled = false;
|
||||
|
||||
aCallback(domwindow);
|
||||
});
|
||||
}, false);
|
||||
aCallback(domwindow);
|
||||
}, domwindow);
|
||||
},
|
||||
|
||||
onCloseWindow: function(aXULWindow) {
|
||||
|
@ -139,12 +139,6 @@ var Harness = {
|
||||
},
|
||||
|
||||
// Window open handling
|
||||
windowLoad: function(window) {
|
||||
// Allow any other load handlers to execute
|
||||
var self = this;
|
||||
executeSoon(function() { self.windowReady(window); } );
|
||||
},
|
||||
|
||||
windowReady: function(window) {
|
||||
if (window.document.location.href == XPINSTALL_URL) {
|
||||
if (this.installBlockedCallback)
|
||||
@ -224,10 +218,9 @@ var Harness = {
|
||||
var domwindow = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIDOMWindowInternal);
|
||||
var self = this;
|
||||
domwindow.addEventListener("load", function() {
|
||||
domwindow.removeEventListener("load", arguments.callee, false);
|
||||
self.windowLoad(domwindow);
|
||||
}, false);
|
||||
waitForFocus(function() {
|
||||
self.windowReady(domwindow);
|
||||
}, domwindow);
|
||||
},
|
||||
|
||||
onCloseWindow: function(window) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user