Bug 1480593 - Allow setting a different instance of perf.html for the new performance panel, using a pref r=gregtatum
authorJulien Wajsberg <felash@gmail.com>
Thu, 18 Oct 2018 20:06:57 +0000
changeset 442167 c05cdb233b60f923e667a9a6729e14e4a2dbbda0
parent 442166 776414145c58b27c8135d102d71263164f1d329f
child 442168 f0ff2d5a07933131a84ac880193fc43c2e7245be
push id34890
push userdvarga@mozilla.com
push dateSat, 20 Oct 2018 09:40:11 +0000
treeherdermozilla-central@d0f1450799b5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgregtatum
bugs1480593
milestone64.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 1480593 - Allow setting a different instance of perf.html for the new performance panel, using a pref r=gregtatum Differential Revision: https://phabricator.services.mozilla.com/D8869
devtools/client/performance-new/browser.js
devtools/client/preferences/devtools-client.js
--- a/devtools/client/performance-new/browser.js
+++ b/devtools/client/performance-new/browser.js
@@ -2,16 +2,18 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 "use strict";
 const Services = require("Services");
 
 const TRANSFER_EVENT = "devtools:perf-html-transfer-profile";
 const SYMBOL_TABLE_REQUEST_EVENT = "devtools:perf-html-request-symbol-table";
 const SYMBOL_TABLE_RESPONSE_EVENT = "devtools:perf-html-reply-symbol-table";
+const UI_BASE_URL_PREF = "devtools.performance.recording.ui-base-url";
+const UI_BASE_URL_DEFAULT = "https://perf-html.io";
 
 /**
  * This file contains all of the privileged browser-specific functionality. This helps
  * keep a clear separation between the privileged and non-privileged client code. It
  * is also helpful in being able to mock out browser behavior for tests, without
  * worrying about polluting the browser environment.
  */
 
@@ -32,17 +34,18 @@ function receiveProfile(profile, getSymb
   // of hosts.
   const win = Services.wm.getMostRecentWindow("navigator:browser");
   if (!win) {
     throw new Error("No browser window");
   }
   const browser = win.gBrowser;
   Services.focus.activeWindow = win;
 
-  const tab = browser.addWebTab("https://perf-html.io/from-addon", {
+  const baseUrl = Services.prefs.getStringPref(UI_BASE_URL_PREF, UI_BASE_URL_DEFAULT);
+  const tab = browser.addWebTab(`${baseUrl}/from-addon`, {
     triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({
       userContextId: browser.contentPrincipal.userContextId,
     }),
   });
   browser.selectedTab = tab;
   const mm = tab.linkedBrowser.messageManager;
   mm.loadFrameScript(
     "chrome://devtools/content/performance-new/frame-script.js",
--- a/devtools/client/preferences/devtools-client.js
+++ b/devtools/client/preferences/devtools-client.js
@@ -135,16 +135,23 @@ pref("devtools.performance.ui.enable-mem
 
 // Enable experimental options in the UI only in Nightly
 #if defined(NIGHTLY_BUILD)
 pref("devtools.performance.ui.experimental", true);
 #else
 pref("devtools.performance.ui.experimental", false);
 #endif
 
+// Preferences for the new performance panel
+// This pref configures the base URL for the perf.html instance to use. This is
+// useful so that a developer can change it while working on perf.html, or in
+// tests.
+// This isn't exposed directly to the user.
+pref("devtools.performance.recording.ui-base-url", "https://perf-html.io");
+
 // The default cache UI setting
 pref("devtools.cache.disabled", false);
 
 // The default service workers UI setting
 pref("devtools.serviceWorkers.testing.enabled", false);
 
 // Enable the Network Monitor
 pref("devtools.netmonitor.enabled", true);