| Commit-Queue | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
This looks reasonable to me, but I'm not a loading/modules expert. I'm chatting with Nate in a few min, I'll see if he has enough context to review.
// <script type="module">import "leaf.js";</script>I gather from the test that `<script type="module" src="leaf.js"</script>` has the same behavior (the document will be the initiator), which is good. Will that -- and should that -- always hold? I _think_ it works during initial page load because `GetIsolateIfRunningScript()` will be false. Is that also the case if dynamically inserting <script> via JavaScript?
<script type="module" src="/resource-timing/resources/module-script-importer-module-static.js"></script>Maybe it would make sense to break this up into separate tests? There's a lot going on and I'm having a hard time following each thread. I think this is testing four separate things?
1. module-script-importer-module-static.js (its importer and what it imports)
2. module-script-imported.js?label=document-static-import (its and what it imports)
3. module-script-importer-classic.js (just what it imports)
4. module-script-worker.js (worker imports)
I know these are all related, but I think separating them out would probably help readability.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
This looks resonable to me % Scott's question about how we're getting the initiatory for `<script type="module" src="leaf.js"</script>`.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Update: I am working on the improvement on the comments and splitting the tests (maybe add a few more cases).
For `<script type="module" src="leaf.js"</script>.` it's actually "resource statically included by html", (even though it's marked by `type='module`). It's loaded when the parser processes the html. It then falls into the "document" branch at the end.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
// <script type="module">import "leaf.js";</script>I gather from the test that `<script type="module" src="leaf.js"</script>` has the same behavior (the document will be the initiator), which is good. Will that -- and should that -- always hold? I _think_ it works during initial page load because `GetIsolateIfRunningScript()` will be false. Is that also the case if dynamically inserting <script> via JavaScript?
The comments here were lacking and I updated them -- I hope they now cover sufficiently. I also added a test case. (dynamically "adding" script)
<script type="module" src="/resource-timing/resources/module-script-importer-module-static.js"></script>Maybe it would make sense to break this up into separate tests? There's a lot going on and I'm having a hard time following each thread. I think this is testing four separate things?
1. module-script-importer-module-static.js (its importer and what it imports)
2. module-script-imported.js?label=document-static-import (its and what it imports)
3. module-script-importer-classic.js (just what it imports)
4. module-script-worker.js (worker imports)
I know these are all related, but I think separating them out would probably help readability.
Yeap that's too much in a test. I now broke it into 4:
1) document
2) dynamic importer
3) static importer
4) worker
I think the labels were too long, and I managed to shorten them a bit.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Sorry for the lag. Appreciate the test and comment cleanup! One more question on behavior.
document.head.appendChild(script);What would happen if this happened inside of a `setTimeout()` inside of a `<script src=somethingelse.js>`? Would it fallback to the `document_->Url()` case, or would it use the task attribution info?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
// <script type="module">import "leaf.js";</script>Guohui DengI gather from the test that `<script type="module" src="leaf.js"</script>` has the same behavior (the document will be the initiator), which is good. Will that -- and should that -- always hold? I _think_ it works during initial page load because `GetIsolateIfRunningScript()` will be false. Is that also the case if dynamically inserting <script> via JavaScript?
The comments here were lacking and I updated them -- I hope they now cover sufficiently. I also added a test case. (dynamically "adding" script)
Seems this one is resolved.
document.head.appendChild(script);What would happen if this happened inside of a `setTimeout()` inside of a `<script src=somethingelse.js>`? Would it fallback to the `document_->Url()` case, or would it use the task attribution info?
Since it's the Javascript that requests the resource, it uses task attribution to find out the "initiator", regardless of whether the initiator is document or not. The "ResourceTimingContext" points the initaitor to the html file.
The same is true with `(initiator_info.is_imported_module && !initiator_info.referrer.empty())` branch -- as long as it's statical imported modular script, the branch catches it.
The exception is the CSS `referer` -- it catches resource referred by "CSS files", not "CSS code" that could be in the html. All the statically included resources in html are caught by "document fall back" branch -- they are fetched when the parser of the html file is working.
BTW I added a test case that covers the situation you asked about.
<script type="module" src="/resource-timing/resources/module-script-importer-module-static.js"></script>Guohui DengMaybe it would make sense to break this up into separate tests? There's a lot going on and I'm having a hard time following each thread. I think this is testing four separate things?
1. module-script-importer-module-static.js (its importer and what it imports)
2. module-script-imported.js?label=document-static-import (its and what it imports)
3. module-script-importer-classic.js (just what it imports)
4. module-script-worker.js (worker imports)
I know these are all related, but I think separating them out would probably help readability.
Yeap that's too much in a test. I now broke it into 4:
1) document
2) dynamic importer
3) static importer
4) workerI think the labels were too long, and I managed to shorten them a bit.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
document.head.appendChild(script);Guohui DengWhat would happen if this happened inside of a `setTimeout()` inside of a `<script src=somethingelse.js>`? Would it fallback to the `document_->Url()` case, or would it use the task attribution info?
Since it's the Javascript that requests the resource, it uses task attribution to find out the "initiator", regardless of whether the initiator is document or not. The "ResourceTimingContext" points the initaitor to the html file.
The same is true with `(initiator_info.is_imported_module && !initiator_info.referrer.empty())` branch -- as long as it's statical imported modular script, the branch catches it.
The exception is the CSS `referer` -- it catches resource referred by "CSS files", not "CSS code" that could be in the html. All the statically included resources in html are caught by "document fall back" branch -- they are fetched when the parser of the html file is working.
BTW I added a test case that covers the situation you asked about.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Exportable changes to web-platform-tests were detected in this CL and a pull request in the upstream repo has been made: https://github.com/web-platform-tests/wpt/pull/61897.
When this CL lands, the bot will automatically merge the PR on GitHub if the required GitHub checks pass; otherwise, ecosystem-infra@ team will triage the failures and may contact you.
WPT Export docs:
https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_platform_tests.md#Automatic-export-process
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Enable InitiatorUrl for ResourceTiming on modular scripts
Worker scripts are not covered and will be addressed in a follow-up CL.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
The WPT PR for this CL has been merged upstream! https://github.com/web-platform-tests/wpt/pull/61897
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |