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

Implement StaticRange #31809

Merged
merged 9 commits into from Mar 22, 2024
Merged

Implement StaticRange #31809

merged 9 commits into from Mar 22, 2024

Conversation

cathiechen
Copy link
Contributor

@cathiechen cathiechen commented Mar 21, 2024

This PR creates the AbstractRange and StaticRange DOM interfaces. It also refactors the Range DOM interface so that it inherits from the Abstract Range DOM interface.

This PR is originally from #25466, with rebased code and fixes for some failures. All the tests in tests/wpt/web-platform-tests/dom/ranges are now passing.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix Implement StaticRange #25376 (GitHub issue number if applicable)
  • There are tests for these changes

@mrobinson mrobinson added the T-linux-wpt-2020 Do a try run of the WPT label Mar 21, 2024
@github-actions github-actions bot removed the T-linux-wpt-2020 Do a try run of the WPT label Mar 21, 2024
Copy link

🔨 Triggering try run (#8375206346) for Linux WPT

@jdm jdm mentioned this pull request Mar 21, 2024
4 tasks
Copy link

Test results for linux-wpt-layout-2020 from try job (#8375206346):

Flaky unexpected result (17)
  • TIMEOUT [expected OK] /_webgl/conformance/glsl/misc/shader-with-non-reserved-words.html (#16216)
    • NOTRUN [expected PASS] subtest: Overall test
  • TIMEOUT [expected OK] /_webgl/conformance/uniforms/out-of-bounds-uniform-array-access.html (#26225)
    • NOTRUN [expected PASS] subtest: Overall test
  • OK /css/cssom-view/MediaQueryList-addListener-removeListener.html (#24569)
    • PASS [expected FAIL] subtest: listeners are called correct number of times
  • OK /css/cssom-view/MediaQueryList-extends-EventTarget-interop.html (#25285)
    • FAIL [expected PASS] subtest: listener added with addListener and addEventListener is called once

      assert_equals: triggerMQLEvent expected 1 but got 0
      

  • OK /css/cssom-view/matchMedia.html (#31428)
    • PASS [expected FAIL] subtest: iframe.matchMedia("(width: 200px)") matches
  • TIMEOUT [expected OK] /fetch/api/redirect/redirect-keepalive.https.any.html
    • TIMEOUT [expected PASS] subtest: [keepalive][iframe][load] mixed content redirect; setting up

      Test timed out
      

  • TIMEOUT /fetch/metadata/generated/element-img-environment-change.https.sub.html (#30111)
    • FAIL [expected TIMEOUT] subtest: sec-fetch-site - Cross-site, no attributes

      promise_test: Unhandled rejection with value: object "Error: Failed to query for recorded headers."
      

    • TIMEOUT [expected NOTRUN] subtest: sec-fetch-site - Same site, no attributes

      Test timed out
      

  • 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
      

  • TIMEOUT [expected OK] /html/browsers/browsing-the-web/navigating-across-documents/initial-empty-document/iframe-src-aboutblank-navigate-immediately.html (#29048)
    • TIMEOUT [expected FAIL] subtest: Navigating to a different document with link click

      Test timed out
      

    • NOTRUN [expected FAIL] subtest: Navigating to a different document with form submission
  • OK /html/browsers/history/the-history-interface/traverse_the_history_5.html (#21383)
    • FAIL [expected PASS] subtest: Multiple history traversals, last would be aborted

      assert_array_equals: Pages opened during history navigation expected property 1 to be 5 but got 3 (expected array [6, 5] got [6, 3])
      

  • OK [expected TIMEOUT] /html/infrastructure/urls/base-url/document-base-url-window-initiator-is-not-opener.https.window.html (#30970)
  • TIMEOUT [expected OK] /html/semantics/document-metadata/the-base-element/base_target_does_not_affect_location_assignment.html
    • TIMEOUT [expected PASS] subtest: base_target_does_not_affect_location_assignment

      Test timed out
      

  • OK [expected CRASH] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-1.html (#22647)
    • FAIL [expected TIMEOUT] subtest: Check that popups from a sandboxed iframe escape the sandbox if allow-popups-to-escape-sandbox is used

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

  • OK [expected TIMEOUT] /html/semantics/forms/form-submission-0/reparent-form-during-planned-navigation-task.html (#29724)
    • PASS [expected TIMEOUT] subtest: reparent-form-during-planned-navigation-task
  • OK [expected ERROR] /html/semantics/scripting-1/the-script-element/defer-script/async-script.html?reload (#29054)
  • OK [expected TIMEOUT] /webmessaging/with-ports/018.html (#24485)
    • PASS [expected TIMEOUT] subtest: origin of the script that invoked the method, javascript:
  • OK /workers/WorkerGlobalScope-close.html (#23064)
    • PASS [expected FAIL] subtest: Test sending a message after closing.
Stable unexpected results that are known to be intermittent (14)
  • FAIL [expected PASS] /_mozilla/css/dirty_viewport.html (#13731)
  • FAIL [expected PASS] /_mozilla/css/iframe/hide_and_show.html (#15265)
  • TIMEOUT [expected OK] /_webgl/conformance/glsl/misc/shader-uniform-packing-restrictions.html (#28103)
    • NOTRUN [expected PASS] subtest: Overall test
  • PASS [expected FAIL] /css/css-sizing/dynamic-available-size-iframe.html (#31559)
  • TIMEOUT /fetch/metadata/generated/css-images.sub.tentative.html (#29047)
    • PASS [expected TIMEOUT] subtest: background-image sec-fetch-site - HTTPS downgrade (header not sent)
  • OK /html/browsers/browsing-the-web/navigating-across-documents/initial-empty-document/load-pageshow-events-iframe-contentWindow.html (#28681)
    • FAIL [expected PASS] subtest: load & pageshow events do not fire on contentWindow of <iframe> element created with src=''

      assert_unreached: load should not be fired Reached unreachable code
      

  • OK /html/browsers/browsing-the-web/navigating-across-documents/initial-empty-document/load-pageshow-events-window-open.html (#28691)
    • FAIL [expected PASS] subtest: load event does not fire on window.open('about:blank')

      assert_unreached: load should not be fired Reached unreachable code
      

  • OK /html/browsers/browsing-the-web/navigating-across-documents/navigation-unload-same-origin.window.html (#29049)
    • PASS [expected FAIL] subtest: Same-origin navigation started from unload handler must be ignored
  • PASS [expected CRASH] /html/canvas/element/manual/drawing-text-to-the-canvas/canvas.2d.disconnected-font-size-math.html (#30063)
  • FAIL [expected CRASH] /html/canvas/element/manual/text/canvas.2d.disconnected.html (#30063)
  • CRASH [expected TIMEOUT] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-3.html (#24057)
  • OK /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"
      

  • TIMEOUT /resource-timing/test_resource_timing.https.html (#25216)
    • PASS [expected FAIL] subtest: PerformanceEntry has correct name, initiatorType, startTime, and duration (img)
  • OK [expected TIMEOUT] /webmessaging/with-ports/017.html (#24486)
    • PASS [expected TIMEOUT] subtest: origin of the script that invoked the method, about:blank

Copy link

✨ Try run (#8375206346) succeeded.

@sagudev sagudev requested a review from jdm March 21, 2024 13:51
Copy link
Member

@mrobinson mrobinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. I have just a few minor comments.

components/script/dom/abstractrange.rs Outdated Show resolved Hide resolved
components/script/dom/staticrange.rs Outdated Show resolved Hide resolved
components/script/dom/abstractrange.rs Outdated Show resolved Hide resolved
components/script/dom/staticrange.rs Outdated Show resolved Hide resolved
components/script/dom/range.rs Outdated Show resolved Hide resolved
components/script/dom/range.rs Outdated Show resolved Hide resolved
components/script/dom/range.rs Show resolved Hide resolved
components/script/dom/range.rs Outdated Show resolved Hide resolved
@mrobinson
Copy link
Member

@cathiechen Thank you!

@mrobinson mrobinson added this pull request to the merge queue Mar 22, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 22, 2024
@mrobinson
Copy link
Member

Looks like one test needs to updated in legacy layout mode:

    OK /dom/idlharness.window.html?exclude=Node
        PASS [expected FAIL] subtest: AbstractRange interface: existence and properties of interface object
        PASS [expected FAIL] subtest: AbstractRange interface object length
        PASS [expected FAIL] subtest: AbstractRange interface object name
        PASS [expected FAIL] subtest: AbstractRange interface: existence and properties of interface prototype object
        PASS [expected FAIL] subtest: AbstractRange interface: existence and properties of interface prototype object's "constructor" property
        PASS [expected FAIL] subtest: AbstractRange interface: existence and properties of interface prototype object's @@unscopables property
        PASS [expected FAIL] subtest: AbstractRange interface: attribute startContainer
        PASS [expected FAIL] subtest: AbstractRange interface: attribute startOffset
        PASS [expected FAIL] subtest: AbstractRange interface: attribute endContainer
        PASS [expected FAIL] subtest: AbstractRange interface: attribute endOffset
        And 9 more unexpected results...

You can run that with:

./mach test-wpt -r --legacy-layout *test* --log-raw out.log
./mach update-wpt --legacy-layout out.log

@cathiechen
Copy link
Contributor Author

Looks like one test needs to updated in legacy layout mode:

    OK /dom/idlharness.window.html?exclude=Node
        PASS [expected FAIL] subtest: AbstractRange interface: existence and properties of interface object
        PASS [expected FAIL] subtest: AbstractRange interface object length
        PASS [expected FAIL] subtest: AbstractRange interface object name
        PASS [expected FAIL] subtest: AbstractRange interface: existence and properties of interface prototype object
        PASS [expected FAIL] subtest: AbstractRange interface: existence and properties of interface prototype object's "constructor" property
        PASS [expected FAIL] subtest: AbstractRange interface: existence and properties of interface prototype object's @@unscopables property
        PASS [expected FAIL] subtest: AbstractRange interface: attribute startContainer
        PASS [expected FAIL] subtest: AbstractRange interface: attribute startOffset
        PASS [expected FAIL] subtest: AbstractRange interface: attribute endContainer
        PASS [expected FAIL] subtest: AbstractRange interface: attribute endOffset
        And 9 more unexpected results...

You can run that with:

./mach test-wpt -r --legacy-layout *test* --log-raw out.log
./mach update-wpt --legacy-layout out.log

Done! Thanks:)

@mrobinson mrobinson added this pull request to the merge queue Mar 22, 2024
Merged via the queue into servo:main with commit cb275e0 Mar 22, 2024
9 checks passed
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.

Implement StaticRange
3 participants