Bug 1347739 Don't crash if an ExtendableMessageEvent object has a null source. r=asuth
authorBen Kelly <ben@wanderview.com>
Thu, 16 Mar 2017 21:25:42 -0400
changeset 348058 77b0e80d2bd3c7605682686d384b6dea62a4540e
parent 348057 b66398167216f8c1caabcdfca0c5742c6e9ce207
child 348059 a6780188f66986608a220efc6095e93daaa9e45e
push id88141
push userbkelly@mozilla.com
push dateFri, 17 Mar 2017 01:25:48 +0000
treeherdermozilla-inbound@77b0e80d2bd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersasuth
bugs1347739
milestone55.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 1347739 Don't crash if an ExtendableMessageEvent object has a null source. r=asuth
dom/workers/ServiceWorkerEvents.cpp
--- a/dom/workers/ServiceWorkerEvents.cpp
+++ b/dom/workers/ServiceWorkerEvents.cpp
@@ -1186,17 +1186,18 @@ ExtendableMessageEvent::GetSource(Nullab
 {
   if (mClient) {
     aValue.SetValue().SetAsClient() = mClient;
   } else if (mServiceWorker) {
     aValue.SetValue().SetAsServiceWorker() = mServiceWorker;
   } else if (mMessagePort) {
     aValue.SetValue().SetAsMessagePort() = mMessagePort;
   } else {
-    MOZ_CRASH("Unexpected source value");
+    // nullptr source is possible for manually constructed event
+    aValue.SetNull();
   }
 }
 
 /* static */ already_AddRefed<ExtendableMessageEvent>
 ExtendableMessageEvent::Constructor(const GlobalObject& aGlobal,
                                     const nsAString& aType,
                                     const ExtendableMessageEventInit& aOptions,
                                     ErrorResult& aRv)