Bug 1583251 - P4 - Allow deserialize shared memory for Workers; r=nika,perry
authorTom Tung <ttung@mozilla.com>
Wed, 23 Oct 2019 07:20:35 +0000
changeset 498677 481515dd4b9d31d5ae7d934935e5262093a60a2a
parent 498676 8900fd9c1c09a2e4e33caf82a336f718f402345f
child 498678 6145f7c31786ebb18ebd6af87c5197a4c697d5ac
push id98599
push userttung@mozilla.com
push dateWed, 23 Oct 2019 07:22:53 +0000
treeherderautoland@058946a415aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnika, perry
bugs1583251
milestone72.0a1
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
Bug 1583251 - P4 - Allow deserialize shared memory for Workers; r=nika,perry Differential Revision: https://phabricator.services.mozilla.com/D48560
dom/workers/MessageEventRunnable.cpp
--- a/dom/workers/MessageEventRunnable.cpp
+++ b/dom/workers/MessageEventRunnable.cpp
@@ -56,17 +56,22 @@ bool MessageEventRunnable::DispatchDOMEv
   if (isTimelineRecording) {
     start = MakeUnique<WorkerTimelineMarker>(
         aIsMainThread
             ? ProfileTimelineWorkerOperationType::DeserializeDataOnMainThread
             : ProfileTimelineWorkerOperationType::DeserializeDataOffMainThread,
         MarkerTracingType::START);
   }
 
-  Read(parent, aCx, &messageData, rv);
+  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);
 
   if (isTimelineRecording) {
     end = MakeUnique<WorkerTimelineMarker>(
         aIsMainThread
             ? ProfileTimelineWorkerOperationType::DeserializeDataOnMainThread
             : ProfileTimelineWorkerOperationType::DeserializeDataOffMainThread,
         MarkerTracingType::END);
     timelines->AddMarkerForAllObservedDocShells(start);