Skip to content

Commit

Permalink
activeTab extension has access to page after turning the extension of…
Browse files Browse the repository at this point in the history
…f, 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 committed Mar 4, 2024
1 parent bb5e136 commit 7b1151e
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 7b1151e

Please sign in to comment.