Skip to content

Commit

Permalink
Inject Web Extension bindings before the InjectedBundle.
Browse files Browse the repository at this point in the history
https://webkit.org/b/262576

Reviewed by Brian Weinstein.

Reverse the order of inject so Safari can inject after WebKit if needed.
Aslo adopt RefPtr in more spots to match Chris's change in bd0e961.

* Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp:
(WebKit::WebLocalFrameLoaderClient::dispatchDidStartProvisionalLoad):
(WebKit::WebLocalFrameLoaderClient::dispatchDidCommitLoad):
(WebKit::WebLocalFrameLoaderClient::dispatchDidFinishLoad):
(WebKit::WebLocalFrameLoaderClient::dispatchGlobalObjectAvailable):
(WebKit::WebLocalFrameLoaderClient::dispatchServiceWorkerGlobalObjectAvailable):

Canonical link: https://commits.webkit.org/268878@main
  • Loading branch information
xeenon committed Oct 4, 2023
1 parent 043b7ce commit 9fe72b9
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ void WebLocalFrameLoaderClient::dispatchDidStartProvisionalLoad()

#if ENABLE(WK_WEB_EXTENSIONS)
// Notify the extensions controller.
if (auto* extensionControllerProxy = webPage->webExtensionControllerProxy())
if (RefPtr extensionControllerProxy = webPage->webExtensionControllerProxy())
extensionControllerProxy->didStartProvisionalLoadForFrame(*webPage, m_frame, url);
#endif

Expand Down Expand Up @@ -617,7 +617,7 @@ void WebLocalFrameLoaderClient::dispatchDidCommitLoad(std::optional<HasInsecureC

#if ENABLE(WK_WEB_EXTENSIONS)
// Notify the extensions controller.
if (auto* extensionControllerProxy = webPage->webExtensionControllerProxy())
if (RefPtr extensionControllerProxy = webPage->webExtensionControllerProxy())
extensionControllerProxy->didCommitLoadForFrame(*webPage, m_frame, m_frame->url());
#endif

Expand Down Expand Up @@ -736,7 +736,7 @@ void WebLocalFrameLoaderClient::dispatchDidFinishLoad()

#if ENABLE(WK_WEB_EXTENSIONS)
// Notify the extensions controller.
if (auto* extensionControllerProxy = webPage->webExtensionControllerProxy())
if (RefPtr extensionControllerProxy = webPage->webExtensionControllerProxy())
extensionControllerProxy->didFinishLoadForFrame(*webPage, m_frame, m_frame->url());
#endif

Expand Down Expand Up @@ -1698,12 +1698,12 @@ void WebLocalFrameLoaderClient::dispatchGlobalObjectAvailable(DOMWrapperWorld& w
if (!webPage)
return;

webPage->injectedBundleLoaderClient().globalObjectIsAvailableForFrame(*webPage, m_frame, world);

#if ENABLE(WK_WEB_EXTENSIONS)
if (auto* extensionControllerProxy = webPage->webExtensionControllerProxy())
if (RefPtr extensionControllerProxy = webPage->webExtensionControllerProxy())
extensionControllerProxy->globalObjectIsAvailableForFrame(*webPage, m_frame, world);
#endif

webPage->injectedBundleLoaderClient().globalObjectIsAvailableForFrame(*webPage, m_frame, world);
}

void WebLocalFrameLoaderClient::dispatchServiceWorkerGlobalObjectAvailable(DOMWrapperWorld& world)
Expand All @@ -1712,12 +1712,12 @@ void WebLocalFrameLoaderClient::dispatchServiceWorkerGlobalObjectAvailable(DOMWr
if (!webPage)
return;

webPage->injectedBundleLoaderClient().serviceWorkerGlobalObjectIsAvailableForFrame(*webPage, m_frame, world);

#if ENABLE(WK_WEB_EXTENSIONS)
if (auto* extensionControllerProxy = webPage->webExtensionControllerProxy())
if (RefPtr extensionControllerProxy = webPage->webExtensionControllerProxy())
extensionControllerProxy->serviceWorkerGlobalObjectIsAvailableForFrame(*webPage, m_frame, world);
#endif

webPage->injectedBundleLoaderClient().serviceWorkerGlobalObjectIsAvailableForFrame(*webPage, m_frame, world);
}

void WebLocalFrameLoaderClient::willInjectUserScript(DOMWrapperWorld& world)
Expand Down

0 comments on commit 9fe72b9

Please sign in to comment.