Bug 1528593 - Rename UrlbarInput::value getter to untrimmedValue and textValue to value. r=dao

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
harry 2019-08-19 19:15:47 +00:00
parent 9875e48074
commit 4f4a15a1d5
32 changed files with 123 additions and 120 deletions

View File

@ -395,7 +395,7 @@ function test() {
"We should have reset the load state when the tab loaded"
);
is(
gURLBar.textValue,
gURLBar.value,
gURLBar.trimValue("http://example.com/"),
"Address bar's value set after loading URI"
);

View File

@ -99,8 +99,8 @@ add_task(async function() {
ok(!tab.linkedBrowser.isRemoteBrowser, "Browser should no longer be remote");
is(gURLBar.textValue, TESTURL, "URL bar visible value should be correct.");
is(gURLBar.value, TESTURL, "URL bar value should be correct.");
is(gURLBar.value, TESTURL, "URL bar visible value should be correct.");
is(gURLBar.untrimmedValue, TESTURL, "URL bar value should be correct.");
is(
gURLBar.getAttribute("pageproxystate"),
"valid",

View File

@ -247,7 +247,7 @@ class UrlbarController {
if (
end != start ||
(isArrowUp && start > 0) ||
(isArrowDown && end < this.input.textValue.length)
(isArrowDown && end < this.input.value.length)
) {
return true;
}
@ -350,7 +350,7 @@ class UrlbarController {
if (executeAction) {
this.userSelectionBehavior = "arrow";
this.engagementEvent.start(event);
this.input.startQuery({ searchString: this.input.textValue });
this.input.startQuery({ searchString: this.input.value });
}
}
event.preventDefault();

View File

@ -401,7 +401,7 @@ class UrlbarInput {
let url;
let selType = this.controller.engagementEvent.typeFromResult(result);
let numChars = this.textValue.length;
let numChars = this.value.length;
if (selectedOneOff) {
selType = "oneoff";
numChars = this._lastSearchString.length;
@ -419,7 +419,7 @@ class UrlbarInput {
} else {
// Use the current value if we don't have a UrlbarResult e.g. because the
// view is closed.
url = this.value;
url = this.untrimmedValue;
openParams.postData = null;
}
@ -641,7 +641,7 @@ class UrlbarInput {
// autofilled value but the value that the user typed.
canonizedUrl = this._maybeCanonizeURL(
event,
result.autofill ? this._lastSearchString : this.textValue
result.autofill ? this._lastSearchString : this.value
);
if (canonizedUrl) {
this.value = canonizedUrl;
@ -738,13 +738,13 @@ class UrlbarInput {
if (!searchString) {
searchString =
this.getAttribute("pageproxystate") == "valid" ? "" : this.textValue;
} else if (!this.textValue.startsWith(searchString)) {
this.getAttribute("pageproxystate") == "valid" ? "" : this.value;
} else if (!this.value.startsWith(searchString)) {
throw new Error("The current value doesn't start with the search string");
}
this._lastSearchString = searchString;
this._textValueOnLastSearch = this.textValue;
this._textValueOnLastSearch = this.value;
// TODO (Bug 1522902): This promise is necessary for tests, because some
// tests are not listening for completion when starting a query through
@ -826,11 +826,11 @@ class UrlbarInput {
return this.querySelector("#urlbar-go-button");
}
get textValue() {
get value() {
return this.inputField.value;
}
get value() {
get untrimmedValue() {
return this._untrimmedValue;
}
@ -916,7 +916,7 @@ class UrlbarInput {
* with the input don't interfere with searches from a new interaction.
*/
_resetSearchState() {
this._lastSearchString = this.textValue;
this._lastSearchString = this.value;
this._autofillPlaceholder = "";
}
@ -990,7 +990,7 @@ class UrlbarInput {
if (this.focused || !this._overflowing) {
this.inputField.removeAttribute("title");
} else {
this.inputField.setAttribute("title", this.value);
this.inputField.setAttribute("title", this.untrimmedValue);
}
}
@ -1016,7 +1016,7 @@ class UrlbarInput {
// The selection doesn't span the full domain if it doesn't contain a slash and is
// followed by some character other than a slash.
if (!selectedVal.includes("/")) {
let remainder = this.textValue.replace(selectedVal, "");
let remainder = this.value.replace(selectedVal, "");
if (remainder != "" && remainder[0] != "/") {
return selectedVal;
}
@ -1055,7 +1055,7 @@ class UrlbarInput {
// unless we want a decoded URI, or it's a data: or javascript: URI,
// since those are hard to read when encoded.
if (
this.textValue == selectedVal &&
this.value == selectedVal &&
!uri.schemeIs("javascript") &&
!uri.schemeIs("data") &&
!UrlbarPrefs.get("decodeURLsOnCopy")
@ -1558,7 +1558,7 @@ class UrlbarInput {
}
_on_input(event) {
let value = this.textValue;
let value = this.value;
this.valueIsTyped = true;
this._untrimmedValue = value;
this.window.gBrowser.userTypedValue = value;

View File

@ -32,7 +32,7 @@ var tests = [
loadTabInWindow(window, function(tab) {
gURLBar.handleRevert();
is(
gURLBar.textValue,
gURLBar.value,
"example.com",
"URL bar had user/pass stripped after reverting"
);
@ -48,7 +48,7 @@ var tests = [
openToolbarCustomizationUI(function() {
closeToolbarCustomizationUI(function() {
is(
win.gURLBar.textValue,
win.gURLBar.value,
"example.com",
"URL bar had user/pass stripped after customize"
);
@ -66,7 +66,7 @@ var tests = [
BrowserTestUtils.loadURI(tab.linkedBrowser, "http://test1.example.com");
tab.linkedBrowser.stop();
is(
gURLBar.textValue,
gURLBar.value,
"example.com",
"URL bar had user/pass stripped after load error"
);
@ -86,7 +86,7 @@ function loadTabInWindow(win, callback) {
BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, url).then(() => {
info("Tab loaded");
is(
win.gURLBar.textValue,
win.gURLBar.value,
"example.com",
"URL bar had user/pass stripped initially"
);

View File

@ -91,7 +91,7 @@ add_task(async function() {
function testVal(originalValue, targetValue) {
gURLBar.value = originalValue;
gURLBar.valueIsTyped = false;
is(gURLBar.textValue, targetValue || originalValue, "url bar value set");
is(gURLBar.value, targetValue || originalValue, "url bar value set");
}
function testCopy(originalValue, targetValue) {
@ -99,7 +99,7 @@ function testCopy(originalValue, targetValue) {
waitForClipboard(
targetValue,
function() {
is(gURLBar.textValue, originalValue, "url bar copy value set");
is(gURLBar.value, originalValue, "url bar copy value set");
gURLBar.focus();
gURLBar.select();

View File

@ -43,7 +43,7 @@ add_task(async function() {
await promiseAutocompleteResultPopup("moz");
Assert.equal(
gURLBar.textValue,
gURLBar.value,
"moz",
"Preselected search keyword result shouldn't automatically add a space"
);

View File

@ -12,11 +12,7 @@ async function test_autocomplete(data) {
info(desc);
await promiseAutocompleteResultPopup(typed);
Assert.equal(
gURLBar.textValue,
autofilled,
"autofilled value is as expected"
);
Assert.equal(gURLBar.value, autofilled, "autofilled value is as expected");
if (onAutoFill) {
onAutoFill();
}
@ -29,7 +25,7 @@ async function test_autocomplete(data) {
await promiseSearchComplete();
Assert.equal(gURLBar.textValue, modified, "backspaced value is as expected");
Assert.equal(gURLBar.value, modified, "backspaced value is as expected");
Assert.greater(
UrlbarTestUtils.getResultCount(window),

View File

@ -10,11 +10,7 @@ async function test_autocomplete(data) {
info(desc);
await promiseAutocompleteResultPopup(typed);
Assert.equal(
gURLBar.textValue,
autofilled,
"autofilled value is as expected"
);
Assert.equal(gURLBar.value, autofilled, "autofilled value is as expected");
let promiseLoad = BrowserTestUtils.waitForDocLoadAndStopIt(
waitForUrl,
@ -23,7 +19,7 @@ async function test_autocomplete(data) {
keys.forEach(([key, mods]) => EventUtils.synthesizeKey(key, mods));
Assert.equal(gURLBar.textValue, modified, "value is as expected");
Assert.equal(gURLBar.value, modified, "value is as expected");
await promiseLoad;
gURLBar.blur();

View File

@ -216,7 +216,7 @@ function checkKeys(testTuples) {
for (let [key, value, selectedIndex] of testTuples) {
EventUtils.synthesizeKey(key);
Assert.equal(UrlbarTestUtils.getSelectedIndex(window), selectedIndex);
Assert.equal(gURLBar.value, value);
Assert.equal(gURLBar.untrimmedValue, value);
}
}

View File

@ -39,13 +39,17 @@ add_task(async function() {
nextIndex,
"Should have selected the next item"
);
Assert.equal(gURLBar.value, nextResult.url, "Should have completed the URL");
Assert.equal(
gURLBar.untrimmedValue,
nextResult.url,
"Should have completed the URL"
);
info("Press backspace");
EventUtils.synthesizeKey("KEY_Backspace");
await promiseSearchComplete();
let editedValue = gURLBar.textValue;
let editedValue = gURLBar.value;
Assert.equal(
UrlbarTestUtils.getSelectedIndex(window),
initialIndex,

View File

@ -36,7 +36,7 @@ add_task(async function() {
await checkCaretMoves(
"KEY_ArrowDown",
gURLBar.textValue.length,
gURLBar.value.length,
"Caret should have moved to the end"
);
await checkPopupOpens("KEY_ArrowDown");

View File

@ -17,15 +17,15 @@ add_task(async function init() {
add_task(async function url() {
await BrowserTestUtils.withNewTab("http://example.com/", async () => {
gURLBar.focus();
gURLBar.selectionEnd = gURLBar.value.length;
gURLBar.selectionStart = gURLBar.value.length;
gURLBar.selectionEnd = gURLBar.untrimmedValue.length;
gURLBar.selectionStart = gURLBar.untrimmedValue.length;
EventUtils.synthesizeKey("KEY_ArrowDown");
await UrlbarTestUtils.promiseSearchComplete(window);
Assert.equal(UrlbarTestUtils.getSelectedIndex(window), 0);
let details = await UrlbarTestUtils.getDetailsOfResultAt(window, 0);
Assert.ok(details.autofill);
Assert.equal(details.url, "http://example.com/");
Assert.equal(gURLBar.textValue, "example.com/");
Assert.equal(gURLBar.value, "example.com/");
await UrlbarTestUtils.promisePopupClose(window);
});
});
@ -40,7 +40,7 @@ add_task(async function userTyping() {
Assert.equal(details.type, UrlbarUtils.RESULT_TYPE.SEARCH);
Assert.ok(details.searchParams);
Assert.equal(details.searchParams.query, "foo");
Assert.equal(gURLBar.textValue, "foo");
Assert.equal(gURLBar.value, "foo");
await UrlbarTestUtils.promisePopupClose(window);
});
@ -52,5 +52,5 @@ add_task(async function empty() {
Assert.equal(UrlbarTestUtils.getSelectedIndex(window), -1);
let details = await UrlbarTestUtils.getDetailsOfResultAt(window, 0);
Assert.equal(details.url, "http://example.com/");
Assert.equal(gURLBar.textValue, "");
Assert.equal(gURLBar.value, "");
});

View File

@ -13,7 +13,7 @@ add_task(async function basic() {
"Clicking the history dropmarker should initiate an empty search instead of searching for the loaded URL"
);
is(
gURLBar.value,
gURLBar.untrimmedValue,
"http://example.com/",
"Clicking the history dropmarker should not change the input value"
);

View File

@ -21,7 +21,7 @@ async function bumpScore(uri, searchString, counts, useMouseClick = false) {
gBrowser.selectedBrowser
);
// Look for the expected uri.
while (gURLBar.value != uri) {
while (gURLBar.untrimmedValue != uri) {
EventUtils.synthesizeKey("KEY_ArrowDown");
}
if (useMouseClick) {

View File

@ -27,10 +27,10 @@ add_task(async function() {
gURLBar.select();
EventUtils.sendKey("return");
await errorPageLoaded;
is(gURLBar.textValue, input, "Text is still in URL bar");
is(gURLBar.value, input, "Text is still in URL bar");
await BrowserTestUtils.switchTab(gBrowser, tab.previousElementSibling);
await BrowserTestUtils.switchTab(gBrowser, tab);
is(gURLBar.textValue, input, "Text is still in URL bar after tab switch");
is(gURLBar.value, input, "Text is still in URL bar after tab switch");
BrowserTestUtils.removeTab(tab);
});
@ -59,11 +59,11 @@ add_task(async function() {
gURLBar.select();
EventUtils.sendKey("return");
await errorPageLoaded;
is(gURLBar.textValue, input, "Text is still in URL bar");
is(gURLBar.value, input, "Text is still in URL bar");
is(tab.linkedBrowser.userTypedValue, input, "Text still stored on browser");
await BrowserTestUtils.switchTab(gBrowser, tab.previousElementSibling);
await BrowserTestUtils.switchTab(gBrowser, tab);
is(gURLBar.textValue, input, "Text is still in URL bar after tab switch");
is(gURLBar.value, input, "Text is still in URL bar after tab switch");
is(tab.linkedBrowser.userTypedValue, input, "Text still stored on browser");
BrowserTestUtils.removeTab(tab);
});

View File

@ -72,7 +72,7 @@ add_task(async function() {
await promiseSearchComplete();
Assert.equal(
gURLBar.textValue,
gURLBar.value,
"keyword ab",
"urlbar should have expected input"
);

View File

@ -53,7 +53,7 @@ add_task(async function shift_left_click_test() {
gBrowser.selectedBrowser,
"Content window should be focused"
);
is(win.gURLBar.textValue, TEST_VALUE, "New URL is loaded in new window");
is(win.gURLBar.value, TEST_VALUE, "New URL is loaded in new window");
// Cleanup.
let ourWindowRefocusedPromise = Promise.all([
@ -97,7 +97,7 @@ add_task(async function shift_accel_left_click_test() {
// Select the new background tab
gBrowser.selectedTab = gBrowser.selectedTab.nextElementSibling;
is(gURLBar.textValue, TEST_VALUE, "New URL is loaded in new tab");
is(gURLBar.value, TEST_VALUE, "New URL is loaded in new tab");
// Cleanup.
gBrowser.removeCurrentTab();
@ -143,7 +143,7 @@ add_task(async function load_in_current_tab_test() {
await loadStartedPromise;
info("URL should be loaded in the current tab");
is(gURLBar.textValue, TEST_VALUE, "Urlbar still has the value we entered");
is(gURLBar.value, TEST_VALUE, "Urlbar still has the value we entered");
await promiseCheckChildNoFocusedElement(gBrowser.selectedBrowser);
is(
document.activeElement,
@ -192,7 +192,7 @@ add_task(async function load_in_new_tab_test() {
// Check the load occurred in a new tab.
info("URL should be loaded in a new focused tab");
is(gURLBar.textValue, TEST_VALUE, "Urlbar still has the value we entered");
is(gURLBar.value, TEST_VALUE, "Urlbar still has the value we entered");
await promiseCheckChildNoFocusedElement(gBrowser.selectedBrowser);
is(
document.activeElement,

View File

@ -80,7 +80,7 @@ add_task(async function test_stripUnsafeProtocolPaste() {
await paste(inputValue);
Assert.equal(
gURLBar.textValue,
gURLBar.value,
expectedURL,
`entering ${inputValue} strips relevant bits.`
);

View File

@ -34,7 +34,11 @@ add_task(async function() {
let sawChange = false;
let handler = e => {
sawChange = true;
is(gURLBar.value, expectedURLBarChange, "Should not change URL bar value!");
is(
gURLBar.untrimmedValue,
expectedURLBarChange,
"Should not change URL bar value!"
);
};
let obs = new MutationObserver(handler);
@ -50,7 +54,7 @@ add_task(async function() {
gURLBar.value = expectedURLBarChange;
gURLBar.handleCommand();
is(
gURLBar.value,
gURLBar.untrimmedValue,
expectedURLBarChange,
"Should not have changed URL bar value synchronously."
);
@ -107,7 +111,7 @@ add_task(async function() {
// get new tab, switch to it
let newTab = (await newTabPromise).target;
await BrowserTestUtils.switchTab(gBrowser, newTab);
is(gURLBar.value, SLOW_HOST, "Should have slow page in URL bar");
is(gURLBar.untrimmedValue, SLOW_HOST, "Should have slow page in URL bar");
let browserStoppedPromise = BrowserTestUtils.browserStopped(
newTab.linkedBrowser,
null,
@ -117,7 +121,7 @@ add_task(async function() {
await browserStoppedPromise;
is(
gURLBar.value,
gURLBar.untrimmedValue,
SLOW_HOST,
"Should still have slow page in URL bar after stop"
);
@ -175,7 +179,7 @@ add_task(async function() {
// get new tab, switch to it
let newTab = (await newTabPromise).target;
await BrowserTestUtils.switchTab(gBrowser, newTab);
is(gURLBar.value, SLOW_HOST1, "Should have slow page in URL bar");
is(gURLBar.untrimmedValue, SLOW_HOST1, "Should have slow page in URL bar");
let browserStoppedPromise = BrowserTestUtils.browserStopped(
newTab.linkedBrowser,
null,
@ -185,7 +189,11 @@ add_task(async function() {
gURLBar.handleCommand();
await browserStoppedPromise;
is(gURLBar.value, SLOW_HOST2, "Should have second slow page in URL bar");
is(
gURLBar.untrimmedValue,
SLOW_HOST2,
"Should have second slow page in URL bar"
);
browserStoppedPromise = BrowserTestUtils.browserStopped(
newTab.linkedBrowser,
null,
@ -195,7 +203,7 @@ add_task(async function() {
await browserStoppedPromise;
is(
gURLBar.value,
gURLBar.untrimmedValue,
SLOW_HOST2,
"Should still have second slow page in URL bar after stop"
);

View File

@ -252,7 +252,7 @@ function runTest(testCase, cb) {
function doCheck() {
if (testCase.setURL || testCase.loadURL) {
gURLBar.valueIsTyped = !!testCase.setURL;
is(gURLBar.textValue, testCase.expectedURL, "url bar value set");
is(gURLBar.value, testCase.expectedURL, "url bar value set");
}
testCopy(testCase.copyVal, testCase.copyExpected, cb);
@ -292,7 +292,7 @@ function testCopy(copyVal, targetValue, cb) {
offsets.push([startBracket, endBracket - 1]);
copyVal = copyVal.replace("<", "").replace(">", "");
}
if (offsets.length == 0 || copyVal != gURLBar.textValue) {
if (offsets.length == 0 || copyVal != gURLBar.value) {
ok(false, "invalid copyVal: " + copyVal);
}
gURLBar.selectionStart = offsets[0][0];

View File

@ -16,7 +16,7 @@ add_task(async function returnKeypress() {
// Check url bar and selected tab.
is(
gURLBar.textValue,
gURLBar.value,
TEST_VALUE,
"Urlbar should preserve the value on return keypress"
);
@ -42,7 +42,7 @@ add_task(async function altReturnKeypress() {
// Check url bar and selected tab.
is(
gURLBar.textValue,
gURLBar.value,
TEST_VALUE,
"Urlbar should preserve the value on return keypress"
);
@ -69,7 +69,7 @@ add_task(async function altGrReturnKeypress() {
// Check url bar and selected tab.
is(
gURLBar.textValue,
gURLBar.value,
TEST_VALUE,
"Urlbar should preserve the value on return keypress"
);

View File

@ -69,7 +69,7 @@ add_task(async function() {
let expectedURL = result.url;
Assert.equal(
gURLBar.value,
gURLBar.untrimmedValue,
expectedURL,
"Value in the URL bar should be updated by keyboard selection"
);

View File

@ -16,12 +16,12 @@ add_task(async function() {
let verifyURLBarState = testType => {
is(
gURLBar.textValue,
gURLBar.value,
expectedURL,
"URL bar visible value should be correct " + testType
);
is(
gURLBar.value,
gURLBar.untrimmedValue,
expectedURL,
"URL bar value should be correct " + testType
);
@ -122,12 +122,12 @@ add_task(async function() {
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
is(
gURLBar.textValue,
gURLBar.value,
url,
"URL bar visible value should be correct when the page loads from about:newtab"
);
is(
gURLBar.value,
gURLBar.untrimmedValue,
url,
"URL bar value should be correct when the page loads from about:newtab"
);

View File

@ -267,7 +267,7 @@ function assertState(result, oneOff, textValue = undefined) {
"Expected one-off should be selected"
);
if (textValue !== undefined) {
Assert.equal(gURLBar.textValue, textValue, "Expected textValue");
Assert.equal(gURLBar.value, textValue, "Expected value");
}
}

View File

@ -204,6 +204,6 @@ function assertState(result, oneOff, textValue = undefined) {
"Expected one-off should be selected"
);
if (textValue !== undefined) {
Assert.equal(gURLBar.textValue, textValue, "Expected textValue");
Assert.equal(gURLBar.value, textValue, "Expected textValue");
}
}

View File

@ -15,25 +15,25 @@ add_task(async function() {
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, goodURL);
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
is(
gURLBar.textValue,
gURLBar.value,
gURLBar.trimValue(goodURL),
"location bar reflects loaded page"
);
await typeAndSubmitAndStop(badURL);
is(
gURLBar.textValue,
gURLBar.value,
gURLBar.trimValue(goodURL),
"location bar reflects loaded page after stop()"
);
gBrowser.removeCurrentTab();
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, "about:blank");
is(gURLBar.textValue, "", "location bar is empty");
is(gURLBar.value, "", "location bar is empty");
await typeAndSubmitAndStop(badURL);
is(
gURLBar.textValue,
gURLBar.value,
gURLBar.trimValue(badURL),
"location bar reflects stopped page in an empty tab"
);
@ -43,7 +43,7 @@ add_task(async function() {
async function typeAndSubmitAndStop(url) {
await promiseAutocompleteResultPopup(url, window, true);
is(
gURLBar.textValue,
gURLBar.value,
gURLBar.trimValue(url),
"location bar reflects loading page"
);

View File

@ -113,8 +113,8 @@ add_task(async function inputDoesntMatchHeuristicResult() {
gURLBar.value = `${ALIAS}xxx`;
// The alias substring should not be highlighted.
Assert.equal(gURLBar.value, value);
Assert.ok(gURLBar.value.includes(ALIAS));
Assert.equal(gURLBar.untrimmedValue, value);
Assert.ok(gURLBar.untrimmedValue.includes(ALIAS));
assertHighlighted(false, ALIAS);
// Do another search using the alias.
@ -134,8 +134,8 @@ add_task(async function inputDoesntMatchHeuristicResult() {
gURLBar.value = `bbb ${ALIAS}`;
// The alias substring should not be highlighted.
Assert.equal(gURLBar.value, value);
Assert.ok(gURLBar.value.includes(ALIAS));
Assert.equal(gURLBar.untrimmedValue, value);
Assert.ok(gURLBar.untrimmedValue.includes(ALIAS));
assertHighlighted(false, ALIAS);
// Reset for the next test.
@ -232,7 +232,7 @@ add_task(async function clickAndFillAlias() {
// The urlbar input value should be the alias followed by a space so that it's
// ready for the user to start typing.
Assert.equal(gURLBar.textValue, `${ALIAS} `);
Assert.equal(gURLBar.value, `${ALIAS} `);
// Press the enter key a couple of times. Nothing should happen except a new
// search will start and its result should be the alias again. The urlbar
@ -243,7 +243,7 @@ add_task(async function clickAndFillAlias() {
await promiseSearchComplete();
await waitForAutocompleteResultAt(0);
await assertAlias(true);
Assert.equal(gURLBar.textValue, `${ALIAS} `);
Assert.equal(gURLBar.value, `${ALIAS} `);
}
await UrlbarTestUtils.promisePopupClose(window, () =>
@ -280,7 +280,7 @@ add_task(async function enterAndFillAlias() {
// The urlbar input value should be the alias followed by a space so that it's
// ready for the user to start typing.
Assert.equal(gURLBar.textValue, `${ALIAS} `);
Assert.equal(gURLBar.value, `${ALIAS} `);
// Press the enter key a couple of times. Nothing should happen except a new
// search will start and its result should be the alias again. The urlbar
@ -291,7 +291,7 @@ add_task(async function enterAndFillAlias() {
await promiseSearchComplete();
await waitForAutocompleteResultAt(0);
await assertAlias(true);
Assert.equal(gURLBar.textValue, `${ALIAS} `);
Assert.equal(gURLBar.value, `${ALIAS} `);
}
await UrlbarTestUtils.promisePopupClose(window, () =>
@ -319,7 +319,7 @@ add_task(async function enterAutofillsAlias() {
// The urlbar input value should be the alias followed by a space so that it's
// ready for the user to start typing.
Assert.equal(gURLBar.textValue, expectedString);
Assert.equal(gURLBar.value, expectedString);
Assert.equal(gURLBar.selectionStart, expectedString.length);
Assert.equal(gURLBar.selectionEnd, expectedString.length);
await assertAlias(true);
@ -434,10 +434,10 @@ function assertHighlighted(highlighted, expectedAlias) {
return;
}
Assert.equal(selection.rangeCount, 1);
let index = gURLBar.textValue.indexOf(expectedAlias);
let index = gURLBar.value.indexOf(expectedAlias);
Assert.ok(
index >= 0,
`gURLBar.textValue="${gURLBar.textValue}" expectedAlias="${expectedAlias}"`
`gURLBar.value="${gURLBar.value}" expectedAlias="${expectedAlias}"`
);
let range = selection.getRangeAt(0);
Assert.ok(range);

View File

@ -18,7 +18,7 @@ add_task(async function() {
);
EventUtils.sendKey("return");
await loadPromise;
is(gURLBar.textValue, "www.example.com");
is(gURLBar.value, "www.example.com");
}
);
});

View File

@ -57,29 +57,29 @@ add_task(async function() {
async function cycleTabs() {
await BrowserTestUtils.switchTab(gBrowser, fullURLTab);
is(
gURLBar.textValue,
gURLBar.value,
testURL,
"gURLBar.textValue should be testURL after switching back to fullURLTab"
"gURLBar.value should be testURL after switching back to fullURLTab"
);
await BrowserTestUtils.switchTab(gBrowser, partialURLTab);
is(
gURLBar.textValue,
gURLBar.value,
testPartialURL,
"gURLBar.textValue should be testPartialURL after switching back to partialURLTab"
"gURLBar.value should be testPartialURL after switching back to partialURLTab"
);
await BrowserTestUtils.switchTab(gBrowser, deletedURLTab);
is(
gURLBar.textValue,
gURLBar.value,
"",
'gURLBar.textValue should be "" after switching back to deletedURLTab'
'gURLBar.value should be "" after switching back to deletedURLTab'
);
await BrowserTestUtils.switchTab(gBrowser, fullURLTab);
is(
gURLBar.textValue,
gURLBar.value,
testURL,
"gURLBar.textValue should be testURL after switching back to fullURLTab"
"gURLBar.value should be testURL after switching back to fullURLTab"
);
}
@ -97,8 +97,7 @@ add_task(async function() {
if (removeAll) {
gURLBar.select();
} else {
gURLBar.selectionStart = gURLBar.selectionEnd =
gURLBar.textValue.length;
gURLBar.selectionStart = gURLBar.selectionEnd = gURLBar.value.length;
}
EventUtils.synthesizeKey("KEY_Backspace");
});
@ -107,31 +106,31 @@ add_task(async function() {
async function prepareDeletedURLTab() {
await BrowserTestUtils.switchTab(gBrowser, deletedURLTab);
is(
gURLBar.textValue,
gURLBar.value,
testURL,
"gURLBar.textValue should be testURL after initial switch to deletedURLTab"
"gURLBar.value should be testURL after initial switch to deletedURLTab"
);
// simulate the user removing the whole url from the location bar
await urlbarBackspace(true);
is(gURLBar.textValue, "", 'gURLBar.textValue should be "" (just set)');
is(gURLBar.value, "", 'gURLBar.value should be "" (just set)');
}
async function prepareFullURLTab() {
await BrowserTestUtils.switchTab(gBrowser, fullURLTab);
is(
gURLBar.textValue,
gURLBar.value,
testURL,
"gURLBar.textValue should be testURL after initial switch to fullURLTab"
"gURLBar.value should be testURL after initial switch to fullURLTab"
);
}
async function preparePartialURLTab() {
await BrowserTestUtils.switchTab(gBrowser, partialURLTab);
is(
gURLBar.textValue,
gURLBar.value,
testURL,
"gURLBar.textValue should be testURL after initial switch to partialURLTab"
"gURLBar.value should be testURL after initial switch to partialURLTab"
);
// simulate the user removing part of the url from the location bar
@ -142,9 +141,9 @@ add_task(async function() {
}
is(
gURLBar.textValue,
gURLBar.value,
testPartialURL,
"gURLBar.textValue should be testPartialURL (just set)"
"gURLBar.value should be testPartialURL (just set)"
);
}

View File

@ -184,7 +184,7 @@ const tests = [
gURLBar.select();
let promise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
await promiseAutocompleteResultPopup("exa", window, true);
while (gURLBar.value != "http://example.com/?q=%s") {
while (gURLBar.untrimmedValue != "http://example.com/?q=%s") {
EventUtils.synthesizeKey("KEY_ArrowDown");
}
let element = UrlbarTestUtils.getSelectedElement(window);
@ -233,7 +233,7 @@ const tests = [
gURLBar.select();
let promise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
await promiseAutocompleteResultPopup("exa", window, true);
while (gURLBar.value != "http://example.com/?q=%s") {
while (gURLBar.untrimmedValue != "http://example.com/?q=%s") {
EventUtils.synthesizeKey("KEY_ArrowDown");
}
EventUtils.synthesizeKey("VK_RETURN");
@ -256,7 +256,7 @@ const tests = [
info("Type @, Enter on a keywordoffer");
gURLBar.select();
await promiseAutocompleteResultPopup("@", window, true);
while (gURLBar.value != "@test ") {
while (gURLBar.untrimmedValue != "@test ") {
EventUtils.synthesizeKey("KEY_ArrowDown");
}
EventUtils.synthesizeKey("VK_RETURN");
@ -338,7 +338,7 @@ const tests = [
EventUtils.synthesizeKey("KEY_ArrowDown", {});
});
await UrlbarTestUtils.promiseSearchComplete(window);
while (gURLBar.value != "http://mochi.test:8888/") {
while (gURLBar.untrimmedValue != "http://mochi.test:8888/") {
EventUtils.synthesizeKey("KEY_ArrowDown");
}
EventUtils.synthesizeKey("VK_RETURN");
@ -365,7 +365,7 @@ const tests = [
await UrlbarTestUtils.promisePopupOpen(window, () => {
EventUtils.synthesizeKey("KEY_ArrowDown", {});
});
while (gURLBar.value != "http://mochi.test:8888/") {
while (gURLBar.untrimmedValue != "http://mochi.test:8888/") {
EventUtils.synthesizeKey("KEY_ArrowDown");
}
let element = UrlbarTestUtils.getSelectedElement(window);

View File

@ -88,9 +88,9 @@ add_task(async function test_reader_button() {
is_element_visible(iconEl, "Favicon should be visible");
is(iconEl.src, favicon, "Correct favicon should be loaded");
is(gURLBar.value, readerUrl, "gURLBar value is about:reader URL");
is(gURLBar.untrimmedValue, readerUrl, "gURLBar value is about:reader URL");
is(
gURLBar.textValue,
gURLBar.value,
url.substring("http://".length),
"gURLBar is displaying original article URL"
);