Skip to content

Commit ad18f31

Browse files
committed
[SaferCPP] Fix smart pointer fails in WKMockMediaDevice.cpp & WKMessageListener.cpp
https://bugs.webkit.org/show_bug.cgi?id=294870 <rdar://154137011> Reviewed by Chris Dumez. Fix smart pointer fails in `WKMockMediaDevice.cpp` & `WKMessageListener.cpp` * Source/WebKit/SaferCPPExpectations/UncountedCallArgsCheckerExpectations: * Source/WebKit/UIProcess/API/C/WKMessageListener.cpp: (WKMessageListenerSendReply): * Source/WebKit/UIProcess/API/C/WKMockMediaDevice.cpp: (WKAddMockMediaDevice): (WKClearMockMediaDevices): (WKRemoveMockMediaDevice): (WKResetMockMediaDevices): (WKSetMockMediaDeviceIsEphemeral): Canonical link: https://commits.webkit.org/296546@main
1 parent 9811652 commit ad18f31

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

Source/WebKit/SaferCPPExpectations/UncountedCallArgsCheckerExpectations

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ UIProcess/API/C/WKGeolocationPermissionRequest.cpp
2222
UIProcess/API/C/WKHTTPCookieStoreRef.cpp
2323
UIProcess/API/C/WKInspector.cpp
2424
UIProcess/API/C/WKMediaKeySystemPermissionCallback.cpp
25-
UIProcess/API/C/WKMessageListener.cpp
26-
UIProcess/API/C/WKMockMediaDevice.cpp
2725
UIProcess/API/C/WKNotification.cpp
2826
UIProcess/API/C/WKNotificationManager.cpp
2927
UIProcess/API/C/WKNotificationPermissionRequest.cpp

Source/WebKit/UIProcess/API/C/WKMessageListener.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019 Apple Inc. All rights reserved.
2+
* Copyright (C) 2019-2025 Apple Inc. All rights reserved.
33
*
44
* Redistribution and use in source and binary forms, with or without
55
* modification, are permitted provided that the following conditions
@@ -38,5 +38,5 @@ WKTypeID WKMessageListenerGetTypeID()
3838

3939
void WKMessageListenerSendReply(WKMessageListenerRef listenerRef, WKTypeRef value)
4040
{
41-
toImpl(listenerRef)->sendReply(toImpl(value));
41+
toProtectedImpl(listenerRef)->sendReply(toImpl(value));
4242
}

Source/WebKit/UIProcess/API/C/WKMockMediaDevice.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2018 Apple Inc. All rights reserved.
2+
* Copyright (C) 2018-2025 Apple Inc. All rights reserved.
33
*
44
* Redistribution and use in source and binary forms, with or without
55
* modification, are permitted provided that the following conditions
@@ -39,7 +39,7 @@ using namespace WebKit;
3939
void WKAddMockMediaDevice(WKContextRef context, WKStringRef persistentId, WKStringRef label, WKStringRef type, WKDictionaryRef properties, bool isDefault)
4040
{
4141
#if ENABLE(MEDIA_STREAM)
42-
String typeString = WebKit::toImpl(type)->string();
42+
String typeString = WebKit::toProtectedImpl(type)->string();
4343
Variant<WebCore::MockMicrophoneProperties, WebCore::MockSpeakerProperties, WebCore::MockCameraProperties, WebCore::MockDisplayProperties> deviceProperties;
4444
if (typeString == "camera"_s) {
4545
WebCore::MockCameraProperties cameraProperties;
@@ -72,26 +72,26 @@ void WKAddMockMediaDevice(WKContextRef context, WKStringRef persistentId, WKStri
7272
}
7373
}
7474

75-
toImpl(context)->addMockMediaDevice({ WebKit::toImpl(persistentId)->string(), WebKit::toImpl(label)->string(), flags, isDefault, WTFMove(deviceProperties) });
75+
toProtectedImpl(context)->addMockMediaDevice({ WebKit::toProtectedImpl(persistentId)->string(), WebKit::toProtectedImpl(label)->string(), flags, isDefault, WTFMove(deviceProperties) });
7676
#endif
7777
}
7878

7979
void WKClearMockMediaDevices(WKContextRef context)
8080
{
81-
toImpl(context)->clearMockMediaDevices();
81+
toProtectedImpl(context)->clearMockMediaDevices();
8282
}
8383

8484
void WKRemoveMockMediaDevice(WKContextRef context, WKStringRef persistentId)
8585
{
86-
toImpl(context)->removeMockMediaDevice(WebKit::toImpl(persistentId)->string());
86+
toProtectedImpl(context)->removeMockMediaDevice(WebKit::toProtectedImpl(persistentId)->string());
8787
}
8888

8989
void WKResetMockMediaDevices(WKContextRef context)
9090
{
91-
toImpl(context)->resetMockMediaDevices();
91+
toProtectedImpl(context)->resetMockMediaDevices();
9292
}
9393

9494
void WKSetMockMediaDeviceIsEphemeral(WKContextRef context, WKStringRef persistentId, bool isEphemeral)
9595
{
96-
toImpl(context)->setMockMediaDeviceIsEphemeral(WebKit::toImpl(persistentId)->string(), isEphemeral);
96+
toProtectedImpl(context)->setMockMediaDeviceIsEphemeral(WebKit::toProtectedImpl(persistentId)->string(), isEphemeral);
9797
}

0 commit comments

Comments
 (0)