Closed Bug 2085511 Opened 1 month ago Closed 24 days ago

[wpt-sync] Sync PR 64049 - [CE] Fix setConstraints() silently discarding track constraints

Categories

(Core :: DOM: Core & HTML, task, P4)

task

Tracking

()

RESOLVED FIXED
162 Branch
Tracking Status
firefox162 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 64049 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/64049
Details from upstream follow.

Ravjit Uppal <ravjit@chromium.org> wrote:

[CE] Fix setConstraints() silently discarding track constraints

Previously, UserMediaRequestProviderImpl::StartRequest passed
static_cast\<const MediaTrackConstraints*>(constraints->audio()) to
V8UnionBooleanOrMediaTrackConstraints. Because the generated union class
only has constructors for (bool) and non-const (MediaTrackConstraints*),
the const-qualified pointer could not bind to the MediaTrackConstraints*
constructor. Instead, C++ overload resolution implicitly converted the
non-null const pointer to bool(true), calling the (bool) constructor and
silently discarding all track constraints.

This CL stores the sanitized MediaTrackConstraints* directly on
MediaCaptureElementConstraints (eliminating the upcast to
MediaTrackConstraintSet* and subsequent static_cast downcast in
StartRequest) and updates WPTs and unit tests to verify that track
constraints are preserved and applied.

Bug: 575970640
Change-Id: I39cd2fb1b35eb1573f5682312a10886374b5829a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8618251
Commit-Queue: Ravjit Uppal \<ravjit@chromium.org>
Reviewed-by: Joey Arhar \<jarhar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1724951}

Component: web-platform-tests → DOM: Core & HTML
Product: Testing → Core

CI Results

Ran 9 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 24 tests and 1 subtests

Status Summary

Firefox

OK : 3[GitHub] 24[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
PASS: 42
FAIL: 6[GitHub] 103[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]

Chrome

OK : 3
FAIL: 6

Safari

OK : 3
FAIL: 6

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

New Tests That Don't Pass

  • /html/semantics/permission-element/camera/camera-element-use-cases.https.html [wpt.fyi]
    • A camera element with video constraints requests camera permission and yields single video capture stream on user click: FAIL
  • /html/semantics/permission-element/camera/camera-error-scenarios.https.html [wpt.fyi]
    • Denying camera permission prompt triggers oncancel event and sets NotAllowedError: FAIL
    • Untrusted click on camera element fails with InvalidStateError: FAIL
  • /html/semantics/permission-element/camera/camera-set-constraints.https.html [wpt.fyi]
    • HTMLCameraElement initializes video track and never audio track: FAIL (Chrome: FAIL, Safari: FAIL)
    • HTMLCameraElement setConstraints sanitization strips complex ranges without crashing: FAIL (Chrome: FAIL, Safari: FAIL)
  • /html/semantics/permission-element/camera/camera-track-attribute.https.html [wpt.fyi]
    • HTMLCameraElement has track attribute and ontrack event handler: FAIL
  • /html/semantics/permission-element/camera/idlharness.window.html [wpt.fyi]
    • HTMLCameraElement interface: existence and properties of interface object: FAIL
    • HTMLCameraElement interface object length: FAIL
    • HTMLCameraElement interface object name: FAIL
    • HTMLCameraElement interface: existence and properties of interface prototype object: FAIL
    • HTMLCameraElement interface: existence and properties of interface prototype object's "constructor" property: FAIL
    • HTMLCameraElement interface: existence and properties of interface prototype object's @@unscopables property: FAIL
    • HTMLCameraElement interface: attribute track: FAIL
    • HTMLCameraElement interface: attribute error: FAIL
    • HTMLCameraElement interface: attribute ontrack: FAIL
    • HTMLCameraElement interface: attribute oncancel: FAIL
    • HTMLCameraElement interface: attribute onerror: FAIL
    • HTMLCameraElement must be primary interface of document.createElement('camera'): FAIL
    • Stringification of document.createElement('camera'): FAIL
    • HTMLCameraElement interface: document.createElement('camera') must inherit property "track" with the proper type: FAIL
    • HTMLCameraElement interface: document.createElement('camera') must inherit property "error" with the proper type: FAIL
    • HTMLCameraElement interface: document.createElement('camera') must inherit property "ontrack" with the proper type: FAIL
  • /html/semantics/permission-element/microphone/idlharness.window.html [wpt.fyi]
    • HTMLMicrophoneElement interface: existence and properties of interface object: FAIL
    • HTMLMicrophoneElement interface object length: FAIL
    • HTMLMicrophoneElement interface object name: FAIL
    • HTMLMicrophoneElement interface: existence and properties of interface prototype object: FAIL
    • HTMLMicrophoneElement interface: existence and properties of interface prototype object's "constructor" property: FAIL
    • HTMLMicrophoneElement interface: existence and properties of interface prototype object's @@unscopables property: FAIL
    • HTMLMicrophoneElement interface: attribute track: FAIL
    • HTMLMicrophoneElement interface: attribute error: FAIL
    • HTMLMicrophoneElement interface: attribute ontrack: FAIL
    • HTMLMicrophoneElement interface: attribute oncancel: FAIL
    • HTMLMicrophoneElement interface: attribute onerror: FAIL
    • HTMLMicrophoneElement must be primary interface of document.createElement('microphone'): FAIL
    • Stringification of document.createElement('microphone'): FAIL
    • HTMLMicrophoneElement interface: document.createElement('microphone') must inherit property "track" with the proper type: FAIL
    • HTMLMicrophoneElement interface: document.createElement('microphone') must inherit property "error" with the proper type: FAIL
    • HTMLMicrophoneElement interface: document.createElement('microphone') must inherit property "ontrack" with the proper type: FAIL
  • /html/semantics/permission-element/microphone/microphone-element-use-cases.https.html [wpt.fyi]
    • A microphone element with audio constraints requests microphone permission and yields single audio capture track on user click: FAIL
  • /html/semantics/permission-element/microphone/microphone-error-scenarios.https.html [wpt.fyi]
    • Denying microphone permission prompt triggers oncancel event and sets NotAllowedError: FAIL
    • Untrusted click on microphone element fails with InvalidStateError: FAIL
  • /html/semantics/permission-element/microphone/microphone-set-constraints.https.html [wpt.fyi]
    • HTMLMicrophoneElement initializes audio track and never video track: FAIL (Chrome: FAIL, Safari: FAIL)
    • HTMLMicrophoneElement applies constraints set in a capture-phase click listener: FAIL (Chrome: FAIL, Safari: FAIL)
    • HTMLMicrophoneElement setConstraints sanitization strips complex ranges without crashing: FAIL (Chrome: FAIL, Safari: FAIL)
  • /html/semantics/permission-element/microphone/microphone-track-attribute.https.html [wpt.fyi]
    • HTMLMicrophoneElement has track attribute and ontrack event handler: FAIL
  • /html/semantics/permission-element/usermedia/idlharness.window.html [wpt.fyi]
    • HTMLUserMediaElement interface: existence and properties of interface object: FAIL
    • HTMLUserMediaElement interface object length: FAIL
    • HTMLUserMediaElement interface object name: FAIL
    • HTMLUserMediaElement interface: existence and properties of interface prototype object: FAIL
    • HTMLUserMediaElement interface: existence and properties of interface prototype object's "constructor" property: FAIL
    • HTMLUserMediaElement interface: existence and properties of interface prototype object's @@unscopables property: FAIL
    • HTMLUserMediaElement interface: attribute onstream: FAIL
    • HTMLUserMediaElement interface: attribute oncancel: FAIL
    • HTMLUserMediaElement interface: attribute onerror: FAIL
    • HTMLUserMediaElement interface: attribute stream: FAIL
    • HTMLUserMediaElement interface: attribute error: FAIL
    • HTMLUserMediaElement interface: operation setConstraints(optional HTMLMediaStreamConstraints): FAIL
    • HTMLUserMediaElement must be primary interface of document.createElement('usermedia'): FAIL
    • Stringification of document.createElement('usermedia'): FAIL
    • HTMLUserMediaElement interface: document.createElement('usermedia') must inherit property "onstream" with the proper type: FAIL
    • HTMLUserMediaElement interface: document.createElement('usermedia') must inherit property "stream" with the proper type: FAIL
    • HTMLUserMediaElement interface: document.createElement('usermedia') must inherit property "error" with the proper type: FAIL
    • HTMLUserMediaElement interface: document.createElement('usermedia') must inherit property "setConstraints(optional HTMLMediaStreamConstraints)" with the proper type: FAIL
    • HTMLUserMediaElement interface: calling setConstraints(optional HTMLMediaStreamConstraints) on document.createElement('usermedia') with too few arguments must throw TypeError: FAIL
    • HTMLGeolocationElement interface: existence and properties of interface object: FAIL
    • HTMLGeolocationElement interface object length: FAIL
    • HTMLGeolocationElement interface object name: FAIL
    • HTMLGeolocationElement interface: existence and properties of interface prototype object: FAIL
    • HTMLGeolocationElement interface: existence and properties of interface prototype object's "constructor" property: FAIL
    • HTMLGeolocationElement interface: existence and properties of interface prototype object's @@unscopables property: FAIL
    • HTMLGeolocationElement interface: attribute position: FAIL
    • HTMLGeolocationElement interface: attribute error: FAIL
    • HTMLGeolocationElement interface: attribute autolocate: FAIL
    • HTMLGeolocationElement interface: attribute watch: FAIL
    • HTMLGeolocationElement interface: attribute onlocation: FAIL
    • HTMLGeolocationElement interface: attribute isValid: FAIL
    • HTMLGeolocationElement interface: attribute invalidReason: FAIL
    • HTMLGeolocationElement interface: attribute initialPermissionStatus: FAIL
    • HTMLGeolocationElement interface: attribute permissionStatus: FAIL
    • HTMLGeolocationElement interface: attribute onpromptaction: FAIL
    • HTMLGeolocationElement interface: attribute onpromptdismiss: FAIL
    • HTMLGeolocationElement interface: attribute onvalidationstatuschange: FAIL
  • /html/semantics/permission-element/usermedia/invalid-css-properties.html [wpt.fyi]
    • None of the listed properties should be applied: FAIL
  • /html/semantics/permission-element/usermedia/lang-attribute-update.html [wpt.fyi]
    • UserMedia element should dynamically change text when the lang attribute changes: FAIL
  • /html/semantics/permission-element/usermedia/legacy-mode/legacy-mode.https.html [wpt.fyi]
    • isTypeSupported existence and behavior: FAIL
    • Legacy attributes existence and validation: FAIL
    • Invalid type causes fallback/invalid state in legacy mode: FAIL
    • Standard events and stream attribute are not active in legacy mode: FAIL
  • /html/semantics/permission-element/usermedia/no-children-rendered.html [wpt.fyi]
    • The usermedia element should have no end tag or contents: FAIL
  • /html/semantics/permission-element/usermedia/no-focus.html [wpt.fyi]
    • UserMedia element is not focusable by script and does not autofocus in dialog without user activation: FAIL
    • UserMedia element and dialog autofocus are allowed with user activation: FAIL
  • /html/semantics/permission-element/usermedia/oncancel-attribute.html [wpt.fyi]
    • oncancel IDL attribute: FAIL
  • /html/semantics/permission-element/usermedia/onerror-attribute.html [wpt.fyi]
    • onerror IDL attribute: FAIL
  • /html/semantics/permission-element/usermedia/onstream-attribute.html [wpt.fyi]
    • onstream IDL attribute: FAIL
    • onstream HTML attribute: FAIL
  • /html/semantics/permission-element/usermedia/set-constraints-combinations.https.html [wpt.fyi]
    • Case 0: No constraints: FAIL
    • Case 1: Video set, Audio missing: FAIL
    • Case 2: Audio set, Video missing: FAIL
    • Case 3: Both set: FAIL
  • /html/semantics/permission-element/usermedia/usermedia-cancel-prompt.https.html [wpt.fyi]
    • Denying PEPC prompt triggers oncancel event and sets NotAllowedError: FAIL
  • /html/semantics/permission-element/usermedia/usermedia-iframe.https.html [wpt.fyi]
    • A usermedia element in an iframe without permissions policy delegation should be blocked: FAIL
  • /html/semantics/permission-element/usermedia/usermedia-set-constraints-sanitization.https.html [wpt.fyi]
    • HTMLUserMediaElement setConstraints sanitization handles video and audio constraint dictionaries correctly: FAIL (Chrome: FAIL, Safari: FAIL)
  • /html/semantics/permission-element/usermedia/usermedia-untrusted-click.https.html [wpt.fyi]
    • Untrusted click on usermedia element should fail with InvalidStateError: FAIL
Status: NEW → RESOLVED
Closed: 24 days ago
Resolution: --- → FIXED
Target Milestone: --- → 162 Branch
You need to log in before you can comment on or make changes to this bug.