Skip to content

Commit

Permalink
Bug 1538158 - Clicking the history dropmarker should initiate an empt…
Browse files Browse the repository at this point in the history
…y search instead of searching for the loaded URL. r=adw

Differential Revision: https://phabricator.services.mozilla.com/D25059

--HG--
extra : moz-landing-system : lando
  • Loading branch information
daogottwald committed Mar 28, 2019
1 parent 9fb5e17 commit ebf1e69
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion browser/components/urlbar/UrlbarInput.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ class UrlbarInput {
}

if (!searchString) {
searchString = this.textValue;
searchString = this.valueIsTyped ? this.textValue : "";
} else if (!this.textValue.startsWith(searchString)) {
throw new Error("The current value doesn't start with the search string");
}
Expand Down
1 change: 1 addition & 0 deletions browser/components/urlbar/tests/browser/browser.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ skip-if = os != "mac" # Mac only feature
[browser_canonizeURL.js]
[browser_caret_navigation.js]
[browser_dragdropURL.js]
[browser_dropmarker.js]
[browser_keepStateAcrossTabSwitches.js]
[browser_keyword_override.js]
[browser_keyword_select_and_type.js]
Expand Down
19 changes: 19 additions & 0 deletions browser/components/urlbar/tests/browser/browser_dropmarker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/

"use strict";

add_task(async function() {
await BrowserTestUtils.withNewTab({ gBrowser, url: "http://example.com/" }, async () => {
await UrlbarTestUtils.promisePopupOpen(window, () => {
let historyDropMarker =
window.document.getAnonymousElementByAttribute(gURLBar.textbox, "anonid", "historydropmarker");
EventUtils.synthesizeMouseAtCenter(historyDropMarker, {}, window);
});
let queryContext = await gURLBar.lastQueryContextPromise;
is(queryContext.searchString, "",
"Clicking the history dropmarker should initiate an empty search instead of searching for the loaded URL");
await UrlbarTestUtils.promisePopupClose(window);
});
});

0 comments on commit ebf1e69

Please sign in to comment.