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

Resource fetch timing information is stored too late during document navigation #24468

Closed
jdm opened this issue Oct 17, 2019 · 10 comments
Closed

Resource fetch timing information is stored too late during document navigation #24468

jdm opened this issue Oct 17, 2019 · 10 comments

Comments

@jdm
Copy link
Member

@jdm jdm commented Oct 17, 2019

Given the changes in #24466 (or substituting timing() without them), it is easy to get a page to panic by checking navigation.timing before parsing is complete. More specifically, the panic occurs because in this code there is no navigation timing entry that has been reported when a page like this is loaded:

<script>
console.log(performance.timing)
</script>

This occurs because we only register performance entries when a response is complete, rather than when the first bytes are received. I think we need to update all of the resource timing code to submit twice - when the first bytes are received, and then update the existing entry when all of the final timings are available.

We could:

@tomasdivito
Copy link
Contributor

@tomasdivito tomasdivito commented Oct 17, 2019

I'll try to work on this as soon as I can :)
@highfive: assign me

@highfive highfive added the C-assigned label Oct 17, 2019
@highfive
Copy link

@highfive highfive commented Oct 17, 2019

Hey @tomasdivito! Thanks for your interest in working on this issue. It's now assigned to you!

@tomasdivito
Copy link
Contributor

@tomasdivito tomasdivito commented Oct 19, 2019

@jdm I have a couple questions regarding to your suggested solution.

add a ResourceFetchTiming argument to the Result passed in process_response
Not pretty sure what this mean, and what would be the point on doing so...
fn process_response(&mut self, meta_result: Result<FetchMetadata, NetworkError>) you mean something like instead making something like Result<(FetchMetadata, ResourceFetchTiming), NetworkError> which I'm not that sure if it's actually valid and as I said, I don't know how would relate to the other steps...

make Performance::queue_entries return the index of the added performance entry in self.entries
queue_entry() receives the entry itself and the add_to_performance_entries_buffer
Should we return the index of the entry in the buffer when we push this entry:

        if add_to_performance_entries_buffer {
            self.buffer
                .borrow_mut()
                .entries
                .push(DomRoot::from_ref(entry));
        }

because we are also adding it to the observers... maybe it doesn't matter, but if that's the case and we get the index back (adding the return value to be -> usize who would have to carry this index and then pass it somehow to process_response_eof 🤔

Sorry for the amount of questions but I'm not pretty sure how this would work. I get what this would solve but I'm having some doubts and maybe this is a little bit more complicated.

@jdm
Copy link
Member Author

@jdm jdm commented Oct 21, 2019

Good questions! Looking more closely at the code, there is already a timing field inside Metadata, and that's part of the FetchMetadata enum, so we should be able to rely on that in the process_response implementations.

As for the question about queue_entry, since every caller of queue_entry passes true for add_to_performance_entries_buffer, let's remove that argument and always push the entry. Then we will always have an index that we can return at the end of the method.

@tomasdivito
Copy link
Contributor

@tomasdivito tomasdivito commented Oct 29, 2019

Just as an update, I was not able to focus on this because I was too busy with university.

I will work on this saturday and will create a Pull Request for this.

Again sorry! I would love to work on this more but at least until december I have no much free time :(

@jdm
Copy link
Member Author

@jdm jdm commented Oct 29, 2019

Thanks for letting us know!

@tomasdivito
Copy link
Contributor

@tomasdivito tomasdivito commented Nov 11, 2019

@jdm As I had a harder time than I thought with exams, which won't end until the second week of december, I may had to leave this patch be! And maybe the issue and PR from #24466

I'll surely will be back to do these if nobody made it, or find something else! Sorry :(

@jdm jdm removed the C-assigned label Nov 11, 2019
@shnmorimoto
Copy link
Contributor

@shnmorimoto shnmorimoto commented Dec 7, 2019

@highfive: assign me

@highfive
Copy link

@highfive highfive commented Dec 7, 2019

Hey @shnmorimoto! Thanks for your interest in working on this issue. It's now assigned to you!

@highfive highfive added the C-assigned label Dec 7, 2019
shnmorimoto added a commit to shnmorimoto/servo that referenced this issue Dec 7, 2019
shnmorimoto added a commit to shnmorimoto/servo that referenced this issue Dec 7, 2019
shnmorimoto added a commit to shnmorimoto/servo that referenced this issue Dec 7, 2019
shnmorimoto added a commit to shnmorimoto/servo that referenced this issue Dec 7, 2019
shnmorimoto added a commit to shnmorimoto/servo that referenced this issue Dec 7, 2019
shnmorimoto added a commit to shnmorimoto/servo that referenced this issue Dec 7, 2019
shnmorimoto added a commit to shnmorimoto/servo that referenced this issue Dec 7, 2019
shnmorimoto added a commit to shnmorimoto/servo that referenced this issue Dec 7, 2019
@shnmorimoto shnmorimoto mentioned this issue Dec 7, 2019
4 of 4 tasks complete
shnmorimoto added a commit to shnmorimoto/servo that referenced this issue Dec 11, 2019
bors-servo added a commit that referenced this issue Dec 11, 2019
…ember, r=<try>

Fix performance interface timing member

<!-- Please describe your changes on the following line: -->

---
<!-- 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 #23330 and #24468 (GitHub issue number if applicable)

<!-- Either: -->
- [x] There are tests for these changes

<!-- 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. -->
shnmorimoto added a commit to shnmorimoto/servo that referenced this issue Dec 13, 2019
shnmorimoto added a commit to shnmorimoto/servo that referenced this issue Dec 13, 2019
shnmorimoto added a commit to shnmorimoto/servo that referenced this issue Dec 13, 2019
shnmorimoto added a commit to shnmorimoto/servo that referenced this issue Dec 13, 2019
shnmorimoto added a commit to shnmorimoto/servo that referenced this issue Dec 13, 2019
shnmorimoto added a commit to shnmorimoto/servo that referenced this issue Dec 13, 2019
shnmorimoto added a commit to shnmorimoto/servo that referenced this issue Dec 13, 2019
shnmorimoto added a commit to shnmorimoto/servo that referenced this issue Dec 13, 2019
bors-servo added a commit that referenced this issue Dec 13, 2019
…ember, r=<try>

Fix performance interface timing member

<!-- Please describe your changes on the following line: -->

---
<!-- 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 #23330 and #24468 (GitHub issue number if applicable)

<!-- Either: -->
- [x] There are tests for these changes

<!-- 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. -->
jdm added a commit to shnmorimoto/servo that referenced this issue Dec 13, 2019
jdm added a commit to shnmorimoto/servo that referenced this issue Dec 13, 2019
jdm added a commit to shnmorimoto/servo that referenced this issue Dec 13, 2019
jdm added a commit to shnmorimoto/servo that referenced this issue Dec 13, 2019
bors-servo added a commit that referenced this issue Dec 13, 2019
…ember, r=jdm

Fix performance interface timing member

<!-- Please describe your changes on the following line: -->

---
<!-- 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 #23330 and #24468 (GitHub issue number if applicable)

<!-- Either: -->
- [x] There are tests for these changes

<!-- 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. -->
bors-servo added a commit that referenced this issue Dec 13, 2019
…ember, r=jdm

Fix performance interface timing member

<!-- Please describe your changes on the following line: -->

---
<!-- 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 #23330 and #24468 (GitHub issue number if applicable)

<!-- Either: -->
- [x] There are tests for these changes

<!-- 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. -->
bors-servo added a commit that referenced this issue Dec 13, 2019
…ember, r=jdm

Fix performance interface timing member

<!-- Please describe your changes on the following line: -->

---
<!-- 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 #23330 and #24468 (GitHub issue number if applicable)

<!-- Either: -->
- [x] There are tests for these changes

<!-- 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. -->
bors-servo added a commit that referenced this issue Dec 14, 2019
…ember, r=jdm

Fix performance interface timing member

<!-- Please describe your changes on the following line: -->

---
<!-- 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 #23330 and #24468 (GitHub issue number if applicable)

<!-- Either: -->
- [x] There are tests for these changes

<!-- 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. -->
@CYBAI
Copy link
Collaborator

@CYBAI CYBAI commented Dec 14, 2019

Fixed by #25205

@CYBAI CYBAI closed this Dec 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.