mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Backed out changeset 8c2f5b82f33a (bug 1573753) for causing browser chrome perma failure. CLOSED TREE
This commit is contained in:
parent
acebcd6ca5
commit
ea34f56947
@ -1232,18 +1232,29 @@ class UrlbarInput {
|
||||
if (this.getAttribute("pageproxystate") == "valid") {
|
||||
uri = this.window.gBrowser.currentURI;
|
||||
} else {
|
||||
// The value could be:
|
||||
// 1. a trimmed url, set by selecting a result
|
||||
// 2. a search string set by selecting a result
|
||||
// 3. a url that was confirmed but didn't finish loading yet
|
||||
// If it's an url the untrimmedValue should resolve to a valid URI,
|
||||
// otherwise it's a search string that should be copied as-is.
|
||||
// We're dealing with an autocompleted value.
|
||||
if (!this._resultForCurrentValue) {
|
||||
throw new Error(
|
||||
"UrlbarInput: Should have a UrlbarResult since " +
|
||||
"pageproxystate != 'valid' and valueIsTyped == false"
|
||||
);
|
||||
}
|
||||
let resultURL = this._resultForCurrentValue.payload.url;
|
||||
if (!resultURL) {
|
||||
return selectedVal;
|
||||
}
|
||||
|
||||
try {
|
||||
uri = Services.io.newURI(this._untrimmedValue);
|
||||
} catch (ex) {
|
||||
uri = Services.uriFixup.createFixupURI(
|
||||
resultURL,
|
||||
Services.uriFixup.FIXUP_FLAG_NONE
|
||||
);
|
||||
} catch (e) {}
|
||||
if (!uri) {
|
||||
return selectedVal;
|
||||
}
|
||||
}
|
||||
|
||||
uri = this.makeURIReadable(uri);
|
||||
|
||||
// If the entire URL is selected, just use the actual loaded URI,
|
||||
|
@ -118,9 +118,6 @@ support-files =
|
||||
file_blank_but_not_blank.html
|
||||
[browser_urlbar_collapseOnChromeMousedown.js]
|
||||
[browser_urlbar_content_opener.js]
|
||||
[browser_urlbar_copy_during_load.js]
|
||||
support-files =
|
||||
slow-page.sjs
|
||||
[browser_urlbar_display_selectedAction_Extensions.js]
|
||||
[browser_urlbar_empty_search.js]
|
||||
[browser_urlbar_event_telemetry.js]
|
||||
|
@ -1,42 +0,0 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
// Test that copying from the urlbar page works correctly after a result is
|
||||
// confirmed but takes a while to load.
|
||||
|
||||
add_task(async function() {
|
||||
const SLOW_PAGE =
|
||||
getRootDirectory(gTestPath).replace(
|
||||
"chrome://mochitests/content",
|
||||
"http://www.example.com"
|
||||
) + "slow-page.sjs";
|
||||
|
||||
await BrowserTestUtils.withNewTab(gBrowser, async tab => {
|
||||
gURLBar.focus();
|
||||
gURLBar.value = SLOW_PAGE;
|
||||
let promise = TestUtils.waitForCondition(
|
||||
() => gURLBar.getAttribute("pageproxystate") == "invalid"
|
||||
);
|
||||
EventUtils.synthesizeKey("KEY_Enter");
|
||||
info("wait for the initial conditions");
|
||||
await promise;
|
||||
|
||||
info("Copy the whole url");
|
||||
await SimpleTest.promiseClipboardChange(SLOW_PAGE, () => {
|
||||
gURLBar.select();
|
||||
goDoCommand("cmd_copy");
|
||||
});
|
||||
|
||||
info("Copy the initial part of the url, as a different valid url");
|
||||
await SimpleTest.promiseClipboardChange(
|
||||
SLOW_PAGE.substring(0, SLOW_PAGE.indexOf("slow-page.sjs")),
|
||||
() => {
|
||||
gURLBar.selectionStart = 0;
|
||||
gURLBar.selectionEnd = gURLBar.value.indexOf("slow-page.sjs");
|
||||
goDoCommand("cmd_copy");
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
@ -11,13 +11,9 @@ function handleRequest(request, response) {
|
||||
}
|
||||
response.processAsync();
|
||||
timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
timer.init(
|
||||
() => {
|
||||
response.setHeader("Content-Type", "text/html", false);
|
||||
response.write("<body>This is a slow loading page.</body>");
|
||||
response.finish();
|
||||
},
|
||||
DELAY_MS,
|
||||
Ci.nsITimer.TYPE_ONE_SHOT
|
||||
);
|
||||
timer.init(() => {
|
||||
response.setHeader("Content-Type", "text/html", false);
|
||||
response.write("<body>This was the slow load. You should never see this.</body>");
|
||||
response.finish();
|
||||
}, DELAY_MS, Ci.nsITimer.TYPE_ONE_SHOT);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user