mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 610661 - Addon object not passed to custom about dialogs; r,a=Mossop
--HG-- rename : toolkit/mozapps/extensions/test/browser/addon_prefs.xul => toolkit/mozapps/extensions/test/browser/addon_about.xul
This commit is contained in:
parent
4c7a50053e
commit
614084bd6a
@ -887,7 +887,7 @@ var gViewController = {
|
||||
doCommand: function(aAddon) {
|
||||
var aboutURL = aAddon.aboutURL;
|
||||
if (aboutURL)
|
||||
openDialog(aboutURL, "", "chrome,centerscreen,modal");
|
||||
openDialog(aboutURL, "", "chrome,centerscreen,modal", aAddon);
|
||||
else
|
||||
openDialog("chrome://mozapps/content/extensions/about.xul",
|
||||
"", "chrome,centerscreen,modal", aAddon);
|
||||
|
@ -47,6 +47,7 @@ include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
_MAIN_TEST_FILES = \
|
||||
head.js \
|
||||
browser_about.js \
|
||||
browser_bug557943.js \
|
||||
browser_bug562797.js \
|
||||
browser_bug562854.js \
|
||||
@ -93,6 +94,7 @@ _TEST_FILES = \
|
||||
$(NULL)
|
||||
|
||||
_TEST_RESOURCES = \
|
||||
addon_about.xul \
|
||||
addon_prefs.xul \
|
||||
browser_bug557956.rdf \
|
||||
browser_bug557956_8_2.xpi \
|
||||
|
6
toolkit/mozapps/extensions/test/browser/addon_about.xul
Normal file
6
toolkit/mozapps/extensions/test/browser/addon_about.xul
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
id="addon-test-about-window">
|
||||
<label value="Oh hai!"/>
|
||||
</window>
|
85
toolkit/mozapps/extensions/test/browser/browser_about.js
Normal file
85
toolkit/mozapps/extensions/test/browser/browser_about.js
Normal file
@ -0,0 +1,85 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Tests the default and custom "about" dialogs of add-ons.
|
||||
*
|
||||
* Test for bug 610661 <https://bugzilla.mozilla.org/show_bug.cgi?id=610661>:
|
||||
* Addon object not passed to custom about dialogs.
|
||||
*/
|
||||
|
||||
var gManagerWindow;
|
||||
|
||||
const URI_ABOUT_DEFAULT = "chrome://mozapps/content/extensions/about.xul";
|
||||
const URI_ABOUT_CUSTOM = CHROMEROOT + "addon_about.xul";
|
||||
|
||||
function test() {
|
||||
requestLongerTimeout(2);
|
||||
|
||||
waitForExplicitFinish();
|
||||
|
||||
var gProvider = new MockProvider();
|
||||
gProvider.createAddons([{
|
||||
id: "test1@tests.mozilla.org",
|
||||
name: "Test add-on 1",
|
||||
description: "foo"
|
||||
},
|
||||
{
|
||||
id: "test2@tests.mozilla.org",
|
||||
name: "Test add-on 2",
|
||||
description: "bar",
|
||||
aboutURL: URI_ABOUT_CUSTOM
|
||||
}]);
|
||||
|
||||
open_manager("addons://list/extension", function(aManager) {
|
||||
gManagerWindow = aManager;
|
||||
|
||||
test_about_window("Test add-on 1", URI_ABOUT_DEFAULT, function() {
|
||||
test_about_window("Test add-on 2", URI_ABOUT_CUSTOM, function() {
|
||||
close_manager(gManagerWindow, finish);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function test_about_window(aAddonItemName, aExpectedAboutUri, aCallback) {
|
||||
var addonList = gManagerWindow.document.getElementById("addon-list");
|
||||
for (var i = 0; i < addonList.childNodes.length; i++) {
|
||||
var addonItem = addonList.childNodes[i];
|
||||
if (addonItem.hasAttribute("name") &&
|
||||
addonItem.getAttribute("name") === aAddonItemName)
|
||||
break;
|
||||
}
|
||||
|
||||
info("Waiting for about dialog");
|
||||
Services.ww.registerNotification(function TEST_ww_observer(aSubject, aTopic,
|
||||
aData) {
|
||||
if (aTopic == "domwindowclosed") {
|
||||
Services.ww.unregisterNotification(TEST_ww_observer);
|
||||
|
||||
info("About dialog closed, waiting for focus on browser window");
|
||||
waitForFocus(aCallback);
|
||||
} else if (aTopic == "domwindowopened") {
|
||||
info("About dialog opened, waiting for focus");
|
||||
|
||||
let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
|
||||
waitForFocus(function() {
|
||||
info("Saw about dialog");
|
||||
|
||||
is(win.location,
|
||||
aExpectedAboutUri,
|
||||
"The correct add-on about window should have opened");
|
||||
|
||||
is(win.arguments && win.arguments[0] && win.arguments[0].name,
|
||||
aAddonItemName,
|
||||
"window.arguments[0] should refer to the add-on object");
|
||||
|
||||
win.close();
|
||||
}, win);
|
||||
}
|
||||
});
|
||||
|
||||
gManagerWindow.gViewController.doCommand("cmd_showItemAbout",
|
||||
addonItem.mAddon);
|
||||
}
|
Loading…
Reference in New Issue
Block a user