Issue 1133238 in chromium: initiating script is not plumbed around setTimeout(), resulting in wrong base URL, credentials mode, nonce etc. in dynamic import
6 views
Skip to first unread message
hiroshige via monorail
unread,
Aug 2, 2021, 12:07:39 AM8/2/21
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
[WPT] Distinguish Document base URL, Document URL, and inline script base URL in dynamic-import
This exposes Chromium bugs:
- The base URL of dynamic imports from event handlers is Document URL while it should be Document base URL (crbug.com/1235202) - The base URL of dynamic imports from setTimeout is Document base URL while it should be initiating script's base URL (crbug.com/1133238)
Fix base URL of dynamic imports for no referencing scripts
Before this CL, the following three types of dynamic import cases were all encoded to 0-length V8HostDefinedOptions and thus decoded to default-constructed `ReferrerScriptInfo()`:
1. From no referencing scripts (e.g. event handlers) 2. From referencing scripts with default base URL and default ScriptFetchOptions (e.g. normal classic scripts) 3. From referencing scripts with null base URL and default ScriptFetchOptions (e.g. setTimeout())
This CL introduces ReferrerScriptInfo::CreateNoReferencingScript() (for 1) and ReferrerScriptInfo::CreateWithReferencingScript() (for 2 and 3) to clarifies this semantics.
This CL fixes the behavior for Case 1: Previously the base URL fell back v8::ScriptOrModule::GetResourceName(), but after this CL the base URL falls back to the ExecutionContext's base URL, which is spec conformant.
This CL preserves the behavior for 3: The base URL is the ExecutionContext's base URL. This CL adds fallback to the ExecutionContext's base URL even when there is a referencing script in DynamicModuleResolver::ResolveDynamically(), which is not in the spec. In the future, we might refactor this condition after Issue 1133238 is fixed and setTimeout() is moved to Case 2.
Revert "Fix base URL of dynamic imports for no referencing scripts"
This reverts commit 8a7275c6166e81b5285855afcbb85b38f219bca0.
Reason for revert: The original CL caused a regression crbug.com/1244145 by exposing underlying Issue v8:10284 (https://bugs.chromium.org/p/v8/issues/detail?id=10284). Given that the fixes for Issue v8:10284 won't be merged to M-94, the original CL is reverted and the revert will be merged to M-94 instead to at least prevent regressions.