Skip to content

Fix onBlock not being called during a block #121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

lejara
Copy link

@lejara lejara commented Apr 30, 2022

In Firefox,
i noticed the script would crash if the this.window is null on line

this.container = this.window.document.createElement('div')

and this.setState({ mounted: true }) is set regardless.

This pr fixes this issue which allows onBlock to be called.

@@ -102,7 +102,7 @@ class NewWindow extends React.PureComponent {

// Open a new window.
this.window = window.open(url, name, toWindowFeatures(features))
this.container = this.window.document.createElement('div')
this.container = this.window?.document.createElement('div')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -143,6 +143,8 @@ class NewWindow extends React.PureComponent {

// Release anything bound to this component before the new window unload.
this.window.addEventListener('beforeunload', () => this.release())

this.setState({ mounted: true })
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to check why is this needed.

@rmariuzzo rmariuzzo changed the title Fix onBlock not being called during a block Fix onBlock not being called during a block Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants