mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-25 11:15:34 +00:00
Backed out changeset b37620ff38b6 (bug 1579004) for failures browser_urlbar_collapseOnChromeMousedown.js CLOSED TREE
This commit is contained in:
parent
ce6f028211
commit
0cefb9ebf8
@ -206,9 +206,6 @@ class UrlbarInput {
|
||||
|
||||
this.dropmarker.addEventListener("mousedown", this);
|
||||
|
||||
this.window.addEventListener("mousedown", this);
|
||||
this.textbox.addEventListener("mousedown", this);
|
||||
|
||||
// This is used to detect commands launched from the panel, to avoid
|
||||
// recording abandonment events when the command causes a blur event.
|
||||
this.view.panel.addEventListener("command", this, true);
|
||||
@ -240,8 +237,6 @@ class UrlbarInput {
|
||||
this.removeEventListener(name, this);
|
||||
}
|
||||
this.dropmarker.removeEventListener("mousedown", this);
|
||||
this.window.removeEventListener("mousedown", this);
|
||||
this.textbox.removeEventListener("mousedown", this);
|
||||
|
||||
this.view.panel.remove();
|
||||
this.endLayoutExtend(true);
|
||||
@ -1689,53 +1684,37 @@ class UrlbarInput {
|
||||
}
|
||||
|
||||
_on_mousedown(event) {
|
||||
switch (event.currentTarget) {
|
||||
case this.inputField:
|
||||
this.startLayoutExtend();
|
||||
this._preventClickSelectsAll = this.focused;
|
||||
if (event.currentTarget == this.inputField) {
|
||||
this._preventClickSelectsAll = this.focused;
|
||||
|
||||
// The rest of this case only cares about left clicks.
|
||||
if (event.button != 0) {
|
||||
break;
|
||||
}
|
||||
// The rest of this handler only cares about left clicks.
|
||||
if (event.button != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.detail == 2 && UrlbarPrefs.get("doubleClickSelectsAll")) {
|
||||
this.editor.selectAll();
|
||||
event.preventDefault();
|
||||
} else if (this.openViewOnFocusForCurrentTab && !this.view.isOpen) {
|
||||
this.startQuery({
|
||||
allowAutofill: false,
|
||||
event,
|
||||
});
|
||||
}
|
||||
break;
|
||||
case this.dropmarker:
|
||||
if (event.button != 0) {
|
||||
break;
|
||||
}
|
||||
if (event.detail == 2 && UrlbarPrefs.get("doubleClickSelectsAll")) {
|
||||
this.editor.selectAll();
|
||||
event.preventDefault();
|
||||
} else if (this.openViewOnFocusForCurrentTab && !this.view.isOpen) {
|
||||
this.startQuery({
|
||||
allowAutofill: false,
|
||||
event,
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.view.isOpen) {
|
||||
this.view.close();
|
||||
} else {
|
||||
this.focus();
|
||||
this.startQuery({
|
||||
allowAutofill: false,
|
||||
event,
|
||||
});
|
||||
this._maybeSelectAll();
|
||||
}
|
||||
break;
|
||||
case this.textbox:
|
||||
this._mousedownOnUrlbarDescendant = true;
|
||||
break;
|
||||
case this.window:
|
||||
// We collapse the Urlbar for any mousedowns outside of it.
|
||||
if (this._mousedownOnUrlbarDescendant) {
|
||||
this._mousedownOnUrlbarDescendant = false;
|
||||
break;
|
||||
}
|
||||
|
||||
this.endLayoutExtend(true);
|
||||
if (event.currentTarget == this.dropmarker && event.button == 0) {
|
||||
if (this.view.isOpen) {
|
||||
this.view.close();
|
||||
} else {
|
||||
this.focus();
|
||||
this.startQuery({
|
||||
allowAutofill: false,
|
||||
event,
|
||||
});
|
||||
this._maybeSelectAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,6 @@ support-files =
|
||||
[browser_urlbar_blanking.js]
|
||||
support-files =
|
||||
file_blank_but_not_blank.html
|
||||
[browser_urlbar_collapseOnChromeMousedown.js]
|
||||
[browser_urlbar_content_opener.js]
|
||||
[browser_urlbar_display_selectedAction_Extensions.js]
|
||||
[browser_urlbar_empty_search.js]
|
||||
|
@ -1,47 +0,0 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
const MEGABAR_PREF = "browser.urlbar.megabar";
|
||||
|
||||
add_task(async function() {
|
||||
Services.prefs.setBoolPref(MEGABAR_PREF, true);
|
||||
// We need to open a new window for the Megabar to kick in. This can be
|
||||
// removed when the Megabar is on by default.
|
||||
let win = await BrowserTestUtils.openNewBrowserWindow();
|
||||
registerCleanupFunction(() => {
|
||||
BrowserTestUtils.closeWindow(win);
|
||||
Services.prefs.clearUserPref(MEGABAR_PREF);
|
||||
});
|
||||
|
||||
win.gURLBar.focus();
|
||||
Assert.ok(
|
||||
win.gURLBar.hasAttribute("breakout-extend"),
|
||||
"The Urlbar should have the breakout-extend attribute."
|
||||
);
|
||||
EventUtils.synthesizeMouseAtCenter(gURLBar.textbox, {}, win);
|
||||
Assert.ok(
|
||||
win.gURLBar.hasAttribute("breakout-extend"),
|
||||
"The Urlbar should have the breakout-extend attribute."
|
||||
);
|
||||
|
||||
// We just want a non-interactive part of the UI.
|
||||
let chromeTarget = gURLBar.textbox
|
||||
.closest("toolbar")
|
||||
.querySelector("toolbarspring");
|
||||
EventUtils.synthesizeMouseAtCenter(chromeTarget, {}, win);
|
||||
Assert.ok(
|
||||
!win.gURLBar.hasAttribute("breakout-extend"),
|
||||
"The Urlbar should not have the breakout-extend attribute."
|
||||
);
|
||||
Assert.ok(win.gURLBar.focused, "The Urlbar should be focused.");
|
||||
|
||||
// Simulating a user switching out of the Firefox window and back in.
|
||||
let newWin = await BrowserTestUtils.openNewBrowserWindow();
|
||||
await BrowserTestUtils.closeWindow(newWin);
|
||||
Assert.ok(
|
||||
win.gURLBar.hasAttribute("breakout-extend"),
|
||||
"The Urlbar should have the breakout-extend attribute."
|
||||
);
|
||||
});
|
Loading…
Reference in New Issue
Block a user