Bug 432599 - Double-click on the Star icon leads to incorrect display of the bookmark properties panel. Patch from Ehsan Akhgari [:ehsan] <ehsan.akhgari@gmail.com>, r=me.
☠☠ backed out by cab5a570f46e ☠ ☠
authorAsaf Romano <mozilla.mano@sent.com>
Tue, 29 Jul 2008 21:55:50 +0300
changeset 16286 96ca77c43cb9addf18588d138e910a5d201a1111
parent 16285 d811aa4cf0cf2c0c23fb423ed23a452bd4f94cf0
child 16287 cab5a570f46e10259bcd9152bcd3fab535a35e5c
child 16309 2fe00375ae00e093ff6962e30e58115667b76bba
push idunknown
push userunknown
push dateunknown
reviewersme
bugs432599
milestone1.9.1a2pre
Bug 432599 - Double-click on the Star icon leads to incorrect display of the bookmark properties panel. Patch from Ehsan Akhgari [:ehsan] <ehsan.akhgari@gmail.com>, r=me.
browser/base/content/test/browser_bug432599.js
new file mode 100644
--- /dev/null
+++ b/browser/base/content/test/browser_bug432599.js
@@ -0,0 +1,58 @@
+function invokeUsingCtrlD(close) {
+  if (close)
+    EventUtils.sendMouseEvent({ type: "click", button: 1 }, "editBookmarkPanelDoneButton");
+  else
+    EventUtils.synthesizeKey("d", { accelKey: true });
+}
+
+function invokeUsingStarButton(close) {
+  if (close)
+    EventUtils.sendMouseEvent({ type: "click", button: 1 }, "editBookmarkPanelDoneButton");
+  else
+    EventUtils.sendMouseEvent({ type: "click", button: 1 }, "star-button");
+}
+
+let testBrowser = null;
+
+// test bug 432599
+function test() {
+  waitForExplicitFinish();
+
+  let testTab = gBrowser.addTab();
+  gBrowser.selectedTab = testTab;
+  testBrowser = gBrowser.getBrowserForTab(testTab);
+  testBrowser.addEventListener("load", initTest, true);
+
+  testBrowser.contentWindow.location = 'data:text/plain,Content';
+}
+
+function initTest() {
+  let invokers = [invokeUsingStarButton, invokeUsingCtrlD];
+
+  // first, bookmark the page
+  PlacesCommandHook.bookmarkPage(testBrowser);
+
+  invokers.forEach(checkBookmarksPanel);
+
+  finish();
+}
+
+function checkBookmarksPanel(invoker)
+{
+  let titleElement = document.getElementById("editBookmarkPanelTitle");
+  let removeElement = document.getElementById("editBookmarkPanelRemoveButton");
+
+  // invoke the panel for the first time
+  invoker();
+
+  let initialValue = titleElement.value;
+  let initialRemoveHidden = removeElement.hidden;
+  invoker(true);
+
+  // invoke the panel for the second time
+  invoker();
+
+  is(titleElement.value, initialValue, "The bookmark panel's title should be the same");
+  is(removeElement.hidden, initialRemoveHidden, "The bookmark panel's visibility should not change");
+  invoker(true);
+}