browser_bug432599.js
Go to the documentation of this file.
1 function invokeUsingCtrlD(phase) {
2  switch (phase) {
3  case 1:
4  EventUtils.synthesizeKey("d", { accelKey: true });
5  break;
6  case 2:
7  case 4:
8  EventUtils.synthesizeKey("VK_ESCAPE", {});
9  break;
10  case 3:
11  EventUtils.synthesizeKey("d", { accelKey: true });
12  EventUtils.synthesizeKey("d", { accelKey: true });
13  break;
14  }
15 }
16 
17 function invokeUsingStarButton(phase) {
18  switch (phase) {
19  case 1:
20  EventUtils.sendMouseEvent({ type: "click" }, "star-button");
21  break;
22  case 2:
23  case 4:
24  EventUtils.synthesizeKey("VK_ESCAPE", {});
25  break;
26  case 3:
27  EventUtils.synthesizeMouse(document.getElementById("star-button"),
28  1, 1, { clickCount: 2 });
29  break;
30  }
31 }
32 
33 var testURL = "data:text/plain,Content";
34 
35 // test bug 432599
36 function test() {
38 
39  gBrowser.selectedTab = gBrowser.addTab();
40  gBrowser.selectedBrowser.addEventListener("load", initTest, true);
41 
42  content.location = testURL;
43 }
44 
47 
48 function initTest() {
49  // first, bookmark the page
50  Application.bookmarks.toolbar.addBookmark("Bug 432599 Test", makeURI(testURL));
51 
53 }
54 
57 
58 let popupElement = document.getElementById("editBookmarkPanel");
59 let titleElement = document.getElementById("editBookmarkPanelTitle");
60 let removeElement = document.getElementById("editBookmarkPanelRemoveButton");
61 
62 function checkBookmarksPanel(invoker, phase)
63 {
64  let onPopupShown = function(aEvent) {
65  if (aEvent.originalTarget == popupElement) {
66  checkBookmarksPanel(invoker, phase + 1);
67  popupElement.removeEventListener("popupshown", onPopupShown, false);
68  }
69  };
70  let onPopupHidden = function(aEvent) {
71  if (aEvent.originalTarget == popupElement) {
72  if (phase < 4) {
73  checkBookmarksPanel(invoker, phase + 1);
74  } else {
76  if (currentInvoker < invokers.length) {
78  } else {
79  gBrowser.removeCurrentTab();
80  finish();
81  }
82  }
83  popupElement.removeEventListener("popuphidden", onPopupHidden, false);
84  }
85  };
86 
87  switch (phase) {
88  case 1:
89  case 3:
90  popupElement.addEventListener("popupshown", onPopupShown, false);
91  break;
92  case 2:
93  popupElement.addEventListener("popuphidden", onPopupHidden, false);
94  initialValue = titleElement.value;
95  initialRemoveHidden = removeElement.hidden;
96  break;
97  case 4:
98  popupElement.addEventListener("popuphidden", onPopupHidden, false);
99  is(titleElement.value, initialValue, "The bookmark panel's title should be the same");
100  is(removeElement.hidden, initialRemoveHidden, "The bookmark panel's visibility should not change");
101  break;
102  }
103  invoker(phase);
104 }
let initialValue
var Application
Definition: sbAboutDRM.js:37
let popupElement
function checkBookmarksPanel(invoker, phase)
let removeElement
function test()
let initialRemoveHidden
function makeURI(aURLSpec, aCharset)
Definition: FeedWriter.js:71
let currentInvoker
let invokers
waitForExplicitFinish()
var testURL
function invokeUsingCtrlD(phase)
let titleElement
function initTest()
function invokeUsingStarButton(phase)