Bug 222125

Summary: AX: Update macOS attribute initializers to be more modern
Product: WebKit Reporter: chris fleizach <cfleizach>
Component: AccessibilityAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   

Description chris fleizach 2021-02-18 12:32:21 PST
> Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:1601
> +        auto tempArray = adoptNS([[NSMutableArray alloc] initWithArray:attributes]);
> +        [tempArray addObject:NSAccessibilityEmbeddedImageDescriptionAttribute];
> +        [tempArray addObject:NSAccessibilityURLAttribute];
> +        imageAttrs = tempArray.leakRef();
> +    }


adoptNS(...).leakRef() seems to be a no-op, so I'm not sure what it's doing here. This applies to all the other initializers in this function as well.

Additionally, it's a little weird that every attribute dictionary is initialized the first time this method is called, rather than have a separate static/NeverDestroyed method for each, so the cost is only paid when at item of the specific type is passed in.
Comment 1 Radar WebKit Bug Importer 2021-02-18 12:32:40 PST
<rdar://problem/74489846>