Backed out 2 changesets (bug 1744352) for causing failures at test_javascript_sandboxed_popup.html. CLOSED TREE

Backed out changeset 1a7d29ce984c (bug 1744352)
Backed out changeset b3a8f99f0044 (bug 1744352)
This commit is contained in:
Butkovits Atila 2022-02-09 17:53:32 +02:00
parent 4905393a20
commit 1d9c37d4a5
6 changed files with 0 additions and 42 deletions

View File

@ -127,8 +127,6 @@ enum class ExplicitActiveStatus : uint8_t {
FIELD(ShouldDelayMediaFromStart, bool) \
/* See nsSandboxFlags.h for the possible flags. */ \
FIELD(SandboxFlags, uint32_t) \
/* The value of SandboxFlags when the BrowsingContext is first created. \
* Used for sandboxing the initial about:blank document. */ \
FIELD(InitialSandboxFlags, uint32_t) \
/* A non-zero unique identifier for the browser element that is hosting \
* this \

View File

@ -308,11 +308,6 @@ void CanonicalBrowsingContext::ReplacedBy(
txn.SetExplicitActive(GetExplicitActive());
txn.SetHasRestoreData(GetHasRestoreData());
txn.SetShouldDelayMediaFromStart(GetShouldDelayMediaFromStart());
// As this is a different BrowsingContext, set InitialSandboxFlags to the
// current flags in the new context so that they also apply to any initial
// about:blank documents created in it.
txn.SetSandboxFlags(GetSandboxFlags());
txn.SetInitialSandboxFlags(GetSandboxFlags());
if (aNewContext->EverAttached()) {
MOZ_ALWAYS_SUCCEEDS(txn.Commit(aNewContext));
} else {

View File

@ -161,4 +161,3 @@ support-files =
clicker.html
double_submit.sjs
[test_iframe_srcdoc_to_remote.html]
[test_javascript_sandboxed_popup.html]

View File

@ -1,27 +0,0 @@
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css" />
</head>
<body>
<iframe srcdoc="<a href='opener.parent.ok(false, `The JS ran!`)' target=_blank rel=opener>click</a>"
sandbox="allow-popups allow-same-origin"></iframe>
<script>
add_task(async function() {
let promise = new Promise(resolve =>{
SpecialPowers.addObserver(function obs(subject) {
is(subject.opener, window[0],
"blocked javascript URI should have been targeting the pop-up document");
subject.close();
SpecialPowers.removeObserver(obs, "javascript-uri-blocked-by-sandbox");
resolve();
}, "javascript-uri-blocked-by-sandbox");
});
document.querySelector("iframe").contentDocument.querySelector("a").click();
await promise;
});
</script>
</body>

View File

@ -236,11 +236,6 @@ nsresult nsJSThunk::EvaluateScript(
// Sandboxed document check: javascript: URI execution is disabled
// in a sandboxed document unless 'allow-scripts' was specified.
if (targetDoc->HasScriptsBlockedBySandbox()) {
if (nsCOMPtr<nsIObserverService> obs =
mozilla::services::GetObserverService()) {
obs->NotifyWhenScriptSafe(ToSupports(innerWin),
"javascript-uri-blocked-by-sandbox");
}
return NS_ERROR_DOM_RETVAL_UNDEFINED;
}

View File

@ -1034,8 +1034,6 @@ nsresult nsWindowWatcher::OpenWindowInternal(
SANDBOX_PROPAGATES_TO_AUXILIARY_BROWSING_CONTEXTS) {
MOZ_ASSERT(windowIsNew, "Should only get here for new windows");
MOZ_ALWAYS_SUCCEEDS(newBC->SetSandboxFlags(activeDocsSandboxFlags));
MOZ_ALWAYS_SUCCEEDS(
newBC->SetInitialSandboxFlags(newBC->GetSandboxFlags()));
}
RefPtr<nsGlobalWindowOuter> win(