Skip to content

Commit

Permalink
Remove WebKit::WebDocumentLoader
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=267895
rdar://121405086

Reviewed by Brady Eidson.

This is the first step towards untangling WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction
which has no business looking for a DocumentLoader because the frame may be a RemoteFrame.

WebKit::WebDocumentLoader is just a WebCore::DocumentLoader with a navigation identifier.
Move the navigation identifier to WebCore::DocumentLoader, move all the other code to better
places, and remove the abstraction.  Now WebKit::WebFrameLoaderClient has no DocumentLoader
information that the caller in WebCore doesn't have.

* Source/WebCore/loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::detachFromFrame):
(WebCore::DocumentLoader::setNavigationID):
* Source/WebCore/loader/DocumentLoader.h:
(WebCore::DocumentLoader::navigationID const):
* Source/WebCore/loader/FrameLoader.cpp:
(WebCore::FrameLoader::loaderForWebsitePolicies const):
* Source/WebCore/loader/FrameLoader.h:
* Source/WebCore/loader/LocalFrameLoaderClient.h:
* Source/WebCore/page/LocalFrame.h:
* Source/WebKit/Sources.txt:
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::policySourceDocumentLoaderForFrame):
(WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
* Source/WebKit/WebProcess/Storage/RemoteWorkerFrameLoaderClient.cpp:
(WebKit::RemoteWorkerFrameLoaderClient::createDocumentLoader):
* Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp:
* Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
* Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp:
(WebKit::WebLocalFrameLoaderClient::documentLoaderDetached):
(WebKit::WebLocalFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad):
(WebKit::WebLocalFrameLoaderClient::dispatchDidChangeProvisionalURL):
(WebKit::WebLocalFrameLoaderClient::dispatchDidStartProvisionalLoad):
(WebKit::WebLocalFrameLoaderClient::dispatchDidCommitLoad):
(WebKit::WebLocalFrameLoaderClient::dispatchDidFailProvisionalLoad):
(WebKit::WebLocalFrameLoaderClient::dispatchDidFailLoad):
(WebKit::WebLocalFrameLoaderClient::dispatchDidFinishDocumentLoad):
(WebKit::WebLocalFrameLoaderClient::dispatchDidFinishLoad):
(WebKit::WebLocalFrameLoaderClient::dispatchDecidePolicyForResponse):
(WebKit::WebLocalFrameLoaderClient::applyToDocumentLoader):
(WebKit::WebLocalFrameLoaderClient::updateCachedDocumentLoader):
* Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.h:
* Source/WebKit/WebProcess/WebPage/WebDocumentLoader.cpp: Removed.
* Source/WebKit/WebProcess/WebPage/WebDocumentLoader.h: Removed.
* Source/WebKit/WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::didReceivePolicyDecision):
(WebKit::WebFrame::documentLoaderDetached): Deleted.
* Source/WebKit/WebProcess/WebPage/WebFrame.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didSameDocumentNavigationForFrame):
(WebKit::WebPage::createDocumentLoader):
(WebKit::WebPage::updateCachedDocumentLoader):
* Source/WebKit/WebProcess/WebPage/WebPage.h:

Canonical link: https://commits.webkit.org/273347@main
  • Loading branch information
achristensen07 committed Jan 23, 2024
1 parent 86b022b commit d9bdd69
Show file tree
Hide file tree
Showing 20 changed files with 65 additions and 169 deletions.
11 changes: 10 additions & 1 deletion Source/WebCore/loader/DocumentLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1495,7 +1495,7 @@ void DocumentLoader::attachToFrame()
DOCUMENTLOADER_RELEASE_LOG("DocumentLoader::attachToFrame: m_frame=%p", m_frame.get());
}

void DocumentLoader::detachFromFrame(LoadWillContinueInAnotherProcess)
void DocumentLoader::detachFromFrame(LoadWillContinueInAnotherProcess loadWillContinueInAnotherProcess)
{
DOCUMENTLOADER_RELEASE_LOG("DocumentLoader::detachFromFrame: m_frame=%p", m_frame.get());

Expand Down Expand Up @@ -1529,11 +1529,20 @@ void DocumentLoader::detachFromFrame(LoadWillContinueInAnotherProcess)
if (!m_frame)
return;

if (auto navigationID = std::exchange(m_navigationID, 0))
m_frame->loader().client().documentLoaderDetached(navigationID, loadWillContinueInAnotherProcess);

InspectorInstrumentation::loaderDetachedFromFrame(*m_frame, *this);

observeFrame(nullptr);
}

void DocumentLoader::setNavigationID(uint64_t navigationID)
{
ASSERT(navigationID);
m_navigationID = navigationID;
}

void DocumentLoader::clearMainResourceLoader()
{
m_loadingMainResource = false;
Expand Down
5 changes: 5 additions & 0 deletions Source/WebCore/loader/DocumentLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,9 @@ class DocumentLoader
void contentFilterHandleProvisionalLoadFailure(const ResourceError&);
#endif

uint64_t navigationID() const { return m_navigationID; }
WEBCORE_EXPORT void setNavigationID(uint64_t);

protected:
WEBCORE_EXPORT DocumentLoader(const ResourceRequest&, const SubstituteData&);

Expand Down Expand Up @@ -624,6 +627,8 @@ class DocumentLoader
// benefit of the various policy handlers.
NavigationAction m_triggeringAction;

uint64_t m_navigationID { 0 };

// We retain all the received responses so we can play back the
// WebResourceLoadDelegate messages if the item is loaded from the
// back/forward cache.
Expand Down
10 changes: 10 additions & 0 deletions Source/WebCore/loader/FrameLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4628,6 +4628,16 @@ RefPtr<DocumentLoader> FrameLoader::protectedProvisionalDocumentLoader() const
return m_provisionalDocumentLoader;
}

RefPtr<DocumentLoader> FrameLoader::loaderForWebsitePolicies(CanIncludeCurrentDocumentLoader canIncludeCurrentDocumentLoader) const
{
RefPtr loader = policyDocumentLoader();
if (!loader)
loader = provisionalDocumentLoader();
if (!loader && canIncludeCurrentDocumentLoader == CanIncludeCurrentDocumentLoader::Yes)
loader = documentLoader();
return loader;
}

} // namespace WebCore

#undef PAGE_ID
Expand Down
3 changes: 3 additions & 0 deletions Source/WebCore/loader/FrameLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ class FrameLoader final : public CanMakeCheckedPtr {
RefPtr<DocumentLoader> protectedProvisionalDocumentLoader() const;
FrameState state() const { return m_state; }

enum class CanIncludeCurrentDocumentLoader : bool { No, Yes };
WEBCORE_EXPORT RefPtr<DocumentLoader> loaderForWebsitePolicies(CanIncludeCurrentDocumentLoader = CanIncludeCurrentDocumentLoader::Yes) const;

bool shouldReportResourceTimingToParentFrame() const { return m_shouldReportResourceTimingToParentFrame; };

#if PLATFORM(IOS_FAMILY)
Expand Down
3 changes: 3 additions & 0 deletions Source/WebCore/loader/LocalFrameLoaderClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class SharedBuffer;
class SubstituteData;
class Widget;

enum class LoadWillContinueInAnotherProcess : bool;
enum class LockBackForwardList : bool;
enum class UsedLegacyTLS : bool;
enum class WasPrivateRelayed : bool;
Expand Down Expand Up @@ -378,6 +379,8 @@ class WEBCORE_EXPORT LocalFrameLoaderClient : public FrameLoaderClient {
#if ENABLE(WINDOW_PROXY_PROPERTY_ACCESS_NOTIFICATION)
virtual void didAccessWindowProxyPropertyViaOpener(SecurityOriginData&&, WindowProxyProperty) { }
#endif

virtual void documentLoaderDetached(uint64_t, LoadWillContinueInAnotherProcess) { }
};

} // namespace WebCore
2 changes: 2 additions & 0 deletions Source/WebCore/page/LocalFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,8 @@ class LocalFrame final : public Frame {
void didAccessWindowProxyPropertyViaOpener(WindowProxyProperty);
#endif

WEBCORE_EXPORT RefPtr<DocumentLoader> loaderForWebsitePolicies() const;

protected:
void frameWasDisconnectedFromOwner() const final;

Expand Down
1 change: 0 additions & 1 deletion Source/WebKit/Sources.txt
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,6 @@ WebProcess/WebPage/WebContextMenu.cpp
WebProcess/WebPage/WebCookieCache.cpp
WebProcess/WebPage/WebCookieJar.cpp
WebProcess/WebPage/WebDisplayRefreshMonitor.cpp
WebProcess/WebPage/WebDocumentLoader.cpp
WebProcess/WebPage/WebFoundTextRangeController.cpp
WebProcess/WebPage/WebFrame.cpp
WebProcess/WebPage/WebHistoryItemClient.cpp
Expand Down
6 changes: 0 additions & 6 deletions Source/WebKit/WebKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@
1A5705111BE410E600874AF1 /* BlockSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A5705101BE410E500874AF1 /* BlockSPI.h */; };
1A57109F1ABA0027002FABBE /* WKWebsiteDataStoreRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A57109D1ABA0027002FABBE /* WKWebsiteDataStoreRef.h */; settings = {ATTRIBUTES = (Private, ); }; };
1A5B1C511898606F004FCF9B /* WKNavigation.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A5B1C4F1898606F004FCF9B /* WKNavigation.h */; settings = {ATTRIBUTES = (Public, ); }; };
1A5B1C5518987EDF004FCF9B /* WebDocumentLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A5B1C5318987EDF004FCF9B /* WebDocumentLoader.h */; };
1A5E4DA412D3BD3D0099A2BB /* TextCheckerState.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A5E4DA312D3BD3D0099A2BB /* TextCheckerState.h */; };
1A60224C18C16B9F00C3E8C9 /* VisitedLinkStoreMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A60224A18C16B9F00C3E8C9 /* VisitedLinkStoreMessageReceiver.cpp */; };
1A60224D18C16B9F00C3E8C9 /* VisitedLinkStoreMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A60224B18C16B9F00C3E8C9 /* VisitedLinkStoreMessages.h */; };
Expand Down Expand Up @@ -3334,8 +3333,6 @@
1A57109D1ABA0027002FABBE /* WKWebsiteDataStoreRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebsiteDataStoreRef.h; sourceTree = "<group>"; };
1A5B1C4E1898606F004FCF9B /* WKNavigation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKNavigation.mm; sourceTree = "<group>"; };
1A5B1C4F1898606F004FCF9B /* WKNavigation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNavigation.h; sourceTree = "<group>"; };
1A5B1C5218987EDF004FCF9B /* WebDocumentLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebDocumentLoader.cpp; sourceTree = "<group>"; };
1A5B1C5318987EDF004FCF9B /* WebDocumentLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDocumentLoader.h; sourceTree = "<group>"; };
1A5E4DA312D3BD3D0099A2BB /* TextCheckerState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextCheckerState.h; sourceTree = "<group>"; };
1A60224918C16B0800C3E8C9 /* VisitedLinkStore.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = VisitedLinkStore.messages.in; sourceTree = "<group>"; };
1A60224A18C16B9F00C3E8C9 /* VisitedLinkStoreMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VisitedLinkStoreMessageReceiver.cpp; sourceTree = "<group>"; };
Expand Down Expand Up @@ -13171,8 +13168,6 @@
5C7FB46F21E97C0C009E3241 /* WebCookieJar.h */,
7AFA6F6F2A9F58FB0055322A /* WebDisplayRefreshMonitor.cpp */,
7AFA6F702A9F58FB0055322A /* WebDisplayRefreshMonitor.h */,
1A5B1C5218987EDF004FCF9B /* WebDocumentLoader.cpp */,
1A5B1C5318987EDF004FCF9B /* WebDocumentLoader.h */,
E55CFD4D279D31C3002F1020 /* WebFoundTextRangeController.cpp */,
E55CFD4C279D31C3002F1020 /* WebFoundTextRangeController.h */,
BC111ADC112F5B9300337BAB /* WebFrame.cpp */,
Expand Down Expand Up @@ -16074,7 +16069,6 @@
E3866B082399A2D100F88FE9 /* WebDeviceOrientationUpdateProviderProxyMessages.h in Headers */,
CD19A26E1A13E834008D650E /* WebDiagnosticLoggingClient.h in Headers */,
7AFA6F712A9F590A0055322A /* WebDisplayRefreshMonitor.h in Headers */,
1A5B1C5518987EDF004FCF9B /* WebDocumentLoader.h in Headers */,
BC032D7B10F4378D0058C15A /* WebDragClient.h in Headers */,
BCA0EF9F12332642007D3CFB /* WebEditCommandProxy.h in Headers */,
BC032D7D10F4378D0058C15A /* WebEditorClient.h in Headers */,
Expand Down
7 changes: 3 additions & 4 deletions Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include "RemoteWorkerFrameLoaderClient.h"
#include "WebCompiledContentRuleList.h"
#include "WebCoreArgumentCoders.h"
#include "WebDocumentLoader.h"
#include "WebErrors.h"
#include "WebFrame.h"
#include "WebLocalFrameLoaderClient.h"
Expand Down Expand Up @@ -310,8 +309,8 @@ static RefPtr<DocumentLoader> policySourceDocumentLoaderForFrame(const LocalFram
if (!mainFrame)
return { };

auto canIncludeCurrentDocumentLoader = isMainFrameNavigation ? WebDocumentLoader::CanIncludeCurrentDocumentLoader::No : WebDocumentLoader::CanIncludeCurrentDocumentLoader::Yes;
RefPtr<DocumentLoader> mainFrameDocumentLoader = WebDocumentLoader::loaderForWebsitePolicies(*mainFrame, canIncludeCurrentDocumentLoader);
auto canIncludeCurrentDocumentLoader = isMainFrameNavigation ? FrameLoader::CanIncludeCurrentDocumentLoader::No : FrameLoader::CanIncludeCurrentDocumentLoader::Yes;
auto mainFrameDocumentLoader = mainFrame->loader().loaderForWebsitePolicies(canIncludeCurrentDocumentLoader);

auto policySourceDocumentLoader = mainFrameDocumentLoader;
if (policySourceDocumentLoader && !policySourceDocumentLoader->request().url().hasSpecialScheme() && frame.document()->url().protocolIsInHTTPFamily())
Expand Down Expand Up @@ -495,7 +494,7 @@ void WebLoaderStrategy::scheduleLoadFromNetworkProcess(ResourceLoader& resourceL
loadParameters.isMainResourceNavigationForAnyFrame = resourceLoader.frame() && resourceLoader.options().mode == FetchOptions::Mode::Navigate;
if (loadParameters.isMainResourceNavigationForAnyFrame) {
if (auto documentLoader = resourceLoader.documentLoader()) {
loadParameters.navigationID = static_cast<WebDocumentLoader&>(*documentLoader).navigationID();
loadParameters.navigationID = documentLoader->navigationID();
loadParameters.navigationRequester = documentLoader->triggeringAction().requester();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "RemoteWorkerFrameLoaderClient.h"

#include "Logging.h"
#include "WebDocumentLoader.h"
#include <WebCore/DocumentLoader.h>

namespace WebKit {

Expand All @@ -40,7 +40,7 @@ RemoteWorkerFrameLoaderClient::RemoteWorkerFrameLoaderClient(WebPageProxyIdentif

Ref<WebCore::DocumentLoader> RemoteWorkerFrameLoaderClient::createDocumentLoader(const WebCore::ResourceRequest& request, const WebCore::SubstituteData& substituteData)
{
return WebDocumentLoader::create(request, substituteData);
return WebCore::DocumentLoader::create(request, substituteData);
}

} // namespace WebKit
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#include "WebCookieJar.h"
#include "WebCoreArgumentCoders.h"
#include "WebDatabaseProvider.h"
#include "WebDocumentLoader.h"
#include "WebLocalFrameLoaderClient.h"
#include "WebMessagePortChannelProvider.h"
#include "WebNotificationClient.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@
#include "MessageSenderInlines.h"
#include "NavigationActionData.h"
#include "NavigationActionPolicyParameters.h"
#include "WebDocumentLoader.h"
#include "WebFrame.h"
#include "WebMouseEvent.h"
#include "WebPage.h"
#include "WebPageProxyMessages.h"
#include "WebProcess.h"
#include <WebCore/DocumentLoader.h>
#include <WebCore/FrameLoader.h>
#include <WebCore/LocalFrame.h>
#include <WebCore/PolicyChecker.h>
Expand Down Expand Up @@ -121,9 +121,9 @@ void WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(const Navigat

// FIXME: When we receive a redirect after the navigation policy has been decided for the initial request,
// the provisional load's DocumentLoader needs to receive navigation policy decisions. We need a better model for this state.
RefPtr<WebDocumentLoader> documentLoader;
RefPtr<DocumentLoader> documentLoader;
if (coreFrame)
documentLoader = WebDocumentLoader::loaderForWebsitePolicies(*coreFrame);
documentLoader = coreFrame->loader().loaderForWebsitePolicies();

auto& mouseEventData = navigationAction.mouseEventData();
NavigationActionData navigationActionData {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
#include "WebAutomationSessionProxy.h"
#include "WebBackForwardListProxy.h"
#include "WebCoreArgumentCoders.h"
#include "WebDocumentLoader.h"
#include "WebErrors.h"
#include "WebEvent.h"
#include "WebFrame.h"
Expand Down Expand Up @@ -215,6 +214,12 @@ void WebLocalFrameLoaderClient::detachedFromParent3()
notImplemented();
}

void WebLocalFrameLoaderClient::documentLoaderDetached(uint64_t navigationID, LoadWillContinueInAnotherProcess loadWillContinueInAnotherProcess)
{
if (RefPtr page = m_frame->page(); page && loadWillContinueInAnotherProcess == LoadWillContinueInAnotherProcess::No)
page->send(Messages::WebPageProxy::DidDestroyNavigation(navigationID));
}

void WebLocalFrameLoaderClient::assignIdentifierToInitialRequest(ResourceLoaderIdentifier identifier, DocumentLoader* loader, const ResourceRequest& request)
{
RefPtr webPage = m_frame->page();
Expand Down Expand Up @@ -362,7 +367,7 @@ void WebLocalFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLo
if (!webPage)
return;

RefPtr documentLoader = static_cast<WebDocumentLoader*>(m_frame->coreLocalFrame()->loader().provisionalDocumentLoader());
RefPtr documentLoader = m_frame->coreLocalFrame()->loader().provisionalDocumentLoader();
if (!documentLoader) {
WebLocalFrameLoaderClient_RELEASE_LOG_FAULT(Loading, "dispatchDidReceiveServerRedirectForProvisionalLoad: Called with no provisional DocumentLoader (frameState=%hhu, stateForDebugging=%i)", static_cast<uint8_t>(m_frame->coreLocalFrame()->loader().state()), m_frame->coreLocalFrame()->loader().stateMachine().stateForDebugging());
return;
Expand All @@ -385,7 +390,7 @@ void WebLocalFrameLoaderClient::dispatchDidChangeProvisionalURL()
if (!webPage)
return;

Ref documentLoader = static_cast<WebDocumentLoader&>(*m_frame->coreLocalFrame()->loader().provisionalDocumentLoader());
Ref documentLoader { *m_frame->coreLocalFrame()->loader().provisionalDocumentLoader() };
webPage->send(Messages::WebPageProxy::DidChangeProvisionalURLForFrame(m_frame->frameID(), documentLoader->navigationID(), documentLoader->url()));
}

Expand Down Expand Up @@ -547,7 +552,7 @@ void WebLocalFrameLoaderClient::dispatchDidStartProvisionalLoad()

// Notify the bundle client.
webPage->injectedBundleLoaderClient().didStartProvisionalLoadForFrame(*webPage, m_frame, userData);
RefPtr provisionalLoader = static_cast<WebDocumentLoader*>(m_frame->coreLocalFrame()->loader().provisionalDocumentLoader());
RefPtr provisionalLoader = m_frame->coreLocalFrame()->loader().provisionalDocumentLoader();

if (!provisionalLoader || provisionalLoader->isContinuingLoadAfterProvisionalLoadStarted())
return;
Expand Down Expand Up @@ -591,7 +596,7 @@ void WebLocalFrameLoaderClient::dispatchDidCommitLoad(std::optional<HasInsecureC
if (!webPage)
return;

Ref documentLoader = static_cast<WebDocumentLoader&>(*m_frame->coreLocalFrame()->loader().documentLoader());
Ref documentLoader { *m_frame->coreLocalFrame()->loader().documentLoader() };
RefPtr<API::Object> userData;

// Notify the bundle client.
Expand Down Expand Up @@ -661,7 +666,7 @@ void WebLocalFrameLoaderClient::dispatchDidFailProvisionalLoad(const ResourceErr
uint64_t navigationID = 0;
ResourceRequest request;
if (auto documentLoader = m_frame->coreLocalFrame()->loader().provisionalDocumentLoader()) {
navigationID = static_cast<WebDocumentLoader*>(documentLoader)->navigationID();
navigationID = documentLoader->navigationID();
request = documentLoader->request();
}

Expand All @@ -684,7 +689,7 @@ void WebLocalFrameLoaderClient::dispatchDidFailLoad(const ResourceError& error)

RefPtr<API::Object> userData;

Ref documentLoader = static_cast<WebDocumentLoader&>(*m_frame->coreLocalFrame()->loader().documentLoader());
Ref documentLoader { *m_frame->coreLocalFrame()->loader().documentLoader() };
auto navigationID = documentLoader->navigationID();

// Notify the bundle client.
Expand Down Expand Up @@ -712,7 +717,7 @@ void WebLocalFrameLoaderClient::dispatchDidFinishDocumentLoad()

RefPtr<API::Object> userData;

auto navigationID = static_cast<WebDocumentLoader&>(*m_frame->coreLocalFrame()->loader().documentLoader()).navigationID();
auto navigationID = m_frame->coreLocalFrame()->loader().documentLoader()->navigationID();

// Notify the bundle client.
webPage->injectedBundleLoaderClient().didFinishDocumentLoadForFrame(*webPage, m_frame, userData);
Expand All @@ -731,7 +736,7 @@ void WebLocalFrameLoaderClient::dispatchDidFinishLoad()

RefPtr<API::Object> userData;

Ref documentLoader = static_cast<WebDocumentLoader&>(*m_frame->coreLocalFrame()->loader().documentLoader());
Ref documentLoader { *m_frame->coreLocalFrame()->loader().documentLoader() };
auto navigationID = documentLoader->navigationID();

// Notify the bundle client.
Expand Down Expand Up @@ -910,7 +915,7 @@ void WebLocalFrameLoaderClient::dispatchDecidePolicyForResponse(const ResourceRe

RefPtr coreFrame = m_frame->coreLocalFrame();
RefPtr policyDocumentLoader = coreFrame ? coreFrame->loader().provisionalDocumentLoader() : nullptr;
auto navigationID = policyDocumentLoader ? static_cast<WebDocumentLoader&>(*policyDocumentLoader).navigationID() : 0;
auto navigationID = policyDocumentLoader ? policyDocumentLoader->navigationID() : 0;

auto protectedFrame = m_frame.copyRef();
uint64_t listenerID = protectedFrame->setUpPolicyListener(identifier, WTFMove(function), WebFrame::ForNavigationAction::No);
Expand Down Expand Up @@ -975,7 +980,7 @@ void WebLocalFrameLoaderClient::applyToDocumentLoader(WebsitePoliciesData&& webs
if (!coreFrame)
return;

RefPtr documentLoader = WebDocumentLoader::loaderForWebsitePolicies(*coreFrame);
RefPtr documentLoader = coreFrame->loader().loaderForWebsitePolicies();
if (!documentLoader)
return;

Expand Down Expand Up @@ -1442,7 +1447,7 @@ Ref<DocumentLoader> WebLocalFrameLoaderClient::createDocumentLoader(const Resour

void WebLocalFrameLoaderClient::updateCachedDocumentLoader(WebCore::DocumentLoader& loader)
{
m_frame->page()->updateCachedDocumentLoader(static_cast<WebDocumentLoader&>(loader), *m_frame->coreLocalFrame());
m_frame->page()->updateCachedDocumentLoader(loader, *m_frame->coreLocalFrame());
}

void WebLocalFrameLoaderClient::setTitle(const StringWithDirection& title, const URL& url)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,8 @@ class WebLocalFrameLoaderClient final : public WebCore::LocalFrameLoaderClient,
void broadcastFrameRemovalToOtherProcesses() final;
void broadcastMainFrameURLChangeToOtherProcesses(const URL&) final;

void documentLoaderDetached(uint64_t navigationID, WebCore::LoadWillContinueInAnotherProcess) final;

#if ENABLE(WINDOW_PROXY_PROPERTY_ACCESS_NOTIFICATION)
void didAccessWindowProxyPropertyViaOpener(WebCore::SecurityOriginData&&, WebCore::WindowProxyProperty) final;
#endif
Expand Down
Loading

0 comments on commit d9bdd69

Please sign in to comment.