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

Fix unloading, active BC, and clearing js runtime #24789

Merged
merged 1 commit into from Nov 22, 2019

Conversation

@gterzian
Copy link
Member

gterzian commented Nov 20, 2019

Do not set the window to be the currently active one for the windowproxy as part of load, as it will be done later when the document activity is set. And doing it later means that when unload runs, it is with the unloaded pipeline as the active window.

Only nullify the window proxy if it's not used by another (currently-active) window.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #24591 (GitHub issue number if applicable)
  • There are tests for these changes OR
  • These changes do not require tests because ___
@highfive
Copy link

highfive commented Nov 20, 2019

Heads up! This PR modifies the following files:

  • @asajeffrey: components/script/script_thread.rs, components/script/dom/window.rs, components/constellation/constellation.rs
  • @cbrewster: components/constellation/constellation.rs
  • @KiChjang: components/script/script_thread.rs, components/script/dom/window.rs, components/script_traits/lib.rs
@highfive
Copy link

highfive commented Nov 20, 2019

warning Warning warning

  • These commits modify script code, but no tests are modified. Please consider adding a test!
@gterzian
Copy link
Member Author

gterzian commented Nov 20, 2019

@bors-servo try=wpt

@bors-servo
Copy link
Contributor

bors-servo commented Nov 20, 2019

Trying commit c7c76b8 with merge acec9ef...

bors-servo added a commit that referenced this pull request Nov 20, 2019
fix unloading, active BC, and clearing js runtime

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

Move the unload steps of the currently active doc to the beginning of the "load" for the new document.

Only nullify the window proxy if it's not used by another window.

---
<!-- 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 #24591 (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. -->
@gterzian gterzian force-pushed the gterzian:fix_unloading branch from c7c76b8 to 3be6a0d Nov 20, 2019
@paulrouget
Copy link
Contributor

paulrouget commented Nov 20, 2019

Will the document unload when the window is closed? For example, are we supposed to get an unload event when the glutin window is closed?

Also - this indeed fixes #24591 :)

@gterzian
Copy link
Member Author

gterzian commented Nov 20, 2019

{
    "status": "PASS", 
    "group": "default", 
    "message": null, 
    "stack": null, 
    "subtest": "document.open bailout should not have any side effects (ignore-opens-during-unload is greater than 0 during unload event)", 
    "test": "/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/bailout-side-effects-ignore-opens-during-unload.window.html", 
    "line": 121939, 
    "action": "test_result", 
    "expected": "FAIL"
}
{
    "status": "PASS", 
    "group": "default", 
    "message": null, 
    "stack": null, 
    "subtest": "document.open bailout should not have any side effects (ignore-opens-during-unload is greater than 0 during pagehide event)", 
    "test": "/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/bailout-side-effects-ignore-opens-during-unload.window.html", 
    "line": 121941, 
    "action": "test_result", 
    "expected": "FAIL"
}
{
    "status": "TIMEOUT", 
    "group": "default", 
    "message": "Test timed out", 
    "stack": null, 
    "subtest": "Traversing the history, unload event is fired on doucment", 
    "test": "/html/browsers/history/the-history-interface/traverse_the_history_unload_1.html", 
    "line": 172030, 
    "action": "test_result", 
    "expected": "PASS"
}
{
    "status": "TIMEOUT", 
    "group": "default", 
    "message": null, 
    "stack": null, 
    "subtest": null, 
    "test": "/html/browsers/history/the-history-interface/traverse_the_history_unload_1.html", 
    "line": 172031, 
    "action": "test_result", 
    "expected": "OK"
}
{
    "status": "OK", 
    "group": "default", 
    "message": null, 
    "stack": null, 
    "subtest": null, 
    "test": "/html/semantics/scripting-1/the-script-element/execution-timing/083.html", 
    "line": 194814, 
    "action": "test_result", 
    "expected": "ERROR"
}
{
    "status": "TIMEOUT", 
    "group": "default", 
    "message": "Test timed out", 
    "stack": null, 
    "subtest": "history.forward() with session history", 
    "test": "/html/browsers/history/the-history-interface/history_go_undefined.html", 
    "line": 200279, 
    "action": "test_result", 
    "expected": "FAIL"
}
{
    "status": "TIMEOUT", 
    "group": "default", 
    "message": null, 
    "stack": null, 
    "subtest": null, 
    "test": "/html/browsers/history/the-history-interface/history_go_undefined.html", 
    "line": 200280, 
    "action": "test_result", 
    "expected": "OK"
}
{
    "status": "TIMEOUT", 
    "group": "default", 
    "message": "Test timed out", 
    "stack": null, 
    "subtest": "history.back() with session history", 
    "test": "/html/browsers/history/the-history-interface/history_back_1.html", 
    "line": 316729, 
    "action": "test_result", 
    "expected": "PASS"
}
{
    "status": "TIMEOUT", 
    "group": "default", 
    "message": null, 
    "stack": null, 
    "subtest": null, 
    "test": "/html/browsers/history/the-history-interface/history_back_1.html", 
    "line": 316730, 
    "action": "test_result", 
    "expected": "OK"
} 

Yeah I think the problem is not all unload happens via a corresponding load of a new doc, so we still need the message from the constellation. Trying out with basically a boolean on whether the doc has unloaded already, to ignore further unload calls, because I think it will be hard to unify the unload flow in one go.

@gterzian
Copy link
Member Author

gterzian commented Nov 20, 2019

@bors-servo try=wpt

@bors-servo
Copy link
Contributor

bors-servo commented Nov 20, 2019

Trying commit f8c79ca with merge 9e8d581...

bors-servo added a commit that referenced this pull request Nov 20, 2019
fix unloading, active BC, and clearing js runtime

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

Move the unload steps of the currently active doc to the beginning of the "load" for the new document.

Only nullify the window proxy if it's not used by another window.

---
<!-- 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 #24591 (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. -->
@bors-servo
Copy link
Contributor

bors-servo commented Nov 20, 2019

💔 Test failed - status-taskcluster

@gterzian
Copy link
Member Author

gterzian commented Nov 20, 2019

Ok so the unloading happens now "earlier", and this breaks something about the history flow. To be investigated.

@gterzian gterzian force-pushed the gterzian:fix_unloading branch from f8c79ca to eca9c8d Nov 21, 2019
@gterzian gterzian force-pushed the gterzian:fix_unloading branch from eca9c8d to fb2d2fa Nov 21, 2019
@gterzian
Copy link
Member Author

gterzian commented Nov 21, 2019

@bors-servo try=wpt

@bors-servo
Copy link
Contributor

bors-servo commented Nov 21, 2019

Trying commit fb2d2fa with merge 29d4f7d...

bors-servo added a commit that referenced this pull request Nov 21, 2019
fix unloading, active BC, and clearing js runtime

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

Move the unload steps of the currently active doc to the beginning of the "load" for the new document.

Only nullify the window proxy if it's not used by another window.

---
<!-- 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 #24591 (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. -->
@gterzian gterzian changed the title fix unloading, active BC, and clearing js runtime Fix unloading, active BC, and clearing js runtime Nov 21, 2019
@bors-servo
Copy link
Contributor

bors-servo commented Nov 21, 2019

💔 Test failed - status-taskcluster

@gterzian
Copy link
Member Author

gterzian commented Nov 21, 2019

I think the taskcluster results include intermittents, is there are way to know which ones are "real" failures?

@jdm
Copy link
Member

jdm commented Nov 21, 2019

Look at filtered-wpt-errorsummary.log under Artifacts.

@gterzian
Copy link
Member Author

gterzian commented Nov 21, 2019

thanks, here is filtered-wpt-errorsummary.log as well as the crash log

{
    "status": "OK", 
    "group": "default", 
    "message": null, 
    "stack": null, 
    "subtest": null, 
    "test": "/html/semantics/scripting-1/the-script-element/execution-timing/083.html", 
    "line": 33327, 
    "action": "test_result", 
    "expected": "ERROR"
}
{
    "status": "CRASH", 
    "group": "default", 
    "message": null, 
    "stack": null, 
    "subtest": null, 
    "test": "/webvr/webvr-enabled-on-self-origin-by-feature-policy.https.sub.html", 
    "line": 68600, 
    "action": "test_result", 
    "expected": "OK"
}

▶ CRASH [expected OK] /webvr/webvr-enabled-on-self-origin-by-feature-policy.https.sub.html
  │ 
  │ 
  │ 
  │ 
  │ Layout thread disconnected.: "SendError(..)" (thread ScriptThread PipelineId { namespace_id: PipelineNamespaceId(1), index: PipelineIndex(1) }, at src/libcore/result.rs:1187)
  │ stack backtrace:
  │    0: servo::main::{{closure}}
  │    1: std::panicking::rust_panic_with_hook
  │              at src/libstd/panicking.rs:468
  │    2: std::panicking::continue_panic_fmt
  │              at src/libstd/panicking.rs:373
  │    3: rust_begin_unwind
  │              at src/libstd/panicking.rs:302
  │    4: core::panicking::panic_fmt
  │              at src/libcore/panicking.rs:82
  │    5: core::result::unwrap_failed
  │              at src/libcore/result.rs:1187
  │    6: script::dom::window::Window::force_reflow
  │    7: script::dom::window::Window::reflow
  │    8: script::dom::document::Document::finish_load
  │    9: script::dom::servoparser::ServoParser::do_parse_sync
  │   10: profile_traits::time::profile
  │   11: _ZN6script3dom11servoparser11ServoParser10parse_sync17hccbe7f353bb0c19dE.llvm.4139705411756622029
  │   12: <script::dom::servoparser::ParserContext as net_traits::FetchResponseListener>::process_response_eof
  │   13: script::script_thread::ScriptThread::handle_msg_from_constellation
  │   14: _ZN6script13script_thread12ScriptThread11handle_msgs17h702aaab883c81f98E.llvm.13163992065417716
  │   15: script::script_thread::ScriptThread::start
  │   16: profile_traits::mem::ProfilerChan::run_with_memory_reporting
  │   17: std::sys_common::backtrace::__rust_begin_short_backtrace

@jdm
Copy link
Member

jdm commented Nov 21, 2019

That crash is one that I would usually associated with #22955.

@bors-servo
Copy link
Contributor

bors-servo commented Nov 21, 2019

Testing commit fb2d2fa with merge 7367d9d...

bors-servo added a commit that referenced this pull request Nov 21, 2019
Fix unloading, active BC, and clearing js runtime

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

Do not set the window to be the currently active one for the windowproxy as part of `load`, as it will be done later when the document activity is set. And doing it later means that when unload runs, it is with the unloaded pipeline as the active window.

Only nullify the window proxy if it's not used by another (currently-active) window.

---
<!-- 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 #24591 (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. -->
@bors-servo
Copy link
Contributor

bors-servo commented Nov 21, 2019

💔 Test failed - status-taskcluster

@CYBAI
Copy link
Collaborator

CYBAI commented Nov 22, 2019

{
    "status": "OK", 
    "group": "default", 
    "message": null, 
    "stack": null, 
    "subtest": null, 
    "test": "/html/semantics/scripting-1/the-script-element/execution-timing/083.html", 
    "line": 35742, 
    "action": "test_result", 
    "expected": "ERROR"
}

I've updated the test expectations for the unexpected OK.

@gterzian Maybe you want to mark this one as OK 👀?

Other failures are #24795 and #22276.

@gterzian gterzian force-pushed the gterzian:fix_unloading branch from fb2d2fa to a21c0bf Nov 22, 2019
@gterzian
Copy link
Member Author

gterzian commented Nov 22, 2019

Yep sorry I forgot to push the change with the updated expectation.

@bors-servo r=jdm

@bors-servo
Copy link
Contributor

bors-servo commented Nov 22, 2019

📌 Commit a21c0bf has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented Nov 22, 2019

Testing commit a21c0bf with merge 67e8086...

bors-servo added a commit that referenced this pull request Nov 22, 2019
Fix unloading, active BC, and clearing js runtime

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

Do not set the window to be the currently active one for the windowproxy as part of `load`, as it will be done later when the document activity is set. And doing it later means that when unload runs, it is with the unloaded pipeline as the active window.

Only nullify the window proxy if it's not used by another (currently-active) window.

---
<!-- 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 #24591 (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. -->
@bors-servo
Copy link
Contributor

bors-servo commented Nov 22, 2019

💔 Test failed - status-taskcluster

@jdm
Copy link
Member

jdm commented Nov 22, 2019

@bors-servo
Copy link
Contributor

bors-servo commented Nov 22, 2019

💣 Failed to start rebuilding: 405 Not Allowed

@bors-servo
Copy link
Contributor

bors-servo commented Nov 22, 2019

Testing commit a21c0bf with merge c060f00...

bors-servo added a commit that referenced this pull request Nov 22, 2019
Fix unloading, active BC, and clearing js runtime

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

Do not set the window to be the currently active one for the windowproxy as part of `load`, as it will be done later when the document activity is set. And doing it later means that when unload runs, it is with the unloaded pipeline as the active window.

Only nullify the window proxy if it's not used by another (currently-active) window.

---
<!-- 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 #24591 (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. -->
@bors-servo
Copy link
Contributor

bors-servo commented Nov 22, 2019

☀️ Test successful - linux-rel-css, linux-rel-wpt, status-taskcluster
Approved by: jdm
Pushing c060f00 to master...

@bors-servo bors-servo merged commit a21c0bf into servo:master Nov 22, 2019
2 checks passed
2 checks passed
Community-TC (pull_request) TaskGroup: success
Details
homu Test successful
Details
@gterzian gterzian deleted the gterzian:fix_unloading branch Nov 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

7 participants
You can’t perform that action at this time.