Bug 461304 - Part 2: Use UTF-8 flag in the browser; r=gavin

This commit is contained in:
Masatoshi Kimura 2011-11-05 15:48:28 +00:00
parent 4f145e7333
commit 4ac41f5d14
3 changed files with 20 additions and 2 deletions

View File

@ -1108,6 +1108,7 @@
<![CDATA[
var aFromExternal;
var aRelatedToCurrent;
var aIsUTF8;
if (arguments.length == 2 &&
typeof arguments[1] == "object" &&
!(arguments[1] instanceof Ci.nsIURI)) {
@ -1119,6 +1120,7 @@
aAllowThirdPartyFixup = params.allowThirdPartyFixup;
aFromExternal = params.fromExternal;
aRelatedToCurrent = params.relatedToCurrent;
aIsUTF8 = params.isUTF8;
}
var bgLoad = (aLoadInBackground != null) ? aLoadInBackground :
@ -1131,7 +1133,8 @@
ownerTab: owner,
allowThirdPartyFixup: aAllowThirdPartyFixup,
fromExternal: aFromExternal,
relatedToCurrent: aRelatedToCurrent});
relatedToCurrent: aRelatedToCurrent,
isUTF8: aIsUTF8});
if (!bgLoad)
this.selectedTab = tab;
@ -1204,6 +1207,7 @@
var aFromExternal;
var aRelatedToCurrent;
var aSkipAnimation;
var aIsUTF8;
if (arguments.length == 2 &&
typeof arguments[1] == "object" &&
!(arguments[1] instanceof Ci.nsIURI)) {
@ -1216,6 +1220,7 @@
aFromExternal = params.fromExternal;
aRelatedToCurrent = params.relatedToCurrent;
aSkipAnimation = params.skipAnimation;
aIsUTF8 = params.isUTF8;
}
this._browsers = null; // invalidate cache
@ -1363,6 +1368,8 @@
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
if (aFromExternal)
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_FROM_EXTERNAL;
if (aIsUTF8)
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_URI_IS_UTF8;
try {
b.loadURIWithFlags(aURI, flags, aReferrerURI, aCharset, aPostData);
} catch (ex) {

View File

@ -326,6 +326,10 @@
// keyword).
if (!mayInheritPrincipal)
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_DISALLOW_INHERIT_OWNER;
// If the value wasn't typed, we know that we decoded the value as
// UTF-8 (see losslessDecodeURI)
if (!this.valueIsTyped)
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_URI_IS_UTF8;
gBrowser.loadURIWithFlags(url, flags, null, null, postData);
}
@ -361,6 +365,8 @@
let params = { allowThirdPartyFixup: true, postData: postData };
if (altEnter)
params.inBackground = false;
if (!this.valueIsTyped)
params.isUTF8 = true;
openUILinkIn(url, where, params);
}
} else {

View File

@ -199,6 +199,8 @@ function openLinkIn(url, where, params) {
var aRelatedToCurrent = params.relatedToCurrent;
var aInBackground = params.inBackground;
var aDisallowInheritPrincipal = params.disallowInheritPrincipal;
// Currently, this parameter works only for where=="tab" or "current"
var aIsUTF8 = params.isUTF8;
if (where == "save") {
saveURL(url, null, null, true, null, aReferrerURI);
@ -272,6 +274,8 @@ function openLinkIn(url, where, params) {
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
if (aDisallowInheritPrincipal)
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_DISALLOW_INHERIT_OWNER;
if (aIsUTF8)
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_URI_IS_UTF8;
w.gBrowser.loadURIWithFlags(url, flags, aReferrerURI, null, aPostData);
break;
case "tabshifted":
@ -285,7 +289,8 @@ function openLinkIn(url, where, params) {
postData: aPostData,
inBackground: loadInBackground,
allowThirdPartyFixup: aAllowThirdPartyFixup,
relatedToCurrent: aRelatedToCurrent});
relatedToCurrent: aRelatedToCurrent,
isUTF8: aIsUTF8});
break;
}