1 function invokeUsingCtrlD(phase) {
4 EventUtils.synthesizeKey("d", { accelKey: true });
8 EventUtils.synthesizeKey("VK_ESCAPE", {});
11 EventUtils.synthesizeKey("d", { accelKey: true });
12 EventUtils.synthesizeKey("d", { accelKey: true });
17 function invokeUsingStarButton(phase) {
20 EventUtils.sendMouseEvent({ type: "click" }, "star-button");
24 EventUtils.synthesizeKey("VK_ESCAPE", {});
27 EventUtils.synthesizeMouse(document.getElementById("star-button"),
28 1, 1, { clickCount: 2 });
33 var testURL = "data:text/plain,Content";
36 function add_bookmark(aURI, aTitle) {
37 return PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
38 aURI, PlacesUtils.bookmarks.DEFAULT_INDEX,
44 waitForExplicitFinish();
46 gBrowser.selectedTab = gBrowser.addTab();
47 gBrowser.selectedBrowser.addEventListener("load", function () {
48 gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
49 waitForStarChange(false, initTest);
52 content.location = testURL;
56 // First, bookmark the page.
57 bookmarkId = add_bookmark(makeURI(testURL), "Bug 432599 Test");
59 checkBookmarksPanel(invokers[currentInvoker], 1);
62 function waitForStarChange(aValue, aCallback) {
63 let starButton = document.getElementById("star-button");
64 if (PlacesStarButton._pendingStmt || starButton.hasAttribute("starred") != aValue) {
65 info("Waiting for star button change.");
66 setTimeout(arguments.callee, 50, aValue, aCallback);
72 let invokers = [invokeUsingStarButton, invokeUsingCtrlD];
73 let currentInvoker = 0;
76 let initialRemoveHidden;
78 let popupElement = document.getElementById("editBookmarkPanel");
79 let titleElement = document.getElementById("editBookmarkPanelTitle");
80 let removeElement = document.getElementById("editBookmarkPanelRemoveButton");
82 function checkBookmarksPanel(invoker, phase)
84 let onPopupShown = function(aEvent) {
85 if (aEvent.originalTarget == popupElement) {
86 popupElement.removeEventListener("popupshown", arguments.callee, false);
87 checkBookmarksPanel(invoker, phase + 1);
90 let onPopupHidden = function(aEvent) {
91 if (aEvent.originalTarget == popupElement) {
92 popupElement.removeEventListener("popuphidden", arguments.callee, false);
94 checkBookmarksPanel(invoker, phase + 1);
97 if (currentInvoker < invokers.length) {
98 checkBookmarksPanel(invokers[currentInvoker], 1);
100 gBrowser.removeCurrentTab();
101 PlacesUtils.bookmarks.removeItem(bookmarkId);
111 popupElement.addEventListener("popupshown", onPopupShown, false);
114 popupElement.addEventListener("popuphidden", onPopupHidden, false);
115 initialValue = titleElement.value;
116 initialRemoveHidden = removeElement.hidden;
119 popupElement.addEventListener("popuphidden", onPopupHidden, false);
120 is(titleElement.value, initialValue, "The bookmark panel's title should be the same");
121 is(removeElement.hidden, initialRemoveHidden, "The bookmark panel's visibility should not change");