Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1587394 - Provide a pref to bypass postMessage COOP and COEP chec…
Browse files Browse the repository at this point in the history
…k on Nightly and Dev; r=nika

Differential Revision: https://phabricator.services.mozilla.com/D48713
  • Loading branch information
chihweitung committed Oct 17, 2019
1 parent 20a8d53 commit d312063
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions dom/base/nsGlobalWindowInner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2400,6 +2400,11 @@ void nsGlobalWindowInner::UpdateTopInnerWindow() {
bool nsGlobalWindowInner::CanShareMemory(const nsID& aAgentClusterId) {
MOZ_ASSERT(NS_IsMainThread());

if (StaticPrefs::
dom_postMessage_sharedArrayBuffer_bypassCOOP_COEP_insecure_enabled()) {
return true;
}

if (!StaticPrefs::dom_postMessage_sharedArrayBuffer_withCOOP_COEP()) {
return false;
}
Expand Down
5 changes: 5 additions & 0 deletions dom/workers/WorkerPrivate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4970,6 +4970,11 @@ const nsAString& WorkerPrivate::Id() {
bool WorkerPrivate::CanShareMemory(const nsID& aAgentClusterId) {
AssertIsOnWorkerThread();

if (StaticPrefs::
dom_postMessage_sharedArrayBuffer_bypassCOOP_COEP_insecure_enabled()) {
return true;
}

if (!StaticPrefs::dom_postMessage_sharedArrayBuffer_withCOOP_COEP()) {
return false;
}
Expand Down
6 changes: 6 additions & 0 deletions modules/libpref/init/StaticPrefList.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1903,6 +1903,12 @@
value: false
mirror: always

# Overridden in all.js on RELEASE_OR_BETA in order to add the locked attribute.
- name: dom.postMessage.sharedArrayBuffer.bypassCOOP_COEP.insecure.enabled
type: RelaxedAtomicBool
value: false
mirror: always

# Presentation API
- name: dom.presentation.enabled
type: bool
Expand Down
8 changes: 8 additions & 0 deletions modules/libpref/init/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -4935,3 +4935,11 @@ pref("devtools.devices.url", "https://code.cdn.mozilla.net/devices/devices.json"

// Enable Inactive CSS detection; used both by the client and the server.
pref("devtools.inspector.inactive.css.enabled", true);

#if defined(NIGHTLY_BUILD) || defined(MOZ_DEV_EDITION)
// Define in StaticPrefList.yaml and override here since StaticPrefList.yaml
// doesn't provide a way to lock the pref
pref("dom.postMessage.sharedArrayBuffer.bypassCOOP_COEP.insecure.enabled", false);
#else
pref("dom.postMessage.sharedArrayBuffer.bypassCOOP_COEP.insecure.enabled", false, locked);
#endif

0 comments on commit d312063

Please sign in to comment.