Skip to content

Commit

Permalink
Cherry-pick b5ff6a9. rdar://123323719
Browse files Browse the repository at this point in the history
    Crash with Turn Off the Lights extension enabled
    https://bugs.webkit.org/show_bug.cgi?id=269924
    rdar://123323719

    Reviewed by Timothy Hatcher.

    This assertion is being hit:
    *** Assertion failure in -[_UIMenuBuilder _insertMenu:intoParentMenu:newParentMenu:], UIMenuBuilder.m:443

    This is because "duplicate" commands are being inserting into the menu. Per UIKit,
    commands cannot have the same selector if their propertyList is the same. To fix this,
    pass in a propertyList to each command so they can be distinguished from one other.

    * Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionCommandCocoa.mm:
    (+[_WKWebExtensionKeyCommand commandWithTitle:image:input:modifierFlags:handler:]):

    Canonical link: https://commits.webkit.org/275193@main

Identifier: 273664.1311@safari-7619.1.5-branch
  • Loading branch information
kiaraarose authored and MyahCobbs committed Feb 26, 2024
1 parent 2a57f59 commit 16c5a2b
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ + (instancetype)commandWithTitle:(NSString *)title image:(UIImage *)image input:
RELEASE_ASSERT(input.length);
RELEASE_ASSERT(handler);

auto *command = [self commandWithTitle:title image:image action:@selector(_performWithTarget:) input:input modifierFlags:modifierFlags propertyList:nil];
auto *propertyList = @{
@"title": title,
@"activation": input,
};

auto *command = [self commandWithTitle:title image:image action:@selector(_performWithTarget:) input:input modifierFlags:modifierFlags propertyList:propertyList];
if (!command)
return nil;

Expand Down

0 comments on commit 16c5a2b

Please sign in to comment.