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 import() inside setTimeout()/setInterval() strings #3117

Merged
merged 1 commit into from
Dec 18, 2017

Conversation

domenic
Copy link
Member

@domenic domenic commented Oct 11, 2017

This fixes part of #3116, leaving the question of cryptographic nonce
and parser metadata for later. For these two, the only impact is on
dynamic import() inside such strings.

Tests: web-platform-tests/wpt#7684

@nyaxt to review


/timers-and-user-prompts.html ( diff )

@annevk
Copy link
Member

annevk commented Oct 22, 2017

When you get the active script here, can you be sure it's not null? Might be nice to add an assert.

@domenic domenic added the do not merge yet Pull request must not be merged per rationale in comment label Oct 27, 2017
@domenic domenic force-pushed the inherit-some-setTimeout-stuff branch from b77b7f6 to 63669d2 Compare October 27, 2017 19:31
@domenic
Copy link
Member Author

domenic commented Oct 27, 2017

I actually cannot guarantee that. This is basically tc39/ecma262#871 all over again, arg. Let me think harder...

domenic added a commit that referenced this pull request Oct 27, 2017
Fixes tc39/ecma262#871, given that we have our
own version of EnqueueJob. Important for #3117.
domenic added a commit that referenced this pull request Oct 27, 2017
Fixes tc39/ecma262#871, given that we have our
own version of EnqueueJob. Important for #3117.
domenic added a commit that referenced this pull request Oct 27, 2017
"Fixes" tc39/ecma262#871, at least for HTML,
given that we have our own version of EnqueueJob. Important for #3117.
domenic added a commit that referenced this pull request Nov 17, 2017
"Fixes" tc39/ecma262#871, at least for HTML,
given that we have our own version of EnqueueJob. Important for #3117.
domenic added a commit that referenced this pull request Nov 17, 2017
"Fixes" tc39/ecma262#871, at least for HTML,
given that we have our own version of EnqueueJob. Important for #3117.
domenic added a commit that referenced this pull request Nov 17, 2017
"Fixes" tc39/ecma262#871, at least for HTML,
given that we have our own version of EnqueueJob. Important for #3117.
@domenic domenic force-pushed the inherit-some-setTimeout-stuff branch 2 times, most recently from 81d77cf to eb9f6f5 Compare December 15, 2017 20:13
@domenic
Copy link
Member Author

domenic commented Dec 15, 2017

This is ready for re-review. Working on tests now.

@domenic domenic changed the title Make setTimeout(string) scripts inherit base URL and credentials mode Fix import() inside setTimeout()/setInterval() strings Dec 15, 2017
@domenic domenic added needs tests Moving the issue forward requires someone to write tests and removed do not merge yet Pull request must not be merged per rationale in comment labels Dec 15, 2017
Closes #3116. Before this change, the "new script"-ness of setTimeout()
and setInterval()'s string compilation was making any import() calls
inside the compiled source behave unexpectedly. After this, they behave
like eval().
@domenic domenic force-pushed the inherit-some-setTimeout-stuff branch from eb9f6f5 to 5f001ce Compare December 15, 2017 22:32
domenic added a commit to web-platform-tests/wpt that referenced this pull request Dec 15, 2017
Follows whatwg/html#3117. Parser state is implicitly tested because lots of tests would otherwise fail.

Referrer policy tests omitted for now since you can only set that via modulepreload at the moment.
@domenic domenic removed the needs tests Moving the issue forward requires someone to write tests label Dec 15, 2017
Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

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

I assume there are tests for the base URL thing? That it does indeed come from that script and not some settings object? Because I thought that the base URL always came from a settings object, but I might not have paid enough attention to all the settings object changes.

<var>calleeRealm</var>). If this throws an exception, catch it, and <span>report the
exception</span>.</p></li>
<var>calleeRealm</var>). If this throws an exception, catch it, <span>report the
exception</span>, and abort these steps.</p></li>
Copy link
Member

Choose a reason for hiding this comment

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

return?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is inside a set of substeps that run in parallel.

Copy link
Member

Choose a reason for hiding this comment

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

How can you report an exception from there?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry, they run inside a task that is enqueued from in parallel. See https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timer-initialisation-steps for the actual context.

Copy link
Member

Choose a reason for hiding this comment

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

In that case return seems fine, since it's a synchronous algorithm, but okay either way.

@domenic
Copy link
Member Author

domenic commented Dec 16, 2017

Yeah, the -base-url tests in web-platform-tests/wpt#7684 test what you're referring to.

@nyaxt
Copy link
Member

nyaxt commented Dec 18, 2017

lgtm

@domenic domenic merged commit 12cdfef into master Dec 18, 2017
@domenic domenic deleted the inherit-some-setTimeout-stuff branch December 18, 2017 06:08
annevk pushed a commit to web-platform-tests/wpt that referenced this pull request Dec 18, 2017
Follows whatwg/html#3117. Parser state is implicitly tested because lots of tests would otherwise fail.

Referrer policy tests omitted for now since you can only set that via modulepreload at the moment.
alice pushed a commit to alice/html that referenced this pull request Jan 8, 2019
"Fixes" tc39/ecma262#871, at least for HTML,
given that we have our own version of EnqueueJob. Important for whatwg#3117.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants