blob: 729426cea2c4e6d3b07e775cd12eb4d44eba52a2 [file] [log] [blame]
tkent@chromium.orga1b52272012-04-11 02:27:01 +00001/*
2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org>
darin@apple.comaf74ed12017-01-07 22:08:28 +00003 * Copyright (C) 2008-2017 Apple Inc. All rights reserved.
tkent@chromium.orga1b52272012-04-11 02:27:01 +00004 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
16 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
19 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#include "config.h"
29#include "EmptyClients.h"
30
andersca@apple.comd81b5f12016-04-22 00:33:32 +000031#include "ApplicationCacheStorage.h"
andersca@apple.com4c593692016-10-14 17:14:39 +000032#include "BackForwardClient.h"
andersca@apple.com7d7200b2015-01-06 19:08:37 +000033#include "ColorChooser.h"
darin@apple.comaf74ed12017-01-07 22:08:28 +000034#include "ContextMenuClient.h"
andersca@apple.com7d7200b2015-01-06 19:08:37 +000035#include "DatabaseProvider.h"
darin@apple.comaf74ed12017-01-07 22:08:28 +000036#include "DiagnosticLoggingClient.h"
37#include "DocumentFragment.h"
tkent@chromium.org4e0dc662012-06-05 09:08:04 +000038#include "DocumentLoader.h"
darin@apple.comaf74ed12017-01-07 22:08:28 +000039#include "DragClient.h"
40#include "EditorClient.h"
tkent@chromium.orga1b52272012-04-11 02:27:01 +000041#include "FileChooser.h"
42#include "FormState.h"
tkent@chromium.org4e0dc662012-06-05 09:08:04 +000043#include "Frame.h"
darin@apple.comaf74ed12017-01-07 22:08:28 +000044#include "FrameLoaderClient.h"
tkent@chromium.org4e0dc662012-06-05 09:08:04 +000045#include "FrameNetworkingContext.h"
tkent@chromium.orga1b52272012-04-11 02:27:01 +000046#include "HTMLFormElement.h"
beidson@apple.com18db5552015-09-28 22:44:42 +000047#include "InProcessIDBServer.h"
darin@apple.comaf74ed12017-01-07 22:08:28 +000048#include "InspectorClient.h"
darin@apple.comc04189e2017-01-18 05:17:17 +000049#include "NetworkStorageSession.h"
achristensen@apple.come5945672016-06-13 21:58:53 +000050#include "Page.h"
jer.noble@apple.com9e0f0602014-11-22 05:27:16 +000051#include "PageConfiguration.h"
andersca@apple.com4b166142016-06-22 20:00:03 +000052#include "PaymentCoordinatorClient.h"
andersca@apple.com531352c2016-08-08 23:43:50 +000053#include "PluginInfoProvider.h"
darin@apple.comaf74ed12017-01-07 22:08:28 +000054#include "ProgressTrackerClient.h"
ossy@webkit.org99ec90f2016-11-27 18:16:51 +000055#include "SecurityOriginData.h"
andersca@apple.com22319ce2014-12-11 02:35:06 +000056#include "StorageArea.h"
57#include "StorageNamespace.h"
58#include "StorageNamespaceProvider.h"
beidson@apple.comaebe99b2017-03-31 19:27:52 +000059#include "StorageType.h"
darin@apple.comaf74ed12017-01-07 22:08:28 +000060#include "TextCheckerClient.h"
commit-queue@webkit.org7fb61bb2016-07-07 21:09:14 +000061#include "ThreadableWebSocketChannel.h"
weinig@apple.com1578a242016-03-15 00:48:40 +000062#include "UserContentProvider.h"
darin@apple.comaf74ed12017-01-07 22:08:28 +000063#include "VisitedLinkStore.h"
fpizlo@apple.combc16ddb2016-09-06 01:02:22 +000064#include <heap/HeapInlines.h>
zandobersek@gmail.com58137de2013-10-22 20:16:49 +000065#include <wtf/NeverDestroyed.h>
tkent@chromium.orga1b52272012-04-11 02:27:01 +000066
darin@apple.comaf74ed12017-01-07 22:08:28 +000067#if ENABLE(CONTENT_EXTENSIONS)
68#include "CompiledContentExtension.h"
69#endif
70
aestes@apple.com77827742017-01-31 03:06:05 +000071#if USE(QUICK_LOOK)
aestes@apple.com756915c2017-03-22 18:11:08 +000072#include "PreviewLoaderClient.h"
aestes@apple.com77827742017-01-31 03:06:05 +000073#endif
74
tkent@chromium.orga1b52272012-04-11 02:27:01 +000075namespace WebCore {
76
darin@apple.comaf74ed12017-01-07 22:08:28 +000077class UserMessageHandlerDescriptor;
andersca@apple.com9b0fd602016-09-21 22:51:52 +000078
darin@apple.comaf74ed12017-01-07 22:08:28 +000079class EmptyBackForwardClient final : public BackForwardClient {
80 void addItem(Ref<HistoryItem>&&) final { }
81 void goToItem(HistoryItem*) final { }
82 HistoryItem* itemAtIndex(int) final { return nullptr; }
83 int backListCount() final { return 0; }
84 int forwardListCount() final { return 0; }
85 void close() final { }
andersca@apple.com4b166142016-06-22 20:00:03 +000086};
darin@apple.comaf74ed12017-01-07 22:08:28 +000087
88#if ENABLE(CONTEXT_MENUS)
89
90class EmptyContextMenuClient final : public ContextMenuClient {
91 void contextMenuDestroyed() final { }
92
93 void downloadURL(const URL&) final { }
94 void searchWithGoogle(const Frame*) final { }
95 void lookUpInDictionary(Frame*) final { }
96 bool isSpeaking() final { return false; }
97 void speak(const String&) final { }
98 void stopSpeaking() final { }
99
100#if PLATFORM(COCOA)
101 void searchWithSpotlight() final { }
andersca@apple.com4b166142016-06-22 20:00:03 +0000102#endif
103
darin@apple.comaf74ed12017-01-07 22:08:28 +0000104#if USE(ACCESSIBILITY_CONTEXT_MENUS)
105 void showContextMenu() final { }
106#endif
107};
108
109#endif // ENABLE(CONTEXT_MENUS)
110
andersca@apple.com7d7200b2015-01-06 19:08:37 +0000111class EmptyDatabaseProvider final : public DatabaseProvider {
112#if ENABLE(INDEXED_DATABASE)
darin@apple.comaf74ed12017-01-07 22:08:28 +0000113 IDBClient::IDBConnectionToServer& idbConnectionToServerForSession(const SessionID&) final
beidson@apple.com18db5552015-09-28 22:44:42 +0000114 {
115 static NeverDestroyed<Ref<InProcessIDBServer>> sharedConnection(InProcessIDBServer::create());
116 return sharedConnection.get()->connectionToServer();
117 }
andersca@apple.com7d7200b2015-01-06 19:08:37 +0000118#endif
119};
120
darin@apple.comaf74ed12017-01-07 22:08:28 +0000121class EmptyDiagnosticLoggingClient final : public DiagnosticLoggingClient {
122 void logDiagnosticMessage(const String&, const String&, ShouldSample) final { }
123 void logDiagnosticMessageWithResult(const String&, const String&, DiagnosticLoggingResultType, ShouldSample) final { }
cdumez@apple.com172b8902017-01-30 18:45:21 +0000124 void logDiagnosticMessageWithValue(const String&, const String&, double, unsigned, ShouldSample) final { }
cdumez@apple.comeb4832c2017-02-08 15:39:38 +0000125 void logDiagnosticMessageWithEnhancedPrivacy(const String&, const String&, ShouldSample) final { }
andersca@apple.com531352c2016-08-08 23:43:50 +0000126};
127
tkent@chromium.orga1b52272012-04-11 02:27:01 +0000128#if ENABLE(DRAG_SUPPORT)
darin@apple.comaf74ed12017-01-07 22:08:28 +0000129
130class EmptyDragClient final : public DragClient {
131 void willPerformDragDestinationAction(DragDestinationAction, const DragData&) final { }
132 void willPerformDragSourceAction(DragSourceAction, const IntPoint&, DataTransfer&) final { }
darin@apple.comaf74ed12017-01-07 22:08:28 +0000133 DragSourceAction dragSourceActionMaskForPoint(const IntPoint&) final { return DragSourceActionNone; }
andersca@apple.com346172f2017-02-15 18:31:00 +0000134 void startDrag(DragImage, const IntPoint&, const IntPoint&, const FloatPoint&, DataTransfer&, Frame&, DragSourceAction) final { }
darin@apple.comaf74ed12017-01-07 22:08:28 +0000135 void dragControllerDestroyed() final { }
136};
137
138#endif // ENABLE(DRAG_SUPPORT)
139
140class EmptyEditorClient final : public EditorClient {
141 WTF_MAKE_FAST_ALLOCATED;
142
143public:
144 EmptyEditorClient() = default;
145
146private:
147 bool shouldDeleteRange(Range*) final { return false; }
148 bool smartInsertDeleteEnabled() final { return false; }
achristensen@apple.com09e70aa2017-04-27 16:42:13 +0000149 bool isSelectTrailingWhitespaceEnabled() const final { return false; }
darin@apple.comaf74ed12017-01-07 22:08:28 +0000150 bool isContinuousSpellCheckingEnabled() final { return false; }
151 void toggleContinuousSpellChecking() final { }
152 bool isGrammarCheckingEnabled() final { return false; }
153 void toggleGrammarChecking() final { }
154 int spellCheckerDocumentTag() final { return -1; }
155
156 bool shouldBeginEditing(Range*) final { return false; }
157 bool shouldEndEditing(Range*) final { return false; }
158 bool shouldInsertNode(Node*, Range*, EditorInsertAction) final { return false; }
159 bool shouldInsertText(const String&, Range*, EditorInsertAction) final { return false; }
160 bool shouldChangeSelectedRange(Range*, Range*, EAffinity, bool) final { return false; }
161
162 bool shouldApplyStyle(StyleProperties*, Range*) final { return false; }
163 void didApplyStyle() final { }
164 bool shouldMoveRangeAfterDelete(Range*, Range*) final { return false; }
165
166 void didBeginEditing() final { }
167 void respondToChangedContents() final { }
168 void respondToChangedSelection(Frame*) final { }
169 void didChangeSelectionAndUpdateLayout() final { }
170 void updateEditorStateAfterLayoutIfEditabilityChanged() final { }
171 void discardedComposition(Frame*) final { }
172 void canceledComposition() final { }
173 void didEndEditing() final { }
174 void willWriteSelectionToPasteboard(Range*) final { }
175 void didWriteSelectionToPasteboard() final { }
176 void getClientPasteboardDataForRange(Range*, Vector<String>&, Vector<RefPtr<SharedBuffer>>&) final { }
177 void requestCandidatesForSelection(const VisibleSelection&) final { }
178 void handleAcceptedCandidateWithSoftSpaces(TextCheckingResult) final { }
179
darin@apple.comc04189e2017-01-18 05:17:17 +0000180 void registerUndoStep(UndoStep&) final;
181 void registerRedoStep(UndoStep&) final;
darin@apple.comaf74ed12017-01-07 22:08:28 +0000182 void clearUndoRedoOperations() final { }
183
184 bool canCopyCut(Frame*, bool defaultValue) const final { return defaultValue; }
185 bool canPaste(Frame*, bool defaultValue) const final { return defaultValue; }
186 bool canUndo() const final { return false; }
187 bool canRedo() const final { return false; }
188
189 void undo() final { }
190 void redo() final { }
191
192 void handleKeyboardEvent(KeyboardEvent*) final { }
193 void handleInputMethodKeydown(KeyboardEvent*) final { }
194
195 void textFieldDidBeginEditing(Element*) final { }
196 void textFieldDidEndEditing(Element*) final { }
197 void textDidChangeInTextField(Element*) final { }
198 bool doTextFieldCommandFromEvent(Element*, KeyboardEvent*) final { return false; }
199 void textWillBeDeletedInTextField(Element*) final { }
200 void textDidChangeInTextArea(Element*) final { }
201 void overflowScrollPositionChanged() final { }
202
203#if PLATFORM(IOS)
204 void startDelayingAndCoalescingContentChangeNotifications() final { }
205 void stopDelayingAndCoalescingContentChangeNotifications() final { }
206 void writeDataToPasteboard(NSDictionary*) final { }
207 NSArray* supportedPasteboardTypesForCurrentSelection() final { return nullptr; }
208 NSArray* readDataFromPasteboard(NSString*, int) final { return nullptr; }
209 bool hasRichlyEditableSelection() final { return false; }
210 int getPasteboardItemsCount() final { return 0; }
211 RefPtr<DocumentFragment> documentFragmentFromDelegate(int) final { return nullptr; }
212 bool performsTwoStepPaste(DocumentFragment*) final { return false; }
213 int pasteboardChangeCount() final { return 0; }
tkent@chromium.orga1b52272012-04-11 02:27:01 +0000214#endif
215
wenson_hsieh@apple.comb88d30f2017-06-09 20:10:59 +0000216 bool performTwoStepDrop(DocumentFragment&, Range&, bool) final { return false; }
217
darin@apple.comaf74ed12017-01-07 22:08:28 +0000218#if PLATFORM(COCOA)
219 NSString *userVisibleString(NSURL *) final { return nullptr; }
220 void setInsertionPasteboard(const String&) final { };
221 NSURL *canonicalizeURL(NSURL *) final { return nullptr; }
222 NSURL *canonicalizeURLString(NSString *) final { return nullptr; }
223#endif
akling@apple.com8e830e42013-08-26 17:54:33 +0000224
darin@apple.comaf74ed12017-01-07 22:08:28 +0000225#if USE(APPKIT)
226 void uppercaseWord() final { }
227 void lowercaseWord() final { }
228 void capitalizeWord() final { }
229#endif
jer.noble@apple.com9e0f0602014-11-22 05:27:16 +0000230
darin@apple.comaf74ed12017-01-07 22:08:28 +0000231#if USE(AUTOMATIC_TEXT_REPLACEMENT)
232 void showSubstitutionsPanel(bool) final { }
233 bool substitutionsPanelIsShowing() final { return false; }
234 void toggleSmartInsertDelete() final { }
235 bool isAutomaticQuoteSubstitutionEnabled() final { return false; }
236 void toggleAutomaticQuoteSubstitution() final { }
237 bool isAutomaticLinkDetectionEnabled() final { return false; }
238 void toggleAutomaticLinkDetection() final { }
239 bool isAutomaticDashSubstitutionEnabled() final { return false; }
240 void toggleAutomaticDashSubstitution() final { }
241 bool isAutomaticTextReplacementEnabled() final { return false; }
242 void toggleAutomaticTextReplacement() final { }
243 bool isAutomaticSpellingCorrectionEnabled() final { return false; }
244 void toggleAutomaticSpellingCorrection() final { }
245#endif
jer.noble@apple.com9e0f0602014-11-22 05:27:16 +0000246
darin@apple.comaf74ed12017-01-07 22:08:28 +0000247#if PLATFORM(GTK)
248 bool shouldShowUnicodeMenu() final { return false; }
249#endif
andersca@apple.com5782df82014-11-29 22:17:07 +0000250
darin@apple.comaf74ed12017-01-07 22:08:28 +0000251 TextCheckerClient* textChecker() final { return &m_textCheckerClient; }
252
253 void updateSpellingUIWithGrammarString(const String&, const GrammarDetail&) final { }
254 void updateSpellingUIWithMisspelledWord(const String&) final { }
255 void showSpellingUI(bool) final { }
256 bool spellingUIIsShowing() final { return false; }
257
258 void willSetInputMethodState() final { }
259 void setInputMethodState(bool) final { }
260
261 class EmptyTextCheckerClient final : public TextCheckerClient {
262 bool shouldEraseMarkersAfterChangeSelection(TextCheckingType) const final { return true; }
263 void ignoreWordInSpellDocument(const String&) final { }
264 void learnWord(const String&) final { }
265 void checkSpellingOfString(StringView, int*, int*) final { }
266 String getAutoCorrectSuggestionForMisspelledWord(const String&) final { return { }; }
267 void checkGrammarOfString(StringView, Vector<GrammarDetail>&, int*, int*) final { }
268
269#if USE(UNIFIED_TEXT_CHECKING)
270 Vector<TextCheckingResult> checkTextOfParagraph(StringView, TextCheckingTypeMask, const VisibleSelection&) final { return Vector<TextCheckingResult>(); }
271#endif
272
273 void getGuessesForWord(const String&, const String&, const VisibleSelection&, Vector<String>&) final { }
274 void requestCheckingOfString(TextCheckingRequest&, const VisibleSelection&) final;
275 };
276
277 EmptyTextCheckerClient m_textCheckerClient;
278};
279
280class EmptyFrameLoaderClient final : public FrameLoaderClient {
281 void frameLoaderDestroyed() final { }
282
283 bool hasWebView() const final { return true; } // mainly for assertions
284
285 void makeRepresentation(DocumentLoader*) final { }
286#if PLATFORM(IOS)
287 bool forceLayoutOnRestoreFromPageCache() final { return false; }
288#endif
289 void forceLayoutForNonHTML() final { }
290
291 void setCopiesOnScroll() final { }
292
293 void detachedFromParent2() final { }
294 void detachedFromParent3() final { }
295
296 void convertMainResourceLoadToDownload(DocumentLoader*, SessionID, const ResourceRequest&, const ResourceResponse&) final { }
297
298 void assignIdentifierToInitialRequest(unsigned long, DocumentLoader*, const ResourceRequest&) final { }
299 bool shouldUseCredentialStorage(DocumentLoader*, unsigned long) final { return false; }
300 void dispatchWillSendRequest(DocumentLoader*, unsigned long, ResourceRequest&, const ResourceResponse&) final { }
301 void dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long, const AuthenticationChallenge&) final { }
302#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
303 bool canAuthenticateAgainstProtectionSpace(DocumentLoader*, unsigned long, const ProtectionSpace&) final { return false; }
304#endif
305
306#if PLATFORM(IOS)
307 RetainPtr<CFDictionaryRef> connectionProperties(DocumentLoader*, unsigned long) final { return nullptr; }
308#endif
309
310 void dispatchDidReceiveResponse(DocumentLoader*, unsigned long, const ResourceResponse&) final { }
311 void dispatchDidReceiveContentLength(DocumentLoader*, unsigned long, int) final { }
312 void dispatchDidFinishLoading(DocumentLoader*, unsigned long) final { }
313#if ENABLE(DATA_DETECTION)
314 void dispatchDidFinishDataDetection(NSArray *) final { }
315#endif
316 void dispatchDidFailLoading(DocumentLoader*, unsigned long, const ResourceError&) final { }
317 bool dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int) final { return false; }
318
319 void dispatchDidDispatchOnloadEvents() final { }
320 void dispatchDidReceiveServerRedirectForProvisionalLoad() final { }
321 void dispatchDidCancelClientRedirect() final { }
322 void dispatchWillPerformClientRedirect(const URL&, double, double) final { }
323 void dispatchDidChangeLocationWithinPage() final { }
324 void dispatchDidPushStateWithinPage() final { }
325 void dispatchDidReplaceStateWithinPage() final { }
326 void dispatchDidPopStateWithinPage() final { }
327 void dispatchWillClose() final { }
328 void dispatchDidReceiveIcon() final { }
329 void dispatchDidStartProvisionalLoad() final { }
330 void dispatchDidReceiveTitle(const StringWithDirection&) final { }
331 void dispatchDidCommitLoad(std::optional<HasInsecureContent>) final { }
332 void dispatchDidFailProvisionalLoad(const ResourceError&) final { }
333 void dispatchDidFailLoad(const ResourceError&) final { }
334 void dispatchDidFinishDocumentLoad() final { }
335 void dispatchDidFinishLoad() final { }
336 void dispatchDidReachLayoutMilestone(LayoutMilestones) final { }
337
338 Frame* dispatchCreatePage(const NavigationAction&) final { return nullptr; }
339 void dispatchShow() final { }
340
341 void dispatchDecidePolicyForResponse(const ResourceResponse&, const ResourceRequest&, FramePolicyFunction) final { }
darin@apple.comc04189e2017-01-18 05:17:17 +0000342 void dispatchDecidePolicyForNewWindowAction(const NavigationAction&, const ResourceRequest&, FormState*, const String&, FramePolicyFunction) final;
343 void dispatchDecidePolicyForNavigationAction(const NavigationAction&, const ResourceRequest&, FormState*, FramePolicyFunction) final;
darin@apple.comaf74ed12017-01-07 22:08:28 +0000344 void cancelPolicyCheck() final { }
345
346 void dispatchUnableToImplementPolicy(const ResourceError&) final { }
347
darin@apple.comc04189e2017-01-18 05:17:17 +0000348 void dispatchWillSendSubmitEvent(Ref<FormState>&&) final;
349 void dispatchWillSubmitForm(FormState&, FramePolicyFunction) final;
darin@apple.comaf74ed12017-01-07 22:08:28 +0000350
351 void revertToProvisionalState(DocumentLoader*) final { }
352 void setMainDocumentError(DocumentLoader*, const ResourceError&) final { }
353
354 void setMainFrameDocumentReady(bool) final { }
355
356 void startDownload(const ResourceRequest&, const String&) final { }
357
358 void willChangeTitle(DocumentLoader*) final { }
359 void didChangeTitle(DocumentLoader*) final { }
360
361 void willReplaceMultipartContent() final { }
362 void didReplaceMultipartContent() final { }
363
364 void committedLoad(DocumentLoader*, const char*, int) final { }
365 void finishedLoading(DocumentLoader*) final { }
366
367 ResourceError cancelledError(const ResourceRequest&) final { return { ResourceError::Type::Cancellation }; }
368 ResourceError blockedError(const ResourceRequest&) final { return { }; }
369 ResourceError blockedByContentBlockerError(const ResourceRequest&) final { return { }; }
370 ResourceError cannotShowURLError(const ResourceRequest&) final { return { }; }
371 ResourceError interruptedForPolicyChangeError(const ResourceRequest&) final { return { }; }
372#if ENABLE(CONTENT_FILTERING)
373 ResourceError blockedByContentFilterError(const ResourceRequest&) final { return { }; }
374#endif
375
376 ResourceError cannotShowMIMETypeError(const ResourceResponse&) final { return { }; }
377 ResourceError fileDoesNotExistError(const ResourceResponse&) final { return { }; }
378 ResourceError pluginWillHandleLoadError(const ResourceResponse&) final { return { }; }
379
380 bool shouldFallBack(const ResourceError&) final { return false; }
381
382 bool canHandleRequest(const ResourceRequest&) const final { return false; }
383 bool canShowMIMEType(const String&) const final { return false; }
384 bool canShowMIMETypeAsHTML(const String&) const final { return false; }
385 bool representationExistsForURLScheme(const String&) const final { return false; }
386 String generatedMIMETypeForURLScheme(const String&) const final { return emptyString(); }
387
388 void frameLoadCompleted() final { }
389 void restoreViewState() final { }
390 void provisionalLoadStarted() final { }
391 void didFinishLoad() final { }
392 void prepareForDataSourceReplacement() final { }
393
394 Ref<DocumentLoader> createDocumentLoader(const ResourceRequest&, const SubstituteData&) final;
395 void updateCachedDocumentLoader(DocumentLoader&) final { }
396 void setTitle(const StringWithDirection&, const URL&) final { }
397
398 String userAgent(const URL&) final { return emptyString(); }
399
400 void savePlatformDataToCachedFrame(CachedFrame*) final { }
401 void transitionToCommittedFromCachedFrame(CachedFrame*) final { }
402#if PLATFORM(IOS)
403 void didRestoreFrameHierarchyForCachedFrame() final { }
404#endif
405 void transitionToCommittedForNewPage() final { }
406
407 void didSaveToPageCache() final { }
408 void didRestoreFromPageCache() final { }
409
410 void dispatchDidBecomeFrameset(bool) final { }
411
412 void updateGlobalHistory() final { }
413 void updateGlobalHistoryRedirectLinks() final { }
414 bool shouldGoToHistoryItem(HistoryItem*) const final { return false; }
415 void updateGlobalHistoryItemForPage() final { }
416 void saveViewStateToItem(HistoryItem&) final { }
417 bool canCachePage() const final { return false; }
418 void didDisplayInsecureContent() final { }
akling@apple.com6be0e972017-01-18 19:35:49 +0000419 void didRunInsecureContent(SecurityOrigin&, const URL&) final { }
darin@apple.comaf74ed12017-01-07 22:08:28 +0000420 void didDetectXSS(const URL&, bool) final { }
darin@apple.comc04189e2017-01-18 05:17:17 +0000421 RefPtr<Frame> createFrame(const URL&, const String&, HTMLFrameOwnerElement&, const String&, bool, int, int) final;
422 RefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement&, const URL&, const Vector<String>&, const Vector<String>&, const String&, bool) final;
darin@apple.comaf74ed12017-01-07 22:08:28 +0000423 void recreatePlugin(Widget*) final;
darin@apple.comc04189e2017-01-18 05:17:17 +0000424 RefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement&, const URL&, const Vector<String>&, const Vector<String>&) final;
darin@apple.comaf74ed12017-01-07 22:08:28 +0000425
426 ObjectContentType objectContentType(const URL&, const String&) final { return ObjectContentType::None; }
427 String overrideMediaType() const final { return { }; }
428
commit-queue@webkit.org6c0b3512017-02-17 02:40:21 +0000429 void redirectDataToPlugin(Widget&) final { }
darin@apple.comaf74ed12017-01-07 22:08:28 +0000430 void dispatchDidClearWindowObjectInWorld(DOMWrapperWorld&) final { }
431
432 void registerForIconNotification(bool) final { }
433
434#if PLATFORM(COCOA)
435 RemoteAXObjectRef accessibilityRemoteObject() final { return nullptr; }
436 NSCachedURLResponse *willCacheResponse(DocumentLoader*, unsigned long, NSCachedURLResponse *response) const final { return response; }
437#endif
438
439#if PLATFORM(WIN) && USE(CFURLCONNECTION)
440 bool shouldCacheResponse(DocumentLoader*, unsigned long, const ResourceResponse&, const unsigned char*, unsigned long long) final { return true; }
441#endif
442
darin@apple.comc04189e2017-01-18 05:17:17 +0000443 Ref<FrameNetworkingContext> createNetworkingContext() final;
darin@apple.comaf74ed12017-01-07 22:08:28 +0000444
445#if ENABLE(REQUEST_AUTOCOMPLETE)
darin@apple.comc04189e2017-01-18 05:17:17 +0000446 void didRequestAutocomplete(Ref<FormState>&&) final { }
darin@apple.comaf74ed12017-01-07 22:08:28 +0000447#endif
448
449 bool isEmptyFrameLoaderClient() final { return true; }
450 void prefetchDNS(const String&) final { }
aestes@apple.com77827742017-01-31 03:06:05 +0000451
452#if USE(QUICK_LOOK)
aestes@apple.com756915c2017-03-22 18:11:08 +0000453 RefPtr<PreviewLoaderClient> createPreviewLoaderClient(const String&, const String&) final { return nullptr; }
aestes@apple.com77827742017-01-31 03:06:05 +0000454#endif
darin@apple.comaf74ed12017-01-07 22:08:28 +0000455};
456
darin@apple.comc04189e2017-01-18 05:17:17 +0000457class EmptyFrameNetworkingContext final : public FrameNetworkingContext {
458public:
459 static Ref<EmptyFrameNetworkingContext> create() { return adoptRef(*new EmptyFrameNetworkingContext); }
460
461private:
462 EmptyFrameNetworkingContext();
463
464 bool shouldClearReferrerOnHTTPSToHTTPRedirect() const { return true; }
465 NetworkStorageSession& storageSession() const final { return NetworkStorageSession::defaultStorageSession(); }
466
467#if PLATFORM(COCOA)
468 bool localFileContentSniffingEnabled() const { return false; }
469 SchedulePairHashSet* scheduledRunLoopPairs() const { return nullptr; }
470 RetainPtr<CFDataRef> sourceApplicationAuditData() const { return nullptr; };
471#endif
472
473#if PLATFORM(COCOA) || PLATFORM(WIN)
474 ResourceError blockedError(const ResourceRequest&) const final { return { }; }
475#endif
476};
477
darin@apple.comaf74ed12017-01-07 22:08:28 +0000478class EmptyInspectorClient final : public InspectorClient {
479 void inspectedPageDestroyed() final { }
480 Inspector::FrontendChannel* openLocalFrontend(InspectorController*) final { return nullptr; }
481 void bringFrontendToFront() final { }
482 void highlight() final { }
483 void hideHighlight() final { }
484};
485
486#if ENABLE(APPLE_PAY)
487
488class EmptyPaymentCoordinatorClient final : public PaymentCoordinatorClient {
489 bool supportsVersion(unsigned) final { return false; }
490 bool canMakePayments() final { return false; }
491 void canMakePaymentsWithActiveCard(const String&, const String&, std::function<void(bool)> completionHandler) final { callOnMainThread([completionHandler] { completionHandler(false); }); }
492 void openPaymentSetup(const String&, const String&, std::function<void(bool)> completionHandler) final { callOnMainThread([completionHandler] { completionHandler(false); }); }
493 bool showPaymentUI(const URL&, const Vector<URL>&, const PaymentRequest&) final { return false; }
494 void completeMerchantValidation(const PaymentMerchantSession&) final { }
andersca@apple.com78a3d272017-03-08 22:56:22 +0000495 void completeShippingMethodSelection(std::optional<ShippingMethodUpdate>&&) final { }
496 void completeShippingContactSelection(std::optional<ShippingContactUpdate>&&) final { }
497 void completePaymentMethodSelection(std::optional<PaymentMethodUpdate>&&) final { }
498 void completePaymentSession(std::optional<PaymentAuthorizationResult>&&) final { }
andersca@apple.com44fddbd2017-04-19 23:30:47 +0000499 void cancelPaymentSession() final { }
darin@apple.comaf74ed12017-01-07 22:08:28 +0000500 void abortPaymentSession() final { }
501 void paymentCoordinatorDestroyed() final { }
502};
503
504#endif
505
506class EmptyPluginInfoProvider final : public PluginInfoProvider {
507 void refreshPlugins() final { };
508 void getPluginInfo(Page&, Vector<PluginInfo>&) final { }
509 void getWebVisiblePluginInfo(Page&, Vector<PluginInfo>&) final { }
510};
tkent@chromium.orga1b52272012-04-11 02:27:01 +0000511
tkent@chromium.org4e0dc662012-06-05 09:08:04 +0000512class EmptyPopupMenu : public PopupMenu {
513public:
darin@apple.comaf74ed12017-01-07 22:08:28 +0000514 EmptyPopupMenu() = default;
515private:
516 void show(const IntRect&, FrameView*, int) final { }
517 void hide() final { }
518 void updateFromElement() final { }
519 void disconnectClient() final { }
520};
521
522class EmptyProgressTrackerClient final : public ProgressTrackerClient {
523 void willChangeEstimatedProgress() final { }
524 void didChangeEstimatedProgress() final { }
525 void progressStarted(Frame&) final { }
526 void progressEstimateChanged(Frame&) final { }
527 void progressFinished(Frame&) final { }
tkent@chromium.org4e0dc662012-06-05 09:08:04 +0000528};
529
530class EmptySearchPopupMenu : public SearchPopupMenu {
531public:
darin@apple.comaf74ed12017-01-07 22:08:28 +0000532 EmptySearchPopupMenu()
533 : m_popup(adoptRef(*new EmptyPopupMenu))
534 {
535 }
tkent@chromium.org4e0dc662012-06-05 09:08:04 +0000536
537private:
darin@apple.comaf74ed12017-01-07 22:08:28 +0000538 PopupMenu* popupMenu() final { return m_popup.ptr(); }
539 void saveRecentSearches(const AtomicString&, const Vector<RecentSearch>&) final { }
540 void loadRecentSearches(const AtomicString&, Vector<RecentSearch>&) final { }
541 bool enabled() final { return false; }
542
543 Ref<EmptyPopupMenu> m_popup;
544};
545
546class EmptyStorageNamespaceProvider final : public StorageNamespaceProvider {
547 struct EmptyStorageArea : public StorageArea {
548 unsigned length() final { return 0; }
549 String key(unsigned) final { return { }; }
550 String item(const String&) final { return { }; }
551 void setItem(Frame*, const String&, const String&, bool&) final { }
552 void removeItem(Frame*, const String&) final { }
553 void clear(Frame*) final { }
554 bool contains(const String&) final { return false; }
555 bool canAccessStorage(Frame*) final { return false; }
beidson@apple.comaebe99b2017-03-31 19:27:52 +0000556 StorageType storageType() const final { return StorageType::Local; }
darin@apple.comaf74ed12017-01-07 22:08:28 +0000557 size_t memoryBytesUsedByCache() final { return 0; }
558 SecurityOriginData securityOrigin() const final { return { }; }
559 };
560
561 struct EmptyStorageNamespace final : public StorageNamespace {
562 RefPtr<StorageArea> storageArea(const SecurityOriginData&) final { return adoptRef(*new EmptyStorageArea); }
563 RefPtr<StorageNamespace> copy(Page*) final { return adoptRef(*new EmptyStorageNamespace); }
564 };
565
566 RefPtr<StorageNamespace> createSessionStorageNamespace(Page&, unsigned) final;
567 RefPtr<StorageNamespace> createLocalStorageNamespace(unsigned) final;
beidson@apple.com6fc12ef2017-04-13 06:38:19 +0000568 RefPtr<StorageNamespace> createEphemeralLocalStorageNamespace(Page&, unsigned) final;
darin@apple.comaf74ed12017-01-07 22:08:28 +0000569 RefPtr<StorageNamespace> createTransientLocalStorageNamespace(SecurityOrigin&, unsigned) final;
570};
571
572class EmptyUserContentProvider final : public UserContentProvider {
commit-queue@webkit.org0e0b8562017-04-26 21:40:49 +0000573 void forEachUserScript(Function<void(DOMWrapperWorld&, const UserScript&)>&&) const final { }
574 void forEachUserStyleSheet(Function<void(const UserStyleSheet&)>&&) const final { }
darin@apple.comaf74ed12017-01-07 22:08:28 +0000575#if ENABLE(USER_MESSAGE_HANDLERS)
commit-queue@webkit.org0e0b8562017-04-26 21:40:49 +0000576 void forEachUserMessageHandler(Function<void(const UserMessageHandlerDescriptor&)>&&) const final { }
darin@apple.comaf74ed12017-01-07 22:08:28 +0000577#endif
578#if ENABLE(CONTENT_EXTENSIONS)
579 ContentExtensions::ContentExtensionsBackend& userContentExtensionBackend() final { static NeverDestroyed<ContentExtensions::ContentExtensionsBackend> backend; return backend.get(); };
580#endif
581};
582
583class EmptyVisitedLinkStore final : public VisitedLinkStore {
584 bool isLinkVisited(Page&, LinkHash, const URL&, const AtomicString&) final { return false; }
585 void addVisitedLink(Page&, LinkHash) final { }
tkent@chromium.org4e0dc662012-06-05 09:08:04 +0000586};
587
darin@apple.com9ace8012017-01-23 06:24:18 +0000588RefPtr<PopupMenu> EmptyChromeClient::createPopupMenu(PopupMenuClient&) const
tkent@chromium.org4e0dc662012-06-05 09:08:04 +0000589{
darin@apple.comaf74ed12017-01-07 22:08:28 +0000590 return adoptRef(*new EmptyPopupMenu);
tkent@chromium.org4e0dc662012-06-05 09:08:04 +0000591}
592
darin@apple.com9ace8012017-01-23 06:24:18 +0000593RefPtr<SearchPopupMenu> EmptyChromeClient::createSearchPopupMenu(PopupMenuClient&) const
tkent@chromium.org4e0dc662012-06-05 09:08:04 +0000594{
darin@apple.comaf74ed12017-01-07 22:08:28 +0000595 return adoptRef(*new EmptySearchPopupMenu);
tkent@chromium.org4e0dc662012-06-05 09:08:04 +0000596}
597
598#if ENABLE(INPUT_TYPE_COLOR)
darin@apple.comaf74ed12017-01-07 22:08:28 +0000599
darin@apple.com9ace8012017-01-23 06:24:18 +0000600std::unique_ptr<ColorChooser> EmptyChromeClient::createColorChooser(ColorChooserClient&, const Color&)
tkent@chromium.org4e0dc662012-06-05 09:08:04 +0000601{
602 return nullptr;
tkent@chromium.orga1b52272012-04-11 02:27:01 +0000603}
darin@apple.comaf74ed12017-01-07 22:08:28 +0000604
tkent@chromium.orga1b52272012-04-11 02:27:01 +0000605#endif
tkent@chromium.org4e0dc662012-06-05 09:08:04 +0000606
darin@apple.comc04189e2017-01-18 05:17:17 +0000607void EmptyChromeClient::runOpenPanel(Frame&, FileChooser&)
tkent@chromium.org4e0dc662012-06-05 09:08:04 +0000608{
609}
610
darin@apple.comc04189e2017-01-18 05:17:17 +0000611void EmptyFrameLoaderClient::dispatchDecidePolicyForNewWindowAction(const NavigationAction&, const ResourceRequest&, FormState*, const String&, FramePolicyFunction)
tkent@chromium.org4e0dc662012-06-05 09:08:04 +0000612{
613}
614
darin@apple.comc04189e2017-01-18 05:17:17 +0000615void EmptyFrameLoaderClient::dispatchDecidePolicyForNavigationAction(const NavigationAction&, const ResourceRequest&, FormState*, FramePolicyFunction)
tkent@chromium.org4e0dc662012-06-05 09:08:04 +0000616{
617}
618
darin@apple.comc04189e2017-01-18 05:17:17 +0000619void EmptyFrameLoaderClient::dispatchWillSendSubmitEvent(Ref<FormState>&&)
tkent@chromium.org4e0dc662012-06-05 09:08:04 +0000620{
621}
622
darin@apple.comc04189e2017-01-18 05:17:17 +0000623void EmptyFrameLoaderClient::dispatchWillSubmitForm(FormState&, FramePolicyFunction)
tkent@chromium.org4e0dc662012-06-05 09:08:04 +0000624{
625}
626
gyuyoung.kim@webkit.orgc39073e2015-07-19 00:16:50 +0000627Ref<DocumentLoader> EmptyFrameLoaderClient::createDocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData)
tkent@chromium.org4e0dc662012-06-05 09:08:04 +0000628{
629 return DocumentLoader::create(request, substituteData);
630}
631
darin@apple.comc04189e2017-01-18 05:17:17 +0000632RefPtr<Frame> EmptyFrameLoaderClient::createFrame(const URL&, const String&, HTMLFrameOwnerElement&, const String&, bool, int, int)
tkent@chromium.org4e0dc662012-06-05 09:08:04 +0000633{
gyuyoung.kim@webkit.orgc39073e2015-07-19 00:16:50 +0000634 return nullptr;
tkent@chromium.org4e0dc662012-06-05 09:08:04 +0000635}
636
darin@apple.comc04189e2017-01-18 05:17:17 +0000637RefPtr<Widget> EmptyFrameLoaderClient::createPlugin(const IntSize&, HTMLPlugInElement&, const URL&, const Vector<String>&, const Vector<String>&, const String&, bool)
tkent@chromium.org4e0dc662012-06-05 09:08:04 +0000638{
gyuyoung.kim@webkit.orgc39073e2015-07-19 00:16:50 +0000639 return nullptr;
tkent@chromium.org4e0dc662012-06-05 09:08:04 +0000640}
641
jonlee@apple.com1c74e392012-10-10 23:23:13 +0000642void EmptyFrameLoaderClient::recreatePlugin(Widget*)
643{
644}
645
darin@apple.comc04189e2017-01-18 05:17:17 +0000646RefPtr<Widget> EmptyFrameLoaderClient::createJavaAppletWidget(const IntSize&, HTMLAppletElement&, const URL&, const Vector<String>&, const Vector<String>&)
tkent@chromium.org4e0dc662012-06-05 09:08:04 +0000647{
hs85.jeong@samsung.com13179142015-10-21 02:12:32 +0000648 return nullptr;
tkent@chromium.org4e0dc662012-06-05 09:08:04 +0000649}
650
darin@apple.comc04189e2017-01-18 05:17:17 +0000651inline EmptyFrameNetworkingContext::EmptyFrameNetworkingContext()
652 : FrameNetworkingContext { nullptr }
tkent@chromium.org4e0dc662012-06-05 09:08:04 +0000653{
darin@apple.comc04189e2017-01-18 05:17:17 +0000654}
655
656Ref<FrameNetworkingContext> EmptyFrameLoaderClient::createNetworkingContext()
657{
658 return EmptyFrameNetworkingContext::create();
tkent@chromium.org4e0dc662012-06-05 09:08:04 +0000659}
660
darin@apple.comaf74ed12017-01-07 22:08:28 +0000661void EmptyEditorClient::EmptyTextCheckerClient::requestCheckingOfString(TextCheckingRequest&, const VisibleSelection&)
tkent@chromium.org4e0dc662012-06-05 09:08:04 +0000662{
663}
664
darin@apple.comc04189e2017-01-18 05:17:17 +0000665void EmptyEditorClient::registerUndoStep(UndoStep&)
tkent@chromium.org4e0dc662012-06-05 09:08:04 +0000666{
667}
668
darin@apple.comc04189e2017-01-18 05:17:17 +0000669void EmptyEditorClient::registerRedoStep(UndoStep&)
tkent@chromium.org4e0dc662012-06-05 09:08:04 +0000670{
671}
ossy@webkit.org7917deb2016-07-14 20:14:22 +0000672
darin@apple.comaf74ed12017-01-07 22:08:28 +0000673RefPtr<StorageNamespace> EmptyStorageNamespaceProvider::createSessionStorageNamespace(Page&, unsigned)
674{
675 return adoptRef(*new EmptyStorageNamespace);
676}
677
678RefPtr<StorageNamespace> EmptyStorageNamespaceProvider::createLocalStorageNamespace(unsigned)
679{
680 return adoptRef(*new EmptyStorageNamespace);
681}
682
beidson@apple.com6fc12ef2017-04-13 06:38:19 +0000683RefPtr<StorageNamespace> EmptyStorageNamespaceProvider::createEphemeralLocalStorageNamespace(Page&, unsigned)
684{
685 return adoptRef(*new EmptyStorageNamespace);
686}
687
darin@apple.comaf74ed12017-01-07 22:08:28 +0000688RefPtr<StorageNamespace> EmptyStorageNamespaceProvider::createTransientLocalStorageNamespace(SecurityOrigin&, unsigned)
689{
690 return adoptRef(*new EmptyStorageNamespace);
691}
692
693void fillWithEmptyClients(PageConfiguration& pageConfiguration)
694{
695 static NeverDestroyed<EmptyChromeClient> dummyChromeClient;
696 pageConfiguration.chromeClient = &dummyChromeClient.get();
697
698#if ENABLE(APPLE_PAY)
699 static NeverDestroyed<EmptyPaymentCoordinatorClient> dummyPaymentCoordinatorClient;
700 pageConfiguration.paymentCoordinatorClient = &dummyPaymentCoordinatorClient.get();
701#endif
702
703#if ENABLE(CONTEXT_MENUS)
704 static NeverDestroyed<EmptyContextMenuClient> dummyContextMenuClient;
705 pageConfiguration.contextMenuClient = &dummyContextMenuClient.get();
706#endif
707
708#if ENABLE(DRAG_SUPPORT)
709 static NeverDestroyed<EmptyDragClient> dummyDragClient;
710 pageConfiguration.dragClient = &dummyDragClient.get();
711#endif
712
713 static NeverDestroyed<EmptyInspectorClient> dummyInspectorClient;
714 pageConfiguration.inspectorClient = &dummyInspectorClient.get();
715
716 static NeverDestroyed<EmptyFrameLoaderClient> dummyFrameLoaderClient;
717 pageConfiguration.loaderClientForMainFrame = &dummyFrameLoaderClient.get();
718
719 static NeverDestroyed<EmptyProgressTrackerClient> dummyProgressTrackerClient;
720 pageConfiguration.progressTrackerClient = &dummyProgressTrackerClient.get();
721
722 pageConfiguration.backForwardClient = adoptRef(*new EmptyBackForwardClient);
723 pageConfiguration.diagnosticLoggingClient = std::make_unique<EmptyDiagnosticLoggingClient>();
724
725 pageConfiguration.applicationCacheStorage = ApplicationCacheStorage::create({ }, { });
726 pageConfiguration.databaseProvider = adoptRef(*new EmptyDatabaseProvider);
727 pageConfiguration.pluginInfoProvider = adoptRef(*new EmptyPluginInfoProvider);
728 pageConfiguration.storageNamespaceProvider = adoptRef(*new EmptyStorageNamespaceProvider);
729 pageConfiguration.userContentProvider = adoptRef(*new EmptyUserContentProvider);
730 pageConfiguration.visitedLinkStore = adoptRef(*new EmptyVisitedLinkStore);
731}
732
733UniqueRef<EditorClient> createEmptyEditorClient()
734{
735 return makeUniqueRef<EmptyEditorClient>();
736}
737
738DiagnosticLoggingClient& emptyDiagnosticLoggingClient()
739{
740 static NeverDestroyed<EmptyDiagnosticLoggingClient> client;
741 return client;
742}
743
tkent@chromium.org4e0dc662012-06-05 09:08:04 +0000744}