From e7b359a9229f6063e9dfbfb6ef574e5ed1b2f10c Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Thu, 15 Dec 2011 00:15:38 +0000 Subject: [PATCH] Bug 705808 - TestPilot first-run tab shouldn't open for Thunderbird. r=Standard8,ui-review=bwinton --- .../content/window-utils.js | 17 +++++------- .../modules/interface.js | 27 ++++++++++--------- .../modules/setup.js | 17 +++++++++++- 3 files changed, 37 insertions(+), 24 deletions(-) diff --git a/mail/app/profile/extensions/tbtestpilot@labs.mozilla.com/content/window-utils.js b/mail/app/profile/extensions/tbtestpilot@labs.mozilla.com/content/window-utils.js index db08b5a993..de951a3ed1 100644 --- a/mail/app/profile/extensions/tbtestpilot@labs.mozilla.com/content/window-utils.js +++ b/mail/app/profile/extensions/tbtestpilot@labs.mozilla.com/content/window-utils.js @@ -44,12 +44,6 @@ var TestPilotWindowUtils; const THUNDERBIRD_APP_ID = "{3550f703-e582-4d05-9a08-453d09bdfdc6}"; TestPilotWindowUtils = { - get _appID() { - delete this._appID; - return this._appID = Components.classes["@mozilla.org/xre/app-info;1"] - .getService(Components.interfaces.nsIXULAppInfo).ID; - }, - openAllStudiesWindow: function() { // If the window is not already open, open it; but if it is open, // focus it instead. @@ -68,14 +62,16 @@ var TestPilotWindowUtils; }, openAllStudies: function() { - if (this._appID == FENNEC_APP_ID) { // Fennec only + Components.utils.import("resource://testpilot/modules/setup.js"); + if (TestPilotSetup._appID == FENNEC_APP_ID) { // Fennec only // BrowserUI.newTab will focus on the content area of the new tab BrowserUI.newTab("chrome://testpilot/content/all-studies.html", Browser.selectedTab); } }, openInTab: function(url) { - if (this._appID == FENNEC_APP_ID) { + Components.utils.import("resource://testpilot/modules/setup.js"); + if (TestPilotSetup._appID == FENNEC_APP_ID) { // see if url already open in a tab: let browserList = Browser.browsers; for (let i = 0; i < browserList.length; i++) { @@ -88,7 +84,7 @@ var TestPilotWindowUtils; // if not, open it: Browser.addTab(url, true); // true means bring it to front } - else if (this._appID == THUNDERBIRD_APP_ID) { + else if (TestPilotSetup._appID == THUNDERBIRD_APP_ID) { openContentTab(url); } else { @@ -126,7 +122,8 @@ var TestPilotWindowUtils; }, getCurrentTabUrl: function() { - if (this._appID == THUNDERBIRD_APP_ID) { + Components.utils.import("resource://testpilot/modules/setup.js"); + if (TestPilotSetup._appID == THUNDERBIRD_APP_ID) { return null; // TODO: not sure what to do here } else { diff --git a/mail/app/profile/extensions/tbtestpilot@labs.mozilla.com/modules/interface.js b/mail/app/profile/extensions/tbtestpilot@labs.mozilla.com/modules/interface.js index fcf15fa313..be6066638a 100644 --- a/mail/app/profile/extensions/tbtestpilot@labs.mozilla.com/modules/interface.js +++ b/mail/app/profile/extensions/tbtestpilot@labs.mozilla.com/modules/interface.js @@ -79,12 +79,6 @@ var TestPilotUIBuilder = { .getService(Ci.nsIXULAppInfo).version; }, - get _appID() { - delete this._appID; - return this._appID = Cc["@mozilla.org/xre/app-info;1"] - .getService(Ci.nsIXULAppInfo).ID; - }, - buildTestPilotInterface: function(window) { // Don't need Feedback button: remove it let feedbackButton = window.document.getElementById("feedback-menu-button"); @@ -114,8 +108,10 @@ var TestPilotUIBuilder = { * again (don't want to put it back in after user explicitly takes it out- * bug 577243 )*/ + Cu.import("resource://testpilot/modules/setup.js"); + let mainToolbar; - if (this._appID == THUNDERBIRD_APP_ID) + if (TestPilotSetup._appID == THUNDERBIRD_APP_ID) mainToolbar = window.document.getElementById("mail-bar3"); else mainToolbar = window.document.getElementById("nav-bar"); @@ -144,7 +140,7 @@ var TestPilotUIBuilder = { this._prefDefaultBranch.setIntPref(POPUP_CHECK_INTERVAL, 600000); // Change the happy/sad labels if necessary - if (this._appID == THUNDERBIRD_APP_ID) { + if (TestPilotSetup._appID == THUNDERBIRD_APP_ID) { let happy = window.document.getElementById("feedback-menu-happy-button"); let sad = window.document.getElementById("feedback-menu-sad-button"); happy.setAttribute("label", happy.getAttribute("thunderbirdLabel")); @@ -164,7 +160,9 @@ var TestPilotUIBuilder = { hasDoorhangerNotifications: function() { // Thunderbird doesn't use the add-on bar (it uses the plain old status // bar), and so the doorhanger UI doesn't quite work. - if (this._appID == THUNDERBIRD_APP_ID) + Cu.import("resource://testpilot/modules/setup.js"); + + if (TestPilotSetup._appID == THUNDERBIRD_APP_ID) return false; try { @@ -178,10 +176,12 @@ var TestPilotUIBuilder = { buildCorrectInterface: function(window) { /* Apply no overlay to Fennec: */ - if (this._appID == FENNEC_APP_ID) { + Cu.import("resource://testpilot/modules/setup.js"); + + if (TestPilotSetup._appID == FENNEC_APP_ID) { return; } - else if (this._appID == THUNDERBIRD_APP_ID) { + else if (TestPilotSetup._appID == THUNDERBIRD_APP_ID) { // TODO: do something special here, probably } else { @@ -221,9 +221,10 @@ var TestPilotUIBuilder = { let ntfnModule = {}; Cu.import("resource://testpilot/modules/notifications.js", ntfnModule); Components.utils.import("resource://gre/modules/Services.jsm"); + Cu.import("resource://testpilot/modules/setup.js"); - Services.console.logStringMessage("appID is " + this._appID); - if (this._appID == FENNEC_APP_ID) { + Services.console.logStringMessage("appID is " + TestPilotSetup._appID); + if (TestPilotSetup._appID == FENNEC_APP_ID) { Services.console.logStringMessage("making Android Notfn Manager.."); return new ntfnModule.AndroidNotificationManager(); } diff --git a/mail/app/profile/extensions/tbtestpilot@labs.mozilla.com/modules/setup.js b/mail/app/profile/extensions/tbtestpilot@labs.mozilla.com/modules/setup.js index 2f6ca81882..e6bda8d35e 100644 --- a/mail/app/profile/extensions/tbtestpilot@labs.mozilla.com/modules/setup.js +++ b/mail/app/profile/extensions/tbtestpilot@labs.mozilla.com/modules/setup.js @@ -59,6 +59,8 @@ const UPDATE_CHANNEL_PREF = "app.update.channel"; const LOG_FILE_NAME = "TestPilotErrorLog.log"; const RANDOM_DEPLOY_PREFIX = "extensions.testpilot.deploymentRandomizer"; +const THUNDERBIRD_APP_ID = "{3550f703-e582-4d05-9a08-453d09bdfdc6}"; + Cu.import("resource://testpilot/modules/interface.js"); let TestPilotSetup = { @@ -181,6 +183,12 @@ let TestPilotSetup = { return this.__notifier; }, + get _appID() { + delete this._appID; + return this._appID = Components.classes["@mozilla.org/xre/app-info;1"] + .getService(Components.interfaces.nsIXULAppInfo).ID; + }, + globalStartup: function TPS__doGlobalSetup() { // Only ever run this stuff ONCE, on the first window restore. // Should get called by the Test Pilot component. @@ -227,7 +235,8 @@ let TestPilotSetup = { /* Show first run page (in front window) only the first time after install; * Don't show first run page in Feedback UI version. */ if (!self._prefs.prefHasUserValue(VERSION_PREF) && - (!TestPilotUIBuilder.channelUsesFeedback())) { + (!TestPilotUIBuilder.channelUsesFeedback()) + && self._shouldOpenTabs()) { self._prefs.setCharPref(VERSION_PREF, self.version); let browser = self._getFrontBrowserWindow().getBrowser(); let url = self._prefs.getCharPref(FIRST_RUN_PREF); @@ -637,6 +646,12 @@ let TestPilotSetup = { return true; }, + _shouldOpenTabs: function TPS__shouldOpenTabs() { + // For Thunderbird, we don't want the Test Pilot tab spawning, since + // we're bundling Test Pilot in the release. + return !(this._appID == THUNDERBIRD_APP_ID); + }, + checkForTasks: function TPS_checkForTasks(callback) { let logger = this._logger; if (! this._remoteExperimentLoader ) {