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 upAdd microtask checkpoints to script elements and custom elements #25515
Conversation
highfive
commented
Jan 13, 2020
|
Heads up! This PR modifies the following files:
|
|
@bors-servo r+ |
|
|
Add microtask checkpoints to script elements and custom elements Servo had a microtask checkpoint at the end of running a script, but there was also supposed to be one at the end of HTML-parsing a script element before Javascript-parsing the script itself, and there were supposed to be checkpoints immediately after the call to a custom element constructor. This adds those, passing all cases of one WPT test file. --- <!-- 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 #25016 except for the remaining not-really-about-microtasks case #25514 <!-- 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. -->
|
|
This also changes the behaviour of a reftest, interestingly:
|
|
That mozilla blob one happens intermittently for me on this branch; I'll see if it also happens intermittently for me on master. My first guess here is that the screenshot has a chance of being taken before the file is done loading. |
|
It doesn't seem to happen on master. Hypothesis: The new checkpoint that happens when parsing The one thing I know I didn't follow the exact spec for was that the checkpoint is supposed to happen before "Switch the insertion mode to the original insertion mode", but there wasn't a way to do that with the way Servo and html5ever are connected so I hoped it wasn't observable. I need to look at how the document decides whether it's done being loaded; maybe the insertion mode is part of the problem. |
|
Nothing is logged from document, servoparser, or htmlimageelement between entering and exiting the suspicious checkpoint; all the interesting action happens after it. Running it with logs on, in this branch it looks there is a race between "Document got finish_load: Image([blob url])" and "Document got finish_load: PageSource([test url]), and if Image comes first the test fails. Next question I need to look at: in master, do these events always have a strict order (so I need to make sure one waits for the other), or do we pass the test regardless of order (so I need to make something else insensitive to the difference)? |
|
It looks like with my changes, the document is seeing the finish_load for the the image before the image's process_response has been reached (but after the image has had its blob URL assigned). That then means we have a race between when process_response happens and when the screenshot is taken. In master, the finish_load for the image always happens after process_response. These calls all come later in the timeline than my actual code changes, but I can infer that adding a microtask checkpoint breaks some expectation an image had about its lifecycle, and finding that expectation is the next step. |
|
servo/components/script/dom/htmlimageelement.rs Lines 843 to 847 in 85ea8df This seems to be the thing that is firing at the wrong time; moving it out of the task like the comment says, nothing immediately crashes and the one reftest seems to pass consistently. I'm expecting something else to break. |
|
@bors-servo try=wpt |
Add microtask checkpoints to script elements and custom elements Servo had a microtask checkpoint at the end of running a script, but there was also supposed to be one at the end of HTML-parsing a script element before Javascript-parsing the script itself, and there were supposed to be checkpoints immediately after the call to a custom element constructor. This adds those, passing all cases of one WPT test file. --- <!-- 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 #25016 except for the remaining not-really-about-microtasks case #25514 <!-- 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. -->
|
|
|
Just another one of those background-color intermittents and the new MutationObserver passes. I am surprised that change worked so smoothly. |
|
@bors-servo r+ |
|
|
Add microtask checkpoints to script elements and custom elements Servo had a microtask checkpoint at the end of running a script, but there was also supposed to be one at the end of HTML-parsing a script element before Javascript-parsing the script itself, and there were supposed to be checkpoints immediately after the call to a custom element constructor. This adds those, passing all cases of one WPT test file. --- <!-- 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 #25016 except for the remaining not-really-about-microtasks case #25514 <!-- 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 retry |
Add microtask checkpoints to script elements and custom elements Servo had a microtask checkpoint at the end of running a script, but there was also supposed to be one at the end of HTML-parsing a script element before Javascript-parsing the script itself, and there were supposed to be checkpoints immediately after the call to a custom element constructor. This adds those, passing all cases of one WPT test file. --- <!-- 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 #25016 except for the remaining not-really-about-microtasks case #25514 <!-- 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. -->
|
|
pshaughn commentedJan 13, 2020
Servo had a microtask checkpoint at the end of running a script, but there was also supposed to be one at the end of HTML-parsing a script element before Javascript-parsing the script itself, and there were supposed to be checkpoints immediately after the call to a custom element constructor. This adds those, passing all cases of one WPT test file.
./mach build -ddoes not report any errors./mach test-tidydoes not report any errors