Description
When using the React Developer Tools extension (v6.1.2) together with a popup-opening library (e.g. react-oauth-popup), I consistently get a SecurityError: Failed to read a named property '[react.memo_cache_sentinel]' from 'Window' in the console once the popup closes. This error originates from the DevTools hook (installHook.js) and seems to interfere with normal React lifecycle (e.g. passive effects) in development.
React version: 18.3.0
Library involved:
react-oauth-popup v2.x (or any code that opens a popup via window.open without noopener)
Steps To Reproduce
Create a React component that renders a button inside (or manually calls window.open for OAuth).
Install and enable React Developer Tools (Chrome extension).
Click the button to open the popup and then close it (either via onClose callback or user closing the window).
Observe console for multiple SecurityError: Failed to read a named property '[react.memo_cache_sentinel]' from 'Window'.
Minimal reproduction
import React from 'react';
import OAuthPopup from 'react-oauth-popup';
export default function App() {
return (
<OAuthPopup
url="https://example.com/oauth"
onCode={(code) => console.log(code)}
onClose={() => console.log('closed')}
title="OAuth"
width={600}
height={600}
>
<button>Open OAuth Popup</button>
</OAuthPopup>
);
}
The current behavior
On popup close, React Developer Tools extension (hook) attempts to read internal React fields from the popup or main window.
This triggers a SecurityError logged in the console:
SecurityError: Failed to read a named property '[react.memo_cache_sentinel]' from 'Window': An attempt was made to break through the security policy of the user agent.
React then throws Error: Should not already be working. in the callstack, disrupting normal component updates in development.
The expected behavior
The DevTools hook should gracefully handle the absence of window.opener or blocked frame access and not throw a SecurityError.
Closing a popup opened by React-based libraries should not cause React internals to crash or log errors in development.