Skip to content

Fix import() inside setTimeout()/setInterval() strings - #3117

Merged
domenic merged 1 commit into
masterfrom
inherit-some-setTimeout-stuff
Dec 18, 2017
Merged

domenic merged 1 commit into
masterfrom
inherit-some-setTimeout-stuff

Conversation

@domenic

@domenic domenic commented Oct 11, 2017 •

Copy link
Copy Markdown
Member

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 )

@domenic domenic added the topic: script The script element, fetching and running scripts and modules, and settings objects and realms label Oct 11, 2017
domenic added a commit to web-platform-tests/wpt that referenced this pull request Oct 11, 2017
@annevk

annevk commented Oct 22, 2017

Copy link
Copy Markdown
Member

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

domenic commented Oct 27, 2017

Copy link
Copy Markdown
Member Author

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

domenic commented Dec 15, 2017

Copy link
Copy Markdown
Member Author

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

@annevk annevk left a comment

Copy link
Copy Markdown
Member

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.

Comment thread source
<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
Copy Markdown
Member

Choose a reason for hiding this comment

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

return?

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
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

domenic commented Dec 16, 2017

Copy link
Copy Markdown
Member Author

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

@nyaxt

nyaxt commented Dec 18, 2017

Copy link
Copy Markdown
Member

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

Labels

topic: script The script element, fetching and running scripts and modules, and settings objects and realms

Development

Successfully merging this pull request may close these issues.

3 participants