mirror of
https://github.com/servo/servo.git
synced 2025-06-28 02:53:48 +01:00
Auto merge of #23368 - gterzian:clean_up_navigation, r=asajeffrey
Clean-up navigation <!-- Please describe your changes on the following line: --> 1. Navigation as a result of following a hyperlink should be done in a task: https://html.spec.whatwg.org/multipage/links.html#following-hyperlinks:dom-manipulation-task-source 2. The javascript url navigation should also be done in a task: https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigating-across-documents:dom-manipulation-task-source 3. In `window.load_url`, it seems there is no need to send a message to the script-thread(the entirety of `load_url` should instead be done in a task when appropriate), so we can just do that last part "sync" by calling a method on the script, which will send a message to the constellation(for the parallel navigation steps), or queue task(for the JS navigation), as appropriate. 4. Separate the "normal" navigation flow from the handling of "navigate an iframe" message from constellation, since doing everything in one method as was previously done with `handle_navigate`, is confusing. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #___ (GitHub issue number if applicable) <!-- Either: --> - [ ] 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/23368) <!-- Reviewable:end -->
This commit is contained in:
commit
2dfbbd0ca2
14 changed files with 402 additions and 220 deletions
|
@ -10,6 +10,9 @@
|
|||
<div id="log">FAILED (This TC requires JavaScript enabled)</div>
|
||||
<p><a href="javascript:log('JS URL')"></a></p>
|
||||
<script>log('inline script #1');
|
||||
window.addEventListener("beforeunload", function( event ) {
|
||||
log('beforeunload event');
|
||||
});
|
||||
if(document.links[0].click){
|
||||
document.links[0].click();
|
||||
}else{
|
||||
|
@ -25,13 +28,26 @@
|
|||
log( 'inline script #2' );
|
||||
var t = async_test()
|
||||
|
||||
function test() {
|
||||
function final_test() {
|
||||
// The JS URL part is required to run in an additional task,
|
||||
// altough that is not fully consistently implemented,
|
||||
// see https://github.com/whatwg/html/issues/3730#issuecomment-492071447
|
||||
assert_any(assert_array_equals, eventOrder, [
|
||||
['inline script #1', 'end script #1', 'JS URL', 'inline script #2'],
|
||||
['inline script #1', 'end script #1', 'inline script #2', 'JS URL']]);
|
||||
['inline script #1', 'end script #1', 'beforeunload event', 'inline script #2', 'JS URL'],
|
||||
['inline script #1', 'end script #1', 'inline script #2', 'beforeunload event', 'JS URL']]);
|
||||
t.done();
|
||||
}
|
||||
onload = t.step_func(test)
|
||||
|
||||
function test_on_load() {
|
||||
// When the page loads, a task to run the navigate steps
|
||||
// previously enqueued as part of following-hyperlinks,
|
||||
// should have run, and have enqueued another task to execute the JS URL.
|
||||
assert_any(assert_array_equals, eventOrder, [
|
||||
['inline script #1', 'end script #1', 'beforeunload event', 'inline script #2'],
|
||||
['inline script #1', 'end script #1', 'inline script #2', 'beforeunload event']]);
|
||||
t.step_timeout(final_test, 1000)
|
||||
}
|
||||
onload = t.step_func(test_on_load);
|
||||
</script>
|
||||
|
||||
</body></html>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue