forked from Floorp-Projects/Floorp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1760417 - Make ContentPrincipal more reliable for URIs in the for…
…m of scheme://.origin.tld. r=nika,ckerschb Attempting to get the siteOrigin for a URI of something like "https://.mozilla.org" was returning NS_ERROR_ILLEGAL_VALUE, which caused breakage in parts of the browser UI when trying to initialize a window to point at that URI. It looks like the NS_ERROR_ILLEGAL_VALUE stuff was added back in bug 1491728 as part of an effort to better handle some IPv6 stuff. I tested the STR in bug 1491728 for the original bug, and I cannot reproduce the issue even witht his change. nika suggested that instead of returning NS_ERROR_ILLEGAL_VALUE for this form of URI, we return the same value as `nsIPrincipal.origin`. Differential Revision: https://phabricator.services.mozilla.com/D142493
- Loading branch information
1 parent
ec59040
commit bbb1a59
Showing
4 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
toolkit/modules/tests/xpcshell/test_E10SUtils_getRemoteTypeForURIObject.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* Any copyright is dedicated to the Public Domain. | ||
http://creativecommons.org/publicdomain/zero/1.0/ */ | ||
|
||
"use strict"; | ||
|
||
const { E10SUtils } = ChromeUtils.import( | ||
"resource://gre/modules/E10SUtils.jsm" | ||
); | ||
|
||
/** | ||
* Tests for E10SUtils.getRemoteTypeForURIObject method, which is | ||
* used to compute preferred remote process types for content given | ||
* certain conditions. | ||
*/ | ||
|
||
/** | ||
* Test that getRemoteTypeForURIObject returns the preferred remote type | ||
* when given a URI with an invalid site origin. | ||
* | ||
* This is a regression test for bug 1760417. | ||
*/ | ||
add_task(async function test_invalid_site_origin() { | ||
const INVALID_SITE_ORIGIN_URI = Services.io.newURI( | ||
"https://.mozilla.org/this/is/a/test.html" | ||
); | ||
const EXPECTED_REMOTE_TYPE = `${E10SUtils.FISSION_WEB_REMOTE_TYPE}=https://.mozilla.org`; | ||
let result = E10SUtils.getRemoteTypeForURIObject( | ||
INVALID_SITE_ORIGIN_URI, | ||
true, | ||
true, | ||
E10SUtils.DEFAULT_REMOTE_TYPE | ||
); | ||
Assert.equal( | ||
result, | ||
EXPECTED_REMOTE_TYPE, | ||
"Got the expected default remote type." | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters