Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 525dd980ce78d4d809d726478919965cb2cd05f2
https://github.com/WebKit/WebKit/commit/525dd980ce78d4d809d726478919965cb2cd05f2
Author: Eric Carlson <[email protected]>
Date: 2026-07-06 (Mon, 06 Jul 2026)
Changed paths:
M
LayoutTests/fast/events/constructors/overconstrained-error-event-constructor-expected.txt
M
LayoutTests/fast/events/constructors/overconstrained-error-event-constructor.html
M
LayoutTests/fast/mediastream/mediastream-onaddtrack-and-overconstrainederror-code-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/mediacapture-streams/idlharness.https.window-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/mediacapture-streams/overconstrained_error.https-expected.txt
A Source/WebCore/Modules/mediastream/OverconstrainedError.cpp
M Source/WebCore/Modules/mediastream/OverconstrainedError.h
M Source/WebCore/Modules/mediastream/OverconstrainedError.idl
M Source/WebCore/Sources.txt
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
M Source/WebCore/dom/DOMException.h
Log Message:
-----------
[MediaStream] OverconstrainedError does not inherit from DOMException and has
no code attribute
https://bugs.webkit.org/show_bug.cgi?id=318127
rdar://180728516
Reviewed by Andy Estes.
The MediaCapture-Main specification defines OverconstrainedError as
`interface OverconstrainedError : DOMException`, with the `name`
"OverconstrainedError" and `code` of 0 (no legacy DOMException code
mapping). WebKit's implementation was a standalone RefCounted interface
that did not inherit from DOMException and exposed no `code` attribute,
which caused several spec-compliance failures, including
`new OverconstrainedError("x") instanceof DOMException` returning false
and `OverconstrainedError.length` being 0 instead of 1.
This patch makes OverconstrainedError inherit from DOMException, the
same pattern already used by RTCError, WebTransportError, and
GPUPipelineError. The two constructors now delegate to DOMException
with legacyCode = 0 and name "OverconstrainedError", giving instances
the expected `.code`, `.name`, and DOMException prototype chain for
free. The IDL constructor signature is also tightened to match the
spec: `constructor(DOMString constraint, optional DOMString message = "")`.
A new OverconstrainedError.cpp is added to host the constructors and
the lazy constraint() conversion (previously inline in the header),
and is wired into the unified-sources build and the Xcode project.
Layout test baselines are updated where the new behavior changes
PASS/FAIL state, and
fast/events/constructors/overconstrained-error-event-constructor.html
is adjusted to pass the now-required `constraint` argument.
No new tests, existing tests updated.
*
LayoutTests/fast/events/constructors/overconstrained-error-event-constructor-expected.txt:
*
LayoutTests/fast/events/constructors/overconstrained-error-event-constructor.html:
*
LayoutTests/fast/mediastream/mediastream-onaddtrack-and-overconstrainederror-code-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/mediacapture-streams/idlharness.https.window-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/mediacapture-streams/overconstrained_error.https-expected.txt:
* Source/WebCore/Modules/mediastream/OverconstrainedError.cpp: Copied from
Source/WebCore/Modules/mediastream/OverconstrainedError.idl.
(WebCore::OverconstrainedError::OverconstrainedError):
(WebCore::OverconstrainedError::constraint const):
* Source/WebCore/Modules/mediastream/OverconstrainedError.h:
(isType):
(WebCore::OverconstrainedError::create): Deleted.
(WebCore::OverconstrainedError::message const): Deleted.
(WebCore::OverconstrainedError::name const): Deleted.
(WebCore::OverconstrainedError::OverconstrainedError): Deleted.
(WebCore::OverconstrainedError::constraint const): Deleted.
* Source/WebCore/Modules/mediastream/OverconstrainedError.idl:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/dom/DOMException.h:
Canonical link: https://commits.webkit.org/316578@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications