mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Bug 1251071 - "New bookmark" popup disappears if I reopen it after creating bookmark. r=mak
MozReview-Commit-ID: DNqcu5vxrBG --HG-- extra : rebase_source : 4a8c49ca01ca6987b43b3c1bffcbdd406ca98f70
This commit is contained in:
parent
acbe92a947
commit
217642efe0
@ -25,7 +25,7 @@ var StarUI = {
|
||||
element.hidden = false;
|
||||
element.addEventListener("keypress", this, false);
|
||||
element.addEventListener("mouseout", this, false);
|
||||
element.addEventListener("mouseover", this, false);
|
||||
element.addEventListener("mousemove", this, false);
|
||||
element.addEventListener("popuphidden", this, false);
|
||||
element.addEventListener("popupshown", this, false);
|
||||
return this.panel = element;
|
||||
@ -63,7 +63,7 @@ var StarUI = {
|
||||
// nsIDOMEventListener
|
||||
handleEvent(aEvent) {
|
||||
switch (aEvent.type) {
|
||||
case "mouseover":
|
||||
case "mousemove":
|
||||
clearTimeout(this._autoCloseTimer);
|
||||
break;
|
||||
case "popuphidden":
|
||||
@ -138,6 +138,9 @@ var StarUI = {
|
||||
// Explicit fall-through
|
||||
}
|
||||
case "popupshown":
|
||||
if (aEvent.target != aEvent.currentTarget) {
|
||||
break;
|
||||
}
|
||||
// auto-close if new and not interacted with
|
||||
if (this._isNewBookmark) {
|
||||
// 3500ms matches the timeout that Pocket uses in
|
||||
@ -146,7 +149,9 @@ var StarUI = {
|
||||
if (this._closePanelQuickForTesting) {
|
||||
delay /= 10;
|
||||
}
|
||||
this._autoCloseTimer = setTimeout(() => this.panel.hidePopup(), delay, this);
|
||||
this._autoCloseTimer = setTimeout(() => {
|
||||
this.panel.hidePopup();
|
||||
}, delay);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -122,28 +122,28 @@ add_task(function* panel_shown_for_keyboardshortcut_on_new_bookmark_star_and_aut
|
||||
});
|
||||
});
|
||||
|
||||
add_task(function* panel_shown_for_new_bookmarks_mouseover_mouseout() {
|
||||
add_task(function* panel_shown_for_new_bookmarks_mousemove_mouseout() {
|
||||
yield test_bookmarks_popup({
|
||||
isNewBookmark: true,
|
||||
popupShowFn() {
|
||||
bookmarkStar.click();
|
||||
},
|
||||
*popupEditFn() {
|
||||
let mouseOverPromise = new Promise(resolve => {
|
||||
bookmarkPanel.addEventListener("mouseover", function onmouseover() {
|
||||
bookmarkPanel.removeEventListener("mouseover", onmouseover);
|
||||
let mouseMovePromise = new Promise(resolve => {
|
||||
bookmarkPanel.addEventListener("mousemove", function onmousemove() {
|
||||
bookmarkPanel.removeEventListener("mousemove", onmousemove);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
yield new Promise(resolve => {
|
||||
EventUtils.synthesizeNativeMouseMove(bookmarkPanel, 0, 0, resolve, window);
|
||||
});
|
||||
info("Waiting for mouseover event");
|
||||
yield mouseOverPromise;
|
||||
info("Got mouseover event");
|
||||
info("Waiting for mousemove event");
|
||||
yield mouseMovePromise;
|
||||
info("Got mousemove event");
|
||||
|
||||
yield new Promise(resolve => setTimeout(resolve, 400));
|
||||
is(bookmarkPanel.state, "open", "Panel should still be open on mouseover");
|
||||
is(bookmarkPanel.state, "open", "Panel should still be open on mousemove");
|
||||
},
|
||||
*popupHideFn() {
|
||||
let mouseOutPromise = new Promise(resolve => {
|
||||
|
Loading…
Reference in New Issue
Block a user