Bug 1596918: Part 1e - Correctly handle query handlers throwing uncatchable exceptions. r=mccr8
authorKris Maglione <maglione.k@gmail.com>
Sat, 07 Dec 2019 18:44:33 +0000
changeset 568112 5bae838f369c88fd0a703f4f1f684884359c9e29
parent 568111 1244972229bcc7ea55914ee9f93e4ad47065fc70
child 568113 e2312373dc55560eaee7f28ddd1bff4db06cf1f5
push id12493
push userffxbld-merge
push dateMon, 06 Jan 2020 15:38:57 +0000
treeherdermozilla-beta@63ae456b848d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1596918
milestone73.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 1596918: Part 1e - Correctly handle query handlers throwing uncatchable exceptions. r=mccr8 Differential Revision: https://phabricator.services.mozilla.com/D53738
dom/ipc/JSWindowActor.cpp
--- a/dom/ipc/JSWindowActor.cpp
+++ b/dom/ipc/JSWindowActor.cpp
@@ -286,17 +286,23 @@ void JSWindowActor::ReceiveMessageOrQuer
   RefPtr<MessageListener> messageListener =
       new MessageListener(self, global, nullptr, nullptr);
   messageListener->ReceiveMessage(argument, &retval, aRv,
                                   "JSWindowActor receive message");
 
   // If we have a promise, resolve or reject it respectively.
   if (promise) {
     if (aRv.Failed()) {
-      promise->MaybeReject(aRv);
+      if (aRv.IsUncatchableException()) {
+        aRv.SuppressException();
+        promise->MaybeRejectWithDOMException(
+            NS_ERROR_FAILURE, "Message handler threw uncatchable exception");
+      } else {
+        promise->MaybeReject(aRv);
+      }
     } else {
       promise->MaybeResolve(retval);
     }
   }
 }
 
 void JSWindowActor::ReceiveQueryReply(JSContext* aCx,
                                       const JSWindowActorMessageMeta& aMetadata,