Skip to content

Conversation

@gterzian
Copy link
Member

@gterzian gterzian commented Jan 6, 2025

Implement writable stream https://streams.spec.whatwg.org/#writablestream

Part of #34676


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

@gterzian gterzian force-pushed the implement_writeable_streams branch from 68f2f34 to 6a755ca Compare January 6, 2025 09:55
@mrobinson mrobinson changed the title Dom: Implement writable stream Dom: Implement WritableStream Jan 6, 2025
@mrobinson mrobinson changed the title Dom: Implement WritableStream dom: Implement WritableStream Jan 6, 2025
@gterzian gterzian force-pushed the implement_writeable_streams branch from 629d416 to 76b7775 Compare January 8, 2025 10:25
// Let state be stream.[[state]].

// Assert: state is not "closed" or "errored".
assert!(stream.is_errored() || stream.is_closed());
Copy link
Member

Choose a reason for hiding this comment

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

I think this is inverted from the intended check.

@gterzian gterzian force-pushed the implement_writeable_streams branch 6 times, most recently from eb0c449 to 51fb616 Compare January 17, 2025 10:07
@gterzian gterzian force-pushed the implement_writeable_streams branch 7 times, most recently from cc48833 to 416b619 Compare January 27, 2025 10:19
@gterzian gterzian force-pushed the implement_writeable_streams branch from 4b2cc03 to fd680a5 Compare January 29, 2025 12:22
@gterzian
Copy link
Member Author

Note to self, apply rooting pattern of #34194

@gterzian gterzian force-pushed the implement_writeable_streams branch from 4578d56 to b49ffd8 Compare February 4, 2025 12:42
@gterzian gterzian added the T-linux-wpt Do a try run of the WPT label Feb 5, 2025
@github-actions github-actions bot removed the T-linux-wpt Do a try run of the WPT label Feb 5, 2025
@github-actions
Copy link

github-actions bot commented Feb 5, 2025

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

@github-actions
Copy link

github-actions bot commented Feb 5, 2025

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

Flaky unexpected result (18)
  • OK /_mozilla/css/offset_properties_inline.html
    • FAIL [expected PASS] subtest: offsetTop

      assert_equals: offsetTop of #inline-1 should be 0. expected 0 but got -1
      

    • FAIL [expected PASS] subtest: offsetLeft

      assert_equals: offsetLeft of #inline-2 should be 40. expected 40 but got 25
      

  • TIMEOUT [expected FAIL] /css/css-fonts/font-display/font-display-preload.html (#35108)
  • FAIL [expected PASS] /css/css-fonts/font-face-local-not-family.html
  • FAIL [expected PASS] /css/css-fonts/font-palette-23.html
  • OK /css/css-grid/alignment/grid-content-alignment-with-abspos-001.html (#34339)
    • FAIL [expected PASS] subtest: .grid 1

      assert_equals: 
      <div class="grid" data-expected-width="800" data-expected-height="600">
          <div class="a" id="item" data-offset-x="329" data-offset-y="269" data-expected-width="142" data-expected-height="62" style="place-self: center;"></div>
        </div>
      offsetLeft expected 329 but got 0
      

  • PASS [expected FAIL] /css/css-position/sticky/position-sticky-left-002.html (#35135)
  • PASS [expected FAIL] /css/selectors/invalidation/any-link-attribute-removal.html (#35054)
  • OK /encoding/legacy-mb-japanese/shift_jis/sjis-encode-form-x-sjis.html?1-1000
    • FAIL [expected PASS] subtest: U+80 � %80

      assert_equals: expected "%80" but got ""
      

    • FAIL [expected PASS] subtest: U+A5 ¥ %5C

      str is undefined
      

    • FAIL [expected PASS] subtest: U+A7 § %81%98

      str is undefined
      

    • FAIL [expected PASS] subtest: U+A8 ¨ %81%4E

      str is undefined
      

    • FAIL [expected PASS] subtest: U+B0 ° %81%8B

      str is undefined
      

    • FAIL [expected PASS] subtest: U+B1 ± %81%7D

      str is undefined
      

    • FAIL [expected PASS] subtest: U+B4 ´ %81%4C

      str is undefined
      

    • FAIL [expected PASS] subtest: U+B6 ¶ %81%F7

      str is undefined
      

    • FAIL [expected PASS] subtest: U+D7 × %81%7E

      str is undefined
      

    • FAIL [expected PASS] subtest: U+F7 ÷ %81%80

      str is undefined
      

    • And 390 more unexpected results...
  • OK /fetch/metadata/generated/css-font-face.https.sub.tentative.html (#32732)
    • PASS [expected FAIL] subtest: sec-fetch-dest
    • PASS [expected FAIL] subtest: sec-fetch-storage-access - Same site
  • 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/history/the-history-interface/traverse_the_history_2.html (#21383)
    • PASS [expected FAIL] subtest: Multiple history traversals, last would be aborted
  • OK /html/browsers/history/the-history-interface/traverse_the_history_4.html (#21383)
    • PASS [expected FAIL] subtest: Multiple history traversals, last would be aborted
  • PASS [expected FAIL] /html/canvas/element/manual/drawing-text-to-the-canvas/canvas.2d.disconnected-font-size-math.html (#30063)
  • CRASH [expected OK] /html/canvas/offscreen/canvas-host/2d.canvas.host.size.large.worker.html (#30164)
  • OK /html/semantics/forms/form-submission-0/form-data-set-usv.html (#34934)
    • FAIL [expected PASS] subtest: Strings from form controls should be converted to Unicode scalar values in form submission

      assert_equals: expected "69 6e 70 75 74 31 ef bf bd 3d 69 6e 70 75 74 31 ef bf bd 0d 0a 69 6e 70 75 74 32 ef bf bd 3d 69 6e 70 75 74 32 ef bf bd 0d 0a 69 6e 70 75 74 33 ef bf bd 3d 69 6e 70 75 74 33 ef bf bd 0d 0a 69 6e 70 75 74 34 ef bf bd 3d 69 6e 70 75 74 34 ef bf bd 0d 0a" but got "\n  \n  \n    option\n  \n  \n  \n\n\n\n\"use strict\";\n\nconst form = document.querySelector(\"form\");\n\nfor (let el of Array.from(form.querySelectorAll(\"input\"))) { // Firefox/Edge support\n  el.name = el.id + \"\\uDC01\";\n  el.value = el.id + \"\\uDC01\";\n}\n\nconst select = document.querySelector(\"select\");\nselect.name = select.id + \"\\uDC01\";\nselect.firstElementChild.value = select.id + \"\\uDC01\";\n\n"
      

  • OK /resize-observer/change-layout-in-error.html (#32629)
    • PASS [expected FAIL] subtest: Changing layout in window error handler should not result in lifecyle loop when resize observer loop limit is reached.
  • OK [expected ERROR] /webxr/render_state_update.https.html (#27535)
  • OK /xhr/send-redirect.htm (#32026)
    • FAIL [expected PASS] subtest: XMLHttpRequest: send() - Redirects (basics) (303 does redirect)

      assert_equals: expected (string) "GET" but got (object) null
      

Stable unexpected results that are known to be intermittent (12)
  • OK /FileAPI/url/url-with-fetch.any.worker.html (#21517)
    • FAIL [expected PASS] subtest: Revoke blob URL after calling fetch, fetch should succeed

      promise_test: Unhandled rejection with value: object "TypeError: Network error occurred"
      

  • FAIL [expected PASS] /_mozilla/css/dirty_viewport.html (#13731)
  • FAIL [expected PASS] /css/compositing/mix-blend-mode/mix-blend-mode-video-sibling.html (#32849)
  • ERROR [expected OK] /fetch/fetch-later/quota/same-origin-iframe/empty-payload.tentative.https.window.html (#35176)
  • OK [expected ERROR] /fetch/fetch-later/quota/same-origin-iframe/oversized-payload.tentative.https.window.html (#35210)
  • 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/navigation-unload-cross-origin.sub.window.html (#29056)
    • FAIL [expected PASS] subtest: Cross-origin navigation started from unload handler must be ignored

      promise_test: Unhandled rejection with value: object "SecurityError: The operation is insecure."
      

  • 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 FAIL] /html/canvas/element/manual/text/canvas.2d.disconnected.html (#30063)
  • TIMEOUT [expected CRASH] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-1.html (#22647)
  • 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 /html/semantics/forms/historical.html (#28568)
    • FAIL [expected PASS] subtest: <input name=isindex> should not be supported

      assert_regexp_match: expected object "/\?isindex=x$/" but got "about:blank"
      

Stable unexpected results (4)
  • OK /_mozilla/mozilla/interfaces.https.html
    • FAIL [expected PASS] subtest: Interfaces exposed on the window

      assert_true: If this is failing: DANGER, are you sure you want to expose the new interface WritableStreamDefaultController to all webpages as a property on the global? expected true got false
      

  • OK /_mozilla/mozilla/interfaces.worker.html
    • FAIL [expected PASS] subtest: interfaces

      assert_true: If this is failing: DANGER, are you sure you want to expose the new interface WritableStreamDefaultController to all webpages as a property on the global? expected true got false
      

  • OK [expected ERROR] /encoding/streams/realms.window.html
    • FAIL [expected PASS] subtest: a TextEncoderStream object should be associated with the realm the constructor came from

      promise_test: Unhandled rejection with value: object "TypeError: obj is undefined"
      

    • FAIL [expected PASS] subtest: TextEncoderStream's readable and writable attributes should come from the same realm as the constructor definition

      promise_test: Unhandled rejection with value: object "TypeError: methodRealm[classname] is undefined"
      

    • FAIL [expected PASS] subtest: the output chunks when read is called after write should come from the same realm as the constructor of TextEncoderStream

      promise_test: Unhandled rejection with value: object "TypeError: result is undefined"
      

    • FAIL [expected PASS] subtest: the output chunks when write is called with a pending read should come from the same realm as the constructor of TextEncoderStream

      promise_test: Unhandled rejection with value: object "TypeError: result is undefined"
      

    • FAIL [expected PASS] subtest: TypeError for unconvertable chunk should come from constructor realm of TextEncoderStream

      assert_unreached: Should have rejected: write TypeError should come from constructor realm Reached unreachable code
      

    • FAIL [expected PASS] subtest: a TextDecoderStream object should be associated with the realm the constructor came from

      promise_test: Unhandled rejection with value: object "TypeError: obj is undefined"
      

    • FAIL [expected PASS] subtest: TextDecoderStream's readable and writable attributes should come from the same realm as the constructor definition

      promise_test: Unhandled rejection with value: object "TypeError: methodRealm[classname] is undefined"
      

    • FAIL [expected PASS] subtest: the result object when read is called after write should come from the same realm as the constructor of TextDecoderStream

      promise_test: Unhandled rejection with value: object "TypeError: result is undefined"
      

    • FAIL [expected PASS] subtest: the result object when write is called with a pending read should come from the same realm as the constructor of TextDecoderStream

      promise_test: Unhandled rejection with value: object "TypeError: result is undefined"
      

    • FAIL [expected PASS] subtest: TypeError for chunk with the wrong type should come from constructor realm of TextDecoderStream

      assert_unreached: Should have rejected: write TypeError should come from constructor realm Reached unreachable code
      

    • And 2 more unexpected results...
  • OK /workers/semantics/interface-objects/001.worker.html
    • PASS [expected FAIL] subtest: The WritableStream interface object should be exposed.

@github-actions
Copy link

github-actions bot commented Feb 5, 2025

⚠️ Try run (#13158231151) failed.

@gterzian gterzian added the T-linux-wpt Do a try run of the WPT label Feb 6, 2025
@github-actions github-actions bot removed the T-linux-wpt Do a try run of the WPT label Feb 6, 2025
@github-actions
Copy link

github-actions bot commented Feb 6, 2025

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

gterzian and others added 23 commits February 19, 2025 19:31
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
Signed-off-by: Gregory Terzian <2792687+gterzian@users.noreply.github.com>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
Signed-off-by: Gregory Terzian <2792687+gterzian@users.noreply.github.com>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
Signed-off-by: Gregory Terzian <2792687+gterzian@users.noreply.github.com>
…inish_erroring

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
…finish_erroring

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
…lose_and_closed_promise_if_needed

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
…close_with_error

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
Signed-off-by: Gregory Terzian <2792687+gterzian@users.noreply.github.com>
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
uses ai

Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
@gterzian gterzian force-pushed the implement_writeable_streams branch from 494cb8b to b7688fe Compare February 19, 2025 12:31
@gterzian gterzian enabled auto-merge February 19, 2025 12:37
@gterzian gterzian added this pull request to the merge queue Feb 19, 2025
Merged via the queue into servo:main with commit df6d636 Feb 19, 2025
22 checks passed
@gterzian gterzian deleted the implement_writeable_streams branch February 19, 2025 13:28
@gterzian
Copy link
Member Author

@jdm and @Taym95 Thank you for your reviews!

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.

4 participants