Skip to content

Commit

Permalink
Cherry-pick 7b1151e. rdar://124016968
Browse files Browse the repository at this point in the history
    activeTab extension has access to page after turning the extension off, then back on
    https://bugs.webkit.org/show_bug.cgi?id=270454
    rdar://124016968

    Reviewed by Timothy Hatcher.

    When an extension is unloaded, clear the map of open tabs and windows. That will clear any active tab permissions,
    and lead to new window and tab IDs getting created if the extension is turned back on.

    While we're here, clear a bunch more extension state that should be refreshed if the extension is loaded again.

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

    Canonical link: https://commits.webkit.org/275651@main
  • Loading branch information
b-weinstein authored and Mohsin Qureshi committed Mar 7, 2024
1 parent fca96c1 commit 5e6dae0
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,22 @@ static _WKWebExtensionContextError toAPI(WebExtensionContext::Error error)
m_extensionController = nil;
m_contentScriptWorld = nullptr;

m_tabMap.clear();
m_extensionPageTabMap.clear();

m_windowMap.clear();
m_windowOrderVector.clear();
m_focusedWindowIdentifier = std::nullopt;

m_actionWindowMap.clear();
m_actionTabMap.clear();
m_defaultAction = nullptr;
m_popupPageActionMap.clear();

m_ports.clear();
m_portQueuedMessages.clear();
m_nativePortMap.clear();

return true;
}

Expand Down

0 comments on commit 5e6dae0

Please sign in to comment.