Bug 1641874 - Make the pref unchangeable at runtime; r=nika

Differential Revision: https://phabricator.services.mozilla.com/D78282
This commit is contained in:
Tom Tung 2020-06-09 08:10:42 +00:00
parent 6f5b781a29
commit 492794a250
4 changed files with 8 additions and 5 deletions

View File

@ -1022,7 +1022,8 @@ RefPtr<SessionStorageManager> BrowsingContext::GetSessionStorageManager() {
bool BrowsingContext::CrossOriginIsolated() {
MOZ_ASSERT(NS_IsMainThread());
return StaticPrefs::dom_postMessage_sharedArrayBuffer_withCOOP_COEP() &&
return StaticPrefs::
dom_postMessage_sharedArrayBuffer_withCOOP_COEP_AtStartup() &&
Top()->GetOpenerPolicy() ==
nsILoadInfo::
OPENER_POLICY_SAME_ORIGIN_EMBEDDER_POLICY_REQUIRE_CORP &&

View File

@ -8079,7 +8079,8 @@ void Document::SetDomain(const nsAString& aDomain, ErrorResult& rv) {
return;
}
if (StaticPrefs::dom_postMessage_sharedArrayBuffer_withCOOP_COEP() &&
if (StaticPrefs::
dom_postMessage_sharedArrayBuffer_withCOOP_COEP_AtStartup() &&
GetBrowsingContext() && GetBrowsingContext()->CrossOriginIsolated()) {
WarnOnceAbout(Document::eDocumentSetDomainNotAllowed);
return;

View File

@ -5244,7 +5244,8 @@ bool WorkerPrivate::IsSharedMemoryAllowed() const {
}
bool WorkerPrivate::CrossOriginIsolated() const {
if (!StaticPrefs::dom_postMessage_sharedArrayBuffer_withCOOP_COEP()) {
if (!StaticPrefs::
dom_postMessage_sharedArrayBuffer_withCOOP_COEP_AtStartup()) {
return false;
}

View File

@ -2227,13 +2227,13 @@
# re-SAB: Whether to allow postMessage of a SharedArrayBuffer if various
# preconditions related to COOP and COEP are met
- name: dom.postMessage.sharedArrayBuffer.withCOOP_COEP
type: RelaxedAtomicBool
type: bool
#if !defined(ANDROID)
value: @IS_NIGHTLY_BUILD@
#else
value: false # Blocked by DocumentChannel, see Bug 1589982.
#endif
mirror: always
mirror: once
# Overridden in all.js on RELEASE_OR_BETA in order to add the locked attribute.
- name: dom.postMessage.sharedArrayBuffer.bypassCOOP_COEP.insecure.enabled