Bug 822017 - Remove the global PB specific code from the testpilot extension; r=dao
authorEhsan Akhgari <ehsan@mozilla.com>
Fri, 04 Jan 2013 13:09:11 -0500
changeset 126752 041b62d88da9b15609b31fbb2566eee57a6539d2
parent 126751 79b2064c1a9909f33dd547ab56835fd79cfe343d
child 126753 88b4a62179970ee5ceecf53cb624870c530d9caf
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao
bugs822017
milestone20.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 822017 - Remove the global PB specific code from the testpilot extension; r=dao
browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/setup.js
browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/setup.js.in
browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/tasks.js
browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/tasks.js.in
rename from browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/setup.js
rename to browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/setup.js.in
--- a/browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/setup.js
+++ b/browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/setup.js.in
@@ -167,18 +167,20 @@ let TestPilotSetup = {
 
     // Set up observation for task state changes
     var self = this;
     this._obs.add("testpilot:task:changed", this.onTaskStatusChanged, self);
     this._obs.add(
       "testpilot:task:dataAutoSubmitted", this._onTaskDataAutoSubmitted, self);
     // Set up observation for application shutdown.
     this._obs.add("quit-application", this.globalShutdown, self);
+#ifndef MOZ_PER_WINDOW_PRIVATE_BROWSING
     // Set up observation for enter/exit private browsing:
     this._obs.add("private-browsing", this.onPrivateBrowsingMode, self);
+#endif
 
     // Set up timers to remind user x minutes after startup
     // and once per day thereafter.  Use nsITimer so it doesn't belong to
     // any one window.
     logger.trace("Setting interval for showing reminders...");
 
     this._shortTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
     this._shortTimer.initWithCallback(
@@ -238,39 +240,43 @@ let TestPilotSetup = {
       self.taskList[i].onExperimentShutdown();
     }
     this.taskList = [];
     this._loader.unload();
     this._obs.remove("testpilot:task:changed", this.onTaskStatusChanged, self);
     this._obs.remove(
       "testpilot:task:dataAutoSubmitted", this._onTaskDataAutoSubmitted, self);
     this._obs.remove("quit-application", this.globalShutdown, self);
+#ifndef MOZ_PER_WINDOW_PRIVATE_BROWSING
     this._obs.remove("private-browsing", this.onPrivateBrowsingMode, self);
+#endif
     this._loader.unload();
     this._shortTimer.cancel();
     this._longTimer.cancel();
     logger.trace("Done unregistering everything.");
   },
 
   _getFrontBrowserWindow: function TPS__getFrontWindow() {
     let wm = Cc["@mozilla.org/appshell/window-mediator;1"].
                getService(Ci.nsIWindowMediator);
     // TODO Is "most recent" the same as "front"?
     return wm.getMostRecentWindow("navigator:browser");
   },
 
+#ifndef MOZ_PER_WINDOW_PRIVATE_BROWSING
   onPrivateBrowsingMode: function TPS_onPrivateBrowsingMode(topic, data) {
     for (let i = 0; i < this.taskList.length; i++) {
       if (data == "enter") {
         this.taskList[i].onEnterPrivateBrowsing();
       } else if (data == "exit") {
         this.taskList[i].onExitPrivateBrowsing();
       }
     }
   },
+#endif
 
   onWindowUnload: function TPS__onWindowRegistered(window) {
     this._logger.trace("Called TestPilotSetup.onWindow unload!");
     for (let i = 0; i < this.taskList.length; i++) {
       this.taskList[i].onWindowClosed(window);
     }
   },
 
rename from browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/tasks.js
rename to browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/tasks.js.in
--- a/browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/tasks.js
+++ b/browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/tasks.js.in
@@ -157,21 +157,23 @@ var TestPilotTask = {
   onAppStartup: function TestPilotTask_onAppStartup() {
     // Called by extension core when Firefox startup is complete.
   },
 
   onAppShutdown: function TestPilotTask_onAppShutdown() {
     // Called by extension core when Firefox is shutting down.
   },
 
+#ifndef MOZ_PER_WINDOW_PRIVATE_BROWSING
   onEnterPrivateBrowsing: function TestPilotTask_onEnterPrivate() {
   },
 
   onExitPrivateBrowsing: function TestPilotTask_onExitPrivate() {
   },
+#endif
 
   onNewWindow: function TestPilotTask_onNewWindow(window) {
   },
 
   onWindowClosed: function TestPilotTask_onWindowClosed(window) {
   },
 
   onUrlLoad: function TestPilotTask_onUrlLoad(url) {
@@ -527,16 +529,17 @@ TestPilotExperiment.prototype = {
       try {
         this._handlers.doExperimentCleanup();
       } catch(e) {
         this._dataStore.logException("doExperimentCleanup: " + e);
       }
     }
   },
 
+#ifndef MOZ_PER_WINDOW_PRIVATE_BROWSING
   onEnterPrivateBrowsing: function TestPilotExperiment_onEnterPrivate() {
     this._logger.trace("Task is entering private browsing.");
     if (this.experimentIsRunning()) {
       try {
         this._handlers.onEnterPrivateBrowsing();
       } catch(e) {
         this._dataStore.logException("onEnterPrivateBrowsing: " + e);
       }
@@ -548,16 +551,17 @@ TestPilotExperiment.prototype = {
     if (this.experimentIsRunning()) {
       try {
         this._handlers.onExitPrivateBrowsing();
       } catch(e) {
         this._dataStore.logException("onExitPrivateBrowsing: " + e);
       }
     }
   },
+#endif
 
   getStudyMetadata: function TestPilotExperiment_getStudyMetadata() {
     try {
       if (this._handlers.getStudyMetadata) {
         let metadata = this._handlers.getStudyMetadata();
         if (metadata.length) {
           // getStudyMetadata must return an array, otherwise it is invalid.
           return metadata;