Bug 239643

Summary: Add a smart pointer to hold JSValueProtect() objects
Product: WebKit Reporter: Kimmo Kinnunen <kkinnunen>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 15   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=239495

Description Kimmo Kinnunen 2022-04-22 01:50:35 PDT
Add a smart pointer to hold JSValueProtect() objects

From bug 239495
Comment 1 Kimmo Kinnunen 2022-04-22 01:51:49 PDT
Bugs like

void setWheelEventMonitorTestCallbackAndStartMonitoring(bool expectWheelEndOrCancel, bool expectMomentumEnd, WebCore::Frame& frame, JSContextRef context, JSObjectRef jsCallbackFunction)
{
    Page* page = frame.page();
    if (!page || !page->isMonitoringWheelEvents())
        return;

    JSValueProtect(context, jsCallbackFunction);

    if (auto wheelEventTestMonitor = page->wheelEventTestMonitor()) {
        wheelEventTestMonitor->setTestCallbackAndStartMonitoring(expectWheelEndOrCancel, expectMomentumEnd, [=](void) {
            JSObjectCallAsFunction(context, jsCallbackFunction, nullptr, 0, nullptr, nullptr);
            JSValueUnprotect(context, jsCallbackFunction);
        });
    }
}
Comment 2 Radar WebKit Bug Importer 2022-04-29 01:51:13 PDT
<rdar://problem/92513529>