Skip to content

Commit

Permalink
TestRunner addMockCameraDevice/addMockMicrophoneDevice should have it…
Browse files Browse the repository at this point in the history
…s last parameter as optional

https://bugs.webkit.org/show_bug.cgi?id=270432
rdar://123999260

Reviewed by Eric Carlson.

captureDeviceProperties is triggering stderr TypeError console logs.
We check whether properties is undefined and if so bail out early to not trigger these logs.

* Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::captureDeviceProperties):

Canonical link: https://commits.webkit.org/275622@main
  • Loading branch information
youennf committed Mar 4, 2024
1 parent 1866fce commit 2d02de5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,8 @@ interface TestRunner {

undefined installFakeHelvetica(DOMString configuration);

undefined addMockCameraDevice(DOMString persistentId, DOMString label, object properties);
undefined addMockMicrophoneDevice(DOMString persistentId, DOMString label, object properties);
undefined addMockCameraDevice(DOMString persistentId, DOMString label, optional object properties);
undefined addMockMicrophoneDevice(DOMString persistentId, DOMString label, optional object properties);
undefined addMockScreenDevice(DOMString persistentId, DOMString label);
undefined clearMockMediaDevices();
undefined removeMockMediaDevice(DOMString persistentId);
Expand Down
3 changes: 3 additions & 0 deletions Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1889,6 +1889,9 @@ static WKRetainPtr<WKDictionaryRef> captureDeviceProperties(JSValueRef propertie
{
auto context = mainFrameJSContext();

if (JSValueGetType(context, properties) == kJSTypeUndefined)
return { };

Vector<WKRetainPtr<WKStringRef>> strings;
Vector<WKStringRef> keys;
Vector<WKTypeRef> values;
Expand Down

0 comments on commit 2d02de5

Please sign in to comment.