Bug 1383905 - Push notifications should only use "web" content processes. r=bkelly
authorAndrew Sutherland <asutherland@asutherland.org>
Mon, 24 Jul 2017 23:28:41 -0400
changeset 378425 d69a6595950ce55e48c3f072081984818703803a
parent 378424 7af2b462a50707de5bf79a3f118fee5303c7ab72
child 378426 466dabdf2c4afe34a1a987f44c584c4abe1f48c4
push id32429
push userarchaeopteryx@coole-files.de
push dateSat, 02 Sep 2017 08:56:13 +0000
treeherdermozilla-central@a46a5879b878 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbkelly
bugs1383905, 1395827
milestone57.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 1383905 - Push notifications should only use "web" content processes. r=bkelly This introduces filtering to avoid attempting to dispatch notifications to WebExtensions processes and other types of content processes. This is dependent upon bug 1395827 changing xpcshell to create its child processes with a remote type of "web" in order to not break the push xpcshell tests.
dom/push/PushNotifier.cpp
--- a/dom/push/PushNotifier.cpp
+++ b/dom/push/PushNotifier.cpp
@@ -103,16 +103,23 @@ PushNotifier::Dispatch(PushDispatcher& a
     Unused << NS_WARN_IF(NS_FAILED(aDispatcher.NotifyObservers()));
 
     nsTArray<ContentParent*> contentActors;
     ContentParent::GetAll(contentActors);
     if (!contentActors.IsEmpty()) {
       // At least one content process is active, so e10s must be enabled.
       // Broadcast a message to notify observers and service workers.
       for (uint32_t i = 0; i < contentActors.Length(); ++i) {
+        // We need to filter based on process type, only "web" AKA the default
+        // remote type is acceptable.
+        if (!contentActors[i]->GetRemoteType().EqualsLiteral(
+               DEFAULT_REMOTE_TYPE)) {
+          continue;
+        }
+
         // Ensure that the content actor has the permissions avaliable for the
         // principal the push is being sent for before sending the push message
         // down.
         Unused << contentActors[i]->
           TransmitPermissionsForPrincipal(aDispatcher.GetPrincipal());
         if (aDispatcher.SendToChild(contentActors[i])) {
           // Only send the push message to the first content process to avoid
           // multiple SWs showing the same notification. See bug 1300112.