Skip to content

Determine the initial state for fragment parsing using the scripting flag of the context element#37704

Merged
simonwuelker merged 3 commits intoservo:mainfrom
simonwuelker:fragment-scripting
Jun 26, 2025
Merged

Determine the initial state for fragment parsing using the scripting flag of the context element#37704
simonwuelker merged 3 commits intoservo:mainfrom
simonwuelker:fragment-scripting

Conversation

@simonwuelker
Copy link
Contributor

@simonwuelker simonwuelker commented Jun 25, 2025

When parsing a html fragment, the initial parser state depends on whether or not scripting is enabled. So far we've used the scripting flag of the parser, but that is wrong - the parser's scripting flag is always false, because the fragment document has no browsing context. Instead we should use the scripting flag of the context element.

Testing: A new web platform test passes

…f context node

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
@simonwuelker simonwuelker added the T-linux-wpt Do a try run of the WPT label Jun 26, 2025
@github-actions github-actions bot removed the T-linux-wpt Do a try run of the WPT label Jun 26, 2025
@github-actions
Copy link

🔨 Triggering try run (#15906723754) for Linux (WPT)

@github-actions
Copy link

Test results for linux-wpt from try job (#15906723754):

Flaky unexpected result (19)
  • OK /_mozilla/mozilla/task_queue_throttling.any.html (#22519)
    • FAIL [expected PASS] subtest: Throttling the performance timeline task queue.

      assert_true: expected true got false
      

  • OK /_webgl/conformance/textures/misc/texture-upload-size.html (#21770)
    • FAIL [expected PASS] subtest: WebGL test #53

      assert_true: Texture was smaller than the expected size 2x2 expected true got false
      

    • FAIL [expected PASS] subtest: WebGL test #55

      assert_true: getError expected: INVALID_VALUE. Was NO_ERROR : when calling texSubImage2D with the same texture upload with offset 1, 1 expected true got false
      

    • FAIL [expected PASS] subtest: WebGL test #57

      assert_true: Texture was smaller than the expected size 2x2 expected true got false
      

    • FAIL [expected PASS] subtest: WebGL test #59

      assert_true: getError expected: INVALID_VALUE. Was NO_ERROR : when calling texSubImage2D with the same texture upload with offset 1, 1 expected true got false
      

    • PASS [expected FAIL] subtest: WebGL test #61
    • PASS [expected FAIL] subtest: WebGL test #63
    • PASS [expected FAIL] subtest: WebGL test #65
    • PASS [expected FAIL] subtest: WebGL test #67
  • TIMEOUT [expected OK] /_webgl/conformance/uniforms/out-of-bounds-uniform-array-access.html (#26225)
    • NOTRUN [expected PASS] subtest: Overall test
  • OK /css/css-align/blocks/align-content-block-002.html (#37361)
    • PASS [expected FAIL] subtest: .test 1: start
    • PASS [expected FAIL] subtest: .test 4: baseline
    • PASS [expected FAIL] subtest: .test 6: flex-start
    • PASS [expected FAIL] subtest: .test 8: unsafe start
    • PASS [expected FAIL] subtest: .test 11: safe start
    • PASS [expected FAIL] subtest: .test 15: space-between
    • PASS [expected FAIL] subtest: .test 17: normal
  • OK /css/css-fonts/generic-family-keywords-001.html (#37467)
    • PASS [expected FAIL] subtest: @font-face matching for quoted and unquoted generic(nastaliq)
  • OK /css/css-fonts/variations/at-font-face-font-matching.html (#20684)
    • FAIL [expected PASS] subtest: Matching font-weight: '430' should prefer '501 550' over '502 560'

      assert_equals: Unexpected font on test element expected 487 but got 532
      

  • TIMEOUT [expected ERROR] /fetch/fetch-later/quota/cross-origin-iframe/max-payload.tentative.https.window.html
  • OK [expected ERROR] /fetch/fetch-later/quota/same-origin-iframe/empty-payload.tentative.https.window.html (#35176)
  • OK /html/browsers/browsing-the-web/navigating-across-documents/008.html (#24456)
    • PASS [expected FAIL] subtest: Link with onclick form submit to javascript url and href navigation
  • OK /html/browsers/history/the-history-interface/traverse_the_history_4.html (#21383)
    • PASS [expected FAIL] subtest: Multiple history traversals, last would be aborted
  • TIMEOUT [expected OK] /html/browsers/history/the-location-interface/assign-with-nested-iframe.html
    • TIMEOUT [expected PASS] subtest: Browser sends Referer header when location.assign is called in iframe document on another nested iframe element

      Test timed out
      

  • OK /html/browsers/windows/browsing-context-names/duplicate-name-order.html (#34623)
    • PASS [expected FAIL] subtest: Duplicate name lookup order
  • FAIL [expected PASS] /html/canvas/element/manual/text/canvas.2d.disconnected.html (#30063)
  • OK /html/semantics/embedded-content/the-iframe-element/iframe-loading-lazy-nav-location-assign.html (#32863)
    • FAIL [expected PASS] subtest: Navigating iframe loading='lazy' before it is loaded: location.assign

      uncaught exception: Error: assert_equals: expected "http://web-platform.test:8000/html/semantics/embedded-content/the-iframe-element/support/blank.htm?nav" but got "http://web-platform.test:8000/html/semantics/embedded-content/the-iframe-element/support/blank.htm?src"
      

  • CRASH [expected TIMEOUT] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-1.html (#24066)
  • OK /html/semantics/embedded-content/the-video-element/intrinsic_sizes.htm (#37173)
    • FAIL [expected PASS] subtest: default object size after src is removed

      assert_equals: expected "300px" but got "320px"
      

  • TIMEOUT [expected OK] /html/semantics/forms/form-submission-0/reparent-form-during-planned-navigation-task.html (#29724)
    • TIMEOUT [expected PASS] subtest: reparent-form-during-planned-navigation-task

      Test timed out
      

  • TIMEOUT /preload/preload-resource-match.https.html
    • TIMEOUT [expected FAIL] subtest: Loading script (use-credentials) with link (no-cors) should discard the preloaded response

      Test timed out
      

    • NOTRUN [expected TIMEOUT] subtest: Loading script (use-credentials) with link (anonymous) should discard the preloaded response
  • OK [expected TIMEOUT] /webmessaging/with-ports/017.html (#24486)
    • PASS [expected TIMEOUT] subtest: origin of the script that invoked the method, about:blank
Stable unexpected results that are known to be intermittent (24)
  • TIMEOUT /FileAPI/url/url-in-tags-revoke.window.html (#19978)
    • PASS [expected TIMEOUT] subtest: Fetching a blob URL immediately before revoking it works in &lt;script&gt; tags.
  • FAIL [expected PASS] /_mozilla/css/iframe/hide_and_show.html (#15265)
  • FAIL [expected PASS] /_mozilla/mozilla/sslfail.html (#10760)
  • OK /css/css-align/blocks/align-content-block-003.html (#37360)
    • FAIL [expected PASS] subtest: .test 1: start

      assert_equals: 
      &lt;div class="test" style="align-content: start" title="start"&gt;
          &lt;div class="in-flow" data-offset-y="35"&gt;&lt;/div&gt;
          &lt;div class="in-flow"&gt;
            &lt;span class="label"&gt;START&lt;/span&gt;
            &lt;span class="abspos" data-offset-y="20"&gt;ABS&lt;/span&gt;
            &lt;span class="relpos" data-offset-y="20"&gt;REL&lt;/span&gt;
            &lt;div class="overflow"&gt;OVERFLOW&lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      offsetTop expected 20 but got 19
      

    • FAIL [expected PASS] subtest: .test 2: center

      assert_equals: 
      &lt;div class="test" style="align-content: center" title="center"&gt;
          &lt;div class="in-flow" data-offset-y="35"&gt;&lt;/div&gt;
          &lt;div class="in-flow"&gt;
            &lt;span class="label"&gt;CENTER&lt;/span&gt;
            &lt;span class="abspos" data-offset-y="20"&gt;ABS&lt;/span&gt;
            &lt;span class="relpos" data-offset-y="20"&gt;REL&lt;/span&gt;
            &lt;div class="overflow"&gt;OVERFLOW&lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      offsetTop expected 20 but got 19
      

    • FAIL [expected PASS] subtest: .test 3: end

      assert_equals: 
      &lt;div class="test" style="align-content: end" title="end"&gt;
          &lt;div class="in-flow" data-offset-y="35"&gt;&lt;/div&gt;
          &lt;div class="in-flow"&gt;
            &lt;span class="label"&gt;END&lt;/span&gt;
            &lt;span class="abspos" data-offset-y="20"&gt;ABS&lt;/span&gt;
            &lt;span class="relpos" data-offset-y="20"&gt;REL&lt;/span&gt;
            &lt;div class="overflow"&gt;OVERFLOW&lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      offsetTop expected 20 but got 19
      

    • FAIL [expected PASS] subtest: .test 4: baseline

      assert_equals: 
      &lt;div class="test" style="align-content: baseline" title="baseline"&gt;
          &lt;div class="in-flow" data-offset-y="35"&gt;&lt;/div&gt;
          &lt;div class="in-flow"&gt;
            &lt;span class="label"&gt;BASELINE&lt;/span&gt;
            &lt;span class="abspos" data-offset-y="20"&gt;ABS&lt;/span&gt;
            &lt;span class="relpos" data-offset-y="20"&gt;REL&lt;/span&gt;
            &lt;div class="overflow"&gt;OVERFLOW&lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      offsetTop expected 20 but got 19
      

    • FAIL [expected PASS] subtest: .test 5: last baseline

      assert_equals: 
      &lt;div class="test" style="align-content: last baseline" title="last baseline"&gt;
          &lt;div class="in-flow" data-offset-y="35"&gt;&lt;/div&gt;
          &lt;div class="in-flow"&gt;
            &lt;span class="label"&gt;LAST BASELINE&lt;/span&gt;
            &lt;span class="abspos" data-offset-y="20"&gt;ABS&lt;/span&gt;
            &lt;span class="relpos" data-offset-y="20"&gt;REL&lt;/span&gt;
            &lt;div class="overflow"&gt;OVERFLOW&lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      offsetTop expected 20 but got 19
      

    • FAIL [expected PASS] subtest: .test 6: flex-start

      assert_equals: 
      &lt;div class="test" style="align-content: flex-start" title="flex-start"&gt;
          &lt;div class="in-flow" data-offset-y="35"&gt;&lt;/div&gt;
          &lt;div class="in-flow"&gt;
            &lt;span class="label"&gt;FLEX-START&lt;/span&gt;
            &lt;span class="abspos" data-offset-y="20"&gt;ABS&lt;/span&gt;
            &lt;span class="relpos" data-offset-y="20"&gt;REL&lt;/span&gt;
            &lt;div class="overflow"&gt;OVERFLOW&lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      offsetTop expected 20 but got 19
      

    • FAIL [expected PASS] subtest: .test 7: flex-end

      assert_equals: 
      &lt;div class="test" style="align-content: flex-end" title="flex-end"&gt;
          &lt;div class="in-flow" data-offset-y="35"&gt;&lt;/div&gt;
          &lt;div class="in-flow"&gt;
            &lt;span class="label"&gt;FLEX-END&lt;/span&gt;
            &lt;span class="abspos" data-offset-y="20"&gt;ABS&lt;/span&gt;
            &lt;span class="relpos" data-offset-y="20"&gt;REL&lt;/span&gt;
            &lt;div class="overflow"&gt;OVERFLOW&lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      offsetTop expected 20 but got 19
      

    • FAIL [expected PASS] subtest: .test 8: unsafe start

      assert_equals: 
      &lt;div class="test" style="align-content: unsafe start" title="unsafe start"&gt;
          &lt;div class="in-flow" data-offset-y="35"&gt;&lt;/div&gt;
          &lt;div class="in-flow"&gt;
            &lt;span class="label"&gt;UNSAFE START&lt;/span&gt;
            &lt;span class="abspos" data-offset-y="20"&gt;ABS&lt;/span&gt;
            &lt;span class="relpos" data-offset-y="20"&gt;REL&lt;/span&gt;
            &lt;div class="overflow"&gt;OVERFLOW&lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      offsetTop expected 20 but got 19
      

    • FAIL [expected PASS] subtest: .test 11: safe start

      assert_equals: 
      &lt;div class="test" style="align-content: safe start" title="safe start"&gt;
          &lt;div class="in-flow" data-offset-y="35"&gt;&lt;/div&gt;
          &lt;div class="in-flow"&gt;
            &lt;span class="label"&gt;SAFE START&lt;/span&gt;
            &lt;span class="abspos" data-offset-y="20"&gt;ABS&lt;/span&gt;
            &lt;span class="relpos" data-offset-y="20"&gt;REL&lt;/span&gt;
            &lt;div class="overflow"&gt;OVERFLOW&lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      offsetTop expected 20 but got 19
      

    • FAIL [expected PASS] subtest: .test 12: safe center

      assert_equals: 
      &lt;div class="test" style="align-content: safe center" title="safe center"&gt;
          &lt;div class="in-flow" data-offset-y="35"&gt;&lt;/div&gt;
          &lt;div class="in-flow"&gt;
            &lt;span class="label"&gt;SAFE CENTER&lt;/span&gt;
            &lt;span class="abspos" data-offset-y="20"&gt;ABS&lt;/span&gt;
            &lt;span class="relpos" data-offset-y="20"&gt;REL&lt;/span&gt;
            &lt;div class="overflow"&gt;OVERFLOW&lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      offsetTop expected 20 but got 19
      

    • And 5 more unexpected results...
  • FAIL [expected PASS] /css/css-grid/grid-items/grid-auto-margin-and-replaced-item-001.html (#37162)
  • TIMEOUT [expected ERROR] /fetch/fetch-later/quota/same-origin-iframe/max-payload.tentative.https.window.html (#35210)
  • OK [expected ERROR] /fetch/fetch-later/quota/same-origin-iframe/multiple-iframes.tentative.https.window.html (#35176)
  • OK /fetch/metadata/generated/css-font-face.https.sub.tentative.html (#32732)
    • PASS [expected FAIL] subtest: sec-fetch-user
  • OK /fetch/metadata/generated/css-font-face.sub.tentative.html (#34624)
    • PASS [expected FAIL] subtest: sec-fetch-storage-access - Not sent to non-trustworthy same-site destination
  • ERROR /fetch/metadata/generated/serviceworker.https.sub.html (#36247)
    • PASS [expected FAIL] subtest: sec-fetch-site - Same origin, no options - registration
  • OK /html/browsers/browsing-the-web/navigating-across-documents/009.html (#24456)
    • FAIL [expected PASS] subtest: Link with onclick form submit to javascript url with document.write and href navigation

      assert_array_equals: expected property 1 to be "href" but got "click" (expected array ["write", "href"] got ["write", "click"])
      

  • OK /html/browsers/browsing-the-web/navigating-across-documents/empty-iframe-load-event.html (#29066)
    • FAIL [expected PASS] subtest: Check execution order from nested timeout

      assert_equals: Expected nested setTimeout to run second expected true but got false
      

    • FAIL [expected PASS] subtest: Check execution order on load handler

      assert_equals: Expected onload to run first expected false but got true
      

  • OK /html/browsers/browsing-the-web/navigating-across-documents/initial-empty-document/iframe-nosrc.html (#34819)
    • FAIL [expected PASS] subtest: form submission

      assert_equals: expected "http://web-platform.test:8000/common/blank.html?1=" but got "about:blank"
      

  • OK /html/browsers/browsing-the-web/navigating-across-documents/initial-empty-document/load-pageshow-events-iframe-contentWindow.html (#28681)
    • PASS [expected FAIL] subtest: load &amp; pageshow events do not fire on contentWindow of &lt;iframe&gt; element created with src=''
    • PASS [expected FAIL] subtest: load &amp; pageshow events do not fire on contentWindow of &lt;iframe&gt; element created with src='about:blank'
  • OK [expected TIMEOUT] /html/interaction/focus/the-autofocus-attribute/supported-elements.html (#24145)
    • FAIL [expected TIMEOUT] subtest: Element with tabindex should support autofocus

      assert_equals: expected "SPAN" but got "BODY"
      

    • PASS [expected NOTRUN] subtest: Non-HTMLElement should not support autofocus
    • FAIL [expected NOTRUN] subtest: Host element with delegatesFocus should support autofocus

      assert_equals: expected Element node &lt;div autofocus=""&gt;&lt;/div&gt; but got Element node &lt;body&gt;&lt;/body&gt;
      

    • FAIL [expected NOTRUN] subtest: Host element with delegatesFocus including no focusable descendants should be skipped

      assert_equals: expected Element node &lt;input autofocus=""&gt;&lt;/input&gt; but got Element node &lt;body&gt;&lt;div autofocus=""&gt;&lt;/div&gt;&lt;input autofocus=""&gt;&lt;/body&gt;
      

    • FAIL [expected NOTRUN] subtest: Area element should support autofocus

      promise_test: Unhandled rejection with value: object "TypeError: w.document.querySelector(...) is null"
      

  • CRASH [expected TIMEOUT] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-3.html (#24057)
  • TIMEOUT /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-2.html (#22154)
    • NOTRUN [expected FAIL] subtest: Check that popups from a sandboxed iframe do not escape the sandbox
  • OK [expected TIMEOUT] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-3.html (#24066)
    • FAIL [expected NOTRUN] subtest: Check that popups from a sandboxed iframe do not escape the sandbox

      assert_equals: It came from a sandboxed iframe expected "null" but got "http://web-platform.test:8000"
      

  • OK /navigation-timing/test-navigation-type-reload.html (#33334)
    • PASS [expected FAIL] subtest: Reload domContentLoadedEventEnd &gt; Original domContentLoadedEventEnd
  • OK /preload/preload-error.sub.html (#37177)
    • PASS [expected FAIL] subtest: success (style): main
    • PASS [expected FAIL] subtest: CORS (style): main
    • PASS [expected FAIL] subtest: 404 (script): main
    • PASS [expected FAIL] subtest: 404 (xhr): main
    • PASS [expected FAIL] subtest: CORS (xhr): main
    • PASS [expected FAIL] subtest: Decode-error (script): main
    • FAIL [expected PASS] subtest: MIME-error (script): main

      assert_greater_than: http://web-platform.test:8000/preload/resources/dummy.css?pipe=header%28Content-Type%2Ctext%2Fnotjavascript%29&amp;label=script should be loaded expected a number greater than 0 but got 0
      

  • OK /resize-observer/eventloop.html (#33599)
    • PASS [expected FAIL] subtest: test0: multiple notifications inside same event loop
  • OK /webaudio/the-audio-api/the-audiobuffersourcenode-interface/sub-sample-buffer-stitching.html (#22849)
    • FAIL [expected PASS] subtest: X Stitched sine-wave buffers at sample rate 43800 does not equal [0,0.06264832615852356,0.12505052983760834,0.18696144223213196,0.24813786149024963,0.308339387178421,0.36732959747314453,0.4248766601085663,0.480754554271698,0.5347436666488647,0.5866320133209229,0.6362156271934509,0.6832997798919678,0.7276994585990906,0.7692402601242065,0.8077589869499207...] with an element-wise tolerance of {"absoluteThreshold":0.0038986,"relativeThreshold":0}. Index Actual Expected AbsError RelError Test threshold [14650] -2.3293306371738506e+36 8.6956524848937988e-1 2.3293306371738506e+36 2.6787301369510731e+36 3.8985999999999999e-3 [14651] 3.0547976493835449e-1 8.9879405498504639e-1 5.9331429004669189e-1 6.6012262403823208e-1 3.8985999999999999e-3 Max AbsError of 2.3293306371738506e+36 at index of 14650. Max RelError of 2.6787301369510731e+36 at index of 14650.

      assert_true: expected true got false
      

    • FAIL [expected PASS] subtest: X SNR (-683.9105368340211 dB) is not greater than or equal to 65.737. Got -683.9105368340211.

      assert_true: expected true got false
      

  • TIMEOUT [expected OK] /webmessaging/with-ports/018.html (#24485)
    • TIMEOUT [expected PASS] subtest: origin of the script that invoked the method, javascript:

      Test timed out
      

  • OK [expected ERROR] /workers/constructors/Worker/Worker-constructor.html (#22991)

@github-actions
Copy link

✨ Try run (#15906723754) succeeded.

@simonwuelker simonwuelker marked this pull request as ready for review June 26, 2025 20:03
@simonwuelker simonwuelker requested a review from gterzian as a code owner June 26, 2025 20:03
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
@simonwuelker simonwuelker enabled auto-merge June 26, 2025 20:04
@simonwuelker simonwuelker added this pull request to the merge queue Jun 26, 2025
Merged via the queue into servo:main with commit cbb0407 Jun 26, 2025
22 checks passed
@simonwuelker simonwuelker deleted the fragment-scripting branch June 26, 2025 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants