promise-resolution-order.html relies on src=" " firing error; per the spec it fetches the base URL

Open Beginner friendly
#65,404 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
javascript
Domain
testing

Research direction

Read html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-resolution-order.html and compare its whitespace-only src values with the comment about empty sources. The issue identifies the empty string as the intended value; check the related html/semantics/scripting-1/the-script-element/fetch-src/whitespace-with-base.html test for the spec behavior. Done when the test uses an empty source and reaches t.done().

Written by the indexing model from the issue text.

Description

html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-resolution-order.html inserts two script elements with script.setAttribute('src', ' '). It uses their error events as markers on the DOM manipulation task source, per its comment: "Inserting <script> with an empty source schedules dispatching an 'error' event". The test ends in the second script's error handler.

Three spaces are not an empty src. "Prepare the script element" fires error only when src "is the empty string" (step 3 of its src branch). Any other value is encoding-parsed as a URL. The URL parser strips leading and trailing C0 control or space, so ' ' resolves to the document's base URL. That is the test page itself, which is fetched and run as a classic script. The script fails to parse, so the element gets load, not error, and the test never reaches t.done().

html/semantics/scripting-1/the-script-element/fetch-src/whitespace-with-base.html (d0627f4a50, 2026-11-01) tests exactly this. WebKit changed to that behaviour in 323236@main (https://bugs.webkit.org/show_bug.cgi?id=326654).

wpt.fyi runs aligned at 71b58bb191:

Run promise-resolution-order.html fetch-src/whitespace-with-base.html
Chrome 158.0.8127.36 stable (5091530419994624) PASS FAIL (error fired)
Chrome 160.0.8168.0 experimental (5165587534446592) PASS FAIL (error fired)
Firefox 160.0.1 stable (5102456061820928) TIMEOUT PASS
Firefox 162.0a1 experimental (5188734707040256) TIMEOUT PASS
Safari 27.2 stable (5121161130934272) FAIL (both error events fire; unhandledrejection is missing) FAIL (error fired)
Safari Technology Preview 256 (5096019650674688) TIMEOUT PASS

So the test can pass only in an engine that treats a whitespace-only src as empty, which contradicts the spec and whitespace-with-base.html.

https://wpt.fyi/results/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-resolution-order.html?run_id=5091530419994624&run_id=5102456061820928&run_id=5121161130934272

Suggested fix

Use the empty string, which fires error from the DOM manipulation task source, as the test's comment describes:

script.setAttribute('src', '');
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.