Created
September 3, 2020 03:00
-
-
Save jasonLaster/5b27bfc22ed3158305ec6dca9fa0fa62 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/devtools/startup/DevToolsStartup.jsm b/devtools/startup/DevToolsStartup.jsm | |
| index 01fceea4165e..c5e37c65a86c 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,37 @@ 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() { | |
| + const pageUrl = "http://localhost:3000"; // Services.prefs.getStringPref(urlPref) | |
| + | |
| + console.log(`>> register recording`, pageUrl); | |
| + | |
| + if (channel) { | |
| + channel.stopListening(); | |
| + } | |
| + | |
| + const urlForWebChannel = Services.io.newURI(pageUrl); | |
| + channel = new WebChannel("record-replay", urlForWebChannel); | |
| + console.log(`>> new channel`, pageUrl); | |
| + | |
| + 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment