From 0815d10d2ed8395b043e0334f5cb92f16be6daa0 Mon Sep 17 00:00:00 2001 From: Ryan Duffy Date: Mon, 18 Mar 2024 09:50:39 -0700 Subject: [PATCH 1/3] Fix opening two signin windows from WebChannel connection --- devtools/server/actors/replay/auth.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/devtools/server/actors/replay/auth.js b/devtools/server/actors/replay/auth.js index 4ce42d5aeb412..5f26c318ea4df 100644 --- a/devtools/server/actors/replay/auth.js +++ b/devtools/server/actors/replay/auth.js @@ -233,11 +233,15 @@ function initializeRecordingWebChannel() { ); const localUrl = "http://localhost:8080/"; + const replayio = /^https:\/\/.+.replay.io$/; + const previewBranches = /^https:\/\/.+-recordreplay.vercel.app$/; // custom subdomains - registerWebChannel(/^https:\/\/.+.replay.io$/); + registerWebChannel(replayio); // preview branches - registerWebChannel(/^https:\/\/.+-recordreplay.vercel.app$/); - registerWebChannel(pageUrl); + registerWebChannel(previewBranches); + if (!replayio.test(pageUrl) && !previewBranches.test(pageUrl)) { + registerWebChannel(pageUrl); + } registerWebChannel(localUrl); function registerWebChannel(url) { From c7e8e4855f404fa0cf3d9bf6fa20f47d3d26c7e9 Mon Sep 17 00:00:00 2001 From: Ryan Duffy Date: Mon, 18 Mar 2024 10:17:05 -0700 Subject: [PATCH 2/3] logs --- devtools/server/actors/replay/auth.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/devtools/server/actors/replay/auth.js b/devtools/server/actors/replay/auth.js index 5f26c318ea4df..c9e41e046c6f6 100644 --- a/devtools/server/actors/replay/auth.js +++ b/devtools/server/actors/replay/auth.js @@ -240,11 +240,13 @@ function initializeRecordingWebChannel() { // preview branches registerWebChannel(previewBranches); if (!replayio.test(pageUrl) && !previewBranches.test(pageUrl)) { + console.log(pageUrl, replayio, previewBranches); registerWebChannel(pageUrl); } registerWebChannel(localUrl); function registerWebChannel(url) { + console.log("Registering WebChannel for", url); const urlForWebChannel = url instanceof RegExp ? url : Services.io.newURI(url); const channel = new WebChannel("record-replay-token", urlForWebChannel); From 055106fcfc99bbe3681f79ee26678c711933ea8b Mon Sep 17 00:00:00 2001 From: Ryan Duffy Date: Mon, 18 Mar 2024 10:54:37 -0700 Subject: [PATCH 3/3] handle trailing slash --- devtools/server/actors/replay/auth.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devtools/server/actors/replay/auth.js b/devtools/server/actors/replay/auth.js index c9e41e046c6f6..9bec753815c82 100644 --- a/devtools/server/actors/replay/auth.js +++ b/devtools/server/actors/replay/auth.js @@ -233,8 +233,8 @@ function initializeRecordingWebChannel() { ); const localUrl = "http://localhost:8080/"; - const replayio = /^https:\/\/.+.replay.io$/; - const previewBranches = /^https:\/\/.+-recordreplay.vercel.app$/; + const replayio = /^https:\/\/.+.replay.io\/?$/; + const previewBranches = /^https:\/\/.+-recordreplay.vercel.app\/?$/; // custom subdomains registerWebChannel(replayio); // preview branches