Bug 1744352 - Part 1: Ensure we set InitialSandboxFlags when opening or replacing toplevel BrowsingContexts, r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D138209
This commit is contained in:
Nika Layzell
2022-02-09 14:44:51 +00:00
parent 36182f38f5
commit 1a923f1aee
3 changed files with 9 additions and 0 deletions

View File

@@ -308,6 +308,11 @@ 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 {