1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325
|
/*
* Copyright (C) 2010-2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#include "SameDocumentNavigationType.h"
#include "WebFrameLoaderClient.h"
#include "WebPageProxyIdentifier.h"
#include <WebCore/FrameIdentifier.h>
#include <WebCore/LocalFrameLoaderClient.h>
#include <pal/SessionID.h>
namespace WebCore {
struct BackForwardItemIdentifierType;
using BackForwardItemIdentifier = ProcessQualified<ObjectIdentifier<BackForwardItemIdentifierType>>;
}
namespace WebKit {
class PluginView;
class WebFrame;
struct WebsitePoliciesData;
class WebLocalFrameLoaderClient final : public WebCore::LocalFrameLoaderClient, public WebFrameLoaderClient {
public:
WebLocalFrameLoaderClient(WebCore::LocalFrame&, WebCore::FrameLoader&, Ref<WebFrame>&&, ScopeExit<Function<void()>>&&);
~WebLocalFrameLoaderClient();
bool frameHasCustomContentProvider() const { return m_frameHasCustomContentProvider; }
void setUseIconLoadingClient(bool useIconLoadingClient) { m_useIconLoadingClient = useIconLoadingClient; }
void applyWebsitePolicies(WebsitePoliciesData&&) final;
std::optional<WebPageProxyIdentifier> webPageProxyID() const;
bool hasFrameSpecificStorageAccess() final { return !!m_frameSpecificStorageAccessIdentifier; }
struct FrameSpecificStorageAccessIdentifier {
WebCore::FrameIdentifier frameID;
WebCore::PageIdentifier pageID;
};
void setHasFrameSpecificStorageAccess(FrameSpecificStorageAccessIdentifier&&);
void didLoadFromRegistrableDomain(WebCore::RegistrableDomain&&) final;
Vector<WebCore::RegistrableDomain> loadedSubresourceDomains() const final;
WebCore::AllowsContentJavaScript allowsContentJavaScriptFromMostRecentNavigation() const final;
private:
bool hasHTMLView() const final;
bool hasWebView() const final;
void makeRepresentation(WebCore::DocumentLoader*) final;
#if PLATFORM(IOS_FAMILY)
bool forceLayoutOnRestoreFromBackForwardCache() final;
#endif
void forceLayoutForNonHTML() final;
void setCopiesOnScroll() final;
void detachedFromParent2() final;
void detachedFromParent3() final;
void assignIdentifierToInitialRequest(WebCore::ResourceLoaderIdentifier, WebCore::IsMainResourceLoad, WebCore::DocumentLoader*, const WebCore::ResourceRequest&) final;
void dispatchWillSendRequest(WebCore::DocumentLoader*, WebCore::ResourceLoaderIdentifier, WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse) final;
bool shouldUseCredentialStorage(WebCore::DocumentLoader*, WebCore::ResourceLoaderIdentifier) final;
void dispatchDidReceiveAuthenticationChallenge(WebCore::DocumentLoader*, WebCore::ResourceLoaderIdentifier, const WebCore::AuthenticationChallenge&) final;
#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
bool canAuthenticateAgainstProtectionSpace(WebCore::DocumentLoader*, WebCore::ResourceLoaderIdentifier, const WebCore::ProtectionSpace&) final;
#endif
#if PLATFORM(IOS_FAMILY)
RetainPtr<CFDictionaryRef> connectionProperties(WebCore::DocumentLoader*, WebCore::ResourceLoaderIdentifier) final;
#endif
void dispatchDidReceiveResponse(WebCore::DocumentLoader*, WebCore::ResourceLoaderIdentifier, const WebCore::ResourceResponse&) final;
void dispatchDidReceiveContentLength(WebCore::DocumentLoader*, WebCore::ResourceLoaderIdentifier, int dataLength) final;
void dispatchDidFinishLoading(WebCore::DocumentLoader*, WebCore::IsMainResourceLoad, WebCore::ResourceLoaderIdentifier) final;
void dispatchDidFailLoading(WebCore::DocumentLoader*, WebCore::IsMainResourceLoad, WebCore::ResourceLoaderIdentifier, const WebCore::ResourceError&) final;
bool dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, int length) final;
#if ENABLE(DATA_DETECTION)
void dispatchDidFinishDataDetection(NSArray *detectionResults) final;
#endif
void dispatchDidChangeMainDocument() final;
void dispatchWillChangeDocument(const URL& currentUrl, const URL& newUrl) final;
void dispatchDidDispatchOnloadEvents() final;
void dispatchDidReceiveServerRedirectForProvisionalLoad() final;
void dispatchDidChangeProvisionalURL() final;
void dispatchDidCancelClientRedirect() final;
void dispatchWillPerformClientRedirect(const URL&, double interval, WallTime fireDate, WebCore::LockBackForwardList) final;
void dispatchDidChangeLocationWithinPage() final;
void dispatchDidNavigateWithinPage() final;
void dispatchDidPushStateWithinPage() final;
void dispatchDidReplaceStateWithinPage() final;
void dispatchDidPopStateWithinPage() final;
void didSameDocumentNavigationForFrameViaJS(SameDocumentNavigationType);
void dispatchWillClose() final;
void dispatchDidStartProvisionalLoad() final;
void dispatchDidReceiveTitle(const WebCore::StringWithDirection&) final;
void dispatchDidCommitLoad(std::optional<WebCore::HasInsecureContent>, std::optional<WebCore::UsedLegacyTLS>, std::optional<WebCore::WasPrivateRelayed>) final;
void dispatchDidFailProvisionalLoad(const WebCore::ResourceError&, WebCore::WillContinueLoading, WebCore::WillInternallyHandleFailure) final;
void dispatchDidFailLoad(const WebCore::ResourceError&) final;
void dispatchDidFinishDocumentLoad() final;
void dispatchDidFinishLoad() final;
void dispatchDidExplicitOpen(const URL&, const String& mimeType) final;
void dispatchDidReachLayoutMilestone(OptionSet<WebCore::LayoutMilestone>) final;
void dispatchDidReachVisuallyNonEmptyState() final;
void dispatchDidLayout() final;
WebCore::LocalFrame* dispatchCreatePage(const WebCore::NavigationAction&, WebCore::NewFrameOpenerPolicy) final;
void dispatchShow() final;
void dispatchDecidePolicyForResponse(const WebCore::ResourceResponse&, const WebCore::ResourceRequest&, const String&, WebCore::FramePolicyFunction&&) final;
void dispatchDecidePolicyForNewWindowAction(const WebCore::NavigationAction&, const WebCore::ResourceRequest&, WebCore::FormState*, const String& frameName, std::optional<WebCore::HitTestResult>&&, WebCore::FramePolicyFunction&&) final;
void dispatchDecidePolicyForNavigationAction(const WebCore::NavigationAction&, const WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse, WebCore::FormState*, const String& clientRedirectSourceForHistory, std::optional<WebCore::NavigationIdentifier>, std::optional<WebCore::HitTestResult>&&, bool hasOpener, WebCore::IsPerformingHTTPFallback, WebCore::SandboxFlags, WebCore::PolicyDecisionMode, WebCore::FramePolicyFunction&&) final;
void updateSandboxFlags(WebCore::SandboxFlags) final;
void updateOpener(const WebCore::Frame&) final;
void cancelPolicyCheck() final;
void dispatchUnableToImplementPolicy(const WebCore::ResourceError&) final;
void dispatchWillSendSubmitEvent(Ref<WebCore::FormState>&&) final;
void dispatchWillSubmitForm(WebCore::FormState&, CompletionHandler<void()>&&) final;
void revertToProvisionalState(WebCore::DocumentLoader*) final;
void setMainDocumentError(WebCore::DocumentLoader*, const WebCore::ResourceError&) final;
void setMainFrameDocumentReady(bool) final;
void startDownload(const WebCore::ResourceRequest&, const String& suggestedName = String(), WebCore::FromDownloadAttribute = WebCore::FromDownloadAttribute::No) final;
void willChangeTitle(WebCore::DocumentLoader*) final;
void didChangeTitle(WebCore::DocumentLoader*) final;
void willReplaceMultipartContent() final;
void didReplaceMultipartContent() final;
void committedLoad(WebCore::DocumentLoader*, const WebCore::SharedBuffer&) final;
void finishedLoading(WebCore::DocumentLoader*) final;
void updateGlobalHistory() final;
void updateGlobalHistoryRedirectLinks() final;
WebCore::ShouldGoToHistoryItem shouldGoToHistoryItem(WebCore::HistoryItem&, WebCore::IsSameDocumentNavigation) const final;
bool supportsAsyncShouldGoToHistoryItem() const final;
void shouldGoToHistoryItemAsync(WebCore::HistoryItem&, CompletionHandler<void(WebCore::ShouldGoToHistoryItem)>&&) const final;
void didDisplayInsecureContent() final;
void didRunInsecureContent(WebCore::SecurityOrigin&) final;
void didFinishServiceWorkerPageRegistration(bool success) final;
void loadStorageAccessQuirksIfNeeded() final;
bool shouldFallBack(const WebCore::ResourceError&) const final;
bool canHandleRequest(const WebCore::ResourceRequest&) const final;
bool canShowMIMEType(const String& MIMEType) const final;
bool canShowMIMETypeAsHTML(const String& MIMEType) const final;
bool representationExistsForURLScheme(StringView URLScheme) const final;
String generatedMIMETypeForURLScheme(StringView URLScheme) const final;
void frameLoadCompleted() final;
void saveViewStateToItem(WebCore::HistoryItem&) final;
void restoreViewState() final;
void provisionalLoadStarted() final;
void didFinishLoad() final;
void prepareForDataSourceReplacement() final;
Ref<WebCore::DocumentLoader> createDocumentLoader(const WebCore::ResourceRequest&, const WebCore::SubstituteData&) final;
void updateCachedDocumentLoader(WebCore::DocumentLoader&) final;
void setTitle(const WebCore::StringWithDirection&, const URL&) final;
bool hasCustomUserAgent() const final;
String userAgent(const URL&) const final;
String overrideContentSecurityPolicy() const final;
void savePlatformDataToCachedFrame(WebCore::CachedFrame*) final;
void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*) final;
#if PLATFORM(IOS_FAMILY)
void didRestoreFrameHierarchyForCachedFrame() final;
#endif
void transitionToCommittedForNewPage(InitializingIframe) final;
void didRestoreFromBackForwardCache() final;
bool canCachePage() const final;
void convertMainResourceLoadToDownload(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&) final;
RefPtr<WebCore::LocalFrame> createFrame(const AtomString& name, WebCore::HTMLFrameOwnerElement&) final;
RefPtr<WebCore::Widget> createPlugin(WebCore::HTMLPlugInElement&, const URL&, const Vector<AtomString>&, const Vector<AtomString>&, const String&, bool loadManually) final;
void redirectDataToPlugin(WebCore::Widget&) final;
WebCore::ObjectContentType objectContentType(const URL&, const String& mimeType) final;
AtomString overrideMediaType() const final;
void dispatchDidClearWindowObjectInWorld(WebCore::DOMWrapperWorld&) final;
void dispatchGlobalObjectAvailable(WebCore::DOMWrapperWorld&) final;
void dispatchServiceWorkerGlobalObjectAvailable(WebCore::DOMWrapperWorld&) final;
void dispatchWillDisconnectDOMWindowExtensionFromGlobalObject(WebCore::DOMWindowExtension*) final;
void dispatchDidReconnectDOMWindowExtensionToGlobalObject(WebCore::DOMWindowExtension*) final;
void dispatchWillDestroyGlobalObjectForDOMWindowExtension(WebCore::DOMWindowExtension*) final;
void willInjectUserScript(WebCore::DOMWrapperWorld&) final;
#if PLATFORM(COCOA)
RemoteAXObjectRef accessibilityRemoteObject() final;
WebCore::IntPoint accessibilityRemoteFrameOffset() final;
#if ENABLE(ACCESSIBILITY_ISOLATED_TREE)
void setAXIsolatedTreeRoot(WebCore::AXCoreObject*) final;
#endif
void willCacheResponse(WebCore::DocumentLoader*, WebCore::ResourceLoaderIdentifier, NSCachedURLResponse*, CompletionHandler<void(NSCachedURLResponse *)>&&) const final;
std::optional<double> dataDetectionReferenceDate() final;
#endif
void didChangeScrollOffset() final;
bool isWebLocalFrameLoaderClient() const final { return true; }
bool allowScript(bool enabledPerSettings) final;
bool shouldForceUniversalAccessFromLocalURL(const URL&) final;
Ref<WebCore::FrameNetworkingContext> createNetworkingContext() final;
void completePageTransitionIfNeeded() final;
void setDocumentVisualUpdatesAllowed(bool) final;
#if USE(QUICK_LOOK)
RefPtr<WebCore::LegacyPreviewLoaderClient> createPreviewLoaderClient(const String& fileName, const String& uti) final;
#endif
#if ENABLE(CONTENT_FILTERING)
void contentFilterDidBlockLoad(WebCore::ContentFilterUnblockHandler) final;
#endif
void prefetchDNS(const String&) final;
void sendH2Ping(const URL&, CompletionHandler<void(Expected<WTF::Seconds, WebCore::ResourceError>&&)>&&) final;
void didRestoreScrollPosition() final;
void getLoadDecisionForIcons(const Vector<std::pair<WebCore::LinkIcon&, uint64_t>>&) final;
inline bool hasPlugInView() const;
void documentLoaderDetached(WebCore::NavigationIdentifier, WebCore::LoadWillContinueInAnotherProcess) final;
#if ENABLE(WINDOW_PROXY_PROPERTY_ACCESS_NOTIFICATION)
void didAccessWindowProxyPropertyViaOpener(WebCore::SecurityOriginData&&, WebCore::WindowProxyProperty) final;
#endif
bool siteIsolationEnabled() const;
Ref<WebCore::LocalFrame> protectedLocalFrame() const;
#if ENABLE(CONTENT_EXTENSIONS)
void didExceedNetworkUsageThreshold();
#endif
#if ENABLE(PDF_PLUGIN)
RefPtr<PluginView> m_pluginView;
bool m_hasSentResponseToPluginView { false };
#endif
bool m_didCompletePageTransition { false };
bool m_frameHasCustomContentProvider { false };
bool m_frameCameFromBackForwardCache { false };
bool m_useIconLoadingClient { false };
std::optional<FrameSpecificStorageAccessIdentifier> m_frameSpecificStorageAccessIdentifier;
WeakRef<WebCore::LocalFrame> m_localFrame;
#if ENABLE(APP_BOUND_DOMAINS)
bool shouldEnableInAppBrowserPrivacyProtections() const final;
void notifyPageOfAppBoundBehavior() final;
#endif
#if ENABLE(PDF_PLUGIN)
bool shouldUsePDFPlugin(const String& contentType, StringView path) const final;
#endif
bool isParentProcessAFullWebBrowser() const final;
#if ENABLE(ARKIT_INLINE_PREVIEW_MAC)
void modelInlinePreviewUUIDs(CompletionHandler<void(Vector<String>)>&&) const final;
#endif
void dispatchLoadEventToOwnerElementInAnotherProcess() final;
void frameNameChanged(const String&) final;
RefPtr<WebCore::HistoryItem> createHistoryItemTree(bool clipAtTarget, WebCore::BackForwardItemIdentifier) const final;
};
} // namespace WebKit
SPECIALIZE_TYPE_TRAITS_BEGIN(WebKit::WebLocalFrameLoaderClient)
static bool isType(const WebCore::LocalFrameLoaderClient& client) { return client.isWebLocalFrameLoaderClient(); }
SPECIALIZE_TYPE_TRAITS_END()
|