Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upPerformanceResourceTiming: FetchStart #21258
Comments
|
Hey ! Can I take up on this? :D |
|
Sure! Please ask questions if anything is unclear. |
Actually I do have a couple of questions , |
|
I dug into the code a little bit more and I found the Response being returned by http_fetch has a ResourceFetchTiming entry (which in turn has no of redirects , request_start ) , so maybe this is where I get the values to be set from . But I am still unclear about which PerformanceResourceTiming's fetch_start i have to set ? ( Is it something in the cache , or in some other structure ) |
|
Can I implement fetch_start in ResourceFetchTiming? |
|
Hey! How do I know whether the Resource being fetched is the last one in the http_fetch ? Help please @jdm |
|
Sorry about the lack of response; I'll try to answer your questions in reverse order:
A resource being fetched is the last one if there is no redirection. You can see this information being set in substep 2-3 and substep 4.
Yes. They are linked via the PerformanceResourcetiming::from_resource_timing method, which creates a new PerformanceResourceTiming object and initializes it from the members of ResourceFetchTiming. As you seem to have found, the timing data is collected in ResourceFetchTiming objects in the |
But @jdm the specs say "the final resource in the redirection" , if there is no redirection then whats the point of mentioning it. |
I do have 3 questions @jdm |
If there is no location header, the request is the final resource. We will need to store the time before starting the request, then check if there's a location header when the initial response is received; if there is no location header then that we can store the earlier time as the FetchStart value. |
You should not need to write code that creates a PerformanceResourceTiming object. That already happens in this code which is called from every implementor of this trait, which is invoked automatically in this code. |
|
@jdm I think I was over complicating the issue , anyways are there existing tests for fetch_start ? |
|
You can try running |
Added fetch_start functionality <!-- Please describe your changes on the following line: --> Added the fetch_start functionality in http_loader.rs (http_fetch function) --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #21258 (GitHub issue number if applicable) <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22714) <!-- Reviewable:end -->
Added fetch_start functionality <!-- Please describe your changes on the following line: --> Added the fetch_start functionality in http_loader.rs (http_fetch function) --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #21258 (GitHub issue number if applicable) <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22714) <!-- Reviewable:end -->
Added fetch_start functionality <!-- Please describe your changes on the following line: --> Added the fetch_start functionality in http_loader.rs (http_fetch function) --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #21258 (GitHub issue number if applicable) <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22714) <!-- Reviewable:end -->
Added fetch_start functionality <!-- Please describe your changes on the following line: --> Added the fetch_start functionality in http_loader.rs (http_fetch function) --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #21258 (GitHub issue number if applicable) <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22714) <!-- Reviewable:end -->
Added fetch_start functionality <!-- Please describe your changes on the following line: --> Added the fetch_start functionality in http_loader.rs (http_fetch function) --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #21258 (GitHub issue number if applicable) <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22714) <!-- Reviewable:end -->
Added fetch_start functionality <!-- Please describe your changes on the following line: --> Added the fetch_start functionality in http_loader.rs (http_fetch function) --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #21258 (GitHub issue number if applicable) <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22714) <!-- Reviewable:end -->
In components/net/http_loader.rs::http_fetch we need to set fetch_start.
On getting, the fetchStart attribute MUST return as follows:
https://w3c.github.io/resource-timing/#dom-performanceresourcetiming-fetchstart