Bug 1557807 - Remove null check of sourceBc ContentChild::RecvWindowPostMessage(). r=nika
authorAndrew McCreight <continuation@gmail.com>
Mon, 10 Jun 2019 15:13:07 +0000
changeset 478097 bd7b19350b5a63d77f42c433e54da0e1e12f39bf
parent 478096 bac01d6670ed1e40384e919c3e24f169ce8dd2bb
child 478098 bf5936dc3807e466c5a4d1eb583492408093ce05
push id113405
push usernerli@mozilla.com
push dateTue, 11 Jun 2019 03:22:35 +0000
treeherdermozilla-inbound@e3bbbcf873c2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnika
bugs1557807
milestone69.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 1557807 - Remove null check of sourceBc ContentChild::RecvWindowPostMessage(). r=nika This can happen if the post message is sent to content by chrome. Differential Revision: https://phabricator.services.mozilla.com/D34236
dom/ipc/ContentChild.cpp
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -3947,25 +3947,19 @@ mozilla::ipc::IPCResult ContentChild::Re
   nsCOMPtr<nsIPrincipal> providedPrincipal;
   if (!window->GetPrincipalForPostMessage(
           aData.targetOrigin(), aData.targetOriginURI(),
           aData.callerPrincipal(), *aData.subjectPrincipal(),
           getter_AddRefs(providedPrincipal))) {
     return IPC_OK();
   }
 
-  RefPtr<BrowsingContext> sourceBc = aData.source();
-  if (!sourceBc) {
-    MOZ_LOG(BrowsingContext::GetLog(), LogLevel::Debug,
-            ("ChildIPC: Trying to use a dead or detached context"));
-    return IPC_OK();
-  }
-
   // Create and asynchronously dispatch a runnable which will handle actual DOM
   // event creation and dispatch.
+  RefPtr<BrowsingContext> sourceBc = aData.source();
   RefPtr<PostMessageEvent> event = new PostMessageEvent(
       sourceBc, aData.origin(), window, providedPrincipal,
       aData.callerDocumentURI(), aData.isFromPrivateWindow());
   event->UnpackFrom(aMessage);
 
   window->Dispatch(TaskCategory::Other, event.forget());
   return IPC_OK();
 }