close_script_defer.html: callback = t.step(...) runs assert_unreached at once, so the test fails in every browser

Open Beginner friendly
#65,405 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
88/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
html, javascript
Domain
testing, web-dev

Research direction

Read html/browsers/the-window-object/open-close/close_script_defer.html and check how it assigns the callback used by callback.js. The issue identifies the failing call and gives the suggested fix; inspect the test setup, then run this test in a browser. Done when it passes and fails only if the deferred callback runs after the window closes.

Written by the indexing model from the issue text.

Description

html/browsers/the-window-object/open-close/close_script_defer.html ends with

callback = t.step(function() {assert_unreached()})

t.step(f) calls f at once; it is not t.step_func. So assert_unreached() runs while the test is being set up and fails the test before w.close() is reached, and callback is left undefined. The callback is meant for callback.js (opener.callback()), the deferred script the test writes into the opened window. That script should never run, because the window is closed first.

Every engine fails the same way, with assert_unreached: Reached unreachable code, 0/1. That holds in all six wpt.fyi runs aligned at 71b58bb191. Stable: Chrome 158.0.8127.36 (run 5091530419994624), Firefox 160.0.1 (5102456061820928), Safari 27.2 (5121161130934272). Experimental: Chrome 160.0.8168.0 (5165587534446592), Firefox 162.0a1 (5188734707040256), Safari Technology Preview 256 (5096019650674688).

https://wpt.fyi/results/html/browsers/the-window-object/open-close/close_script_defer.html?run_id=5091530419994624&run_id=5102456061820928&run_id=5121161130934272

The file's last change was the folder rename 54f157400e (2022-04-12).

Suggested fix

callback = t.step_func(function() { assert_unreached(); });

With this change the test fails only if callback.js runs after window.close().

Dominant language
HTML
Stars
6.3k
Forks
4.1k
Avg merge
17h 20m
Merged PRs (30d)
841

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from web-platform-tests/wpt

All issues in web-platform-tests/wpt

Similar issues

More Testing & QA issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.