mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 424251 - "pageproxystate set to valid when selecting an autocomplete result" (use a helper function) [p=dao@mozilla.com (Dão Gottwald) r=gavin a=blocking-firefox3+]
This commit is contained in:
parent
b1b25c0f1f
commit
89550bc0c9
@ -1950,11 +1950,11 @@ function checkForDirectoryListing()
|
||||
}
|
||||
}
|
||||
|
||||
function URLBarSetURI(aURI, aMustUseURI) {
|
||||
function URLBarSetURI(aURI) {
|
||||
var value = getBrowser().userTypedValue;
|
||||
var state = "invalid";
|
||||
|
||||
if (!value || aMustUseURI) {
|
||||
if (!value) {
|
||||
if (aURI) {
|
||||
// If the url has "wyciwyg://" as the protocol, strip it off.
|
||||
// Nobody wants to see it on the urlbar for dynamically generated
|
||||
@ -1969,13 +1969,22 @@ function URLBarSetURI(aURI, aMustUseURI) {
|
||||
aURI = getWebNavigation().currentURI;
|
||||
}
|
||||
|
||||
value = aURI.spec;
|
||||
if (value == "about:blank") {
|
||||
if (aURI.spec == "about:blank") {
|
||||
// Replace "about:blank" with an empty string
|
||||
// only if there's no opener (bug 370555).
|
||||
if (!content.opener)
|
||||
value = "";
|
||||
value = content.opener ? aURI.spec : "";
|
||||
} else {
|
||||
value = losslessDecodeURI(aURI);
|
||||
state = "valid";
|
||||
}
|
||||
}
|
||||
|
||||
gURLBar.value = value;
|
||||
SetPageProxyState(state);
|
||||
}
|
||||
|
||||
function losslessDecodeURI(aURI) {
|
||||
var value = aURI.spec;
|
||||
// Try to decode as UTF-8 if there's no encoding sequence that we would break.
|
||||
if (!/%25(?:3B|2F|3F|3A|40|26|3D|2B|24|2C|23)/i.test(value))
|
||||
try {
|
||||
@ -1995,13 +2004,7 @@ function URLBarSetURI(aURI, aMustUseURI) {
|
||||
// (RFC 3987 sections 3.2 and 4.1 paragraph 6)
|
||||
value = value.replace(/[\u200e\u200f\u202a\u202b\u202c\u202d\u202e]/g,
|
||||
encodeURIComponent);
|
||||
|
||||
state = "valid";
|
||||
}
|
||||
}
|
||||
|
||||
gURLBar.value = value;
|
||||
SetPageProxyState(state);
|
||||
return value;
|
||||
}
|
||||
|
||||
// Replace the urlbar's value with the url of the page.
|
||||
|
@ -247,16 +247,13 @@
|
||||
onget="return this.value;">
|
||||
<setter>
|
||||
<![CDATA[
|
||||
// Force load the value into the urlbar to get it unescaped
|
||||
try {
|
||||
let uri = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService).
|
||||
newURI(val, null, null);
|
||||
URLBarSetURI(uri, true);
|
||||
} catch (ex) {
|
||||
// Incase the value isn't actually a URI
|
||||
val = losslessDecodeURI(uri);
|
||||
} catch (ex) { }
|
||||
this.value = val;
|
||||
}
|
||||
|
||||
// Completing a result should simulate the user typing the result, so
|
||||
// fire an input event.
|
||||
|
Loading…
Reference in New Issue
Block a user