Skip to content

Instantly share code, notes, and snippets.

@jasonLaster
Created September 3, 2020 02:32
Show Gist options
  • Select an option

  • Save jasonLaster/02ebfa3784f54679dff5cfc9f9b91acf to your computer and use it in GitHub Desktop.

Select an option

Save jasonLaster/02ebfa3784f54679dff5cfc9f9b91acf to your computer and use it in GitHub Desktop.
diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js
index 2c1a547dce87..9e0f0b38a36c 100644
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -221,7 +221,7 @@ pref("browser.defaultbrowser.notificationbar", false);
// 0 = blank, 1 = home (browser.startup.homepage), 2 = last visited page, 3 = resume previous browser session
// The behavior of option 3 is detailed at: http://wiki.mozilla.org/Session_Restore
pref("browser.startup.page", 1);
-pref("browser.startup.homepage", "http://google.com");
+pref("browser.startup.homepage", "http://localhost:3000");
pref("browser.startup.homepage.abouthome_cache.enabled", false);
// Whether we should skip the homepage when opening the first-run page
diff --git a/devtools/startup/DevToolsStartup.jsm b/devtools/startup/DevToolsStartup.jsm
index 01fceea4165e..8eba45c697ca 100644
--- a/devtools/startup/DevToolsStartup.jsm
+++ b/devtools/startup/DevToolsStartup.jsm
@@ -620,6 +620,7 @@ DevToolsStartup.prototype = {
return;
}
this.recordingButtonCreated = true;
+ this.initializeRecordingWebChannel();
createRecordingButton();
},
@@ -698,6 +699,40 @@ DevToolsStartup.prototype = {
}
},
+ initializeRecordingWebChannel() {
+ let channel;
+ console.log(`>> initializeRecordingWebChannel`);
+
+ // Register a channel for the URL in preferences. Also update the WebChannel if
+ // the URL changes.
+ const urlPref = "devtools.recordreplay.ui-base-url";
+ Services.prefs.addObserver(urlPref, registerWebChannel);
+ registerWebChannel();
+
+ function registerWebChannel() {
+ console.log(
+ `>> register recording`,
+ Services.prefs.getStringPref(urlPref)
+ );
+
+ if (channel) {
+ channel.stopListening();
+ }
+
+ const urlForWebChannel = Services.io.newURI(
+ Services.prefs.getStringPref(urlPref)
+ );
+
+ channel = new WebChannel("record-replay", urlForWebChannel);
+
+ channel.listen((id, message, target) => {
+ // Defer loading the ProfilerPopupBackground script until it's absolutely needed,
+ // as this code path gets loaded at startup.
+ console.log(`>>>> blowza`, { id, message });
+ dump(`>>> blowze ${id} ${JSON.stringify(message)}\n\n`);
+ });
+ }
+ },
/*
* We listen to the "Web Developer" system menu, which is under "Tools" main item.
* This menu item is hardcoded empty in Firefox UI. We listen for its opening to
diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js
index 62fbce38f258..bbdf854de6c2 100644
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -843,6 +843,7 @@ pref("devtools.recordreplay.cloudServer", "wss://dispatch.replay.io");
// Whether to upload source maps and original sources to the cloud server.
pref("devtools.recordreplay.uploadSourceMaps", true);
+pref("devtools.recordreplay.ui-base-url", "http://localhost:3000")
// Preferences for the new performance panel.
// This pref configures the base URL for the profiler.firefox.com instance to
diff --git a/toolkit/actors/WebChannelParent.jsm b/toolkit/actors/WebChannelParent.jsm
index 7fdeeaf4909e..e2815b63871d 100644
--- a/toolkit/actors/WebChannelParent.jsm
+++ b/toolkit/actors/WebChannelParent.jsm
@@ -14,6 +14,7 @@ const ERRNO_NO_SUCH_CHANNEL = 2;
class WebChannelParent extends JSWindowActorParent {
receiveMessage(msg) {
+ dump(`>>> WebChannelParent::receiveMessage \n`);
let data = msg.data.contentData;
let sendingContext = {
browsingContext: this.browsingContext,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment