Bug 213950 - [macOS] Tests that show system menu popups may fail when run concurrently
Summary: [macOS] Tests that show system menu popups may fail when run concurrently
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Wenson Hsieh
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-07-03 20:16 PDT by Wenson Hsieh
Modified: 2020-07-03 23:38 PDT (History)
6 users (show)

See Also:


Attachments
For EWS (4.03 KB, patch)
2020-07-03 20:34 PDT, Wenson Hsieh
darin: review+
Details | Formatted Diff | Diff
Remove NeverDestroyed. (3.98 KB, patch)
2020-07-03 21:58 PDT, Wenson Hsieh
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Wenson Hsieh 2020-07-03 20:16:28 PDT
<rdar://problem/64551566>
Comment 1 Wenson Hsieh 2020-07-03 20:34:22 PDT
Created attachment 403505 [details]
For EWS
Comment 2 Darin Adler 2020-07-03 21:14:58 PDT
Comment on attachment 403505 [details]
For EWS

View in context: https://bugs.webkit.org/attachment.cgi?id=403505&action=review

> Tools/WebKitTestRunner/mac/TestControllerMac.mm:134
> +    static NeverDestroyed<InstanceMethodSwizzler> cancelTrackingSwizzler { NSMenu.class, @selector(cancelTracking), reinterpret_cast<IMP>(swizzledCancelTracking) };
> +    static NeverDestroyed<ClassMethodSwizzler> menuPopUpSwizzler { NSMenu.class, @selector(popUpContextMenu:withEvent:forView:), reinterpret_cast<IMP>(swizzledPopUpContextMenu) };
> +    static NeverDestroyed<InstanceMethodSwizzler> carbonMenuPopUpSwizzler {

Do these really need NeverDestroyed? Maybe they would with ARC, but I don’t see why they need it without ARC. Keep in mind that NeverDestroyed does not make something stay alive for the duration of execution: being a global makes that happen. NeverDestroyed simply prevents the destructor from being called, which is useful for such objects if they have destructors.
Comment 3 Wenson Hsieh 2020-07-03 21:54:00 PDT
Comment on attachment 403505 [details]
For EWS

View in context: https://bugs.webkit.org/attachment.cgi?id=403505&action=review

>> Tools/WebKitTestRunner/mac/TestControllerMac.mm:134
>> +    static NeverDestroyed<InstanceMethodSwizzler> carbonMenuPopUpSwizzler {
> 
> Do these really need NeverDestroyed? Maybe they would with ARC, but I don’t see why they need it without ARC. Keep in mind that NeverDestroyed does not make something stay alive for the duration of execution: being a global makes that happen. NeverDestroyed simply prevents the destructor from being called, which is useful for such objects if they have destructors.

That's a good point — the `NeverDestroyed<>` doesn't add anything here.

I changed these into just `static InstanceMethodSwizzler …` and `static ClassMethodSwizzler …`.
Comment 4 Wenson Hsieh 2020-07-03 21:58:07 PDT
Created attachment 403507 [details]
Remove NeverDestroyed.
Comment 5 EWS 2020-07-03 23:38:57 PDT
Committed r263929: <https://trac.webkit.org/changeset/263929>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 403507 [details].