Skip to content
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

fix(extras): avoid to check frames in global import #1973

Closed
wants to merge 2 commits into from
Closed

fix(extras): avoid to check frames in global import #1973

wants to merge 2 commits into from

Conversation

kduret
Copy link
Contributor

@kduret kduret commented Jul 24, 2019

Avoid to check frames when comparing properties

eg: routing from a page with iframe to a new page which import global.
Then, the iframe is unmounted during import and "global" value is not the same between noteGlobalProps and getGlobalProp.

Copy link
Member

@guybedford guybedford left a comment

Choose a reason for hiding this comment

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

Excellent, thank you for the PR. Adding exclusions was always a given on this code path.

src/extras/global.js Outdated Show resolved Hide resolved
it has the same behavior

Co-Authored-By: Guy Bedford <guybedford@gmail.com>
@kduret
Copy link
Contributor Author

kduret commented Jul 25, 2019

Thanks for review !
Indeed, it is worth to check global.length :)

@@ -29,7 +30,8 @@ function noteGlobalProps () {
// but this may be faster (pending benchmarks)
firstGlobalProp = secondGlobalProp = undefined;
for (let p in global) {
if (!global.hasOwnProperty(p))
// do not check frames cause it could be removed during import
if (!global.hasOwnProperty(p) || (!isNaN(p) && p < global.frames.length))
Copy link
Member

Choose a reason for hiding this comment

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

Should we change this one as well?

@guybedford
Copy link
Member

Sorry for the delayed response - that sounds good to me. Will definitely merge this for the next release then!

@guybedford
Copy link
Member

Merged manually in 9da282e.

@guybedford guybedford closed this Jul 31, 2019
@guybedford
Copy link
Member

Released in 4.1.1.

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