1/*
2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org>
3 * Copyright (C) 2008-2019 Apple Inc. All rights reserved.
4 * 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
31#include "ApplicationCacheStorage.h"
32#include "BackForwardClient.h"
33#include "CacheStorageProvider.h"
34#include "ColorChooser.h"
35#include "ContextMenuClient.h"
36#include "CookieJar.h"
37#include "DOMPasteAccess.h"
38#include "DataListSuggestionPicker.h"
39#include "DatabaseProvider.h"
40#include "DiagnosticLoggingClient.h"
41#include "DocumentFragment.h"
42#include "DocumentLoader.h"
43#include "DragClient.h"
44#include "EditorClient.h"
45#include "EmptyFrameLoaderClient.h"
46#include "FileChooser.h"
47#include "FormState.h"
48#include "Frame.h"
49#include "FrameLoaderClient.h"
50#include "FrameNetworkingContext.h"
51#include "HTMLFormElement.h"
52#include "HistoryItem.h"
53#include "InProcessIDBServer.h"
54#include "InspectorClient.h"
55#include "LibWebRTCProvider.h"
56#include "NetworkStorageSession.h"
57#include "Page.h"
58#include "PageConfiguration.h"
59#include "PaymentCoordinatorClient.h"
60#include "PluginInfoProvider.h"
61#include "ProgressTrackerClient.h"
62#include "SecurityOriginData.h"
63#include "SocketProvider.h"
64#include "StorageArea.h"
65#include "StorageNamespace.h"
66#include "StorageNamespaceProvider.h"
67#include "StorageType.h"
68#include "TextCheckerClient.h"
69#include "ThreadableWebSocketChannel.h"
70#include "UserContentProvider.h"
71#include "VisitedLinkStore.h"
72#include <JavaScriptCore/HeapInlines.h>
73#include <wtf/NeverDestroyed.h>
74
75#if ENABLE(CONTENT_EXTENSIONS)
76#include "CompiledContentExtension.h"
77#endif
78
79#if USE(QUICK_LOOK)
80#include "PreviewLoaderClient.h"
81#endif
82
83namespace WebCore {
84
85class UserMessageHandlerDescriptor;
86
87class EmptyBackForwardClient final : public BackForwardClient {
88 void addItem(Ref<HistoryItem>&&) final { }
89 void goToItem(HistoryItem&) final { }
90 RefPtr<HistoryItem> itemAtIndex(int) final { return nullptr; }
91 unsigned backListCount() const final { return 0; }
92 unsigned forwardListCount() const final { return 0; }
93 void close() final { }
94};
95
96#if ENABLE(CONTEXT_MENUS)
97
98class EmptyContextMenuClient final : public ContextMenuClient {
99 void contextMenuDestroyed() final { }
100
101 void downloadURL(const URL&) final { }
102 void searchWithGoogle(const Frame*) final { }
103 void lookUpInDictionary(Frame*) final { }
104 bool isSpeaking() final { return false; }
105 void speak(const String&) final { }
106 void stopSpeaking() final { }
107
108#if PLATFORM(COCOA)
109 void searchWithSpotlight() final { }
110#endif
111
112#if PLATFORM(GTK)
113 void insertEmoji(Frame&) final { }
114#endif
115
116#if USE(ACCESSIBILITY_CONTEXT_MENUS)
117 void showContextMenu() final { }
118#endif
119};
120
121#endif // ENABLE(CONTEXT_MENUS)
122
123class EmptyDatabaseProvider final : public DatabaseProvider {
124#if ENABLE(INDEXED_DATABASE)
125 IDBClient::IDBConnectionToServer& idbConnectionToServerForSession(const PAL::SessionID& sessionID) final
126 {
127 static auto& sharedConnection = InProcessIDBServer::create(sessionID).leakRef();
128 return sharedConnection.connectionToServer();
129 }
130#endif
131};
132
133class EmptyDiagnosticLoggingClient final : public DiagnosticLoggingClient {
134 void logDiagnosticMessage(const String&, const String&, ShouldSample) final { }
135 void logDiagnosticMessageWithResult(const String&, const String&, DiagnosticLoggingResultType, ShouldSample) final { }
136 void logDiagnosticMessageWithValue(const String&, const String&, double, unsigned, ShouldSample) final { }
137 void logDiagnosticMessageWithEnhancedPrivacy(const String&, const String&, ShouldSample) final { }
138 void logDiagnosticMessageWithValueDictionary(const String&, const String&, const ValueDictionary&, ShouldSample) final { }
139};
140
141#if ENABLE(DRAG_SUPPORT)
142
143class EmptyDragClient final : public DragClient {
144 void willPerformDragDestinationAction(DragDestinationAction, const DragData&) final { }
145 void willPerformDragSourceAction(DragSourceAction, const IntPoint&, DataTransfer&) final { }
146 DragSourceAction dragSourceActionMaskForPoint(const IntPoint&) final { return DragSourceActionNone; }
147 void startDrag(DragItem, DataTransfer&, Frame&) final { }
148 void dragControllerDestroyed() final { }
149};
150
151#endif // ENABLE(DRAG_SUPPORT)
152
153class EmptyEditorClient final : public EditorClient {
154 WTF_MAKE_FAST_ALLOCATED;
155
156public:
157 EmptyEditorClient() = default;
158
159private:
160 bool shouldDeleteRange(Range*) final { return false; }
161 bool smartInsertDeleteEnabled() final { return false; }
162 bool isSelectTrailingWhitespaceEnabled() const final { return false; }
163 bool isContinuousSpellCheckingEnabled() final { return false; }
164 void toggleContinuousSpellChecking() final { }
165 bool isGrammarCheckingEnabled() final { return false; }
166 void toggleGrammarChecking() final { }
167 int spellCheckerDocumentTag() final { return -1; }
168
169 bool shouldBeginEditing(Range*) final { return false; }
170 bool shouldEndEditing(Range*) final { return false; }
171 bool shouldInsertNode(Node*, Range*, EditorInsertAction) final { return false; }
172 bool shouldInsertText(const String&, Range*, EditorInsertAction) final { return false; }
173 bool shouldChangeSelectedRange(Range*, Range*, EAffinity, bool) final { return false; }
174
175 bool shouldApplyStyle(StyleProperties*, Range*) final { return false; }
176 void didApplyStyle() final { }
177 bool shouldMoveRangeAfterDelete(Range*, Range*) final { return false; }
178
179 void didBeginEditing() final { }
180 void respondToChangedContents() final { }
181 void respondToChangedSelection(Frame*) final { }
182 void updateEditorStateAfterLayoutIfEditabilityChanged() final { }
183 void discardedComposition(Frame*) final { }
184 void canceledComposition() final { }
185 void didUpdateComposition() final { }
186 void didEndEditing() final { }
187 void didEndUserTriggeredSelectionChanges() final { }
188 void willWriteSelectionToPasteboard(Range*) final { }
189 void didWriteSelectionToPasteboard() final { }
190 void getClientPasteboardDataForRange(Range*, Vector<String>&, Vector<RefPtr<SharedBuffer>>&) final { }
191 void requestCandidatesForSelection(const VisibleSelection&) final { }
192 void handleAcceptedCandidateWithSoftSpaces(TextCheckingResult) final { }
193
194 void registerUndoStep(UndoStep&) final;
195 void registerRedoStep(UndoStep&) final;
196 void clearUndoRedoOperations() final { }
197
198 DOMPasteAccessResponse requestDOMPasteAccess(const String&) final { return DOMPasteAccessResponse::DeniedForGesture; }
199
200 bool canCopyCut(Frame*, bool defaultValue) const final { return defaultValue; }
201 bool canPaste(Frame*, bool defaultValue) const final { return defaultValue; }
202 bool canUndo() const final { return false; }
203 bool canRedo() const final { return false; }
204
205 void undo() final { }
206 void redo() final { }
207
208 void handleKeyboardEvent(KeyboardEvent&) final { }
209 void handleInputMethodKeydown(KeyboardEvent&) final { }
210
211 void textFieldDidBeginEditing(Element*) final { }
212 void textFieldDidEndEditing(Element*) final { }
213 void textDidChangeInTextField(Element*) final { }
214 bool doTextFieldCommandFromEvent(Element*, KeyboardEvent*) final { return false; }
215 void textWillBeDeletedInTextField(Element*) final { }
216 void textDidChangeInTextArea(Element*) final { }
217 void overflowScrollPositionChanged() final { }
218
219#if PLATFORM(IOS_FAMILY)
220 void startDelayingAndCoalescingContentChangeNotifications() final { }
221 void stopDelayingAndCoalescingContentChangeNotifications() final { }
222 bool hasRichlyEditableSelection() final { return false; }
223 int getPasteboardItemsCount() final { return 0; }
224 RefPtr<DocumentFragment> documentFragmentFromDelegate(int) final { return nullptr; }
225 bool performsTwoStepPaste(DocumentFragment*) final { return false; }
226 void updateStringForFind(const String&) final { }
227#endif
228
229 bool performTwoStepDrop(DocumentFragment&, Range&, bool) final { return false; }
230
231#if PLATFORM(COCOA)
232 void setInsertionPasteboard(const String&) final { };
233#endif
234
235#if USE(APPKIT)
236 void uppercaseWord() final { }
237 void lowercaseWord() final { }
238 void capitalizeWord() final { }
239#endif
240
241#if USE(AUTOMATIC_TEXT_REPLACEMENT)
242 void showSubstitutionsPanel(bool) final { }
243 bool substitutionsPanelIsShowing() final { return false; }
244 void toggleSmartInsertDelete() final { }
245 bool isAutomaticQuoteSubstitutionEnabled() final { return false; }
246 void toggleAutomaticQuoteSubstitution() final { }
247 bool isAutomaticLinkDetectionEnabled() final { return false; }
248 void toggleAutomaticLinkDetection() final { }
249 bool isAutomaticDashSubstitutionEnabled() final { return false; }
250 void toggleAutomaticDashSubstitution() final { }
251 bool isAutomaticTextReplacementEnabled() final { return false; }
252 void toggleAutomaticTextReplacement() final { }
253 bool isAutomaticSpellingCorrectionEnabled() final { return false; }
254 void toggleAutomaticSpellingCorrection() final { }
255#endif
256
257#if PLATFORM(GTK)
258 bool shouldShowUnicodeMenu() final { return false; }
259#endif
260
261 TextCheckerClient* textChecker() final { return &m_textCheckerClient; }
262
263 void updateSpellingUIWithGrammarString(const String&, const GrammarDetail&) final { }
264 void updateSpellingUIWithMisspelledWord(const String&) final { }
265 void showSpellingUI(bool) final { }
266 bool spellingUIIsShowing() final { return false; }
267
268 void willSetInputMethodState() final { }
269 void setInputMethodState(bool) final { }
270
271 class EmptyTextCheckerClient final : public TextCheckerClient {
272 bool shouldEraseMarkersAfterChangeSelection(TextCheckingType) const final { return true; }
273 void ignoreWordInSpellDocument(const String&) final { }
274 void learnWord(const String&) final { }
275 void checkSpellingOfString(StringView, int*, int*) final { }
276 String getAutoCorrectSuggestionForMisspelledWord(const String&) final { return { }; }
277 void checkGrammarOfString(StringView, Vector<GrammarDetail>&, int*, int*) final { }
278
279#if USE(UNIFIED_TEXT_CHECKING)
280 Vector<TextCheckingResult> checkTextOfParagraph(StringView, OptionSet<TextCheckingType>, const VisibleSelection&) final { return Vector<TextCheckingResult>(); }
281#endif
282
283 void getGuessesForWord(const String&, const String&, const VisibleSelection&, Vector<String>&) final { }
284 void requestCheckingOfString(TextCheckingRequest&, const VisibleSelection&) final;
285 };
286
287 EmptyTextCheckerClient m_textCheckerClient;
288};
289
290class EmptyFrameNetworkingContext final : public FrameNetworkingContext {
291public:
292 static Ref<EmptyFrameNetworkingContext> create() { return adoptRef(*new EmptyFrameNetworkingContext); }
293
294private:
295 EmptyFrameNetworkingContext();
296
297 bool shouldClearReferrerOnHTTPSToHTTPRedirect() const { return true; }
298 NetworkStorageSession* storageSession() const final { return nullptr; }
299
300#if PLATFORM(COCOA)
301 bool localFileContentSniffingEnabled() const { return false; }
302 SchedulePairHashSet* scheduledRunLoopPairs() const { return nullptr; }
303 RetainPtr<CFDataRef> sourceApplicationAuditData() const { return nullptr; };
304#endif
305
306#if PLATFORM(COCOA) || PLATFORM(WIN)
307 ResourceError blockedError(const ResourceRequest&) const final { return { }; }
308#endif
309};
310
311class EmptyInspectorClient final : public InspectorClient {
312 void inspectedPageDestroyed() final { }
313 Inspector::FrontendChannel* openLocalFrontend(InspectorController*) final { return nullptr; }
314 void bringFrontendToFront() final { }
315 void highlight() final { }
316 void hideHighlight() final { }
317};
318
319#if ENABLE(APPLE_PAY)
320
321class EmptyPaymentCoordinatorClient final : public PaymentCoordinatorClient {
322 Optional<String> validatedPaymentNetwork(const String&) final { return WTF::nullopt; }
323 bool canMakePayments() final { return false; }
324 void canMakePaymentsWithActiveCard(const String&, const String&, CompletionHandler<void(bool)>&& completionHandler) final { callOnMainThread([completionHandler = WTFMove(completionHandler)]() mutable { completionHandler(false); }); }
325 void openPaymentSetup(const String&, const String&, CompletionHandler<void(bool)>&& completionHandler) final { callOnMainThread([completionHandler = WTFMove(completionHandler)]() mutable { completionHandler(false); }); }
326 bool showPaymentUI(const URL&, const Vector<URL>&, const ApplePaySessionPaymentRequest&) final { return false; }
327 void completeMerchantValidation(const PaymentMerchantSession&) final { }
328 void completeShippingMethodSelection(Optional<ShippingMethodUpdate>&&) final { }
329 void completeShippingContactSelection(Optional<ShippingContactUpdate>&&) final { }
330 void completePaymentMethodSelection(Optional<PaymentMethodUpdate>&&) final { }
331 void completePaymentSession(Optional<PaymentAuthorizationResult>&&) final { }
332 void cancelPaymentSession() final { }
333 void abortPaymentSession() final { }
334 void paymentCoordinatorDestroyed() final { }
335 bool supportsUnrestrictedApplePay() const final { return false; }
336};
337
338#endif
339
340class EmptyPluginInfoProvider final : public PluginInfoProvider {
341 void refreshPlugins() final { };
342 Vector<PluginInfo> pluginInfo(Page&, Optional<Vector<SupportedPluginIdentifier>>&) final { return { }; }
343 Vector<PluginInfo> webVisiblePluginInfo(Page&, const URL&) final { return { }; }
344};
345
346class EmptyPopupMenu : public PopupMenu {
347public:
348 EmptyPopupMenu() = default;
349private:
350 void show(const IntRect&, FrameView*, int) final { }
351 void hide() final { }
352 void updateFromElement() final { }
353 void disconnectClient() final { }
354};
355
356class EmptyProgressTrackerClient final : public ProgressTrackerClient {
357 void willChangeEstimatedProgress() final { }
358 void didChangeEstimatedProgress() final { }
359 void progressStarted(Frame&) final { }
360 void progressEstimateChanged(Frame&) final { }
361 void progressFinished(Frame&) final { }
362};
363
364class EmptySearchPopupMenu : public SearchPopupMenu {
365public:
366 EmptySearchPopupMenu()
367 : m_popup(adoptRef(*new EmptyPopupMenu))
368 {
369 }
370
371private:
372 PopupMenu* popupMenu() final { return m_popup.ptr(); }
373 void saveRecentSearches(const AtomString&, const Vector<RecentSearch>&) final { }
374 void loadRecentSearches(const AtomString&, Vector<RecentSearch>&) final { }
375 bool enabled() final { return false; }
376
377 Ref<EmptyPopupMenu> m_popup;
378};
379
380class EmptyStorageNamespaceProvider final : public StorageNamespaceProvider {
381 struct EmptyStorageArea : public StorageArea {
382 unsigned length() final { return 0; }
383 String key(unsigned) final { return { }; }
384 String item(const String&) final { return { }; }
385 void setItem(Frame*, const String&, const String&, bool&) final { }
386 void removeItem(Frame*, const String&) final { }
387 void clear(Frame*) final { }
388 bool contains(const String&) final { return false; }
389 StorageType storageType() const final { return StorageType::Local; }
390 size_t memoryBytesUsedByCache() final { return 0; }
391 const SecurityOriginData& securityOrigin() const final { static NeverDestroyed<SecurityOriginData> origin; return origin.get(); }
392 };
393
394 struct EmptyStorageNamespace final : public StorageNamespace {
395 Ref<StorageArea> storageArea(const SecurityOriginData&) final { return adoptRef(*new EmptyStorageArea); }
396 Ref<StorageNamespace> copy(Page*) final { return adoptRef(*new EmptyStorageNamespace); }
397 };
398
399 Ref<StorageNamespace> createSessionStorageNamespace(Page&, unsigned) final;
400 Ref<StorageNamespace> createLocalStorageNamespace(unsigned) final;
401 Ref<StorageNamespace> createEphemeralLocalStorageNamespace(Page&, unsigned) final;
402 Ref<StorageNamespace> createTransientLocalStorageNamespace(SecurityOrigin&, unsigned) final;
403};
404
405class EmptyUserContentProvider final : public UserContentProvider {
406 void forEachUserScript(Function<void(DOMWrapperWorld&, const UserScript&)>&&) const final { }
407 void forEachUserStyleSheet(Function<void(const UserStyleSheet&)>&&) const final { }
408#if ENABLE(USER_MESSAGE_HANDLERS)
409 void forEachUserMessageHandler(Function<void(const UserMessageHandlerDescriptor&)>&&) const final { }
410#endif
411#if ENABLE(CONTENT_EXTENSIONS)
412 ContentExtensions::ContentExtensionsBackend& userContentExtensionBackend() final { static NeverDestroyed<ContentExtensions::ContentExtensionsBackend> backend; return backend.get(); };
413#endif
414};
415
416class EmptyVisitedLinkStore final : public VisitedLinkStore {
417 bool isLinkVisited(Page&, SharedStringHash, const URL&, const AtomString&) final { return false; }
418 void addVisitedLink(Page&, SharedStringHash) final { }
419};
420
421RefPtr<PopupMenu> EmptyChromeClient::createPopupMenu(PopupMenuClient&) const
422{
423 return adoptRef(*new EmptyPopupMenu);
424}
425
426RefPtr<SearchPopupMenu> EmptyChromeClient::createSearchPopupMenu(PopupMenuClient&) const
427{
428 return adoptRef(*new EmptySearchPopupMenu);
429}
430
431#if ENABLE(INPUT_TYPE_COLOR)
432
433std::unique_ptr<ColorChooser> EmptyChromeClient::createColorChooser(ColorChooserClient&, const Color&)
434{
435 return nullptr;
436}
437
438#endif
439
440#if ENABLE(DATALIST_ELEMENT)
441
442std::unique_ptr<DataListSuggestionPicker> EmptyChromeClient::createDataListSuggestionPicker(DataListSuggestionsClient&)
443{
444 return nullptr;
445}
446
447#endif
448
449void EmptyChromeClient::runOpenPanel(Frame&, FileChooser&)
450{
451}
452
453void EmptyChromeClient::showShareSheet(ShareDataWithParsedURL&, CompletionHandler<void(bool)>&&)
454{
455}
456
457PAL::SessionID EmptyFrameLoaderClient::sessionID() const
458{
459 return PAL::SessionID::defaultSessionID();
460}
461
462void EmptyFrameLoaderClient::dispatchDecidePolicyForNewWindowAction(const NavigationAction&, const ResourceRequest&, FormState*, const String&, PolicyCheckIdentifier, FramePolicyFunction&&)
463{
464}
465
466void EmptyFrameLoaderClient::dispatchDecidePolicyForNavigationAction(const NavigationAction&, const ResourceRequest&, const ResourceResponse&, FormState*, PolicyDecisionMode, PolicyCheckIdentifier, FramePolicyFunction&&)
467{
468}
469
470void EmptyFrameLoaderClient::dispatchWillSendSubmitEvent(Ref<FormState>&&)
471{
472}
473
474void EmptyFrameLoaderClient::dispatchWillSubmitForm(FormState&, CompletionHandler<void()>&& completionHandler)
475{
476 completionHandler();
477}
478
479Ref<DocumentLoader> EmptyFrameLoaderClient::createDocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData)
480{
481 return DocumentLoader::create(request, substituteData);
482}
483
484RefPtr<Frame> EmptyFrameLoaderClient::createFrame(const URL&, const String&, HTMLFrameOwnerElement&, const String&)
485{
486 return nullptr;
487}
488
489RefPtr<Widget> EmptyFrameLoaderClient::createPlugin(const IntSize&, HTMLPlugInElement&, const URL&, const Vector<String>&, const Vector<String>&, const String&, bool)
490{
491 return nullptr;
492}
493
494RefPtr<Widget> EmptyFrameLoaderClient::createJavaAppletWidget(const IntSize&, HTMLAppletElement&, const URL&, const Vector<String>&, const Vector<String>&)
495{
496 return nullptr;
497}
498
499inline EmptyFrameNetworkingContext::EmptyFrameNetworkingContext()
500 : FrameNetworkingContext { nullptr }
501{
502}
503
504Ref<FrameNetworkingContext> EmptyFrameLoaderClient::createNetworkingContext()
505{
506 return EmptyFrameNetworkingContext::create();
507}
508
509void EmptyEditorClient::EmptyTextCheckerClient::requestCheckingOfString(TextCheckingRequest&, const VisibleSelection&)
510{
511}
512
513void EmptyEditorClient::registerUndoStep(UndoStep&)
514{
515}
516
517void EmptyEditorClient::registerRedoStep(UndoStep&)
518{
519}
520
521Ref<StorageNamespace> EmptyStorageNamespaceProvider::createSessionStorageNamespace(Page&, unsigned)
522{
523 return adoptRef(*new EmptyStorageNamespace);
524}
525
526Ref<StorageNamespace> EmptyStorageNamespaceProvider::createLocalStorageNamespace(unsigned)
527{
528 return adoptRef(*new EmptyStorageNamespace);
529}
530
531Ref<StorageNamespace> EmptyStorageNamespaceProvider::createEphemeralLocalStorageNamespace(Page&, unsigned)
532{
533 return adoptRef(*new EmptyStorageNamespace);
534}
535
536Ref<StorageNamespace> EmptyStorageNamespaceProvider::createTransientLocalStorageNamespace(SecurityOrigin&, unsigned)
537{
538 return adoptRef(*new EmptyStorageNamespace);
539}
540
541class EmptyStorageSessionProvider : public StorageSessionProvider {
542 NetworkStorageSession* storageSession() const final { return nullptr; }
543};
544
545PageConfiguration pageConfigurationWithEmptyClients()
546{
547 PageConfiguration pageConfiguration {
548 makeUniqueRef<EmptyEditorClient>(),
549 SocketProvider::create(),
550 LibWebRTCProvider::create(),
551 CacheStorageProvider::create(),
552 adoptRef(*new EmptyBackForwardClient),
553 CookieJar::create(adoptRef(*new EmptyStorageSessionProvider))
554 };
555
556 static NeverDestroyed<EmptyChromeClient> dummyChromeClient;
557 pageConfiguration.chromeClient = &dummyChromeClient.get();
558
559#if ENABLE(APPLE_PAY)
560 static NeverDestroyed<EmptyPaymentCoordinatorClient> dummyPaymentCoordinatorClient;
561 pageConfiguration.paymentCoordinatorClient = &dummyPaymentCoordinatorClient.get();
562#endif
563
564#if ENABLE(CONTEXT_MENUS)
565 static NeverDestroyed<EmptyContextMenuClient> dummyContextMenuClient;
566 pageConfiguration.contextMenuClient = &dummyContextMenuClient.get();
567#endif
568
569#if ENABLE(DRAG_SUPPORT)
570 static NeverDestroyed<EmptyDragClient> dummyDragClient;
571 pageConfiguration.dragClient = &dummyDragClient.get();
572#endif
573
574 static NeverDestroyed<EmptyInspectorClient> dummyInspectorClient;
575 pageConfiguration.inspectorClient = &dummyInspectorClient.get();
576
577 static NeverDestroyed<EmptyFrameLoaderClient> dummyFrameLoaderClient;
578 pageConfiguration.loaderClientForMainFrame = &dummyFrameLoaderClient.get();
579
580 static NeverDestroyed<EmptyProgressTrackerClient> dummyProgressTrackerClient;
581 pageConfiguration.progressTrackerClient = &dummyProgressTrackerClient.get();
582
583 pageConfiguration.diagnosticLoggingClient = std::make_unique<EmptyDiagnosticLoggingClient>();
584
585 pageConfiguration.applicationCacheStorage = ApplicationCacheStorage::create({ }, { });
586 pageConfiguration.databaseProvider = adoptRef(*new EmptyDatabaseProvider);
587 pageConfiguration.pluginInfoProvider = adoptRef(*new EmptyPluginInfoProvider);
588 pageConfiguration.storageNamespaceProvider = adoptRef(*new EmptyStorageNamespaceProvider);
589 pageConfiguration.userContentProvider = adoptRef(*new EmptyUserContentProvider);
590 pageConfiguration.visitedLinkStore = adoptRef(*new EmptyVisitedLinkStore);
591
592 return pageConfiguration;
593}
594
595DiagnosticLoggingClient& emptyDiagnosticLoggingClient()
596{
597 static NeverDestroyed<EmptyDiagnosticLoggingClient> client;
598 return client;
599}
600
601}
602