зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1513445: add tests r=ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D26681 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
e3dae73936
Коммит
23a6ba351f
|
@ -16,3 +16,8 @@ support-files =
|
||||||
[browser_test_FTP_console_warning.js]
|
[browser_test_FTP_console_warning.js]
|
||||||
support-files =
|
support-files =
|
||||||
file_FTP_console_warning.html
|
file_FTP_console_warning.html
|
||||||
|
[browser_test_assert_systemprincipal_documents.js]
|
||||||
|
skip-if = !debug && !fuzzing
|
||||||
|
support-files =
|
||||||
|
file_assert_systemprincipal_documents.html
|
||||||
|
file_assert_systemprincipal_documents_iframe.html
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
//"use strict"
|
||||||
|
|
||||||
|
const kTestPath = getRootDirectory(gTestPath);
|
||||||
|
const kTestURI = kTestPath + "file_assert_systemprincipal_documents.html";
|
||||||
|
|
||||||
|
add_task(async function setup() {
|
||||||
|
// We expect the assertion in function
|
||||||
|
// AssertSystemPrincipalMustNotLoadRemoteDocuments as defined in
|
||||||
|
// file dom/security/nsContentSecurityManager.cpp
|
||||||
|
SimpleTest.expectAssertions(1);
|
||||||
|
|
||||||
|
await SpecialPowers.pushPrefEnv({
|
||||||
|
"set": [["security.disallow_non_local_systemprincipal_in_tests", true]],
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
add_task(async function open_test_iframe_in_tab() {
|
||||||
|
// This looks at the iframe (load type SUBDOCUMENT)
|
||||||
|
await BrowserTestUtils.withNewTab({ gBrowser, url: kTestURI}, async (browser) => {
|
||||||
|
await ContentTask.spawn(browser, {}, async function() {
|
||||||
|
let outerPrincipal = content.document.nodePrincipal;
|
||||||
|
ok(outerPrincipal.isSystemPrincipal, "Sanity: Using SystemPrincipal for test file on chrome://");
|
||||||
|
|
||||||
|
const iframeWin = content.document.getElementById("testframe").contentWindow;
|
||||||
|
const iframeChannel = iframeWin.docShell.currentDocumentChannel;
|
||||||
|
ok(iframeChannel.loadInfo.loadingPrincipal.isSystemPrincipal, 'LoadingPrincipal for iframe is SystemPrincipal');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,11 @@
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Bug 1513445: Assert not loading web documents into system land</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>This page loads documents from the SystemPrincipal (which causes the assertion)</h1>
|
||||||
|
<iframe type="chrome" id="testframe" src="http://example.com/browser/dom/security/test/general/file_assert_systemprincipal_documents_iframe.html"></iframe>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Bug 1513445: Assert not loading web documents into system land</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>This is the iframe</h1>
|
||||||
|
</body>
|
||||||
|
</html>
|
Загрузка…
Ссылка в новой задаче