Bug 239643 - Add a smart pointer to hold JSValueProtect() objects
Summary: Add a smart pointer to hold JSValueProtect() objects
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: Safari 15
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-04-22 01:50 PDT by Kimmo Kinnunen
Modified: 2022-04-29 01:51 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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>