Skip to content

Commit 90370e5

Browse files
committed
Avoid sending a message back for 'is-ready' with the same name if windows are the same
1 parent e6fcbfb commit 90370e5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/actions/receive-profile.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -1715,7 +1715,13 @@ export function retrieveProfileForRawUrl(
17151715
'Responding via postMessage that the profiler is ready.'
17161716
);
17171717
const otherWindow = event.source ?? window;
1718-
otherWindow.postMessage({ name: 'is-ready' }, '*');
1718+
if (otherWindow === window) {
1719+
// Avoid sending a message with the same name as it will create
1720+
// an infinite loop within this event listener.
1721+
otherWindow.postMessage({ name: 'ready' }, '*');
1722+
} else {
1723+
otherWindow.postMessage({ name: 'is-ready' }, '*');
1724+
}
17191725
break;
17201726
}
17211727
default:

0 commit comments

Comments
 (0)