forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1855734 - Use innermost nested URI in `PopulateTopLevelInfoFromUR…
…I` r=freddyb,timhuang Differential Revision: https://phabricator.services.mozilla.com/D190468
- Loading branch information
Showing
6 changed files
with
102 additions
and
29 deletions.
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
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
46 changes: 46 additions & 0 deletions
46
toolkit/components/httpsonlyerror/tests/browser/browser_fpi_nested_uri.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,46 @@ | ||
/* Any copyright is dedicated to the Public Domain. | ||
* https://creativecommons.org/publicdomain/zero/1.0/ */ | ||
|
||
"use strict"; | ||
|
||
// Test that a nested URI (in this case `view-source:`) does not result | ||
// in a redirect loop when HTTPS-Only and First Party Isolation are | ||
// enabled (Bug 1855734). | ||
|
||
const INSECURE_VIEW_SOURCE_URL = "view-source:http://123.123.123.123/"; | ||
|
||
function promiseIsErrorPage() { | ||
return new Promise(resolve => { | ||
BrowserTestUtils.waitForErrorPage(gBrowser.selectedBrowser).then(() => | ||
resolve(true) | ||
); | ||
BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(() => | ||
resolve(false) | ||
); | ||
}); | ||
} | ||
|
||
add_task(async function () { | ||
await SpecialPowers.pushPrefEnv({ | ||
set: [ | ||
["dom.security.https_only_mode", true], | ||
["dom.security.https_only_mode.upgrade_local", true], | ||
["privacy.firstparty.isolate", true], | ||
], | ||
}); | ||
|
||
let loaded = BrowserTestUtils.waitForErrorPage(gBrowser.selectedBrowser); | ||
info(`Starting to load ${INSECURE_VIEW_SOURCE_URL}`); | ||
BrowserTestUtils.startLoadingURIString(gBrowser, INSECURE_VIEW_SOURCE_URL); | ||
await loaded; | ||
info(`${INSECURE_VIEW_SOURCE_URL} finished loading`); | ||
|
||
loaded = promiseIsErrorPage(); | ||
await waitForAndClickOpenInsecureButton(gBrowser.selectedBrowser); | ||
info(`Waiting for normal or error page to load`); | ||
const isErrorPage = await loaded; | ||
|
||
ok(!isErrorPage, "We should not land on an error page"); | ||
|
||
await Services.perms.removeAll(); | ||
}); |
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