Skip to content

Commit

Permalink
Cherry-pick 6ada695. rdar://122396440
Browse files Browse the repository at this point in the history
    Crash at WebKit::WebExtensionContext::extensionCanAccessWebPage
    https://bugs.webkit.org/show_bug.cgi?id=268837
    rdar://122396440

    Reviewed by Brian Weinstein.

    As seen in https://webkit.org/b/268767, it's likely that the page is being deallocated
    and closed by the time the callback for storage is called and so the tab for the page is
    not found. Instead of calling the RELEASE_ASSERT_NOT_REACHED() if the extension doesn't
    have access to the tab, return false and just log an error.

    Add an ASSERT_NOT_REACHED() so we can at least keep track of how often this case is hit.

    * Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm:
    (WebKit::WebExtensionContext::extensionCanAccessWebPage):

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

Canonical link: https://commits.webkit.org/274066.6@safari-7619.1.3-branch
  • Loading branch information
kiaraarose authored and rjepstein committed Feb 8, 2024
1 parent 9cb457c commit 808413f
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,9 @@ static _WKWebExtensionContextError toAPI(WebExtensionContext::Error error)
return true;

RELEASE_LOG_ERROR(Extensions, "Access to this tab is not allowed for this extension");
RELEASE_ASSERT_NOT_REACHED();

ASSERT_NOT_REACHED();
return false;
}

void WebExtensionContext::setUniqueIdentifier(String&& uniqueIdentifier)
Expand Down

0 comments on commit 808413f

Please sign in to comment.