зеркало из https://github.com/mozilla/gecko-dev.git
Bug 691389 - Error: win is null when performing drag&drop of a XPI file to Add-ons Manager tab. r=dtownsend
This commit is contained in:
Родитель
e1530b34b1
Коммит
025fdc5b88
|
@ -3292,8 +3292,8 @@ var gDragDrop = {
|
|||
if (pos == urls.length) {
|
||||
if (installs.length > 0) {
|
||||
// Display the normal install confirmation for the installs
|
||||
AddonManager.installAddonsFromWebpage("application/x-xpinstall", this,
|
||||
null, installs);
|
||||
AddonManager.installAddonsFromWebpage("application/x-xpinstall",
|
||||
window, null, installs);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -75,6 +75,17 @@ WindowOpenListener.prototype = {
|
|||
}
|
||||
};
|
||||
|
||||
var gSawInstallNotification = false;
|
||||
var gInstallNotificationObserver = {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
var installInfo = aSubject.QueryInterface(Ci.amIWebInstallInfo);
|
||||
isnot(installInfo.originatingWindow, null, "Notification should have non-null originatingWindow");
|
||||
gSawInstallNotification = true;
|
||||
Services.obs.removeObserver(this, "addon-install-started");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
|
@ -113,9 +124,15 @@ function test_confirmation(aWindow, aExpectedURLs) {
|
|||
add_test(function() {
|
||||
var url = TESTROOT + "addons/browser_dragdrop1.xpi";
|
||||
|
||||
Services.obs.addObserver(gInstallNotificationObserver,
|
||||
"addon-install-started", false);
|
||||
|
||||
new WindowOpenListener(INSTALL_URI, function(aWindow) {
|
||||
test_confirmation(aWindow, [url]);
|
||||
}, run_next_test);
|
||||
}, function() {
|
||||
is(gSawInstallNotification, true, "Should have seen addon-install-started notification.");
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
var viewContainer = gManagerWindow.document.getElementById("view-port");
|
||||
var effect = chromeUtils.synthesizeDrop(viewContainer, viewContainer,
|
||||
|
@ -128,9 +145,15 @@ add_test(function() {
|
|||
add_test(function() {
|
||||
var fileurl = get_addon_file_url("browser_dragdrop1.xpi");
|
||||
|
||||
Services.obs.addObserver(gInstallNotificationObserver,
|
||||
"addon-install-started", false);
|
||||
|
||||
new WindowOpenListener(INSTALL_URI, function(aWindow) {
|
||||
test_confirmation(aWindow, [fileurl.spec]);
|
||||
}, run_next_test);
|
||||
}, function() {
|
||||
is(gSawInstallNotification, true, "Should have seen addon-install-started notification.");
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
var viewContainer = gManagerWindow.document.getElementById("view-port");
|
||||
var effect = chromeUtils.synthesizeDrop(viewContainer, viewContainer,
|
||||
|
@ -144,9 +167,15 @@ add_test(function() {
|
|||
var url1 = TESTROOT + "addons/browser_dragdrop1.xpi";
|
||||
var url2 = TESTROOT2 + "addons/browser_dragdrop2.xpi";
|
||||
|
||||
Services.obs.addObserver(gInstallNotificationObserver,
|
||||
"addon-install-started", false);
|
||||
|
||||
new WindowOpenListener(INSTALL_URI, function(aWindow) {
|
||||
test_confirmation(aWindow, [url1, url2]);
|
||||
}, run_next_test);
|
||||
}, function() {
|
||||
is(gSawInstallNotification, true, "Should have seen addon-install-started notification.");
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
var viewContainer = gManagerWindow.document.getElementById("view-port");
|
||||
var effect = chromeUtils.synthesizeDrop(viewContainer, viewContainer,
|
||||
|
@ -161,9 +190,15 @@ add_test(function() {
|
|||
var fileurl1 = get_addon_file_url("browser_dragdrop1.xpi");
|
||||
var fileurl2 = get_addon_file_url("browser_dragdrop2.xpi");
|
||||
|
||||
Services.obs.addObserver(gInstallNotificationObserver,
|
||||
"addon-install-started", false);
|
||||
|
||||
new WindowOpenListener(INSTALL_URI, function(aWindow) {
|
||||
test_confirmation(aWindow, [fileurl1.spec, fileurl2.spec]);
|
||||
}, run_next_test);
|
||||
}, function() {
|
||||
is(gSawInstallNotification, true, "Should have seen addon-install-started notification.");
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
var viewContainer = gManagerWindow.document.getElementById("view-port");
|
||||
var effect = chromeUtils.synthesizeDrop(viewContainer, viewContainer,
|
||||
|
@ -178,9 +213,15 @@ add_test(function() {
|
|||
var url = TESTROOT + "addons/browser_dragdrop1.xpi";
|
||||
var fileurl = get_addon_file_url("browser_dragdrop2.xpi");
|
||||
|
||||
Services.obs.addObserver(gInstallNotificationObserver,
|
||||
"addon-install-started", false);
|
||||
|
||||
new WindowOpenListener(INSTALL_URI, function(aWindow) {
|
||||
test_confirmation(aWindow, [url, fileurl.spec]);
|
||||
}, run_next_test);
|
||||
}, function() {
|
||||
is(gSawInstallNotification, true, "Should have seen addon-install-started notification.");
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
var viewContainer = gManagerWindow.document.getElementById("view-port");
|
||||
var effect = chromeUtils.synthesizeDrop(viewContainer, viewContainer,
|
||||
|
|
Загрузка…
Ссылка в новой задаче