Bug 1347739 Don't crash if an ExtendableMessageEvent object has a null source. r=asuth a=gchang
authorBen Kelly <ben@wanderview.com>
Thu, 16 Mar 2017 21:25:42 -0400
changeset 379143 03bd925be74071b4ff5c18882e8cd95696dafa13
parent 379142 ee1513ac0f8d38c3842017d15bcc1695b783d2b4
child 379144 b2be2b8f74bb0d74e79ed4cc11f567ad0660142c
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersasuth, gchang
bugs1347739
milestone53.0
Bug 1347739 Don't crash if an ExtendableMessageEvent object has a null source. r=asuth a=gchang
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)