In case the browser settings block the opening of a new popup/tab an error is raised and the onBlock callback is never invoked.
The cause is the creation of the div right after the window creation:
// Open a new window.
this.window = window.open(url, name, toWindowFeatures(features))
this.container = this.window.document.createElement('div')
In case of browser blocking the window opening this.window will be undefined and the second line will fail:
TypeError: Cannot read properties of null (reading 'document')
at NewWindow.openChild (new-window.js:236:32)
at NewWindow.componentDidMount (new-window.js:191:9)
at commitLifeCycles (react-dom.development.js:20664:1)
Also the creation of the div element seems unnecessary since the container property will be set few lines below:
if (this.window) {
this.window.document.title = title;
// Check if the container already exists as the window may have been already open
this.container = this.window.document.getElementById('new-window-container');
In case the browser settings block the opening of a new popup/tab an error is raised and the onBlock callback is never invoked. The cause is the creation of the div right after the window creation:
In case of browser blocking the window opening
this.window
will beundefined
and the second line will fail:Also the creation of the
div
element seems unnecessary since thecontainer
property will be set few lines below: