Bug 1369436, Load PushComponents.js after startup. r=lina,mconley
authorEmma Malysz <emalysz@mozilla.com>
Wed, 25 Sep 2019 15:50:58 +0000
changeset 494928 6a48651180af1c1aa2ee03063989256a968dadef
parent 494927 2b7c5d0a5fe2698312875d36b4c5858d05eac596
child 494929 d6079cfa0c4ffe967dc7352b188ab3b24c487936
push id36618
push userapavel@mozilla.com
push dateWed, 25 Sep 2019 21:51:45 +0000
treeherdermozilla-central@ac2f06a2ddc0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslina, mconley
bugs1369436
milestone71.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 1369436, Load PushComponents.js after startup. r=lina,mconley Differential Revision: https://phabricator.services.mozilla.com/D45079
browser/base/content/test/performance/browser_startup.js
browser/components/BrowserGlue.jsm
dom/push/Push.manifest
dom/push/PushComponents.jsm
dom/push/PushCrypto.jsm
dom/push/PushService.jsm
dom/push/PushServiceAndroidGCM.jsm
dom/push/PushServiceHttp2.jsm
dom/push/PushServiceWebSocket.jsm
dom/push/test/xpcshell/test_notification_http2.js
dom/push/test/xpcshell/test_register_error_http2.js
dom/push/test/xpcshell/test_register_success_http2.js
dom/push/test/xpcshell/xpcshell.ini
--- a/browser/base/content/test/performance/browser_startup.js
+++ b/browser/base/content/test/performance/browser_startup.js
@@ -31,18 +31,16 @@ const startupPhases = {
         "resource:///modules/BrowserGlue.jsm",
         "resource://gre/modules/AppConstants.jsm",
         "resource://gre/modules/ActorManagerParent.jsm",
         "resource://gre/modules/CustomElementsListener.jsm",
         "resource://gre/modules/ExtensionUtils.jsm",
         "resource://gre/modules/MainProcessSingleton.jsm",
         "resource://gre/modules/XPCOMUtils.jsm",
         "resource://gre/modules/Services.jsm",
-        // Bugs to fix: The following components shouldn't be initialized that early.
-        "resource://gre/modules/PushComponents.jsm", // bug 1369436
       ]),
     },
   },
 
   // For the following phases of startup we have only a black list for now
 
   // We are at this phase after creating the first browser window (ie. after final-ui-startup).
   "before opening first browser window": {
@@ -90,16 +88,17 @@ const startupPhases = {
         "resource://gre/modules/BookmarkHTMLUtils.jsm",
         "resource://gre/modules/Bookmarks.jsm",
         "resource://gre/modules/ContextualIdentityService.jsm",
         "resource://gre/modules/CrashSubmit.jsm",
         "resource://gre/modules/FxAccounts.jsm",
         "resource://gre/modules/FxAccountsStorage.jsm",
         "resource://gre/modules/PlacesBackups.jsm",
         "resource://gre/modules/PlacesSyncUtils.jsm",
+        "resource://gre/modules/PushComponents.jsm",
         "resource://gre/modules/Sqlite.jsm",
       ]),
       services: new Set([
         "@mozilla.org/browser/annotation-service;1",
         "@mozilla.org/browser/nav-bookmarks-service;1",
       ]),
     },
   },
--- a/browser/components/BrowserGlue.jsm
+++ b/browser/components/BrowserGlue.jsm
@@ -15,16 +15,23 @@ const { AppConstants } = ChromeUtils.imp
 );
 
 ChromeUtils.defineModuleGetter(
   this,
   "ActorManagerParent",
   "resource://gre/modules/ActorManagerParent.jsm"
 );
 
+XPCOMUtils.defineLazyServiceGetter(
+  this,
+  "PushService",
+  "@mozilla.org/push/Service;1",
+  "nsIPushService"
+);
+
 const PREF_PDFJS_ENABLED_CACHE_STATE = "pdfjs.enabledCache.state";
 
 let ACTORS = {
   BrowserTab: {
     parent: {
       moduleURI: "resource:///actors/BrowserTabParent.jsm",
     },
     child: {
@@ -1993,16 +2000,21 @@ BrowserGlue.prototype = {
     Services.tm.idleDispatchToMainThread(() => {
       Services.prefs.addObserver(
         "permissions.eventTelemetry.enabled",
         this._togglePermissionPromptTelemetry
       );
       this._togglePermissionPromptTelemetry();
     });
 
+    // Begin listening for incoming push messages.
+    Services.tm.idleDispatchToMainThread(() => {
+      PushService.ensureReady();
+    });
+
     Services.tm.idleDispatchToMainThread(() => {
       this._recordContentBlockingTelemetry();
     });
 
     // Load the Login Manager data from disk off the main thread, some time
     // after startup.  If the data is required before this runs, for example
     // because a restored page contains a password field, it will be loaded on
     // the main thread, and this initialization request will be ignored.
--- a/dom/push/Push.manifest
+++ b/dom/push/Push.manifest
@@ -1,4 +1,2 @@
-category app-startup PushServiceParent @mozilla.org/push/Service;1 process=main
-
 # For immediate loading of PushService instead of delayed loading.
 category android-push-service PushServiceParent @mozilla.org/push/Service;1 process=main
--- a/dom/push/PushComponents.jsm
+++ b/dom/push/PushComponents.jsm
@@ -64,41 +64,32 @@ PushServiceBase.prototype = {
     Ci.nsIPushQuotaManager,
     Ci.nsIPushErrorReporter,
   ]),
 
   pushTopic: OBSERVER_TOPIC_PUSH,
   subscriptionChangeTopic: OBSERVER_TOPIC_SUBSCRIPTION_CHANGE,
   subscriptionModifiedTopic: OBSERVER_TOPIC_SUBSCRIPTION_MODIFIED,
 
-  _handleReady() {},
+  ensureReady() {},
 
   _addListeners() {
     for (let message of this._messages) {
       this._mm.addMessageListener(message, this);
     }
   },
 
   _isValidMessage(message) {
     return this._messages.includes(message.name);
   },
 
   observe(subject, topic, data) {
-    if (topic === "app-startup") {
-      Services.obs.addObserver(this, "sessionstore-windows-restored", true);
-      return;
-    }
-    if (topic === "sessionstore-windows-restored") {
-      Services.obs.removeObserver(this, "sessionstore-windows-restored");
-      this._handleReady();
-      return;
-    }
     if (topic === "android-push-service") {
       // Load PushService immediately.
-      this._handleReady();
+      this.ensureReady();
     }
   },
 
   _deliverSubscription(request, props) {
     if (!props) {
       request.onPushSubscription(Cr.NS_OK, null);
       return;
     }
@@ -260,17 +251,17 @@ Object.assign(PushServiceParent.prototyp
             requestID: data.requestID,
             result: error.result,
           });
         }
       )
       .catch(Cu.reportError);
   },
 
-  _handleReady() {
+  ensureReady() {
     this.service.init();
   },
 
   _toPageRecord(principal, data) {
     if (!data.scope) {
       throw new Error("Invalid page record: missing scope");
     }
     if (!principal) {
--- a/dom/push/PushCrypto.jsm
+++ b/dom/push/PushCrypto.jsm
@@ -10,17 +10,17 @@ const { XPCOMUtils } = ChromeUtils.impor
 );
 
 XPCOMUtils.defineLazyGetter(this, "gDOMBundle", () =>
   Services.strings.createBundle("chrome://global/locale/dom/dom.properties")
 );
 
 XPCOMUtils.defineLazyGlobalGetters(this, ["crypto"]);
 
-const EXPORTED_SYMBOLS = ["PushCrypto", "concatArray"];
+const EXPORTED_SYMBOLS = ["PushCrypto"];
 
 const UTF8 = new TextEncoder("utf-8");
 
 const ECDH_KEY = { name: "ECDH", namedCurve: "P-256" };
 const ECDSA_KEY = { name: "ECDSA", namedCurve: "P-256" };
 const HMAC_SHA256 = { name: "HMAC", hash: "SHA-256" };
 const NONCE_INFO = UTF8.encode("Content-Encoding: nonce");
 
@@ -598,16 +598,18 @@ class aesgcm128Decoder extends OldScheme
   }
 
   get padSize() {
     return 1;
   }
 }
 
 var PushCrypto = {
+  concatArray,
+
   generateAuthenticationSecret() {
     return crypto.getRandomValues(new Uint8Array(16));
   },
 
   validateAppServerKey(key) {
     return crypto.subtle
       .importKey("raw", key, ECDSA_KEY, true, ["verify"])
       .then(_ => key);
--- a/dom/push/PushService.jsm
+++ b/dom/push/PushService.jsm
@@ -15,32 +15,16 @@ const { clearTimeout, setTimeout } = Chr
   "resource://gre/modules/Timer.jsm"
 );
 const { XPCOMUtils } = ChromeUtils.import(
   "resource://gre/modules/XPCOMUtils.jsm"
 );
 
 var PushServiceWebSocket, PushServiceHttp2;
 
-const CONNECTION_PROTOCOLS = (function() {
-  if ("android" != AppConstants.MOZ_WIDGET_TOOLKIT) {
-    ({ PushServiceWebSocket } = ChromeUtils.import(
-      "resource://gre/modules/PushServiceWebSocket.jsm"
-    ));
-    ({ PushServiceHttp2 } = ChromeUtils.import(
-      "resource://gre/modules/PushServiceHttp2.jsm"
-    ));
-    return [PushServiceWebSocket, PushServiceHttp2];
-  }
-  const { PushServiceAndroidGCM } = ChromeUtils.import(
-    "resource://gre/modules/PushServiceAndroidGCM.jsm"
-  );
-  return [PushServiceAndroidGCM];
-})();
-
 XPCOMUtils.defineLazyServiceGetter(
   this,
   "gPushNotifier",
   "@mozilla.org/push/Notifier;1",
   "nsIPushNotifier"
 );
 XPCOMUtils.defineLazyServiceGetter(
   this,
@@ -53,16 +37,34 @@ ChromeUtils.defineModuleGetter(
   "pushBroadcastService",
   "resource://gre/modules/PushBroadcastService.jsm"
 );
 ChromeUtils.defineModuleGetter(
   this,
   "PushCrypto",
   "resource://gre/modules/PushCrypto.jsm"
 );
+ChromeUtils.defineModuleGetter(
+  this,
+  "PushServiceAndroidGCM",
+  "resource://gre/modules/PushServiceAndroidGCM.jsm"
+);
+
+const CONNECTION_PROTOCOLS = (function() {
+  if ("android" != AppConstants.MOZ_WIDGET_TOOLKIT) {
+    ({ PushServiceWebSocket } = ChromeUtils.import(
+      "resource://gre/modules/PushServiceWebSocket.jsm"
+    ));
+    ({ PushServiceHttp2 } = ChromeUtils.import(
+      "resource://gre/modules/PushServiceHttp2.jsm"
+    ));
+    return [PushServiceWebSocket, PushServiceHttp2];
+  }
+  return [PushServiceAndroidGCM];
+})();
 
 const EXPORTED_SYMBOLS = ["PushService"];
 
 XPCOMUtils.defineLazyGetter(this, "console", () => {
   let { ConsoleAPI } = ChromeUtils.import("resource://gre/modules/Console.jsm");
   return new ConsoleAPI({
     maxLogLevelPref: "dom.push.loglevel",
     prefix: "PushService",
@@ -95,16 +97,35 @@ const PUSH_SERVICE_RUNNING = 5;
  **/
 
 // This is for starting and stopping service.
 const STARTING_SERVICE_EVENT = 0;
 const CHANGING_SERVICE_EVENT = 1;
 const STOPPING_SERVICE_EVENT = 2;
 const UNINIT_EVENT = 3;
 
+// Returns the backend for the given server URI.
+function getServiceForServerURI(uri) {
+  // Insecure server URLs are allowed for development and testing.
+  let allowInsecure = prefs.get("testing.allowInsecureServerURL");
+  if (AppConstants.MOZ_WIDGET_TOOLKIT == "android") {
+    if (uri.scheme == "https" || (allowInsecure && uri.scheme == "http")) {
+      return CONNECTION_PROTOCOLS;
+    }
+    return null;
+  }
+  if (uri.scheme == "wss" || (allowInsecure && uri.scheme == "ws")) {
+    return PushServiceWebSocket;
+  }
+  if (uri.scheme == "https" || (allowInsecure && uri.scheme == "http")) {
+    return PushServiceHttp2;
+  }
+  return null;
+}
+
 /**
  * Annotates an error with an XPCOM result code. We use this helper
  * instead of `Components.Exception` because the latter can assert in
  * `nsXPCComponents_Exception::HasInstance` when inspected at shutdown.
  */
 function errorWithResult(message, result = Cr.NS_ERROR_FAILURE) {
   let error = new Error(message);
   error.result = result;
@@ -403,41 +424,34 @@ var PushService = {
       .catch(e => {
         console.error("backgroundUnregister: Error notifying server", e);
       });
   },
 
   _findService(serverURL) {
     console.debug("findService()");
 
-    let uri;
-    let service;
-
     if (!serverURL) {
       console.warn("findService: No dom.push.serverURL found");
       return [];
     }
 
+    let uri;
     try {
       uri = Services.io.newURI(serverURL);
     } catch (e) {
       console.warn(
         "findService: Error creating valid URI from",
         "dom.push.serverURL",
         serverURL
       );
       return [];
     }
 
-    for (let connProtocol of CONNECTION_PROTOCOLS) {
-      if (connProtocol.validServerURI(uri)) {
-        service = connProtocol;
-        break;
-      }
-    }
+    let service = getServiceForServerURI(uri);
     return [service, uri];
   },
 
   _changeServerURL(serverURI, event, options = {}) {
     console.debug("changeServerURL()");
 
     switch (event) {
       case UNINIT_EVENT:
--- a/dom/push/PushServiceAndroidGCM.jsm
+++ b/dom/push/PushServiceAndroidGCM.jsm
@@ -74,35 +74,16 @@ var PushServiceAndroidGCM = {
       kPUSHANDROIDGCMDB_DB_NAME,
       kPUSHANDROIDGCMDB_DB_VERSION,
       kPUSHANDROIDGCMDB_STORE_NAME,
       "channelID",
       PushRecordAndroidGCM
     );
   },
 
-  validServerURI(serverURI) {
-    if (!serverURI) {
-      return false;
-    }
-
-    if (serverURI.scheme == "https") {
-      return true;
-    }
-    if (serverURI.scheme == "http") {
-      // Allow insecure server URLs for development and testing.
-      return !!prefs.get("testing.allowInsecureServerURL");
-    }
-    console.info(
-      "Unsupported Android GCM dom.push.serverURL scheme",
-      serverURI.scheme
-    );
-    return false;
-  },
-
   observe(subject, topic, data) {
     switch (topic) {
       case "nsPref:changed":
         if (data == "dom.push.debug") {
           // Reconfigure.
           let debug = !!prefs.get("debug");
           console.info(
             "Debug parameter changed; updating configuration with new debug",
--- a/dom/push/PushServiceHttp2.jsm
+++ b/dom/push/PushServiceHttp2.jsm
@@ -13,17 +13,17 @@ const { XPCOMUtils } = ChromeUtils.impor
   "resource://gre/modules/XPCOMUtils.jsm"
 );
 const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 const { NetUtil } = ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
 const { clearTimeout, setTimeout } = ChromeUtils.import(
   "resource://gre/modules/Timer.jsm"
 );
 
-const { PushCrypto, concatArray } = ChromeUtils.import(
+const { PushCrypto } = ChromeUtils.import(
   "resource://gre/modules/PushCrypto.jsm"
 );
 
 var EXPORTED_SYMBOLS = ["PushServiceHttp2"];
 
 XPCOMUtils.defineLazyGetter(this, "console", () => {
   let { ConsoleAPI } = ChromeUtils.import("resource://gre/modules/Console.jsm");
   return new ConsoleAPI({
@@ -152,17 +152,17 @@ PushChannelListener.prototype = {
       this._mainListener._pushService
     ) {
       let headers = {
         encryption_key: getHeaderField(aRequest, "Encryption-Key"),
         crypto_key: getHeaderField(aRequest, "Crypto-Key"),
         encryption: getHeaderField(aRequest, "Encryption"),
         encoding: getHeaderField(aRequest, "Content-Encoding"),
       };
-      let msg = concatArray(this._message);
+      let msg = PushCrypto.concatArray(this._message);
 
       this._mainListener._pushService._pushChannelOnStop(
         this._mainListener.uri,
         this._ackUri,
         headers,
         msg
       );
     }
@@ -420,23 +420,16 @@ var PushServiceHttp2 = {
       PushRecordHttp2
     );
   },
 
   hasmainPushService() {
     return this._mainPushService !== null;
   },
 
-  validServerURI(serverURI) {
-    if (serverURI.scheme == "http") {
-      return !!prefs.getBoolPref("testing.allowInsecureServerURL", false);
-    }
-    return serverURI.scheme == "https";
-  },
-
   async connect(broadcastListeners) {
     let subscriptions = await this._mainPushService.getAllUnexpired();
     this.startConnections(subscriptions);
   },
 
   async sendSubscribeBroadcast(serviceId, version) {
     // Not implemented yet
   },
--- a/dom/push/PushServiceWebSocket.jsm
+++ b/dom/push/PushServiceWebSocket.jsm
@@ -249,23 +249,16 @@ var PushServiceWebSocket = {
 
     // The most likely reason for a pong or registration request timing out is
     // that the socket has disconnected. Best to reconnect.
     if (requestTimedOut) {
       this._reconnect();
     }
   },
 
-  validServerURI(serverURI) {
-    if (serverURI.scheme == "ws") {
-      return !!prefs.get("testing.allowInsecureServerURL");
-    }
-    return serverURI.scheme == "wss";
-  },
-
   get _UAID() {
     return prefs.get("userAgentID");
   },
 
   set _UAID(newID) {
     if (typeof newID !== "string") {
       console.warn(
         "Got invalid, non-string UAID",
deleted file mode 100644
--- a/dom/push/test/xpcshell/test_notification_http2.js
+++ /dev/null
@@ -1,211 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-const { PushDB, PushService, PushServiceHttp2 } = serviceExports;
-
-var serverPort = -1;
-
-function run_test() {
-  serverPort = getTestServerPort();
-
-  do_get_profile();
-  setPrefs({
-    "testing.allowInsecureServerURL": true,
-  });
-  // Set to allow the cert presented by our H2 server
-  var oldPref = Services.prefs.getIntPref(
-    "network.http.speculative-parallel-limit"
-  );
-  Services.prefs.setIntPref("network.http.speculative-parallel-limit", 0);
-  Services.prefs.setBoolPref("dom.push.enabled", true);
-  Services.prefs.setBoolPref("dom.push.connection.enabled", true);
-
-  trustHttp2CA();
-
-  Services.prefs.setIntPref("network.http.speculative-parallel-limit", oldPref);
-
-  run_next_test();
-}
-
-add_task(async function test_pushNotifications() {
-  // /pushNotifications/subscription1 will send a message with no rs and padding
-  // length 1.
-  // /pushNotifications/subscription2 will send a message with no rs and padding
-  // length 16.
-  // /pushNotifications/subscription3 will send a message with rs equal 24 and
-  // padding length 16.
-  // /pushNotifications/subscription4 will send a message with no rs and padding
-  // length 256.
-
-  let db = PushServiceHttp2.newPushDB();
-  registerCleanupFunction(() => {
-    return db.drop().then(_ => db.close());
-  });
-
-  var serverURL = "https://localhost:" + serverPort;
-
-  let records = [
-    {
-      subscriptionUri: serverURL + "/pushNotifications/subscription1",
-      pushEndpoint: serverURL + "/pushEndpoint1",
-      pushReceiptEndpoint: serverURL + "/pushReceiptEndpoint1",
-      scope: "https://example.com/page/1",
-      p256dhPublicKey:
-        "BPCd4gNQkjwRah61LpdALdzZKLLnU5UAwDztQ5_h0QsT26jk0IFbqcK6-JxhHAm-rsHEwy0CyVJjtnfOcqc1tgA",
-      p256dhPrivateKey: {
-        crv: "P-256",
-        d: "1jUPhzVsRkzV0vIzwL4ZEsOlKdNOWm7TmaTfzitJkgM",
-        ext: true,
-        key_ops: ["deriveBits"],
-        kty: "EC",
-        x: "8J3iA1CSPBFqHrUul0At3NkosudTlQDAPO1Dn-HRCxM",
-        y: "26jk0IFbqcK6-JxhHAm-rsHEwy0CyVJjtnfOcqc1tgA",
-      },
-      originAttributes: ChromeUtils.originAttributesToSuffix({
-        inIsolatedMozBrowser: false,
-      }),
-      quota: Infinity,
-      systemRecord: true,
-    },
-    {
-      subscriptionUri: serverURL + "/pushNotifications/subscription2",
-      pushEndpoint: serverURL + "/pushEndpoint2",
-      pushReceiptEndpoint: serverURL + "/pushReceiptEndpoint2",
-      scope: "https://example.com/page/2",
-      p256dhPublicKey:
-        "BPnWyUo7yMnuMlyKtERuLfWE8a09dtdjHSW2lpC9_BqR5TZ1rK8Ldih6ljyxVwnBA-nygQHGRpEmu1jV5K8437E",
-      p256dhPrivateKey: {
-        crv: "P-256",
-        d: "lFm4nPsUKYgNGBJb5nXXKxl8bspCSp0bAhCYxbveqT4",
-        ext: true,
-        key_ops: ["deriveBits"],
-        kty: "EC",
-        x: "-dbJSjvIye4yXIq0RG4t9YTxrT1212MdJbaWkL38GpE",
-        y: "5TZ1rK8Ldih6ljyxVwnBA-nygQHGRpEmu1jV5K8437E",
-      },
-      originAttributes: ChromeUtils.originAttributesToSuffix({
-        inIsolatedMozBrowser: false,
-      }),
-      quota: Infinity,
-      systemRecord: true,
-    },
-    {
-      subscriptionUri: serverURL + "/pushNotifications/subscription3",
-      pushEndpoint: serverURL + "/pushEndpoint3",
-      pushReceiptEndpoint: serverURL + "/pushReceiptEndpoint3",
-      scope: "https://example.com/page/3",
-      p256dhPublicKey:
-        "BDhUHITSeVrWYybFnb7ylVTCDDLPdQWMpf8gXhcWwvaaJa6n3YH8TOcH8narDF6t8mKVvg2ioLW-8MH5O4dzGcI",
-      p256dhPrivateKey: {
-        crv: "P-256",
-        d: "Q1_SE1NySTYzjbqgWwPgrYh7XRg3adqZLkQPsy319G8",
-        ext: true,
-        key_ops: ["deriveBits"],
-        kty: "EC",
-        x: "OFQchNJ5WtZjJsWdvvKVVMIMMs91BYyl_yBeFxbC9po",
-        y: "Ja6n3YH8TOcH8narDF6t8mKVvg2ioLW-8MH5O4dzGcI",
-      },
-      originAttributes: ChromeUtils.originAttributesToSuffix({
-        inIsolatedMozBrowser: false,
-      }),
-      quota: Infinity,
-      systemRecord: true,
-    },
-    {
-      subscriptionUri: serverURL + "/pushNotifications/subscription4",
-      pushEndpoint: serverURL + "/pushEndpoint4",
-      pushReceiptEndpoint: serverURL + "/pushReceiptEndpoint4",
-      scope: "https://example.com/page/4",
-      p256dhPublicKey: ChromeUtils.base64URLDecode(
-        "BEcvDzkWCrUtjU_wygL98sbQCQrW1lY9irtgGnlCc4B0JJXLCHB9MTM73qD6GZYfL0YOvKo8XLOflh-J4dMGklU",
-        {
-          padding: "reject",
-        }
-      ),
-      p256dhPrivateKey: {
-        crv: "P-256",
-        d: "fWi7tZaX0Pk6WnLrjQ3kiRq_g5XStL5pdH4pllNCqXw",
-        ext: true,
-        key_ops: ["deriveBits"],
-        kty: "EC",
-        x: "Ry8PORYKtS2NT_DKAv3yxtAJCtbWVj2Ku2AaeUJzgHQ",
-        y: "JJXLCHB9MTM73qD6GZYfL0YOvKo8XLOflh-J4dMGklU",
-      },
-      authenticationSecret: ChromeUtils.base64URLDecode(
-        "cwDVC1iwAn8E37mkR3tMSg",
-        {
-          padding: "reject",
-        }
-      ),
-      originAttributes: ChromeUtils.originAttributesToSuffix({
-        inIsolatedMozBrowser: false,
-      }),
-      quota: Infinity,
-      systemRecord: true,
-    },
-  ];
-
-  for (let record of records) {
-    await db.put(record);
-  }
-
-  let notifyPromise = Promise.all([
-    promiseObserverNotification(PushServiceComponent.pushTopic, function(
-      subject,
-      data
-    ) {
-      var message = subject.QueryInterface(Ci.nsIPushMessage).data;
-      if (message && data == "https://example.com/page/1") {
-        equal(message.text(), "Some message", "decoded message is incorrect");
-        return true;
-      }
-      return false;
-    }),
-    promiseObserverNotification(PushServiceComponent.pushTopic, function(
-      subject,
-      data
-    ) {
-      var message = subject.QueryInterface(Ci.nsIPushMessage).data;
-      if (message && data == "https://example.com/page/2") {
-        equal(message.text(), "Some message", "decoded message is incorrect");
-        return true;
-      }
-      return false;
-    }),
-    promiseObserverNotification(PushServiceComponent.pushTopic, function(
-      subject,
-      data
-    ) {
-      var message = subject.QueryInterface(Ci.nsIPushMessage).data;
-      if (message && data == "https://example.com/page/3") {
-        equal(message.text(), "Some message", "decoded message is incorrect");
-        return true;
-      }
-      return false;
-    }),
-    promiseObserverNotification(PushServiceComponent.pushTopic, function(
-      subject,
-      data
-    ) {
-      var message = subject.QueryInterface(Ci.nsIPushMessage).data;
-      if (message && data == "https://example.com/page/4") {
-        equal(
-          message.text(),
-          "Yet another message",
-          "decoded message is incorrect"
-        );
-        return true;
-      }
-      return false;
-    }),
-  ]);
-
-  PushService.init({
-    serverURI: serverURL,
-    db,
-  });
-
-  await notifyPromise;
-});
deleted file mode 100644
--- a/dom/push/test/xpcshell/test_register_error_http2.js
+++ /dev/null
@@ -1,212 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-const { PushDB, PushService, PushServiceHttp2 } = serviceExports;
-
-var serverURL;
-
-var serverPort = -1;
-
-function run_test() {
-  serverPort = getTestServerPort();
-
-  do_get_profile();
-
-  serverURL = "https://localhost:" + serverPort;
-
-  run_next_test();
-}
-
-// Connection will fail because of the certificates.
-add_task(async function test_pushSubscriptionNoConnection() {
-  let db = PushServiceHttp2.newPushDB();
-  registerCleanupFunction(() => {
-    return db.drop().then(_ => db.close());
-  });
-
-  PushService.init({
-    serverURI: serverURL + "/pushSubscriptionNoConnection/subscribe",
-    db,
-  });
-
-  await Assert.rejects(
-    PushService.register({
-      scope: "https://example.net/page/invalid-response",
-      originAttributes: ChromeUtils.originAttributesToSuffix({
-        inIsolatedMozBrowser: false,
-      }),
-    }),
-    /Registration error/,
-    "Expected error for not being able to establish connecion."
-  );
-
-  let record = await db.getAllKeyIDs();
-  ok(
-    record.length === 0,
-    "Should not store records when connection couldn't be established."
-  );
-  PushService.uninit();
-});
-
-add_task(async function test_TLS() {
-  // Set to allow the cert presented by our H2 server
-  var oldPref = Services.prefs.getIntPref(
-    "network.http.speculative-parallel-limit"
-  );
-  Services.prefs.setIntPref("network.http.speculative-parallel-limit", 0);
-
-  trustHttp2CA();
-
-  Services.prefs.setIntPref("network.http.speculative-parallel-limit", oldPref);
-});
-
-add_task(async function test_pushSubscriptionMissingLocation() {
-  let db = PushServiceHttp2.newPushDB();
-  registerCleanupFunction(() => {
-    return db.drop().then(_ => db.close());
-  });
-
-  PushService.init({
-    serverURI: serverURL + "/pushSubscriptionMissingLocation/subscribe",
-    db,
-  });
-
-  await Assert.rejects(
-    PushService.register({
-      scope: "https://example.net/page/invalid-response",
-      originAttributes: ChromeUtils.originAttributesToSuffix({
-        inIsolatedMozBrowser: false,
-      }),
-    }),
-    /Registration error/,
-    "Expected error for the missing location header."
-  );
-
-  let record = await db.getAllKeyIDs();
-  ok(
-    record.length === 0,
-    "Should not store records when the location header is missing."
-  );
-  PushService.uninit();
-});
-
-add_task(async function test_pushSubscriptionMissingLink() {
-  let db = PushServiceHttp2.newPushDB();
-  registerCleanupFunction(() => {
-    return db.drop().then(_ => db.close());
-  });
-
-  PushService.init({
-    serverURI: serverURL + "/pushSubscriptionMissingLink/subscribe",
-    db,
-  });
-
-  await Assert.rejects(
-    PushService.register({
-      scope: "https://example.net/page/invalid-response",
-      originAttributes: ChromeUtils.originAttributesToSuffix({
-        inIsolatedMozBrowser: false,
-      }),
-    }),
-    /Registration error/,
-    "Expected error for the missing link header."
-  );
-
-  let record = await db.getAllKeyIDs();
-  ok(
-    record.length === 0,
-    "Should not store records when a link header is missing."
-  );
-  PushService.uninit();
-});
-
-add_task(async function test_pushSubscriptionMissingLink1() {
-  let db = PushServiceHttp2.newPushDB();
-  registerCleanupFunction(() => {
-    return db.drop().then(_ => db.close());
-  });
-
-  PushService.init({
-    serverURI: serverURL + "/pushSubscriptionMissingLink1/subscribe",
-    db,
-  });
-
-  await Assert.rejects(
-    PushService.register({
-      scope: "https://example.net/page/invalid-response",
-      originAttributes: ChromeUtils.originAttributesToSuffix({
-        inIsolatedMozBrowser: false,
-      }),
-    }),
-    /Registration error/,
-    "Expected error for the missing push endpoint."
-  );
-
-  let record = await db.getAllKeyIDs();
-  ok(
-    record.length === 0,
-    "Should not store records when the push endpoint is missing."
-  );
-  PushService.uninit();
-});
-
-add_task(async function test_pushSubscriptionLocationBogus() {
-  let db = PushServiceHttp2.newPushDB();
-  registerCleanupFunction(() => {
-    return db.drop().then(_ => db.close());
-  });
-
-  PushService.init({
-    serverURI: serverURL + "/pushSubscriptionLocationBogus/subscribe",
-    db,
-  });
-
-  await Assert.rejects(
-    PushService.register({
-      scope: "https://example.net/page/invalid-response",
-      originAttributes: ChromeUtils.originAttributesToSuffix({
-        inIsolatedMozBrowser: false,
-      }),
-    }),
-    /Registration error/,
-    "Expected error for the bogus location"
-  );
-
-  let record = await db.getAllKeyIDs();
-  ok(
-    record.length === 0,
-    "Should not store records when location header is bogus."
-  );
-  PushService.uninit();
-});
-
-add_task(async function test_pushSubscriptionNot2xxCode() {
-  let db = PushServiceHttp2.newPushDB();
-  registerCleanupFunction(() => {
-    return db.drop().then(_ => db.close());
-  });
-
-  PushService.init({
-    serverURI: serverURL + "/pushSubscriptionNot201Code/subscribe",
-    db,
-  });
-
-  await Assert.rejects(
-    PushService.register({
-      scope: "https://example.net/page/invalid-response",
-      originAttributes: ChromeUtils.originAttributesToSuffix({
-        inIsolatedMozBrowser: false,
-      }),
-    }),
-    /Registration error/,
-    "Expected error for not 201 responce code."
-  );
-
-  let record = await db.getAllKeyIDs();
-  ok(
-    record.length === 0,
-    "Should not store records when respons code is not 201."
-  );
-});
deleted file mode 100644
--- a/dom/push/test/xpcshell/test_register_success_http2.js
+++ /dev/null
@@ -1,157 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-const { PushDB, PushService, PushServiceHttp2 } = serviceExports;
-
-var serverURL;
-var serverPort = -1;
-var pushEnabled;
-var pushConnectionEnabled;
-var db;
-
-function run_test() {
-  serverPort = getTestServerPort();
-
-  do_get_profile();
-  pushEnabled = Services.prefs.getBoolPref("dom.push.enabled");
-  pushConnectionEnabled = Services.prefs.getBoolPref(
-    "dom.push.connection.enabled"
-  );
-
-  // Set to allow the cert presented by our H2 server
-  var oldPref = Services.prefs.getIntPref(
-    "network.http.speculative-parallel-limit"
-  );
-  Services.prefs.setIntPref("network.http.speculative-parallel-limit", 0);
-  Services.prefs.setBoolPref("dom.push.enabled", true);
-  Services.prefs.setBoolPref("dom.push.connection.enabled", true);
-
-  trustHttp2CA();
-
-  Services.prefs.setIntPref("network.http.speculative-parallel-limit", oldPref);
-
-  serverURL = "https://localhost:" + serverPort;
-
-  run_next_test();
-}
-
-add_task(async function test_setup() {
-  db = PushServiceHttp2.newPushDB();
-  registerCleanupFunction(() => {
-    return db.drop().then(_ => db.close());
-  });
-});
-
-add_task(async function test_pushSubscriptionSuccess() {
-  PushService.init({
-    serverURI: serverURL + "/pushSubscriptionSuccess/subscribe",
-    db,
-  });
-
-  let newRecord = await PushService.register({
-    scope: "https://example.org/1",
-    originAttributes: ChromeUtils.originAttributesToSuffix({
-      inIsolatedMozBrowser: false,
-    }),
-  });
-
-  var subscriptionUri = serverURL + "/pushSubscriptionSuccesss";
-  var pushEndpoint = serverURL + "/pushEndpointSuccess";
-  var pushReceiptEndpoint = serverURL + "/receiptPushEndpointSuccess";
-  equal(
-    newRecord.endpoint,
-    pushEndpoint,
-    "Wrong push endpoint in registration record"
-  );
-
-  equal(
-    newRecord.pushReceiptEndpoint,
-    pushReceiptEndpoint,
-    "Wrong push endpoint receipt in registration record"
-  );
-
-  let record = await db.getByKeyID(subscriptionUri);
-  equal(
-    record.subscriptionUri,
-    subscriptionUri,
-    "Wrong subscription ID in database record"
-  );
-  equal(
-    record.pushEndpoint,
-    pushEndpoint,
-    "Wrong push endpoint in database record"
-  );
-  equal(
-    record.pushReceiptEndpoint,
-    pushReceiptEndpoint,
-    "Wrong push endpoint receipt in database record"
-  );
-  equal(
-    record.scope,
-    "https://example.org/1",
-    "Wrong scope in database record"
-  );
-
-  PushService.uninit();
-});
-
-add_task(async function test_pushSubscriptionMissingLink2() {
-  PushService.init({
-    serverURI: serverURL + "/pushSubscriptionMissingLink2/subscribe",
-    db,
-  });
-
-  let newRecord = await PushService.register({
-    scope: "https://example.org/no_receiptEndpoint",
-    originAttributes: ChromeUtils.originAttributesToSuffix({
-      inIsolatedMozBrowser: false,
-    }),
-  });
-
-  var subscriptionUri = serverURL + "/subscriptionMissingLink2";
-  var pushEndpoint = serverURL + "/pushEndpointMissingLink2";
-  var pushReceiptEndpoint = "";
-  equal(
-    newRecord.endpoint,
-    pushEndpoint,
-    "Wrong push endpoint in registration record"
-  );
-
-  equal(
-    newRecord.pushReceiptEndpoint,
-    pushReceiptEndpoint,
-    "Wrong push endpoint receipt in registration record"
-  );
-
-  let record = await db.getByKeyID(subscriptionUri);
-  equal(
-    record.subscriptionUri,
-    subscriptionUri,
-    "Wrong subscription ID in database record"
-  );
-  equal(
-    record.pushEndpoint,
-    pushEndpoint,
-    "Wrong push endpoint in database record"
-  );
-  equal(
-    record.pushReceiptEndpoint,
-    pushReceiptEndpoint,
-    "Wrong push endpoint receipt in database record"
-  );
-  equal(
-    record.scope,
-    "https://example.org/no_receiptEndpoint",
-    "Wrong scope in database record"
-  );
-});
-
-add_task(async function test_complete() {
-  Services.prefs.setBoolPref("dom.push.enabled", pushEnabled);
-  Services.prefs.setBoolPref(
-    "dom.push.connection.enabled",
-    pushConnectionEnabled
-  );
-});
--- a/dom/push/test/xpcshell/xpcshell.ini
+++ b/dom/push/test/xpcshell/xpcshell.ini
@@ -58,50 +58,14 @@ skip-if = os == "linux" # Bug 1265233
 [test_service_child.js]
 
 #http2 test
 [test_resubscribe_4xxCode_http2.js]
 [test_resubscribe_5xxCode_http2.js]
 [test_resubscribe_listening_for_msg_error_http2.js]
 [test_register_5xxCode_http2.js]
 [test_updateRecordNoEncryptionKeys_http2.js]
-[test_register_success_http2.js]
-# This used to be hasNode, but that caused too many issues with tests being
-# silently disabled, so now we explicitly call out the platforms not known
-# to have node installed.
-skip-if = os == "android"
-run-sequentially = node server exceptions dont replay well
-[test_register_error_http2.js]
-# This used to be hasNode, but that caused too many issues with tests being
-# silently disabled, so now we explicitly call out the platforms not known
-# to have node installed.
-skip-if = os == "android"
-run-sequentially = node server exceptions dont replay well
-[test_unregister_success_http2.js]
-# This used to be hasNode, but that caused too many issues with tests being
-# silently disabled, so now we explicitly call out the platforms not known
-# to have node installed.
-skip-if = os == "android"
-run-sequentially = node server exceptions dont replay well
-[test_notification_http2.js]
-# This used to be hasNode, but that caused too many issues with tests being
-# silently disabled, so now we explicitly call out the platforms not known
-# to have node installed.
-skip-if = os == "android"
-run-sequentially = node server exceptions dont replay well
-[test_registration_success_http2.js]
-# This used to be hasNode, but that caused too many issues with tests being
-# silently disabled, so now we explicitly call out the platforms not known
-# to have node installed.
-skip-if = os == "android"
-run-sequentially = node server exceptions dont replay well
-[test_registration_error_http2.js]
-# This used to be hasNode, but that caused too many issues with tests being
-# silently disabled, so now we explicitly call out the platforms not known
-# to have node installed.
-skip-if = os == "android"
-run-sequentially = node server exceptions dont replay well
 [test_clearAll_successful.js]
 # This used to be hasNode, but that caused too many issues with tests being
 # silently disabled, so now we explicitly call out the platforms not known
 # to have node installed.
 skip-if = os == "android"
 run-sequentially = This will delete all existing push subscriptions.