Backed out 5 changesets (bug 1583251) for rust build bustages. CLOSED TREE
authorRazvan Maries <rmaries@mozilla.com>
Fri, 18 Oct 2019 17:59:20 +0300
changeset 498158 53bf396c988d3634b7fd62673d515b0d5577306e
parent 498157 9d0c4ad1779dd09b4b0408a61310e5d405e283c6
child 498159 8015660b170f034057c73a8ddd07ec86d4a0c615
push id98323
push userrmaries@mozilla.com
push dateFri, 18 Oct 2019 15:00:01 +0000
treeherderautoland@53bf396c988d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1583251
milestone71.0a1
backs outbfe390ad771b5bbaa5515e376dac91373c7837bd
0113c698b44d431fe02d3f73bea90d65e69df76b
248ad59168dd79138efdf8bed3d5863473142b75
5d5e3dc1711872b853b30dd061b6bd9030df4f45
9e9eaa78c43664445e620c82217f4aa6224f82ab
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 5 changesets (bug 1583251) for rust build bustages. CLOSED TREE Backed out changeset bfe390ad771b (bug 1583251) Backed out changeset 0113c698b44d (bug 1583251) Backed out changeset 248ad59168dd (bug 1583251) Backed out changeset 5d5e3dc17118 (bug 1583251) Backed out changeset 9e9eaa78c436 (bug 1583251)
docshell/base/BrowsingContext.cpp
dom/base/PostMessageEvent.cpp
dom/base/PostMessageEvent.h
dom/base/StructuredCloneHolder.cpp
dom/base/StructuredCloneHolder.h
dom/base/nsGlobalWindowOuter.cpp
dom/base/nsGlobalWindowOuter.h
dom/indexedDB/IDBObjectStore.cpp
dom/workers/MessageEventRunnable.cpp
js/public/StructuredClone.h
js/src/builtin/TestingFunctions.cpp
js/src/fuzz-tests/testStructuredCloneReader.cpp
js/src/jit-test/tests/wasm/memory-cloning.js
js/src/jsapi-tests/testMappedArrayBuffer.cpp
js/src/tests/non262/extensions/clone-sab.js
js/src/tests/non262/extensions/sharedtypedarray.js
js/src/vm/StructuredClone.cpp
--- a/docshell/base/BrowsingContext.cpp
+++ b/docshell/base/BrowsingContext.cpp
@@ -999,26 +999,22 @@ void BrowsingContext::PostMessageMoz(JSC
     return;
   }
 
   RefPtr<BrowsingContext> sourceBc;
   PostMessageData data;
   data.targetOrigin() = aTargetOrigin;
   data.subjectPrincipal() = &aSubjectPrincipal;
   RefPtr<nsGlobalWindowInner> callerInnerWindow;
-  // We don't need to get the caller's agentClusterId since that is used for
-  // checking whehter it's okay to sharing memory (and it's not allowed to share
-  // memory cross processes)
   if (!nsGlobalWindowOuter::GatherPostMessageData(
           aCx, aTargetOrigin, getter_AddRefs(sourceBc), data.origin(),
           getter_AddRefs(data.targetOriginURI()),
           getter_AddRefs(data.callerPrincipal()),
           getter_AddRefs(callerInnerWindow),
-          getter_AddRefs(data.callerDocumentURI()),
-          /* aCallerAgentClusterId */ nullptr, aError)) {
+          getter_AddRefs(data.callerDocumentURI()), aError)) {
     return;
   }
   data.source() = sourceBc;
   data.isFromPrivateWindow() =
       callerInnerWindow &&
       nsScriptErrorBase::ComputeIsFromPrivateWindow(callerInnerWindow);
 
   JS::Rooted<JS::Value> transferArray(aCx);
--- a/dom/base/PostMessageEvent.cpp
+++ b/dom/base/PostMessageEvent.cpp
@@ -3,17 +3,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "PostMessageEvent.h"
 
 #include "MessageEvent.h"
 #include "mozilla/dom/BlobBinding.h"
-#include "mozilla/dom/DocGroup.h"
 #include "mozilla/dom/DocumentInlines.h"
 #include "mozilla/dom/File.h"
 #include "mozilla/dom/FileList.h"
 #include "mozilla/dom/FileListBinding.h"
 #include "mozilla/dom/MessageEventBinding.h"
 #include "mozilla/dom/MessagePort.h"
 #include "mozilla/dom/MessagePortBinding.h"
 #include "mozilla/dom/PMessagePort.h"
@@ -27,28 +26,29 @@
 #include "nsIScriptError.h"
 #include "nsNetUtil.h"
 #include "nsPresContext.h"
 #include "nsQueryObject.h"
 
 namespace mozilla {
 namespace dom {
 
-PostMessageEvent::PostMessageEvent(
-    BrowsingContext* aSource, const nsAString& aCallerOrigin,
-    nsGlobalWindowOuter* aTargetWindow, nsIPrincipal* aProvidedPrincipal,
-    const Maybe<uint64_t>& aCallerWindowID, nsIURI* aCallerDocumentURI,
-    bool aIsFromPrivateWindow, const Maybe<nsID>& aCallerAgentClusterId)
+PostMessageEvent::PostMessageEvent(BrowsingContext* aSource,
+                                   const nsAString& aCallerOrigin,
+                                   nsGlobalWindowOuter* aTargetWindow,
+                                   nsIPrincipal* aProvidedPrincipal,
+                                   const Maybe<uint64_t>& aCallerWindowID,
+                                   nsIURI* aCallerDocumentURI,
+                                   bool aIsFromPrivateWindow)
     : Runnable("dom::PostMessageEvent"),
       mSource(aSource),
       mCallerOrigin(aCallerOrigin),
       mTargetWindow(aTargetWindow),
       mProvidedPrincipal(aProvidedPrincipal),
       mCallerWindowID(aCallerWindowID),
-      mCallerAgentClusterId(aCallerAgentClusterId),
       mCallerDocumentURI(aCallerDocumentURI),
       mIsFromPrivateWindow(aIsFromPrivateWindow) {}
 
 PostMessageEvent::~PostMessageEvent() {}
 
 NS_IMETHODIMP
 PostMessageEvent::Run() {
   // Note: We don't init this AutoJSAPI with targetWindow, because we do not
@@ -157,27 +157,20 @@ PostMessageEvent::Run() {
     }
   }
 
   IgnoredErrorResult rv;
   JS::Rooted<JS::Value> messageData(cx);
   nsCOMPtr<mozilla::dom::EventTarget> eventTarget =
       do_QueryObject(targetWindow);
 
-  JS::CloneDataPolicy cloneDataPolicy;
-  MOZ_DIAGNOSTIC_ASSERT(targetWindow);
-  if (mCallerAgentClusterId.isSome() &&
-      targetWindow->CanShareMemory(mCallerAgentClusterId.ref())) {
-    cloneDataPolicy.allowSharedMemory();
-  }
-
   StructuredCloneHolder* holder;
   if (mHolder.constructed<StructuredCloneHolder>()) {
-    mHolder.ref<StructuredCloneHolder>().Read(
-        ToSupports(targetWindow), cx, &messageData, cloneDataPolicy, rv);
+    mHolder.ref<StructuredCloneHolder>().Read(ToSupports(targetWindow), cx,
+                                              &messageData, rv);
     holder = &mHolder.ref<StructuredCloneHolder>();
   } else {
     MOZ_ASSERT(mHolder.constructed<ipc::StructuredCloneData>());
     mHolder.ref<ipc::StructuredCloneData>().Read(cx, &messageData, rv);
     holder = &mHolder.ref<ipc::StructuredCloneData>();
   }
   if (NS_WARN_IF(rv.Failed())) {
     DispatchError(cx, targetWindow, eventTarget);
--- a/dom/base/PostMessageEvent.h
+++ b/dom/base/PostMessageEvent.h
@@ -33,31 +33,30 @@ class BrowsingContext;
 class PostMessageEvent final : public Runnable {
  public:
   NS_DECL_NSIRUNNABLE
 
   // aCallerWindowID should not be 0.
   PostMessageEvent(BrowsingContext* aSource, const nsAString& aCallerOrigin,
                    nsGlobalWindowOuter* aTargetWindow,
                    nsIPrincipal* aProvidedPrincipal, uint64_t aCallerWindowID,
-                   nsIURI* aCallerDocumentURI,
-                   const Maybe<nsID>& aCallerAgentClusterId)
+                   nsIURI* aCallerDocumentURI)
       : PostMessageEvent(aSource, aCallerOrigin, aTargetWindow,
                          aProvidedPrincipal, Some(aCallerWindowID),
-                         aCallerDocumentURI, false, aCallerAgentClusterId) {}
+                         aCallerDocumentURI, false) {}
 
   // To be used if there is no WindowID for the PostMessage caller's window (for
   // example because it lives in a different process).
   PostMessageEvent(BrowsingContext* aSource, const nsAString& aCallerOrigin,
                    nsGlobalWindowOuter* aTargetWindow,
                    nsIPrincipal* aProvidedPrincipal, nsIURI* aCallerDocumentURI,
                    bool aIsFromPrivateWindow)
       : PostMessageEvent(aSource, aCallerOrigin, aTargetWindow,
                          aProvidedPrincipal, Nothing(), aCallerDocumentURI,
-                         aIsFromPrivateWindow, Nothing()) {}
+                         aIsFromPrivateWindow) {}
 
   void Write(JSContext* aCx, JS::Handle<JS::Value> aMessage,
              JS::Handle<JS::Value> aTransfer, JS::CloneDataPolicy aClonePolicy,
              ErrorResult& aError) {
     mHolder.construct<StructuredCloneHolder>(
         StructuredCloneHolder::CloningSupported,
         StructuredCloneHolder::TransferringSupported,
         JS::StructuredCloneScope::SameProcessSameThread);
@@ -72,35 +71,33 @@ class PostMessageEvent final : public Ru
         aMessageData);
   }
 
  private:
   PostMessageEvent(BrowsingContext* aSource, const nsAString& aCallerOrigin,
                    nsGlobalWindowOuter* aTargetWindow,
                    nsIPrincipal* aProvidedPrincipal,
                    const Maybe<uint64_t>& aCallerWindowID,
-                   nsIURI* aCallerDocumentURI, bool aIsFromPrivateWindow,
-                   const Maybe<nsID>& aCallerAgentClusterId);
+                   nsIURI* aCallerDocumentURI, bool aIsFromPrivateWindow);
   ~PostMessageEvent();
 
   void Dispatch(nsGlobalWindowInner* aTargetWindow, Event* aEvent);
 
   void DispatchError(JSContext* aCx, nsGlobalWindowInner* aTargetWindow,
                      mozilla::dom::EventTarget* aEventTarget);
 
   RefPtr<BrowsingContext> mSource;
   nsString mCallerOrigin;
   RefPtr<nsGlobalWindowOuter> mTargetWindow;
   nsCOMPtr<nsIPrincipal> mProvidedPrincipal;
   // If the postMessage call was made on a WindowProxy whose Window lives in a
   // separate process then mHolder will contain a StructuredCloneData, else
   // it'll contain a StructuredCloneHolder.
   MaybeOneOf<StructuredCloneHolder, ipc::StructuredCloneData> mHolder;
   Maybe<uint64_t> mCallerWindowID;
-  const Maybe<nsID> mCallerAgentClusterId;
   nsCOMPtr<nsIURI> mCallerDocumentURI;
   // This is only set to a relevant value if mCallerWindowID doesn't contain a
   // value.
   bool mIsFromPrivateWindow;
 };
 
 }  // namespace dom
 }  // namespace mozilla
--- a/dom/base/StructuredCloneHolder.cpp
+++ b/dom/base/StructuredCloneHolder.cpp
@@ -167,45 +167,39 @@ void StructuredCloneHolderBase::Clear() 
 bool StructuredCloneHolderBase::Write(JSContext* aCx,
                                       JS::Handle<JS::Value> aValue) {
   return Write(aCx, aValue, JS::UndefinedHandleValue, JS::CloneDataPolicy());
 }
 
 bool StructuredCloneHolderBase::Write(JSContext* aCx,
                                       JS::Handle<JS::Value> aValue,
                                       JS::Handle<JS::Value> aTransfer,
-                                      JS::CloneDataPolicy aCloneDataPolicy) {
+                                      JS::CloneDataPolicy cloneDataPolicy) {
   MOZ_ASSERT(!mBuffer, "Double Write is not allowed");
   MOZ_ASSERT(!mClearCalled, "This method cannot be called after Clear.");
 
   mBuffer = MakeUnique<JSAutoStructuredCloneBuffer>(
       mStructuredCloneScope, &StructuredCloneHolder::sCallbacks, this);
 
-  if (!mBuffer->write(aCx, aValue, aTransfer, aCloneDataPolicy,
+  if (!mBuffer->write(aCx, aValue, aTransfer, cloneDataPolicy,
                       &StructuredCloneHolder::sCallbacks, this)) {
     mBuffer = nullptr;
     return false;
   }
 
   return true;
 }
 
 bool StructuredCloneHolderBase::Read(JSContext* aCx,
                                      JS::MutableHandle<JS::Value> aValue) {
-  return Read(aCx, aValue, JS::CloneDataPolicy());
-}
-
-bool StructuredCloneHolderBase::Read(JSContext* aCx,
-                                     JS::MutableHandle<JS::Value> aValue,
-                                     JS::CloneDataPolicy aCloneDataPolicy) {
   MOZ_ASSERT(mBuffer, "Read() without Write() is not allowed.");
   MOZ_ASSERT(!mClearCalled, "This method cannot be called after Clear.");
 
-  bool ok = mBuffer->read(aCx, aValue, aCloneDataPolicy,
-                          &StructuredCloneHolder::sCallbacks, this);
+  bool ok =
+      mBuffer->read(aCx, aValue, &StructuredCloneHolder::sCallbacks, this);
   return ok;
 }
 
 bool StructuredCloneHolderBase::CustomReadTransferHandler(
     JSContext* aCx, JSStructuredCloneReader* aReader, uint32_t aTag,
     void* aContent, uint64_t aExtraData,
     JS::MutableHandleObject aReturnObject) {
   MOZ_CRASH("Nothing to read.");
@@ -270,32 +264,25 @@ void StructuredCloneHolder::Write(JSCont
     aRv.Throw(NS_ERROR_DOM_DATA_CLONE_ERR);
     return;
   }
 }
 
 void StructuredCloneHolder::Read(nsISupports* aParent, JSContext* aCx,
                                  JS::MutableHandle<JS::Value> aValue,
                                  ErrorResult& aRv) {
-  return Read(aParent, aCx, aValue, JS::CloneDataPolicy(), aRv);
-}
-
-void StructuredCloneHolder::Read(nsISupports* aParent, JSContext* aCx,
-                                 JS::MutableHandle<JS::Value> aValue,
-                                 JS::CloneDataPolicy aCloneDataPolicy,
-                                 ErrorResult& aRv) {
   MOZ_ASSERT_IF(
       mStructuredCloneScope == StructuredCloneScope::SameProcessSameThread,
       mCreationEventTarget->IsOnCurrentThread());
   MOZ_ASSERT(aParent);
 
   mozilla::AutoRestore<nsISupports*> guard(mParent);
   mParent = aParent;
 
-  if (!StructuredCloneHolderBase::Read(aCx, aValue, aCloneDataPolicy)) {
+  if (!StructuredCloneHolderBase::Read(aCx, aValue)) {
     JS_ClearPendingException(aCx);
     aRv.Throw(NS_ERROR_DOM_DATA_CLONE_ERR);
     return;
   }
 
   // If we are tranferring something, we cannot call 'Read()' more than once.
   if (mSupportsTransferring) {
     mBlobImplArray.Clear();
@@ -324,18 +311,18 @@ void StructuredCloneHolder::ReadFromBuff
       mCreationEventTarget->IsOnCurrentThread());
 
   MOZ_ASSERT(!mBuffer, "ReadFromBuffer() must be called without a Write().");
 
   mozilla::AutoRestore<nsISupports*> guard(mParent);
   mParent = aParent;
 
   if (!JS_ReadStructuredClone(aCx, aBuffer, aAlgorithmVersion,
-                              mStructuredCloneScope, aValue,
-                              JS::CloneDataPolicy(), &sCallbacks, this)) {
+                              mStructuredCloneScope, aValue, &sCallbacks,
+                              this)) {
     JS_ClearPendingException(aCx);
     aRv.Throw(NS_ERROR_DOM_DATA_CLONE_ERR);
   }
 }
 
 /* static */
 JSObject* StructuredCloneHolder::ReadFullySerializableObjects(
     JSContext* aCx, JSStructuredCloneReader* aReader, uint32_t aTag) {
@@ -361,20 +348,20 @@ JSObject* StructuredCloneHolder::ReadFul
     }
 
     JS::RootedValue result(aCx);
     {
       // nsJSPrincipals::ReadKnownPrincipalType addrefs for us, but because of
       // the casting between JSPrincipals* and nsIPrincipal* we can't use
       // getter_AddRefs above and have to already_AddRefed here.
       nsCOMPtr<nsIPrincipal> principal =
-          already_AddRefed<nsIPrincipal>(nsJSPrincipals::get(prin));
+        already_AddRefed<nsIPrincipal>(nsJSPrincipals::get(prin));
 
       nsresult rv = nsContentUtils::WrapNative(
-          aCx, principal, &NS_GET_IID(nsIPrincipal), &result);
+        aCx, principal, &NS_GET_IID(nsIPrincipal), &result);
       if (NS_FAILED(rv)) {
         xpc::Throw(aCx, NS_ERROR_DOM_DATA_CLONE_ERR);
         return nullptr;
       }
     }
     return result.toObjectOrNull();
   }
 
@@ -846,17 +833,17 @@ JSObject* ReadInputStream(JSContext* aCx
   }
 #endif
   MOZ_ASSERT(aIndex < aHolder->InputStreams().Length());
   JS::RootedValue result(aCx);
   {
     nsCOMPtr<nsIInputStream> inputStream = aHolder->InputStreams()[aIndex];
 
     nsresult rv = nsContentUtils::WrapNative(
-        aCx, inputStream, &NS_GET_IID(nsIInputStream), &result);
+      aCx, inputStream, &NS_GET_IID(nsIInputStream), &result);
     if (NS_FAILED(rv)) {
       return nullptr;
     }
   }
 
   return &result.toObject();
 }
 
--- a/dom/base/StructuredCloneHolder.h
+++ b/dom/base/StructuredCloneHolder.h
@@ -93,26 +93,22 @@ class StructuredCloneHolderBase {
   // Execute the serialization of aValue using the Structured Clone Algorithm.
   // The data can read back using Read().
   bool Write(JSContext* aCx, JS::Handle<JS::Value> aValue);
 
   // Like Write() but it supports the transferring of objects and handling
   // of cloning policy.
   bool Write(JSContext* aCx, JS::Handle<JS::Value> aValue,
              JS::Handle<JS::Value> aTransfer,
-             JS::CloneDataPolicy aCloneDataPolicy);
+             JS::CloneDataPolicy cloneDataPolicy);
 
   // If Write() has been called, this method retrieves data and stores it into
   // aValue.
   bool Read(JSContext* aCx, JS::MutableHandle<JS::Value> aValue);
 
-  // Like Read() but it supports handling of clone policy.
-  bool Read(JSContext* aCx, JS::MutableHandle<JS::Value> aValue,
-            JS::CloneDataPolicy aCloneDataPolicy);
-
   bool HasData() const { return !!mBuffer; }
 
   JSStructuredCloneData& BufferData() const {
     MOZ_ASSERT(mBuffer, "Write() has never been called.");
     return mBuffer->data();
   }
 
   size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) {
@@ -159,25 +155,21 @@ class StructuredCloneHolder : public Str
   StructuredCloneHolder(StructuredCloneHolder&& aOther) = delete;
 
   // Normally you should just use Write() and Read().
 
   void Write(JSContext* aCx, JS::Handle<JS::Value> aValue, ErrorResult& aRv);
 
   void Write(JSContext* aCx, JS::Handle<JS::Value> aValue,
              JS::Handle<JS::Value> aTransfer,
-             JS::CloneDataPolicy aCloneDataPolicy, ErrorResult& aRv);
+             JS::CloneDataPolicy cloneDataPolicy, ErrorResult& aRv);
 
   void Read(nsISupports* aParent, JSContext* aCx,
             JS::MutableHandle<JS::Value> aValue, ErrorResult& aRv);
 
-  void Read(nsISupports* aParent, JSContext* aCx,
-            JS::MutableHandle<JS::Value> aValue,
-            JS::CloneDataPolicy aCloneDataPolicy, ErrorResult& aRv);
-
   // Call this method to know if this object is keeping some DOM object alive.
   bool HasClonedDOMObjects() const {
     return !mBlobImplArray.IsEmpty() || !mWasmModuleArray.IsEmpty() ||
            !mClonedSurfaces.IsEmpty() || !mInputStreamArray.IsEmpty();
   }
 
   nsTArray<RefPtr<BlobImpl>>& BlobImpls() {
     MOZ_ASSERT(mSupportsCloning,
--- a/dom/base/nsGlobalWindowOuter.cpp
+++ b/dom/base/nsGlobalWindowOuter.cpp
@@ -5847,18 +5847,17 @@ WindowProxyHolder nsGlobalWindowOuter::G
   return WindowProxyHolder(mBrowsingContext);
 }
 
 /* static */
 bool nsGlobalWindowOuter::GatherPostMessageData(
     JSContext* aCx, const nsAString& aTargetOrigin, BrowsingContext** aSource,
     nsAString& aOrigin, nsIURI** aTargetOriginURI,
     nsIPrincipal** aCallerPrincipal, nsGlobalWindowInner** aCallerInnerWindow,
-    nsIURI** aCallerDocumentURI, Maybe<nsID>* aCallerAgentClusterId,
-    ErrorResult& aError) {
+    nsIURI** aCallerDocumentURI, ErrorResult& aError) {
   //
   // Window.postMessage is an intentional subversion of the same-origin policy.
   // As such, this code must be particularly careful in the information it
   // exposes to calling code.
   //
   // http://www.whatwg.org/specs/web-apps/current-work/multipage/section-crossDocumentMessages.html
   //
 
@@ -5934,22 +5933,16 @@ bool nsGlobalWindowOuter::GatherPostMess
   if (!nsContentUtils::IsCallerChrome() && callerInnerWin &&
       callerInnerWin->GetOuterWindowInternal()) {
     NS_ADDREF(*aSource = callerInnerWin->GetOuterWindowInternal()
                              ->GetBrowsingContext());
   } else {
     *aSource = nullptr;
   }
 
-  if (aCallerAgentClusterId && callerInnerWin &&
-      callerInnerWin->GetDocGroup()) {
-    *aCallerAgentClusterId =
-        Some(callerInnerWin->GetDocGroup()->AgentClusterId());
-  }
-
   callerInnerWin.forget(aCallerInnerWindow);
 
   return true;
 }
 
 bool nsGlobalWindowOuter::GetPrincipalForPostMessage(
     const nsAString& aTargetOrigin, nsIURI* aTargetOriginURI,
     nsIPrincipal* aCallerPrincipal, nsIPrincipal& aSubjectPrincipal,
@@ -6047,38 +6040,36 @@ void nsGlobalWindowOuter::PostMessageMoz
                                               nsIPrincipal& aSubjectPrincipal,
                                               ErrorResult& aError) {
   RefPtr<BrowsingContext> sourceBc;
   nsAutoString origin;
   nsCOMPtr<nsIURI> targetOriginURI;
   nsCOMPtr<nsIPrincipal> callerPrincipal;
   RefPtr<nsGlobalWindowInner> callerInnerWindow;
   nsCOMPtr<nsIURI> callerDocumentURI;
-  Maybe<nsID> callerAgentClusterId = Nothing();
-  if (!GatherPostMessageData(
-          aCx, aTargetOrigin, getter_AddRefs(sourceBc), origin,
-          getter_AddRefs(targetOriginURI), getter_AddRefs(callerPrincipal),
-          getter_AddRefs(callerInnerWindow), getter_AddRefs(callerDocumentURI),
-          &callerAgentClusterId, aError)) {
+  if (!GatherPostMessageData(aCx, aTargetOrigin, getter_AddRefs(sourceBc),
+                             origin, getter_AddRefs(targetOriginURI),
+                             getter_AddRefs(callerPrincipal),
+                             getter_AddRefs(callerInnerWindow),
+                             getter_AddRefs(callerDocumentURI), aError)) {
     return;
   }
 
   nsCOMPtr<nsIPrincipal> providedPrincipal;
   if (!GetPrincipalForPostMessage(aTargetOrigin, targetOriginURI,
                                   callerPrincipal, aSubjectPrincipal,
                                   getter_AddRefs(providedPrincipal))) {
     return;
   }
 
   // Create and asynchronously dispatch a runnable which will handle actual DOM
   // event creation and dispatch.
   RefPtr<PostMessageEvent> event = new PostMessageEvent(
       sourceBc, origin, this, providedPrincipal,
-      callerInnerWindow ? callerInnerWindow->WindowID() : 0, callerDocumentURI,
-      callerAgentClusterId);
+      callerInnerWindow ? callerInnerWindow->WindowID() : 0, callerDocumentURI);
 
   JS::CloneDataPolicy clonePolicy;
   if (GetDocGroup() && callerInnerWindow &&
       callerInnerWindow->CanShareMemory(GetDocGroup()->AgentClusterId())) {
     clonePolicy.allowSharedMemory();
   }
   event->Write(aCx, aMessage, aTransfer, clonePolicy, aError);
   if (NS_WARN_IF(aError.Failed())) {
--- a/dom/base/nsGlobalWindowOuter.h
+++ b/dom/base/nsGlobalWindowOuter.h
@@ -998,29 +998,26 @@ class nsGlobalWindowOuter final : public
    *                               postMessage call.
    *
    * @param aCallerInnerWindow [out] Inner window of the caller of
    * postMessage, or null if the incumbent global is not a Window.
    *
    * @param aCallerDocumentURI [out] The URI of the document of the incumbent
    * global if it's a Window, null otherwise.
    *
-   * @param aCallerAgentCluterId [out] If a non-nullptr is passed, it would
-   * return the caller's agent cluster id.
-   *
    * @param aError [out] The error, if any.
    *
    * @return Whether the postMessage call should continue or return now.
    */
   static bool GatherPostMessageData(
       JSContext* aCx, const nsAString& aTargetOrigin,
       mozilla::dom::BrowsingContext** aSource, nsAString& aOrigin,
       nsIURI** aTargetOriginURI, nsIPrincipal** aCallerPrincipal,
       nsGlobalWindowInner** aCallerInnerWindow, nsIURI** aCallerDocumentURI,
-      Maybe<nsID>* aCallerAgentClusterId, mozilla::ErrorResult& aError);
+      mozilla::ErrorResult& aError);
 
   // Ask the user if further dialogs should be blocked, if dialogs are currently
   // being abused. This is used in the cases where we have no modifiable UI to
   // show, in that case we show a separate dialog to ask this question.
   bool ConfirmDialogIfNeeded();
 
   // Helper called after moving/resizing, to update docShell's presContext
   // if we have caused a resolution change by moving across monitors.
--- a/dom/indexedDB/IDBObjectStore.cpp
+++ b/dom/indexedDB/IDBObjectStore.cpp
@@ -1058,17 +1058,17 @@ bool IDBObjectStore::DeserializeValue(JS
       nullptr,
       nullptr};
 
   // FIXME: Consider to use StructuredCloneHolder here and in other
   //        deserializing methods.
   if (!JS_ReadStructuredClone(
           aCx, aCloneReadInfo.mData, JS_STRUCTURED_CLONE_VERSION,
           JS::StructuredCloneScope::DifferentProcessForIndexedDB, aValue,
-          JS::CloneDataPolicy(), &callbacks, &aCloneReadInfo)) {
+          &callbacks, &aCloneReadInfo)) {
     return false;
   }
 
   return true;
 }
 
 namespace {
 
@@ -1217,17 +1217,17 @@ class DeserializeIndexValueHelper final 
         nullptr,
         nullptr,
         nullptr,
         nullptr};
 
     if (!JS_ReadStructuredClone(
             aCx, mCloneReadInfo.mData, JS_STRUCTURED_CLONE_VERSION,
             JS::StructuredCloneScope::DifferentProcessForIndexedDB, aValue,
-            JS::CloneDataPolicy(), &callbacks, &mCloneReadInfo)) {
+            &callbacks, &mCloneReadInfo)) {
       return NS_ERROR_DOM_DATA_CLONE_ERR;
     }
 
     return NS_OK;
   }
 
   void OperationCompleted(nsresult aStatus) {
     mStatus = aStatus;
@@ -1323,17 +1323,17 @@ class DeserializeUpgradeValueHelper fina
         nullptr,
         nullptr,
         nullptr,
         nullptr};
 
     if (!JS_ReadStructuredClone(
             aCx, mCloneReadInfo.mData, JS_STRUCTURED_CLONE_VERSION,
             JS::StructuredCloneScope::DifferentProcessForIndexedDB, aValue,
-            JS::CloneDataPolicy(), &callbacks, &mCloneReadInfo)) {
+            &callbacks, &mCloneReadInfo)) {
       return NS_ERROR_DOM_DATA_CLONE_ERR;
     }
 
     return NS_OK;
   }
 
   void PopulateFileIds(nsAString& aFileIds) {
     for (uint32_t count = mCloneReadInfo.mFiles.Length(), index = 0;
--- a/dom/workers/MessageEventRunnable.cpp
+++ b/dom/workers/MessageEventRunnable.cpp
@@ -56,22 +56,17 @@ bool MessageEventRunnable::DispatchDOMEv
   if (isTimelineRecording) {
     start = MakeUnique<WorkerTimelineMarker>(
         aIsMainThread
             ? ProfileTimelineWorkerOperationType::DeserializeDataOnMainThread
             : ProfileTimelineWorkerOperationType::DeserializeDataOffMainThread,
         MarkerTracingType::START);
   }
 
-  JS::CloneDataPolicy cloneDataPolicy;
-  // The target of a worker postMessage cannot change while the message is
-  // in-flight, so SAB status was checked at sending-time, and does not need to
-  // be checked when deserializing.
-  cloneDataPolicy.allowSharedMemory();
-  Read(parent, aCx, &messageData, cloneDataPolicy, rv);
+  Read(parent, aCx, &messageData, rv);
 
   if (isTimelineRecording) {
     end = MakeUnique<WorkerTimelineMarker>(
         aIsMainThread
             ? ProfileTimelineWorkerOperationType::DeserializeDataOnMainThread
             : ProfileTimelineWorkerOperationType::DeserializeDataOffMainThread,
         MarkerTracingType::END);
     timelines->AddMarkerForAllObservedDocShells(start);
--- a/js/public/StructuredClone.h
+++ b/js/public/StructuredClone.h
@@ -203,17 +203,17 @@ enum TransferableOwnership {
 
   SCTAG_TMO_USER_MIN
 };
 
 class CloneDataPolicy {
   bool sharedArrayBuffer_;
 
  public:
-  // The default is to deny all policy-controlled aspects.
+  // The default is to allow all policy-controlled aspects.
 
   CloneDataPolicy() : sharedArrayBuffer_(false) {}
 
   // In the JS engine, SharedArrayBuffers can only be cloned intra-process
   // because the shared memory areas are allocated in process-private memory.
   // Clients should therefore deny SharedArrayBuffers when cloning data that
   // are to be transmitted inter-process.
   //
@@ -538,17 +538,16 @@ class MOZ_NON_MEMMOVABLE JS_PUBLIC_API J
 /**
  * Implements StructuredDeserialize and StructuredDeserializeWithTransfer.
  *
  * Note: If `data` contains transferable objects, it can be read only once.
  */
 JS_PUBLIC_API bool JS_ReadStructuredClone(
     JSContext* cx, JSStructuredCloneData& data, uint32_t version,
     JS::StructuredCloneScope scope, JS::MutableHandleValue vp,
-    JS::CloneDataPolicy cloneDataPolicy,
     const JSStructuredCloneCallbacks* optionalCallbacks, void* closure);
 
 /**
  * Implements StructuredSerialize, StructuredSerializeForStorage, and
  * StructuredSerializeWithTransfer.
  *
  * Note: If the scope is DifferentProcess then the cloneDataPolicy must deny
  * shared-memory objects, or an error will be signaled if a shared memory object
@@ -628,17 +627,16 @@ class JS_PUBLIC_API JSAutoStructuredClon
    * an external container, though note that you will need to use adopt() to
    * properly release that data eventually.
    */
   void abandon() {
     data_.ownTransferables_ = OwnTransferablePolicy::IgnoreTransferablesIfAny;
   }
 
   bool read(JSContext* cx, JS::MutableHandleValue vp,
-            JS::CloneDataPolicy cloneDataPolicy = JS::CloneDataPolicy(),
             const JSStructuredCloneCallbacks* optionalCallbacks = nullptr,
             void* closure = nullptr);
 
   bool write(JSContext* cx, JS::HandleValue v,
              const JSStructuredCloneCallbacks* optionalCallbacks = nullptr,
              void* closure = nullptr);
 
   bool write(JSContext* cx, JS::HandleValue v, JS::HandleValue transferable,
--- a/js/src/builtin/TestingFunctions.cpp
+++ b/js/src/builtin/TestingFunctions.cpp
@@ -3442,51 +3442,26 @@ static bool Deserialize(JSContext* cx, u
 
   if (!args.get(0).isObject() || !args[0].toObject().is<CloneBufferObject>()) {
     JS_ReportErrorASCII(cx, "deserialize requires a clonebuffer argument");
     return false;
   }
   Rooted<CloneBufferObject*> obj(cx,
                                  &args[0].toObject().as<CloneBufferObject>());
 
-  JS::CloneDataPolicy policy;
   JS::StructuredCloneScope scope =
       obj->isSynthetic() ? JS::StructuredCloneScope::DifferentProcess
                          : JS::StructuredCloneScope::SameProcessSameThread;
   if (args.get(1).isObject()) {
     RootedObject opts(cx, &args[1].toObject());
     if (!opts) {
       return false;
     }
 
     RootedValue v(cx);
-    if (!JS_GetProperty(cx, opts, "SharedArrayBuffer", &v)) {
-      return false;
-    }
-
-    if (!v.isUndefined()) {
-      JSString* str = JS::ToString(cx, v);
-      if (!str) {
-        return false;
-      }
-      JSLinearString* poli = str->ensureLinear(cx);
-      if (!poli) {
-        return false;
-      }
-
-      if (StringEqualsLiteral(poli, "allow")) {
-        policy.allowSharedMemory();
-      } else if (StringEqualsLiteral(poli, "deny")) {
-        // default
-      } else {
-        JS_ReportErrorASCII(cx, "Invalid policy value for 'SharedArrayBuffer'");
-        return false;
-      }
-    }
-
     if (!JS_GetProperty(cx, opts, "scope", &v)) {
       return false;
     }
 
     if (!v.isUndefined()) {
       RootedString str(cx, JS::ToString(cx, v));
       if (!str) {
         return false;
@@ -3518,17 +3493,17 @@ static bool Deserialize(JSContext* cx, u
 
   bool hasTransferable;
   if (!JS_StructuredCloneHasTransferables(*obj->data(), &hasTransferable)) {
     return false;
   }
 
   RootedValue deserialized(cx);
   if (!JS_ReadStructuredClone(cx, *obj->data(), JS_STRUCTURED_CLONE_VERSION,
-                              scope, &deserialized, policy, nullptr, nullptr)) {
+                              scope, &deserialized, nullptr, nullptr)) {
     return false;
   }
   args.rval().set(deserialized);
 
   // Consume any clone buffer with transferables; throw an error if it is
   // deserialized again.
   if (hasTransferable) {
     obj->discard();
@@ -6692,21 +6667,18 @@ gc::ZealModeHelpText),
 "      DifferentProcess, or DifferentProcessForIndexedDB. Determines how some\n"
 "      values will be serialized. Clone buffers may only be deserialized with a\n"
 "      compatible scope. NOTE - For DifferentProcess/DifferentProcessForIndexedDB,\n"
 "      must also set SharedArrayBuffer:'deny' if data contains any shared memory\n"
 "      object."),
 
     JS_FN_HELP("deserialize", Deserialize, 1, 0,
 "deserialize(clonebuffer[, opts])",
-"  Deserialize data generated by serialize. 'opts' may be an options hash.\n"
-"  Valid keys:\n"
-"    'SharedArrayBuffer' - either 'allow' or 'deny' (the default)\n"
-"      to specify whether SharedArrayBuffers may be serialized.\n"
-"    'scope', which limits the clone buffers that are considered\n"
+"  Deserialize data generated by serialize. 'opts' is an options hash with one\n"
+"  recognized key 'scope', which limits the clone buffers that are considered\n"
 "  valid. Allowed values: 'SameProcessSameThread', 'SameProcessDifferentThread',\n"
 "  'DifferentProcess', and 'DifferentProcessForIndexedDB'. So for example, a\n"
 "  DifferentProcessForIndexedDB clone buffer may be deserialized in any scope, but\n"
 "  a SameProcessSameThread clone buffer cannot be deserialized in a\n"
 "  DifferentProcess scope."),
 
     JS_FN_HELP("detachArrayBuffer", DetachArrayBuffer, 1, 0,
 "detachArrayBuffer(buffer)",
--- a/js/src/fuzz-tests/testStructuredCloneReader.cpp
+++ b/js/src/fuzz-tests/testStructuredCloneReader.cpp
@@ -49,33 +49,33 @@ static int testStructuredCloneReaderFuzz
     return 0;
   }
   char padding[kSegmentAlignment] = {0};
   if (!clonebuf->AppendBytes(padding, buf_size - size)) {
     ReportOutOfMemory(gCx);
     return 0;
   }
 
-  JS::CloneDataPolicy policy;
   RootedValue deserialized(gCx);
   if (!JS_ReadStructuredClone(gCx, *clonebuf, JS_STRUCTURED_CLONE_VERSION,
-                              scope, &deserialized, policy, nullptr, nullptr)) {
+                              scope, &deserialized, nullptr, nullptr)) {
     return 0;
   }
 
   /* If we succeeded in deserializing, we should try to reserialize the data.
      This has two main advantages:
 
      1) It tests parts of the serializer as well.
      2) The deserialized data is actually used, making it more likely to detect
         further memory-related problems.
 
      Tests show that this also doesn't cause a serious performance penalty.
   */
   mozilla::Maybe<JSAutoStructuredCloneBuffer> clonebufOut;
+  JS::CloneDataPolicy policy;
 
   clonebufOut.emplace(scope, nullptr, nullptr);
   if (!clonebufOut->write(gCx, deserialized, UndefinedHandleValue, policy)) {
     return 0;
   }
 
   return 0;
 }
--- a/js/src/jit-test/tests/wasm/memory-cloning.js
+++ b/js/src/jit-test/tests/wasm/memory-cloning.js
@@ -19,17 +19,17 @@
 // observe shared effects.
 
 {
     let mem1 = new WebAssembly.Memory({initial: 2, maximum: 4, shared: true});
     let buf1 = mem1.buffer;
 
     // Serialization and deserialization of shared memories work:
 
-    let mem2 = deserialize(serialize(mem1, [], {SharedArrayBuffer: 'allow'}), {SharedArrayBuffer: 'allow'});
+    let mem2 = deserialize(serialize(mem1, [], {SharedArrayBuffer: 'allow'}));
     assertEq(mem2 instanceof WebAssembly.Memory, true);
     let buf2 = mem2.buffer;
     assertEq(buf2 instanceof SharedArrayBuffer, true);
 
     assertEq(buf1 !== buf2, true);
     assertEq(buf1.byteLength, buf2.byteLength);
 
     // Effects to one buffer must be reflected in the other:
@@ -76,11 +76,11 @@
 // of the SAB should not change even if the memory was grown after serialization
 // and before deserialization.
 
 {
     let mem = new WebAssembly.Memory({initial: 2, maximum: 4, shared: true});
     let buf = mem.buffer;
     let clonedbuf = serialize(buf, [], {SharedArrayBuffer: 'allow'});
     mem.grow(1);
-    let buf2 = deserialize(clonedbuf, {SharedArrayBuffer: 'allow'});
+    let buf2 = deserialize(clonedbuf);
     assertEq(buf.byteLength, buf2.byteLength);
 }
--- a/js/src/jsapi-tests/testMappedArrayBuffer.cpp
+++ b/js/src/jsapi-tests/testMappedArrayBuffer.cpp
@@ -132,17 +132,17 @@ bool TestDetachObject() {
 bool TestCloneObject() {
   JS::RootedObject obj1(cx, CreateNewObject(8, 12));
   CHECK(obj1);
   JSAutoStructuredCloneBuffer cloned_buffer(
       JS::StructuredCloneScope::SameProcessSameThread, nullptr, nullptr);
   JS::RootedValue v1(cx, JS::ObjectValue(*obj1));
   CHECK(cloned_buffer.write(cx, v1, nullptr, nullptr));
   JS::RootedValue v2(cx);
-  CHECK(cloned_buffer.read(cx, &v2, JS::CloneDataPolicy(), nullptr, nullptr));
+  CHECK(cloned_buffer.read(cx, &v2, nullptr, nullptr));
   JS::RootedObject obj2(cx, v2.toObjectOrNull());
   CHECK(VerifyObject(obj2, 8, 12, false));
 
   return true;
 }
 
 bool TestStealContents() {
   JS::RootedObject obj(cx, CreateNewObject(8, 12));
@@ -168,20 +168,20 @@ bool TestTransferObject() {
 
   JS::RootedObject obj(
       cx, JS_NewArrayObject(cx, JS::HandleValueArray::subarray(argv, 0, 1)));
   CHECK(obj);
   JS::RootedValue transferable(cx, JS::ObjectValue(*obj));
 
   JSAutoStructuredCloneBuffer cloned_buffer(
       JS::StructuredCloneScope::SameProcessSameThread, nullptr, nullptr);
-  JS::CloneDataPolicy policy;
-  CHECK(cloned_buffer.write(cx, v1, transferable, policy, nullptr, nullptr));
+  CHECK(cloned_buffer.write(cx, v1, transferable, JS::CloneDataPolicy(),
+                            nullptr, nullptr));
   JS::RootedValue v2(cx);
-  CHECK(cloned_buffer.read(cx, &v2, policy, nullptr, nullptr));
+  CHECK(cloned_buffer.read(cx, &v2, nullptr, nullptr));
   JS::RootedObject obj2(cx, v2.toObjectOrNull());
   CHECK(VerifyObject(obj2, 8, 12, true));
   CHECK(JS::IsDetachedArrayBufferObject(obj1));
 
   return true;
 }
 
 static void GC(JSContext* cx) {
--- a/js/src/tests/non262/extensions/clone-sab.js
+++ b/js/src/tests/non262/extensions/clone-sab.js
@@ -17,15 +17,15 @@ if (!this.SharedArrayBuffer) {
 let x = new SharedArrayBuffer(1);
 let y = serialize(x, [], {SharedArrayBuffer: 'allow'});
 x = null;
 
 // If the bug is present this loop usually crashes quickly during
 // deserialization because the memory has become unmapped.
 
 for (let i=0 ; i < 50 ; i++ ) {
-    let obj = deserialize(y, {SharedArrayBuffer: 'allow'});
+    let obj = deserialize(y);
     let z = new Int8Array(obj);
     z[0] = 0;
 }
 
 reportCompare(true, true);
 
--- a/js/src/tests/non262/extensions/sharedtypedarray.js
+++ b/js/src/tests/non262/extensions/sharedtypedarray.js
@@ -165,26 +165,26 @@ function testSharedTypedArrayMethods() {
     assertEq(v[7], -2);
     assertEq(v[8], -4);
     assertEq(v[9], -5);
 }
 
 function testClone1() {
     var sab1 = b;
     var blob = serialize(sab1, [], {SharedArrayBuffer: 'allow'});
-    var sab2 = deserialize(blob, {SharedArrayBuffer: 'allow'});
+    var sab2 = deserialize(blob);
     if (typeof sharedAddress != "undefined")
 	assertEq(sharedAddress(sab1), sharedAddress(sab2));
 }
 
 function testClone2() {
     var sab = b;
     var ia1 = new Int32Array(sab);
     var blob = serialize(ia1, [], {SharedArrayBuffer: 'allow'});
-    var ia2 = deserialize(blob, {SharedArrayBuffer: 'allow'});
+    var ia2 = deserialize(blob);
     assertEq(ia1.length, ia2.length);
     assertEq(ia1.buffer instanceof SharedArrayBuffer, true);
     if (typeof sharedAddress != "undefined")
 	assertEq(sharedAddress(ia1.buffer), sharedAddress(ia2.buffer));
     ia1[10] = 37;
     assertEq(ia2[10], 37);
 }
 
@@ -198,29 +198,16 @@ function testNoClone() {
     // This tests the actual cloning functionality - should fail
     assertThrowsInstanceOf(() => serialize(b, [], {SharedArrayBuffer: 'deny'}), TypeError);
 
     // This tests that cloning a SharedArrayBuffer is not allowed by default
     assertThrowsInstanceOf(() => serialize(b), TypeError);
 
     // Ditto - should succeed
     assertEq(typeof serialize(b, [], {SharedArrayBuffer: 'allow'}), "object");
-
-    let blob = serialize(b, [], {SharedArrayBuffer: 'allow'});
-    // This just tests the API in deserialize()
-    assertThrowsInstanceOf(() => deserialize(blob, {SharedArrayBuffer: false}), Error);
-
-    // This tests the actual cloning functionality - should fail
-    assertThrowsInstanceOf(() => deserialize(blob, {SharedArrayBuffer: 'deny'}), TypeError);
-
-    // This tests that cloning a SharedArrayBuffer is not allowed by default
-    assertThrowsInstanceOf(() => deserialize(blob), TypeError);
-
-    // Ditto - should succeed
-    assertEq(typeof deserialize(blob, {SharedArrayBuffer: 'allow'}), "object");
 }
 
 function testRedundantTransfer() {
     // Throws TypeError in the shell, DataCloneError in the browser.
     assertThrowsInstanceOf(() => {
 	var sab1 = b;
 	var blob = serialize(sab1, [sab1], {SharedArrayBuffer: 'allow'});
     }, TypeError);
--- a/js/src/vm/StructuredClone.cpp
+++ b/js/src/vm/StructuredClone.cpp
@@ -381,22 +381,20 @@ class SCInput {
   BufferIterator point;
 };
 
 }  // namespace js
 
 struct JSStructuredCloneReader {
  public:
   explicit JSStructuredCloneReader(SCInput& in, JS::StructuredCloneScope scope,
-                                   JS::CloneDataPolicy cloneDataPolicy,
                                    const JSStructuredCloneCallbacks* cb,
                                    void* cbClosure)
       : in(in),
         allowedScope(scope),
-        cloneDataPolicy(cloneDataPolicy),
         objs(in.context()),
         allObjs(in.context()),
         callbacks(cb),
         closure(cbClosure) {}
 
   SCInput& input() { return in; }
   bool read(MutableHandleValue vp);
 
@@ -427,18 +425,16 @@ struct JSStructuredCloneReader {
   SCInput& in;
 
   // The widest scope that the caller will accept, where
   // SameProcessSameThread is the widest (it can store anything it wants) and
   // DifferentProcess is the narrowest (it cannot contain pointers and must
   // be valid cross-process.)
   JS::StructuredCloneScope allowedScope;
 
-  const JS::CloneDataPolicy cloneDataPolicy;
-
   // Stack of objects with properties remaining to be read.
   RootedValueVector objs;
 
   // Array of all objects read during this deserialization, for resolving
   // backreferences.
   //
   // For backreferences to work correctly, objects must be added to this
   // array in exactly the order expected by the version of the Writer that
@@ -636,21 +632,20 @@ bool WriteStructuredClone(JSContext* cx,
     return false;
   }
   w.extractBuffer(bufp);
   return true;
 }
 
 bool ReadStructuredClone(JSContext* cx, JSStructuredCloneData& data,
                          JS::StructuredCloneScope scope, MutableHandleValue vp,
-                         JS::CloneDataPolicy cloneDataPolicy,
                          const JSStructuredCloneCallbacks* cb,
                          void* cbClosure) {
   SCInput in(cx, data);
-  JSStructuredCloneReader r(in, scope, cloneDataPolicy, cb, cbClosure);
+  JSStructuredCloneReader r(in, scope, cb, cbClosure);
   return r.read(vp);
 }
 
 static bool StructuredCloneHasTransferObjects(
     const JSStructuredCloneData& data) {
   if (data.Size() < sizeof(uint64_t)) {
     return false;
   }
@@ -2211,22 +2206,16 @@ bool JSStructuredCloneReader::readArrayB
   }
   vp.setObject(*obj);
   ArrayBufferObject& buffer = obj->as<ArrayBufferObject>();
   MOZ_ASSERT(buffer.byteLength() == nbytes);
   return in.readArray(buffer.dataPointer(), nbytes);
 }
 
 bool JSStructuredCloneReader::readSharedArrayBuffer(MutableHandleValue vp) {
-  if (!cloneDataPolicy.isSharedArrayBufferAllowed()) {
-    JS_ReportErrorNumberASCII(context(), GetErrorMessage, nullptr,
-                              JSMSG_SC_NOT_CLONABLE, "SharedArrayBuffer");
-    return false;
-  }
-
   uint32_t byteLength;
   if (!in.readBytes(&byteLength, sizeof(byteLength))) {
     return in.reportTruncated();
   }
 
   intptr_t p;
   if (!in.readBytes(&p, sizeof(p))) {
     return in.reportTruncated();
@@ -2263,29 +2252,24 @@ bool JSStructuredCloneReader::readShared
   }
 
   vp.setObject(*obj);
   return true;
 }
 
 bool JSStructuredCloneReader::readSharedWasmMemory(uint32_t nbytes,
                                                    MutableHandleValue vp) {
-  JSContext* cx = context();
   if (nbytes != 0) {
-    JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
+    JS_ReportErrorNumberASCII(context(), GetErrorMessage, nullptr,
                               JSMSG_SC_BAD_SERIALIZED_DATA,
                               "invalid shared wasm memory tag");
     return false;
   }
 
-  if (!cloneDataPolicy.isSharedArrayBufferAllowed()) {
-    JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
-                              JSMSG_SC_NOT_CLONABLE, "WebAssembly.Memory");
-    return false;
-  }
+  JSContext* cx = context();
 
   // Read the SharedArrayBuffer object.
   RootedValue payload(cx);
   if (!startRead(&payload)) {
     return false;
   }
   if (!payload.isObject() ||
       !payload.toObject().is<SharedArrayBufferObject>()) {
@@ -3019,29 +3003,27 @@ bool JSStructuredCloneReader::read(Mutab
   return true;
 }
 
 using namespace js;
 
 JS_PUBLIC_API bool JS_ReadStructuredClone(
     JSContext* cx, JSStructuredCloneData& buf, uint32_t version,
     JS::StructuredCloneScope scope, MutableHandleValue vp,
-    JS::CloneDataPolicy cloneDataPolicy,
     const JSStructuredCloneCallbacks* optionalCallbacks, void* closure) {
   AssertHeapIsIdle();
   CHECK_THREAD(cx);
 
   if (version > JS_STRUCTURED_CLONE_VERSION) {
     JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
                               JSMSG_SC_BAD_CLONE_VERSION);
     return false;
   }
   const JSStructuredCloneCallbacks* callbacks = optionalCallbacks;
-  return ReadStructuredClone(cx, buf, scope, vp, cloneDataPolicy, callbacks,
-                             closure);
+  return ReadStructuredClone(cx, buf, scope, vp, callbacks, closure);
 }
 
 JS_PUBLIC_API bool JS_WriteStructuredClone(
     JSContext* cx, HandleValue value, JSStructuredCloneData* bufp,
     JS::StructuredCloneScope scope, JS::CloneDataPolicy cloneDataPolicy,
     const JSStructuredCloneCallbacks* optionalCallbacks, void* closure,
     HandleValue transferable) {
   AssertHeapIsIdle();
@@ -3095,17 +3077,17 @@ JS_PUBLIC_API bool JS_StructuredClone(
       }
     } else {
       if (!buf.write(cx, value, callbacks, closure)) {
         return false;
       }
     }
   }
 
-  return buf.read(cx, vp, JS::CloneDataPolicy(), callbacks, closure);
+  return buf.read(cx, vp, callbacks, closure);
 }
 
 JSAutoStructuredCloneBuffer::JSAutoStructuredCloneBuffer(
     JSAutoStructuredCloneBuffer&& other)
     : scope_(other.scope()), data_(other.scope()) {
   data_.ownTransferables_ = other.data_.ownTransferables_;
   other.steal(&data_, &version_, &data_.callbacks_, &data_.closure_);
 }
@@ -3152,21 +3134,21 @@ void JSAutoStructuredCloneBuffer::steal(
   }
   *data = std::move(data_);
 
   version_ = 0;
   data_.setCallbacks(nullptr, nullptr, OwnTransferablePolicy::NoTransferables);
 }
 
 bool JSAutoStructuredCloneBuffer::read(
-    JSContext* cx, MutableHandleValue vp, JS::CloneDataPolicy cloneDataPolicy,
+    JSContext* cx, MutableHandleValue vp,
     const JSStructuredCloneCallbacks* optionalCallbacks, void* closure) {
   MOZ_ASSERT(cx);
   return !!JS_ReadStructuredClone(cx, data_, version_, scope_, vp,
-                                  cloneDataPolicy, optionalCallbacks, closure);
+                                  optionalCallbacks, closure);
 }
 
 bool JSAutoStructuredCloneBuffer::write(
     JSContext* cx, HandleValue value,
     const JSStructuredCloneCallbacks* optionalCallbacks, void* closure) {
   HandleValue transferable = UndefinedHandleValue;
   return write(cx, value, transferable, JS::CloneDataPolicy(),
                optionalCallbacks, closure);