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

dom: Abort media element load on decode errors #31748

Merged
merged 1 commit into from Mar 26, 2024

Conversation

frereit
Copy link
Contributor

@frereit frereit commented Mar 18, 2024

Previously, when a PlayerEvent::Error was encountered, an error Event was fired on the element, but the "delaying-the-load-event" flag was never set to false, so the document was loading until the end of the media source was received in process_response_eof:

elem.delay_load_event(false);

I think the issue was that the PlayerEvent::Error was not handled according to spec. I believe the relevant portion is "The media data processing steps list is as follows: ... If the media is corrupted".

I've implemented most of the steps but am unsure about "6. Abort the overall resource selection algorithm." Is this even applicable here, or is it "automatically" aborted by cancelling the fetch event?

With this patch, the LoadComplete event is triggered immediately after a media decode error:

[2024-03-18T22:02:48Z ERROR script::dom::htmlmediaelement] Player error: "Error from element /GstPlayBin:playbin/GstURIDecodeBin:uridecodebin0: Your GStreamer installation is missing a plug-in.\nYour GStreamer installation is missing a plug-in.\n../gst/playback/gsturidecodebin.c(1049): no_more_pads_full (): /GstPlayBin:playbin/GstURIDecodeBin:uridecodebin0:\nno suitable plugins found:\n../gst/playback/gstdecodebin2.c(4704): gst_decode_bin_expose (): /GstPlayBin:playbin/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0:\nno suitable plugins found:\nMissing decoder: WebM (video/webm)\n"
[2024-03-18T22:02:48Z DEBUG script::dom::document] Document got finish_load: Media
[2024-03-18T22:02:48Z DEBUG script::dom::document] Document loads are complete.
[2024-03-18T22:02:48Z DEBUG script::dom::document] About to dispatch load for "data:text/html,<video autoplay src=\"http... (f8a72f128b37adab)"
[2024-03-18T22:02:48Z TRACE servoshell<servo@LoadComplete] TopLevelBrowsingContext(0,1) LoadComplete

Signed-off-by: Frederik Reiter <hi@frereit.de>
@mrobinson
Copy link
Member

These changes do not require tests because they do not change behavior. The LoadComplete just fires earlier than before now.

I think these changes do change behavior, though perhaps they are hard to test for other reasons. I wonder if there is a way to write a test for this though.

@mrobinson mrobinson added T-linux-wpt-2013 Do a try run of the WPT (legacy layout) T-linux-wpt-2020 Do a try run of the WPT labels Mar 18, 2024
@github-actions github-actions bot removed T-linux-wpt-2013 Do a try run of the WPT (legacy layout) T-linux-wpt-2020 Do a try run of the WPT labels Mar 18, 2024
Copy link

🔨 Triggering try run (#8334593698) for Linux WPT

Copy link

Test results for linux-wpt-layout-2013 from try job (#8334593698):

Flaky unexpected result (20)
  • CRASH [expected OK] /_mozilla/mozilla/service-workers/service-worker-registration.https.html (#31036)
  • CRASH [expected PASS] /_webgl/conformance/glsl/bugs/long-expressions-should-not-crash.html (#19221)
  • 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 /html/browsers/browsing-the-web/navigating-across-documents/initial-empty-document/load-pageshow-events-window-open.html (#28691)
    • PASS [expected FAIL] subtest: load event does not fire on window.open('about:blank')
  • TIMEOUT /html/browsers/browsing-the-web/navigating-across-documents/javascript-url-no-beforeunload.window.html (#29055)
    • PASS [expected FAIL] subtest: Navigating an opened window with an iframe via location.href to a javascript: URL must not fire beforeunload on the iframe: undefined completion
  • 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_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])
      

  • FAIL [expected CRASH] /html/canvas/element/manual/text/canvas.2d.disconnected.html (#30063)
  • TIMEOUT [expected OK] /html/interaction/focus/the-autofocus-attribute/document-with-fragment-empty.html (#28259)
    • TIMEOUT [expected FAIL] subtest: Autofocus elements in top-level browsing context's documents with empty fragments should work.

      Test timed out
      

  • CRASH [expected OK] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-3.html (#24057)
  • CRASH [expected TIMEOUT] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-1.html (#24066)
  • CRASH [expected OK] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-3.html (#24066)
  • OK /html/semantics/forms/form-submission-0/multipart-formdata.window.html (#28725)
    • PASS [expected FAIL] subtest: multipart/form-data: Basic test (formdata event)
  • OK /html/semantics/forms/form-submission-0/text-plain.window.html (#28687)
    • PASS [expected FAIL] subtest: text/plain: 0x00 in value (normal form)
    • PASS [expected FAIL] subtest: text/plain: backslash in filename (formdata event)
  • TIMEOUT /html/webappapis/scripting/events/compile-event-handler-settings-objects.html (#24246)
    • PASS [expected FAIL] subtest: The entry settings object while executing the compiled callback via Web IDL's invoke must be that of the node document
  • TIMEOUT /resource-timing/test_resource_timing.https.html (#25216)
    • FAIL [expected PASS] subtest: PerformanceEntry has correct name, initiatorType, startTime, and duration (img)

      assert_equals: expected 11621632 but got 11621888
      

  • CRASH [expected PASS] /streams/readable-streams/crashtests/strategy-worker-terminate.html
  • OK /workers/WorkerGlobalScope-close.html (#23064)
    • PASS [expected FAIL] subtest: Test sending a message after closing.
  • OK [expected ERROR] /workers/constructors/Worker/Worker-constructor.html (#22991)
Stable unexpected results that are known to be intermittent (11)
  • TIMEOUT [expected OK] /_webgl/conformance/glsl/misc/shader-uniform-packing-restrictions.html (#28103)
    • NOTRUN [expected PASS] subtest: Overall test
  • PASS [expected FAIL] /css/compositing/mix-blend-mode/mix-blend-mode-animation.html (#21930)
  • OK /css/cssom-view/elementsFromPoint-iframes.html (#19273)
    • FAIL [expected PASS] subtest: elementsFromPoint on inner documents

      assert_equals: document.getElementById('iframe').contentDocument.elementsFromPoint(1,1) expected "DIV#div, BODY, HTML" but got "DIV#div, BODY, HTML, IFRAME#iframe, IFRAME#iframe, BODY, HTML, HTML"
      

  • TIMEOUT /fetch/metadata/generated/css-images.sub.tentative.html (#29047)
    • FAIL [expected PASS] subtest: border-image sec-fetch-user - Not sent to non-trustworthy cross-site destination

      assert_unreached: Reached unreachable code
      

    • TIMEOUT [expected PASS] subtest: background-image sec-fetch-site - HTTPS downgrade (header not sent)

      Test timed out
      

    • FAIL [expected PASS] subtest: border-image sec-fetch-site - HTTPS downgrade (header not sent)

      assert_unreached: Reached unreachable code
      

  • OK /html/browsers/browsing-the-web/navigating-across-documents/navigation-unload-cross-origin.sub.window.html (#29056)
    • PASS [expected FAIL] subtest: Cross-origin navigation started from unload handler must be ignored
  • TIMEOUT /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-2.html (#22667)
    • TIMEOUT [expected FAIL] subtest: Check that popups from a sandboxed iframe escape the sandbox if allow-popups-to-escape-sandbox is used

      Test timed out
      

  • OK [expected CRASH] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-2.html (#22154)
    • 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 [expected TIMEOUT] /resource-timing/nested-context-navigations-iframe.html (#24311)
    • PASS [expected NOTRUN] subtest: Test that iframe navigations are not observable by the parent
    • PASS [expected NOTRUN] subtest: Test that crossorigin iframe navigations are not observable by the parent
    • PASS [expected NOTRUN] subtest: Test that cross-site iframe navigations are not observable by the parent
    • PASS [expected NOTRUN] subtest: Test that iframe refreshes are not observable by the parent
    • PASS [expected NOTRUN] subtest: Test that crossorigin iframe refreshes are not observable by the parent
    • PASS [expected NOTRUN] subtest: Test that cross-site iframe refreshes are not observable by the parent
  • TIMEOUT /resource-timing/test_resource_timing.html (#25720)
    • FAIL [expected PASS] subtest: PerformanceEntry has correct name, initiatorType, startTime, and duration (img)

      assert_equals: expected 12638976 but got 12638720
      

  • OK [expected TIMEOUT] /webmessaging/with-ports/017.html (#24486)
    • PASS [expected TIMEOUT] subtest: origin of the script that invoked the method, about:blank
  • TIMEOUT [expected OK] /webmessaging/without-ports/017.html (#24486)
    • TIMEOUT [expected PASS] subtest: origin of the script that invoked the method, about:blank

      Test timed out
      

Copy link

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

Flaky unexpected result (22)
  • 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
  • TIMEOUT [expected PASS] /css/css-color/animation/opacity-animation-ending-correctly-002.html (#29216)
  • TIMEOUT /fetch/metadata/generated/element-img-environment-change.sub.html (#30111)
    • PASS [expected FAIL] subtest: sec-fetch-site - Not sent to non-trustworthy same-origin destination, no attributes
  • 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/javascript-url-return-value-handling-dynamic.html (#28066)
    • FAIL [expected PASS] subtest: 0041 set in href="" targeting a frame and clicked

      assert_equals: expected "A" but got ""
      

    • FAIL [expected PASS] subtest: 0080 00FF set in href="" targeting a frame and clicked

      assert_equals: expected "�ÿ" but got ""
      

    • FAIL [expected PASS] subtest: 0080 00FF 0100 set in href="" targeting a frame and clicked

      assert_equals: expected "�ÿĀ" but got ""
      

    • FAIL [expected PASS] subtest: D83D DE0D set in href="" targeting a frame and clicked

      assert_equals: expected "😍" but got ""
      

    • FAIL [expected PASS] subtest: DE0D 0041 set in href="" targeting a frame and clicked

      assert_equals: expected "\ufffdA" but got ""
      

  • 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/replace-before-load/a-click.html (#28697)
    • PASS [expected FAIL] subtest: aElement.click() before the load event must NOT replace
  • OK [expected CRASH] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-1.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 /html/semantics/embedded-content/the-img-element/non-active-document.html (#21544)
    • FAIL [expected PASS] subtest: DOMParser

      assert_unreached: got unexpected load event Reached unreachable code
      

    • FAIL [expected PASS] subtest: createHTMLDocument

      assert_unreached: got unexpected error event Reached unreachable code
      

    • FAIL [expected PASS] subtest: &lt;template&gt;

      assert_unreached: got unexpected error event Reached unreachable code
      

  • OK /html/semantics/forms/form-submission-0/multipart-formdata.window.html (#28725)
    • PASS [expected FAIL] subtest: multipart/form-data: \r\n in value (formdata event)
  • 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 /html/semantics/forms/form-submission-0/text-plain.window.html (#28687)
    • PASS [expected FAIL] subtest: text/plain: single quote in value (normal form)
  • OK /html/semantics/links/links-created-by-a-and-area-elements/htmlanchorelement_noopener.html (#23205)
    • PASS [expected FAIL] subtest: Check that rel=noopener with target=_self does a normal load
  • OK [expected ERROR] /html/semantics/scripting-1/the-script-element/defer-script/async-script.html?reload (#29054)
  • OK /html/webappapis/dynamic-markup-insertion/document-write/module-tla-delayed.html (#29137)
    • FAIL [expected PASS] subtest: document.write in an imported module

      assert_true: onload must be called expected true got false
      

  • TIMEOUT /html/webappapis/scripting/events/compile-event-handler-settings-objects.html (#24246)
    • PASS [expected FAIL] subtest: The entry settings object while executing the compiled callback via Web IDL's invoke must be that of the node document
  • TIMEOUT [expected OK] /referrer-policy/css-integration/svg/internal-stylesheet.html
    • TIMEOUT [expected FAIL] subtest: Styling SVG from internal styles mask-image

      Test timed out
      

  • TIMEOUT [expected OK] /webmessaging/with-ports/017.html (#24486)
    • TIMEOUT [expected PASS] subtest: origin of the script that invoked the method, about:blank

      Test timed out
      

  • OK [expected TIMEOUT] /webmessaging/with-ports/018.html (#24485)
    • PASS [expected TIMEOUT] subtest: origin of the script that invoked the method, javascript:
  • OK [expected TIMEOUT] /webmessaging/without-ports/017.html (#24486)
    • PASS [expected TIMEOUT] subtest: origin of the script that invoked the method, about:blank
  • TIMEOUT [expected OK] /webstorage/localstorage-about-blank-3P-iframe-opens-3P-window.partitioned.tentative.html (#29053)
    • TIMEOUT [expected PASS] subtest: StorageKey: test 3P about:blank window opened from a 3P iframe

      Test timed out
      

Stable unexpected results that are known to be intermittent (16)
  • 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/CSS2/text/white-space-pre-002.xht (#21909)
  • PASS [expected FAIL] /css/compositing/mix-blend-mode/mix-blend-mode-animation.html (#21930)
  • PASS [expected FAIL] /css/compositing/mix-blend-mode/mix-blend-mode-paragraph.html (#21930)
  • OK /css/css-fonts/variations/at-font-face-font-matching.html (#20684)
    • PASS [expected FAIL] subtest: Matching font-weight: '501' should prefer '503 520' over '500'
    • PASS [expected FAIL] subtest: Matching font-weight: '501' should prefer '500' over '450 460'
    • PASS [expected FAIL] subtest: Matching font-stretch: '110%' should prefer '110% 120%' over '115% 116%'
    • PASS [expected FAIL] subtest: Matching font-style: 'normal' should prefer 'normal' over 'oblique 0deg'
    • PASS [expected FAIL] subtest: Matching font-style: 'normal' should prefer 'oblique 10deg 40deg' over 'oblique 20deg 30deg'
    • PASS [expected FAIL] subtest: Matching font-style: 'oblique 20deg' should prefer 'oblique -50deg -20deg' over 'oblique -40deg -30deg'
    • PASS [expected FAIL] subtest: Matching font-style: 'oblique 21deg' should prefer 'oblique 21deg' over 'oblique 30deg 60deg'
    • PASS [expected FAIL] subtest: Matching font-style: 'oblique 10deg' should prefer 'oblique -50deg -20deg' over 'oblique -40deg -30deg'
    • PASS [expected FAIL] subtest: Matching font-style: 'oblique -10deg' should prefer 'oblique -5deg' over 'oblique -1deg 0deg'
    • PASS [expected FAIL] subtest: Matching font-style: 'oblique -21deg' should prefer 'oblique 30deg 60deg' over 'oblique 40deg 50deg'
  • OK /css/cssom-view/elementsFromPoint-iframes.html (#19273)
    • FAIL [expected PASS] subtest: elementsFromPoint on inner documents

      assert_equals: document.getElementById('iframe').contentDocument.elementsFromPoint(1,1) expected "DIV#div, BODY, HTML" but got "DIV#div, BODY, HTML, IFRAME#iframe, BODY, HTML, HTML"
      

  • OK /css/cssom-view/scroll-behavior-smooth-navigation.html (#29564)
    • PASS [expected FAIL] subtest: Smooth scrolling while doing history navigation.
  • TIMEOUT [expected OK] /html/browsers/browsing-the-web/history-traversal/srcdoc/consecutive-srcdoc.html (#29084)
    • TIMEOUT [expected FAIL] subtest: changing srcdoc to about:srcdoc#yo then another srcdoc does two push navigations and we can navigate back

      Test timed out
      

  • OK /html/browsers/browsing-the-web/navigating-across-documents/initial-empty-document/load-pageshow-events-iframe-contentWindow.html (#28681)
    • FAIL [expected PASS] subtest: load &amp; pageshow events do not fire on contentWindow of &lt;iframe&gt; element created with src=''

      assert_unreached: load should not be fired Reached unreachable code
      

  • 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/interaction/focus/the-autofocus-attribute/document-with-fragment-valid.html (#28259)
    • FAIL [expected TIMEOUT] subtest: Autofocus elements in top-level browsing context's documents with URL fragments should be skipped.

      assert_true: expected true got false
      

  • TIMEOUT [expected OK] /html/interaction/focus/the-autofocus-attribute/supported-elements.html (#24145)
    • TIMEOUT [expected FAIL] subtest: Contenteditable element should support autofocus

      Test timed out
      

    • NOTRUN [expected FAIL] subtest: Element with tabindex should support autofocus
    • NOTRUN [expected PASS] subtest: Non-HTMLElement should not support autofocus
    • NOTRUN [expected FAIL] subtest: Host element with delegatesFocus should support autofocus
    • NOTRUN [expected FAIL] subtest: Host element with delegatesFocus including no focusable descendants should be skipped
    • NOTRUN [expected FAIL] subtest: Area element should support autofocus
  • CRASH [expected TIMEOUT] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-3.html (#24057)
  • OK [expected TIMEOUT] /html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-entry-different-function-realm.html (#25805)
    • FAIL [expected TIMEOUT] subtest: Fulfillment handler on pending-then-fulfilled promise

      assert_equals: expected "http://web-platform.test:8000/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/function/resources/window-to-open.html" but got "http://web-platform.test:8000/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/relevant/resources/window-to-open.html"
      

    • FAIL [expected TIMEOUT] subtest: Rejection handler on pending-then-rejected promise

      assert_equals: expected "http://web-platform.test:8000/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/function/resources/window-to-open.html" but got "http://web-platform.test:8000/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/relevant/resources/window-to-open.html"
      

Copy link

✨ Try run (#8334593698) succeeded.

@frereit
Copy link
Contributor Author

frereit commented Mar 18, 2024

think these changes do change behavior, though perhaps they are hard to test for other reasons. I wonder if there is a way to write a test for this though.

I just spent some time looking into how to test is. Unfortunately it seems pretty difficult to test MEDIA_ERR_DECODE right now. As far as I can tell, WPT currently only tests this through a MediaSource, which is not yet implemented in servo (?):

mediaSource.endOfStream("decode");
});
test.waitForExpectedEvents(function()
{
assert_true(mediaElement.error != null);
assert_equals(mediaElement.error.code, MediaError.MEDIA_ERR_DECODE);
assert_equals(mediaSource.readyState, "ended");

I tried around with creating an MP4 / webm that triggers a MEDIA_ERR_DECODE but neither in firefox, chromum or servo was I able to achieve this. The best I could do is a MEDIA_ERR_SRC_NOT_SUPPORTED. Are you aware of any test files that trigger a MEDIA_ERR_DECODE we could use for this test?

Edit: sorry, accidentally sent the comment too early.. still editing

Edit:

I experimented around some more and managed to create a completely empty MP4 file (i.e. valid, but contains no video or audio streams):

empty.mp4

Reading the file with ffmpeg gives no errors but also shows that it doesn't contain any streams:

$ ffprobe -i empty.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Mpeg4.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
  Duration: N/A, bitrate: N/A

So this file is a valid MP4. However, both firefox and chromium still only raise a "MEDIA_ERR_SRC_NOT_SUPPORTED". Firefox even says that "Media resource [...] could not be decoded" but does not raise a "MEDIA_ERR_DECODE" (??). Servo also doesn't raise a "MEDIA_ERR_DECODE". As a matter of fact, in Chromium, a MEDIA_ERR_DECODE is only raised during a kNetworkStateDecodeError:

https://github.com/chromium/chromium/blob/9201a5daba3e4c3fd30e2562db5f0378eac1acc2/third_party/blink/renderer/core/html/media/html_media_element.cc#L1998-L2000C54

It seems to me like MEDIA_ERR_DECODE is only raised very exceptional cases, which makes testing this very hard until the Media Source API is available. Would it be acceptable to only add a comment that states that a test can only be written when the Media Source API is available?

Comment on lines +1575 to +1576

// TODO: 6. Abort the overall resource selection algorithm.
Copy link
Contributor Author

@frereit frereit Mar 19, 2024

Choose a reason for hiding this comment

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

I believe this is not required here / we can skip this step. There is a similar error path in HTMLMediaElementFetchListener that is also supposed to "Abort the overall resource selection algorithm" and it is skipped there too:

// => "If the connection is interrupted after some media data has been received..."
else if elem.ready_state.get() != ReadyState::HaveNothing {
// Step 1
if let Some(ref mut current_fetch_context) = *elem.current_fetch_context.borrow_mut() {
current_fetch_context.cancel(CancelReason::Error);
}
// Step 2
elem.error.set(Some(&*MediaError::new(
&*window_from_node(&*elem),
MEDIA_ERR_NETWORK,
)));
// Step 3
elem.network_state.set(NetworkState::Idle);
// Step 4.
elem.delay_load_event(false);
// Step 5
elem.upcast::<EventTarget>().fire_event(atom!("error"));

Suggested change
// TODO: 6. Abort the overall resource selection algorithm.

@mrobinson
Copy link
Member

WPT currently only tests this through a MediaSource, which is not yet implemented in servo

This makes sense to me and the code change is pretty straight-forward. I've updated the PR description to say this.

@mrobinson mrobinson added this pull request to the merge queue Mar 26, 2024
Merged via the queue into servo:main with commit 5f7baf3 Mar 26, 2024
61 checks passed
ektuu pushed a commit to ektuu/servo that referenced this pull request Mar 28, 2024
Signed-off-by: Frederik Reiter <hi@frereit.de>
@frereit frereit deleted the 31688-media-player-errors branch March 29, 2024 02:08
MunishMummadi pushed a commit to MunishMummadi/servo that referenced this pull request Mar 29, 2024
Signed-off-by: Frederik Reiter <hi@frereit.de>
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.

Media player errors can prevent documents from reaching DocumentReadyState::Complete for a long time
2 participants