Skip to content

Commit

Permalink
Remove unused didDetectXSS
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=247112

Reviewed by Youenn Fablet.

* Source/WebCore/loader/EmptyClients.cpp:
(WebCore::EmptyFrameLoaderClient::didDetectXSS): Deleted.
* Source/WebCore/loader/EmptyFrameLoaderClient.h:
* Source/WebCore/loader/FrameLoaderClient.h:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didDetectXSSForFrame): Deleted.
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.messages.in:
* Source/WebKit/WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h:
(API::InjectedBundle::PageLoaderClient::didRunInsecureContentForFrame):
(API::InjectedBundle::PageLoaderClient::didDetectXSSForFrame): Deleted.
* Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
(WebKit::InjectedBundlePageLoaderClient::didDetectXSSForFrame): Deleted.
* Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
* Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::didDetectXSS): Deleted.
* Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
* Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h:
* Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::didDetectXSS): Deleted.
* Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::InjectedBundlePage):
(WTR::InjectedBundlePage::didDetectXSSForFrame): Deleted.
* Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:

Canonical link: https://commits.webkit.org/256066@main
  • Loading branch information
Alex Christensen authored and achristensen07 committed Oct 27, 2022
1 parent 45729b1 commit 94530b0
Show file tree
Hide file tree
Showing 17 changed files with 1 addition and 70 deletions.
3 changes: 0 additions & 3 deletions Source/WebCore/loader/EmptyClients.cpp
Expand Up @@ -1045,9 +1045,6 @@ void EmptyFrameLoaderClient::didRunInsecureContent(SecurityOrigin&, const URL&)
{
}

void EmptyFrameLoaderClient::didDetectXSS(const URL&, bool)
{
}

ObjectContentType EmptyFrameLoaderClient::objectContentType(const URL&, const String&)
{
Expand Down
1 change: 0 additions & 1 deletion Source/WebCore/loader/EmptyFrameLoaderClient.h
Expand Up @@ -169,7 +169,6 @@ class WEBCORE_EXPORT EmptyFrameLoaderClient : public FrameLoaderClient {
bool canCachePage() const final;
void didDisplayInsecureContent() final;
void didRunInsecureContent(SecurityOrigin&, const URL&) final;
void didDetectXSS(const URL&, bool) final;
RefPtr<Frame> createFrame(const AtomString&, HTMLFrameOwnerElement&) final;
RefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement&, const URL&, const Vector<AtomString>&, const Vector<AtomString>&, const String&, bool) final;

Expand Down
1 change: 0 additions & 1 deletion Source/WebCore/loader/FrameLoaderClient.h
Expand Up @@ -232,7 +232,6 @@ class WEBCORE_EXPORT FrameLoaderClient {
// script) from an insecure source. Note that the insecure content can
// spread to other frames in the same origin.
virtual void didRunInsecureContent(SecurityOrigin&, const URL&) = 0;
virtual void didDetectXSS(const URL&, bool didBlockEntirePage) = 0;

virtual ResourceError cancelledError(const ResourceRequest&) const = 0;
virtual ResourceError blockedError(const ResourceRequest&) const = 0;
Expand Down
4 changes: 0 additions & 4 deletions Source/WebKit/UIProcess/WebPageProxy.cpp
Expand Up @@ -5596,10 +5596,6 @@ void WebPageProxy::didRunInsecureContentForFrame(FrameIdentifier frameID, const
m_navigationClient->didRunInsecureContent(*this, m_process->transformHandlesToObjects(userData.object()).get());
}

void WebPageProxy::didDetectXSSForFrame(FrameIdentifier, const UserData&)
{
}

void WebPageProxy::mainFramePluginHandlesPageScaleGestureDidChange(bool mainFramePluginHandlesPageScaleGesture)
{
m_mainFramePluginHandlesPageScaleGesture = mainFramePluginHandlesPageScaleGesture;
Expand Down
1 change: 0 additions & 1 deletion Source/WebKit/UIProcess/WebPageProxy.h
Expand Up @@ -2232,7 +2232,6 @@ class WebPageProxy final : public API::ObjectImpl<API::Object::Type::Page>
void didFirstVisuallyNonEmptyLayoutForFrame(WebCore::FrameIdentifier, const UserData&);
void didDisplayInsecureContentForFrame(WebCore::FrameIdentifier, const UserData&);
void didRunInsecureContentForFrame(WebCore::FrameIdentifier, const UserData&);
void didDetectXSSForFrame(WebCore::FrameIdentifier, const UserData&);
void mainFramePluginHandlesPageScaleGestureDidChange(bool);
void didStartProgress();
void didChangeProgress(double);
Expand Down
1 change: 0 additions & 1 deletion Source/WebKit/UIProcess/WebPageProxy.messages.in
Expand Up @@ -136,7 +136,6 @@ messages -> WebPageProxy {
DidReceiveTitleForFrame(WebCore::FrameIdentifier frameID, String title, WebKit::UserData userData)
DidDisplayInsecureContentForFrame(WebCore::FrameIdentifier frameID, WebKit::UserData userData)
DidRunInsecureContentForFrame(WebCore::FrameIdentifier frameID, WebKit::UserData userData)
DidDetectXSSForFrame(WebCore::FrameIdentifier frameID, WebKit::UserData userData)
DidSameDocumentNavigationForFrame(WebCore::FrameIdentifier frameID, uint64_t navigationID, uint32_t type, URL url, WebKit::UserData userData)
DidSameDocumentNavigationForFrameViaJSHistoryAPI(WebCore::FrameIdentifier frameID, uint32_t type, URL url, struct WebKit::NavigationActionData navigationActionData, WebKit::UserData userData);
DidChangeMainDocument(WebCore::FrameIdentifier frameID)
Expand Down
Expand Up @@ -71,7 +71,6 @@ class PageLoaderClient {
virtual void didRemoveFrameFromHierarchy(WebKit::WebPage&, WebKit::WebFrame&, RefPtr<API::Object>&) { }
virtual void didDisplayInsecureContentForFrame(WebKit::WebPage&, WebKit::WebFrame&, RefPtr<API::Object>&) { }
virtual void didRunInsecureContentForFrame(WebKit::WebPage&, WebKit::WebFrame&, RefPtr<API::Object>&) { }
virtual void didDetectXSSForFrame(WebKit::WebPage&, WebKit::WebFrame&, RefPtr<API::Object>&) { }

virtual void didFirstLayoutForFrame(WebKit::WebPage&, WebKit::WebFrame&, RefPtr<API::Object>&) { }
virtual void didFirstVisuallyNonEmptyLayoutForFrame(WebKit::WebPage&, WebKit::WebFrame&, RefPtr<API::Object>&) { }
Expand Down
Expand Up @@ -208,16 +208,6 @@ void InjectedBundlePageLoaderClient::didRunInsecureContentForFrame(WebPage& page
userData = adoptRef(toImpl(userDataToPass));
}

void InjectedBundlePageLoaderClient::didDetectXSSForFrame(WebPage& page, WebFrame& frame, RefPtr<API::Object>& userData)
{
if (!m_client.didDetectXSSForFrame)
return;

WKTypeRef userDataToPass = nullptr;
m_client.didDetectXSSForFrame(toAPI(&page), toAPI(&frame), &userDataToPass, m_client.base.clientInfo);
userData = adoptRef(toImpl(userDataToPass));
}

void InjectedBundlePageLoaderClient::didFirstLayoutForFrame(WebPage& page, WebFrame& frame, RefPtr<API::Object>& userData)
{
if (!m_client.didFirstLayoutForFrame)
Expand Down
Expand Up @@ -62,7 +62,6 @@ class InjectedBundlePageLoaderClient : public API::Client<WKBundlePageLoaderClie
void didRemoveFrameFromHierarchy(WebPage&, WebFrame&, RefPtr<API::Object>&) override;
void didDisplayInsecureContentForFrame(WebPage&, WebFrame&, RefPtr<API::Object>&) override;
void didRunInsecureContentForFrame(WebPage&, WebFrame&, RefPtr<API::Object>&) override;
void didDetectXSSForFrame(WebPage&, WebFrame&, RefPtr<API::Object>&) override;

void didFirstLayoutForFrame(WebPage&, WebFrame&, RefPtr<API::Object>&) override;
void didFirstVisuallyNonEmptyLayoutForFrame(WebPage&, WebFrame&, RefPtr<API::Object>&) override;
Expand Down
13 changes: 0 additions & 13 deletions Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
Expand Up @@ -1315,19 +1315,6 @@ void WebFrameLoaderClient::didRunInsecureContent(SecurityOrigin&, const URL&)
webPage->send(Messages::WebPageProxy::DidRunInsecureContentForFrame(m_frame->frameID(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
}

void WebFrameLoaderClient::didDetectXSS(const URL&, bool)
{
WebPage* webPage = m_frame->page();
if (!webPage)
return;

RefPtr<API::Object> userData;

webPage->injectedBundleLoaderClient().didDetectXSSForFrame(*webPage, m_frame, userData);

webPage->send(Messages::WebPageProxy::DidDetectXSSForFrame(m_frame->frameID(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
}

ResourceError WebFrameLoaderClient::cancelledError(const ResourceRequest& request) const
{
return WebKit::cancelledError(request);
Expand Down
Expand Up @@ -164,7 +164,6 @@ class WebFrameLoaderClient final : public WebCore::FrameLoaderClient {

void didDisplayInsecureContent() final;
void didRunInsecureContent(WebCore::SecurityOrigin&, const URL&) final;
void didDetectXSS(const URL&, bool didBlockEntirePage) final;

#if ENABLE(SERVICE_WORKER)
void didFinishServiceWorkerPageRegistration(bool success) final;
Expand Down
Expand Up @@ -161,7 +161,6 @@ class WebFrameLoaderClient : public WebCore::FrameLoaderClient, public CanMakeWe

void didDisplayInsecureContent() final;
void didRunInsecureContent(WebCore::SecurityOrigin&, const URL&) final;
void didDetectXSS(const URL&, bool didBlockEntirePage) final;

WebCore::ResourceError cancelledError(const WebCore::ResourceRequest&) const final;
WebCore::ResourceError blockedError(const WebCore::ResourceRequest&) const final;
Expand Down
11 changes: 0 additions & 11 deletions Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm
Expand Up @@ -1096,17 +1096,6 @@ static void addRedirectURL(WebHistoryItem *item, const String& url)
}
}

void WebFrameLoaderClient::didDetectXSS(const URL& insecureURL, bool didBlockEntirePage)
{
WebView *webView = getWebView(m_webFrame.get());
WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
if (implementations->didDetectXSSFunc) {
// FIXME: must pass didBlockEntirePage if we want to do more on mac than just pass tests.
NSURL* insecureNSURL = insecureURL;
CallFrameLoadDelegate(implementations->didDetectXSSFunc, webView, @selector(webView:didDetectXSS:), insecureNSURL);
}
}

WebCore::ResourceError WebFrameLoaderClient::cancelledError(const WebCore::ResourceRequest& request) const
{
return [NSError _webKitErrorWithDomain:NSURLErrorDomain code:NSURLErrorCancelled URL:request.url()];
Expand Down
Expand Up @@ -736,11 +736,6 @@ void WebFrameLoaderClient::didRunInsecureContent(SecurityOrigin& origin, const U
frameLoadDelegatePriv2->didRunInsecureContent(webView, webSecurityOrigin.get());
}

void WebFrameLoaderClient::didDetectXSS(const URL&, bool)
{
// FIXME: propogate call into the private delegate.
}

ResourceError WebFrameLoaderClient::cancelledError(const ResourceRequest& request) const
{
// FIXME: Need ChickenCat to include CFNetwork/CFURLError.h to get these values
Expand Down
Expand Up @@ -126,7 +126,6 @@ class WebFrameLoaderClient : public WebCore::FrameLoaderClient {

void didDisplayInsecureContent() override;
void didRunInsecureContent(WebCore::SecurityOrigin&, const URL&) override;
void didDetectXSS(const URL&, bool didBlockEntirePage) override;

WebCore::ResourceError cancelledError(const WebCore::ResourceRequest&) const override;
WebCore::ResourceError blockedError(const WebCore::ResourceRequest&) const override;
Expand Down
14 changes: 1 addition & 13 deletions Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
Expand Up @@ -269,7 +269,7 @@ InjectedBundlePage::InjectedBundlePage(WKBundlePageRef page)
didHandleOnloadEventsForFrame,
0, // didLayoutForFrame
0, // didNewFirstVisuallyNonEmptyLayout_unavailable
didDetectXSSForFrame,
0, // didDetectXSSForFrame
0, // shouldGoToBackForwardListItem
0, // didCreateGlobalObjectForFrame
0, // willDisconnectDOMWindowExtensionFromGlobalObject
Expand Down Expand Up @@ -565,11 +565,6 @@ void InjectedBundlePage::didDisplayInsecureContentForFrame(WKBundlePageRef page,
static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didDisplayInsecureContentForFrame(frame);
}

void InjectedBundlePage::didDetectXSSForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef*, const void* clientInfo)
{
static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didDetectXSSForFrame(frame);
}

void InjectedBundlePage::didRunInsecureContentForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef*, const void* clientInfo)
{
static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didRunInsecureContentForFrame(frame);
Expand Down Expand Up @@ -1003,13 +998,6 @@ void InjectedBundlePage::didRunInsecureContentForFrame(WKBundleFrameRef)
injectedBundle.outputText("didRunInsecureContent\n"_s);
}

void InjectedBundlePage::didDetectXSSForFrame(WKBundleFrameRef)
{
auto& injectedBundle = InjectedBundle::singleton();
if (injectedBundle.testRunner()->shouldDumpFrameLoadCallbacks())
injectedBundle.outputText("didDetectXSS\n"_s);
}

void InjectedBundlePage::didInitiateLoadForResource(WKBundlePageRef page, WKBundleFrameRef, uint64_t identifier, WKURLRequestRef request, bool)
{
if (!InjectedBundle::singleton().isTestRunning())
Expand Down
2 changes: 0 additions & 2 deletions Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h
Expand Up @@ -70,7 +70,6 @@ class InjectedBundlePage {
static void didHandleOnloadEventsForFrame(WKBundlePageRef, WKBundleFrameRef, const void*);
static void didDisplayInsecureContentForFrame(WKBundlePageRef, WKBundleFrameRef, WKTypeRef*, const void*);
static void didRunInsecureContentForFrame(WKBundlePageRef, WKBundleFrameRef, WKTypeRef*, const void*);
static void didDetectXSSForFrame(WKBundlePageRef, WKBundleFrameRef, WKTypeRef*, const void*);
static void didInitiateLoadForResource(WKBundlePageRef, WKBundleFrameRef, uint64_t identifier, WKURLRequestRef, bool pageLoadIsProvisional, const void*);
static WKURLRequestRef willSendRequestForFrame(WKBundlePageRef, WKBundleFrameRef, uint64_t identifier, WKURLRequestRef, WKURLResponseRef, const void*);
static void didReceiveResponseForResource(WKBundlePageRef, WKBundleFrameRef, uint64_t identifier, WKURLResponseRef, const void*);
Expand All @@ -96,7 +95,6 @@ class InjectedBundlePage {
void didHandleOnloadEventsForFrame(WKBundleFrameRef);
void didDisplayInsecureContentForFrame(WKBundleFrameRef);
void didRunInsecureContentForFrame(WKBundleFrameRef);
void didDetectXSSForFrame(WKBundleFrameRef);
void willInjectUserScriptForFrame();

// Resource Load Client
Expand Down

0 comments on commit 94530b0

Please sign in to comment.