Bug 1311739 - Silence `serverURL` pref warnings in push tests. r?dragana draft
authorKit Cambridge <kit@yakshaving.ninja>
Thu, 20 Oct 2016 08:43:11 -0700
changeset 427603 e022506bf1c356e59a6c143d425962cb350c4def
parent 427602 268cf42489c7e6c39da890f34b9b5d9ebba4c8a5
child 534510 d47beca06ec9094a9523efeb42d2cb6307a0add0
push id33063
push userbmo:kcambridge@mozilla.com
push dateThu, 20 Oct 2016 16:29:04 +0000
reviewersdragana
bugs1311739
milestone52.0a1
Bug 1311739 - Silence `serverURL` pref warnings in push tests. r?dragana MozReview-Commit-ID: 9Peorbb5pFS
dom/push/PushService.jsm
--- a/dom/push/PushService.jsm
+++ b/dom/push/PushService.jsm
@@ -487,29 +487,28 @@ this.PushService = {
     console.debug("init()");
 
     if (this._state > PUSH_SERVICE_UNINIT) {
       return;
     }
 
     this._setState(PUSH_SERVICE_ACTIVATING);
 
+    prefs.observe("serverURL", this);
     Services.obs.addObserver(this, "quit-application", false);
 
     if (options.serverURI) {
       // this is use for xpcshell test.
 
       this._stateChangeProcessEnqueue(_ =>
         this._changeServerURL(options.serverURI, STARTING_SERVICE_EVENT, options));
 
     } else {
       // This is only used for testing. Different tests require connecting to
       // slightly different URLs.
-      prefs.observe("serverURL", this);
-
       this._stateChangeProcessEnqueue(_ =>
         this._changeServerURL(prefs.get("serverURL"), STARTING_SERVICE_EVENT));
     }
   },
 
   _startObservers: function() {
     console.debug("startObservers()");