1 | /* |
2 | * Copyright (C) 2017 Apple Inc. All rights reserved. |
3 | * |
4 | * Redistribution and use in source and binary forms, with or without |
5 | * modification, are permitted provided that the following conditions |
6 | * are met: |
7 | * 1. Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. |
9 | * 2. Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. |
12 | * |
13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY |
14 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR |
17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
20 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 | */ |
25 | |
26 | #include "FrameLoaderClient.h" |
27 | |
28 | namespace WebCore { |
29 | |
30 | class WEBCORE_EXPORT EmptyFrameLoaderClient : public FrameLoaderClient { |
31 | Ref<DocumentLoader> createDocumentLoader(const ResourceRequest&, const SubstituteData&) override; |
32 | |
33 | void frameLoaderDestroyed() override { } |
34 | |
35 | Optional<uint64_t> frameID() const override { return WTF::nullopt; } |
36 | Optional<uint64_t> pageID() const override { return WTF::nullopt; } |
37 | PAL::SessionID sessionID() const override; |
38 | |
39 | bool hasWebView() const final { return true; } // mainly for assertions |
40 | |
41 | void makeRepresentation(DocumentLoader*) final { } |
42 | #if PLATFORM(IOS_FAMILY) |
43 | bool forceLayoutOnRestoreFromPageCache() final { return false; } |
44 | #endif |
45 | void forceLayoutForNonHTML() final { } |
46 | |
47 | void setCopiesOnScroll() final { } |
48 | |
49 | void detachedFromParent2() final { } |
50 | void detachedFromParent3() final { } |
51 | |
52 | void convertMainResourceLoadToDownload(DocumentLoader*, PAL::SessionID, const ResourceRequest&, const ResourceResponse&) final { } |
53 | |
54 | void assignIdentifierToInitialRequest(unsigned long, DocumentLoader*, const ResourceRequest&) final { } |
55 | bool shouldUseCredentialStorage(DocumentLoader*, unsigned long) override { return false; } |
56 | void dispatchWillSendRequest(DocumentLoader*, unsigned long, ResourceRequest&, const ResourceResponse&) final { } |
57 | void dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long, const AuthenticationChallenge&) final { } |
58 | #if USE(PROTECTION_SPACE_AUTH_CALLBACK) |
59 | bool canAuthenticateAgainstProtectionSpace(DocumentLoader*, unsigned long, const ProtectionSpace&) final { return false; } |
60 | #endif |
61 | |
62 | #if PLATFORM(IOS_FAMILY) |
63 | RetainPtr<CFDictionaryRef> connectionProperties(DocumentLoader*, unsigned long) final { return nullptr; } |
64 | #endif |
65 | |
66 | void dispatchDidReceiveResponse(DocumentLoader*, unsigned long, const ResourceResponse&) final { } |
67 | void dispatchDidReceiveContentLength(DocumentLoader*, unsigned long, int) final { } |
68 | void dispatchDidFinishLoading(DocumentLoader*, unsigned long) final { } |
69 | #if ENABLE(DATA_DETECTION) |
70 | void dispatchDidFinishDataDetection(NSArray *) final { } |
71 | #endif |
72 | void dispatchDidFailLoading(DocumentLoader*, unsigned long, const ResourceError&) final { } |
73 | bool dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int) final { return false; } |
74 | |
75 | void dispatchDidDispatchOnloadEvents() final { } |
76 | void dispatchDidReceiveServerRedirectForProvisionalLoad() final { } |
77 | void dispatchDidCancelClientRedirect() final { } |
78 | void dispatchWillPerformClientRedirect(const URL&, double, WallTime, LockBackForwardList) final { } |
79 | void dispatchDidChangeLocationWithinPage() final { } |
80 | void dispatchDidPushStateWithinPage() final { } |
81 | void dispatchDidReplaceStateWithinPage() final { } |
82 | void dispatchDidPopStateWithinPage() final { } |
83 | void dispatchWillClose() final { } |
84 | void dispatchDidStartProvisionalLoad() final { } |
85 | void dispatchDidReceiveTitle(const StringWithDirection&) final { } |
86 | void dispatchDidCommitLoad(Optional<HasInsecureContent>) final { } |
87 | void dispatchDidFailProvisionalLoad(const ResourceError&, WillContinueLoading) final { } |
88 | void dispatchDidFailLoad(const ResourceError&) final { } |
89 | void dispatchDidFinishDocumentLoad() final { } |
90 | void dispatchDidFinishLoad() final { } |
91 | void dispatchDidReachLayoutMilestone(OptionSet<LayoutMilestone>) final { } |
92 | |
93 | Frame* dispatchCreatePage(const NavigationAction&) final { return nullptr; } |
94 | void dispatchShow() final { } |
95 | |
96 | void dispatchDecidePolicyForResponse(const ResourceResponse&, const ResourceRequest&, PolicyCheckIdentifier, const String&, FramePolicyFunction&&) final { } |
97 | void dispatchDecidePolicyForNewWindowAction(const NavigationAction&, const ResourceRequest&, FormState*, const String&, PolicyCheckIdentifier, FramePolicyFunction&&) final; |
98 | void dispatchDecidePolicyForNavigationAction(const NavigationAction&, const ResourceRequest&, const ResourceResponse& redirectResponse, FormState*, PolicyDecisionMode, PolicyCheckIdentifier, FramePolicyFunction&&) final; |
99 | void cancelPolicyCheck() final { } |
100 | |
101 | void dispatchUnableToImplementPolicy(const ResourceError&) final { } |
102 | |
103 | void dispatchWillSendSubmitEvent(Ref<FormState>&&) final; |
104 | void dispatchWillSubmitForm(FormState&, CompletionHandler<void()>&&) final; |
105 | |
106 | void revertToProvisionalState(DocumentLoader*) final { } |
107 | void setMainDocumentError(DocumentLoader*, const ResourceError&) final { } |
108 | |
109 | void setMainFrameDocumentReady(bool) final { } |
110 | |
111 | void startDownload(const ResourceRequest&, const String&) final { } |
112 | |
113 | void willChangeTitle(DocumentLoader*) final { } |
114 | void didChangeTitle(DocumentLoader*) final { } |
115 | |
116 | void willReplaceMultipartContent() final { } |
117 | void didReplaceMultipartContent() final { } |
118 | |
119 | void committedLoad(DocumentLoader*, const char*, int) final { } |
120 | void finishedLoading(DocumentLoader*) final { } |
121 | |
122 | ResourceError cancelledError(const ResourceRequest&) final { return { ResourceError::Type::Cancellation }; } |
123 | ResourceError blockedError(const ResourceRequest&) final { return { }; } |
124 | ResourceError blockedByContentBlockerError(const ResourceRequest&) final { return { }; } |
125 | ResourceError cannotShowURLError(const ResourceRequest&) final { return { }; } |
126 | ResourceError interruptedForPolicyChangeError(const ResourceRequest&) final { return { }; } |
127 | #if ENABLE(CONTENT_FILTERING) |
128 | ResourceError blockedByContentFilterError(const ResourceRequest&) final { return { }; } |
129 | #endif |
130 | |
131 | ResourceError cannotShowMIMETypeError(const ResourceResponse&) final { return { }; } |
132 | ResourceError fileDoesNotExistError(const ResourceResponse&) final { return { }; } |
133 | ResourceError pluginWillHandleLoadError(const ResourceResponse&) final { return { }; } |
134 | |
135 | bool shouldFallBack(const ResourceError&) final { return false; } |
136 | |
137 | bool canHandleRequest(const ResourceRequest&) const final { return false; } |
138 | bool canShowMIMEType(const String&) const final { return false; } |
139 | bool canShowMIMETypeAsHTML(const String&) const final { return false; } |
140 | bool representationExistsForURLScheme(const String&) const final { return false; } |
141 | String generatedMIMETypeForURLScheme(const String&) const final { return emptyString(); } |
142 | |
143 | void frameLoadCompleted() final { } |
144 | void restoreViewState() final { } |
145 | void provisionalLoadStarted() final { } |
146 | void didFinishLoad() final { } |
147 | void prepareForDataSourceReplacement() final { } |
148 | |
149 | void updateCachedDocumentLoader(DocumentLoader&) final { } |
150 | void setTitle(const StringWithDirection&, const URL&) final { } |
151 | |
152 | String userAgent(const URL&) override { return emptyString(); } |
153 | |
154 | void savePlatformDataToCachedFrame(CachedFrame*) final { } |
155 | void transitionToCommittedFromCachedFrame(CachedFrame*) final { } |
156 | #if PLATFORM(IOS_FAMILY) |
157 | void didRestoreFrameHierarchyForCachedFrame() final { } |
158 | #endif |
159 | void transitionToCommittedForNewPage() final { } |
160 | |
161 | void didSaveToPageCache() final { } |
162 | void didRestoreFromPageCache() final { } |
163 | |
164 | void dispatchDidBecomeFrameset(bool) final { } |
165 | |
166 | void updateGlobalHistory() final { } |
167 | void updateGlobalHistoryRedirectLinks() final { } |
168 | bool shouldGoToHistoryItem(HistoryItem&) const final { return false; } |
169 | void saveViewStateToItem(HistoryItem&) final { } |
170 | bool canCachePage() const final { return false; } |
171 | void didDisplayInsecureContent() final { } |
172 | void didRunInsecureContent(SecurityOrigin&, const URL&) final { } |
173 | void didDetectXSS(const URL&, bool) final { } |
174 | RefPtr<Frame> createFrame(const URL&, const String&, HTMLFrameOwnerElement&, const String&) final; |
175 | RefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement&, const URL&, const Vector<String>&, const Vector<String>&, const String&, bool) final; |
176 | RefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement&, const URL&, const Vector<String>&, const Vector<String>&) final; |
177 | |
178 | ObjectContentType objectContentType(const URL&, const String&) final { return ObjectContentType::None; } |
179 | String overrideMediaType() const final { return { }; } |
180 | |
181 | void redirectDataToPlugin(Widget&) final { } |
182 | void dispatchDidClearWindowObjectInWorld(DOMWrapperWorld&) final { } |
183 | |
184 | #if PLATFORM(COCOA) |
185 | RemoteAXObjectRef accessibilityRemoteObject() final { return nullptr; } |
186 | void willCacheResponse(DocumentLoader*, unsigned long, NSCachedURLResponse *response, CompletionHandler<void(NSCachedURLResponse *)>&& completionHandler) const final { completionHandler(response); } |
187 | #endif |
188 | |
189 | #if USE(CFURLCONNECTION) |
190 | bool shouldCacheResponse(DocumentLoader*, unsigned long, const ResourceResponse&, const unsigned char*, unsigned long long) final { return true; } |
191 | #endif |
192 | |
193 | Ref<FrameNetworkingContext> createNetworkingContext() final; |
194 | |
195 | bool isEmptyFrameLoaderClient() final { return true; } |
196 | void prefetchDNS(const String&) final { } |
197 | |
198 | #if USE(QUICK_LOOK) |
199 | RefPtr<PreviewLoaderClient> createPreviewLoaderClient(const String&, const String&) final { return nullptr; } |
200 | #endif |
201 | #if ENABLE(RESOURCE_LOAD_STATISTICS) |
202 | bool hasFrameSpecificStorageAccess() final { return false; } |
203 | void setHasFrameSpecificStorageAccess(bool) final { } |
204 | #endif |
205 | }; |
206 | |
207 | } |
208 | |