partly import changes from `dev' branch of rmottola/Arctic-Fox:

- Bug 1172080 - Part 2: Use ^ instead of ! to delimit originAttributes from the URI in nsIPrincipal.origin, r=bholley (929ef38df)
This commit is contained in:
2021-12-28 09:25:23 +08:00
parent c0d865e519
commit 23896f6de1
3 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -51,7 +51,7 @@ OriginAttributes::CreateSuffix(nsACString& aStr) const
params->Serialize(value);
if (!value.IsEmpty()) {
aStr.AppendLiteral("!");
aStr.AppendLiteral("^");
aStr.Append(NS_ConvertUTF16toUTF8(value));
}
}
@@ -117,7 +117,7 @@ OriginAttributes::PopulateFromSuffix(const nsACString& aStr)
return true;
}
if (aStr[0] != '!') {
if (aStr[0] != '^') {
return false;
}
@@ -134,7 +134,7 @@ OriginAttributes::PopulateFromOrigin(const nsACString& aOrigin,
{
// RFindChar is only available on nsCString.
nsCString origin(aOrigin);
int32_t pos = origin.RFindChar('!');
int32_t pos = origin.RFindChar('^');
if (pos == kNotFound) {
aOriginNoSuffix = origin;
+1 -1
View File
@@ -51,7 +51,7 @@ add_test(() => {
});
Assert.ok(mozapp.principal, "app principal should exist");
let expectedPrincipalOrigin = app.origin + "!appId=" + app.localId;
let expectedPrincipalOrigin = app.origin + "^appId=" + app.localId;
Assert.equal(mozapp.principal.origin, expectedPrincipalOrigin,
"app principal origin ok");
Assert.equal(mozapp.principal.appId, app.localId, "app principal appId ok");
+1 -1
View File
@@ -115,7 +115,7 @@ this.BrowserUtils = {
throw new Error("principalFromOrigin does not support nsNullPrincipal");
}
var parts = aOriginString.split('!');
var parts = aOriginString.split('^');
if (parts.length > 2) {
throw new Error("bad origin string: " + aOriginString);
}