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 | |
83 | namespace WebCore { |
84 | |
85 | class UserMessageHandlerDescriptor; |
86 | |
87 | class 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 | |
98 | class final : public ContextMenuClient { |
99 | void () final { } |
100 | |
101 | void (const URL&) final { } |
102 | void (const Frame*) final { } |
103 | void (Frame*) final { } |
104 | bool () final { return false; } |
105 | void (const String&) final { } |
106 | void () final { } |
107 | |
108 | #if PLATFORM(COCOA) |
109 | void searchWithSpotlight() final { } |
110 | #endif |
111 | |
112 | #if PLATFORM(GTK) |
113 | void (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 | |
123 | class 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 | |
133 | class 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 | |
143 | class 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 | |
153 | class EmptyEditorClient final : public EditorClient { |
154 | WTF_MAKE_FAST_ALLOCATED; |
155 | |
156 | public: |
157 | EmptyEditorClient() = default; |
158 | |
159 | private: |
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 () 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 | |
290 | class EmptyFrameNetworkingContext final : public FrameNetworkingContext { |
291 | public: |
292 | static Ref<EmptyFrameNetworkingContext> create() { return adoptRef(*new EmptyFrameNetworkingContext); } |
293 | |
294 | private: |
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 | |
311 | class 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 | |
321 | class 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 | }; |
336 | |
337 | #endif |
338 | |
339 | class EmptyPluginInfoProvider final : public PluginInfoProvider { |
340 | void refreshPlugins() final { }; |
341 | Vector<PluginInfo> pluginInfo(Page&, Optional<Vector<SupportedPluginIdentifier>>&) final { return { }; } |
342 | Vector<PluginInfo> webVisiblePluginInfo(Page&, const URL&) final { return { }; } |
343 | }; |
344 | |
345 | class : public PopupMenu { |
346 | public: |
347 | () = default; |
348 | private: |
349 | void (const IntRect&, FrameView*, int) final { } |
350 | void () final { } |
351 | void () final { } |
352 | void () final { } |
353 | }; |
354 | |
355 | class EmptyProgressTrackerClient final : public ProgressTrackerClient { |
356 | void willChangeEstimatedProgress() final { } |
357 | void didChangeEstimatedProgress() final { } |
358 | void progressStarted(Frame&) final { } |
359 | void progressEstimateChanged(Frame&) final { } |
360 | void progressFinished(Frame&) final { } |
361 | }; |
362 | |
363 | class : public SearchPopupMenu { |
364 | public: |
365 | () |
366 | : m_popup(adoptRef(*new EmptyPopupMenu)) |
367 | { |
368 | } |
369 | |
370 | private: |
371 | PopupMenu* () final { return m_popup.ptr(); } |
372 | void (const AtomicString&, const Vector<RecentSearch>&) final { } |
373 | void (const AtomicString&, Vector<RecentSearch>&) final { } |
374 | bool () final { return false; } |
375 | |
376 | Ref<EmptyPopupMenu> ; |
377 | }; |
378 | |
379 | class EmptyStorageNamespaceProvider final : public StorageNamespaceProvider { |
380 | struct EmptyStorageArea : public StorageArea { |
381 | unsigned length() final { return 0; } |
382 | String key(unsigned) final { return { }; } |
383 | String item(const String&) final { return { }; } |
384 | void setItem(Frame*, const String&, const String&, bool&) final { } |
385 | void removeItem(Frame*, const String&) final { } |
386 | void clear(Frame*) final { } |
387 | bool contains(const String&) final { return false; } |
388 | StorageType storageType() const final { return StorageType::Local; } |
389 | size_t memoryBytesUsedByCache() final { return 0; } |
390 | const SecurityOriginData& securityOrigin() const final { static NeverDestroyed<SecurityOriginData> origin; return origin.get(); } |
391 | }; |
392 | |
393 | struct EmptyStorageNamespace final : public StorageNamespace { |
394 | Ref<StorageArea> storageArea(const SecurityOriginData&) final { return adoptRef(*new EmptyStorageArea); } |
395 | Ref<StorageNamespace> copy(Page*) final { return adoptRef(*new EmptyStorageNamespace); } |
396 | }; |
397 | |
398 | Ref<StorageNamespace> createSessionStorageNamespace(Page&, unsigned) final; |
399 | Ref<StorageNamespace> createLocalStorageNamespace(unsigned) final; |
400 | Ref<StorageNamespace> createEphemeralLocalStorageNamespace(Page&, unsigned) final; |
401 | Ref<StorageNamespace> createTransientLocalStorageNamespace(SecurityOrigin&, unsigned) final; |
402 | }; |
403 | |
404 | class EmptyUserContentProvider final : public UserContentProvider { |
405 | void forEachUserScript(Function<void(DOMWrapperWorld&, const UserScript&)>&&) const final { } |
406 | void forEachUserStyleSheet(Function<void(const UserStyleSheet&)>&&) const final { } |
407 | #if ENABLE(USER_MESSAGE_HANDLERS) |
408 | void forEachUserMessageHandler(Function<void(const UserMessageHandlerDescriptor&)>&&) const final { } |
409 | #endif |
410 | #if ENABLE(CONTENT_EXTENSIONS) |
411 | ContentExtensions::ContentExtensionsBackend& userContentExtensionBackend() final { static NeverDestroyed<ContentExtensions::ContentExtensionsBackend> backend; return backend.get(); }; |
412 | #endif |
413 | }; |
414 | |
415 | class EmptyVisitedLinkStore final : public VisitedLinkStore { |
416 | bool isLinkVisited(Page&, SharedStringHash, const URL&, const AtomicString&) final { return false; } |
417 | void addVisitedLink(Page&, SharedStringHash) final { } |
418 | }; |
419 | |
420 | RefPtr<PopupMenu> EmptyChromeClient::(PopupMenuClient&) const |
421 | { |
422 | return adoptRef(*new EmptyPopupMenu); |
423 | } |
424 | |
425 | RefPtr<SearchPopupMenu> EmptyChromeClient::(PopupMenuClient&) const |
426 | { |
427 | return adoptRef(*new EmptySearchPopupMenu); |
428 | } |
429 | |
430 | #if ENABLE(INPUT_TYPE_COLOR) |
431 | |
432 | std::unique_ptr<ColorChooser> EmptyChromeClient::createColorChooser(ColorChooserClient&, const Color&) |
433 | { |
434 | return nullptr; |
435 | } |
436 | |
437 | #endif |
438 | |
439 | #if ENABLE(DATALIST_ELEMENT) |
440 | |
441 | std::unique_ptr<DataListSuggestionPicker> EmptyChromeClient::createDataListSuggestionPicker(DataListSuggestionsClient&) |
442 | { |
443 | return nullptr; |
444 | } |
445 | |
446 | #endif |
447 | |
448 | void EmptyChromeClient::runOpenPanel(Frame&, FileChooser&) |
449 | { |
450 | } |
451 | |
452 | void EmptyChromeClient::showShareSheet(ShareDataWithParsedURL&, CompletionHandler<void(bool)>&&) |
453 | { |
454 | } |
455 | |
456 | PAL::SessionID EmptyFrameLoaderClient::sessionID() const |
457 | { |
458 | return PAL::SessionID::defaultSessionID(); |
459 | } |
460 | |
461 | void EmptyFrameLoaderClient::dispatchDecidePolicyForNewWindowAction(const NavigationAction&, const ResourceRequest&, FormState*, const String&, PolicyCheckIdentifier, FramePolicyFunction&&) |
462 | { |
463 | } |
464 | |
465 | void EmptyFrameLoaderClient::dispatchDecidePolicyForNavigationAction(const NavigationAction&, const ResourceRequest&, const ResourceResponse&, FormState*, PolicyDecisionMode, PolicyCheckIdentifier, FramePolicyFunction&&) |
466 | { |
467 | } |
468 | |
469 | void EmptyFrameLoaderClient::dispatchWillSendSubmitEvent(Ref<FormState>&&) |
470 | { |
471 | } |
472 | |
473 | void EmptyFrameLoaderClient::dispatchWillSubmitForm(FormState&, CompletionHandler<void()>&& completionHandler) |
474 | { |
475 | completionHandler(); |
476 | } |
477 | |
478 | Ref<DocumentLoader> EmptyFrameLoaderClient::createDocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData) |
479 | { |
480 | return DocumentLoader::create(request, substituteData); |
481 | } |
482 | |
483 | RefPtr<Frame> EmptyFrameLoaderClient::createFrame(const URL&, const String&, HTMLFrameOwnerElement&, const String&) |
484 | { |
485 | return nullptr; |
486 | } |
487 | |
488 | RefPtr<Widget> EmptyFrameLoaderClient::createPlugin(const IntSize&, HTMLPlugInElement&, const URL&, const Vector<String>&, const Vector<String>&, const String&, bool) |
489 | { |
490 | return nullptr; |
491 | } |
492 | |
493 | RefPtr<Widget> EmptyFrameLoaderClient::createJavaAppletWidget(const IntSize&, HTMLAppletElement&, const URL&, const Vector<String>&, const Vector<String>&) |
494 | { |
495 | return nullptr; |
496 | } |
497 | |
498 | inline EmptyFrameNetworkingContext::EmptyFrameNetworkingContext() |
499 | : FrameNetworkingContext { nullptr } |
500 | { |
501 | } |
502 | |
503 | Ref<FrameNetworkingContext> EmptyFrameLoaderClient::createNetworkingContext() |
504 | { |
505 | return EmptyFrameNetworkingContext::create(); |
506 | } |
507 | |
508 | void EmptyEditorClient::EmptyTextCheckerClient::requestCheckingOfString(TextCheckingRequest&, const VisibleSelection&) |
509 | { |
510 | } |
511 | |
512 | void EmptyEditorClient::registerUndoStep(UndoStep&) |
513 | { |
514 | } |
515 | |
516 | void EmptyEditorClient::registerRedoStep(UndoStep&) |
517 | { |
518 | } |
519 | |
520 | Ref<StorageNamespace> EmptyStorageNamespaceProvider::createSessionStorageNamespace(Page&, unsigned) |
521 | { |
522 | return adoptRef(*new EmptyStorageNamespace); |
523 | } |
524 | |
525 | Ref<StorageNamespace> EmptyStorageNamespaceProvider::createLocalStorageNamespace(unsigned) |
526 | { |
527 | return adoptRef(*new EmptyStorageNamespace); |
528 | } |
529 | |
530 | Ref<StorageNamespace> EmptyStorageNamespaceProvider::createEphemeralLocalStorageNamespace(Page&, unsigned) |
531 | { |
532 | return adoptRef(*new EmptyStorageNamespace); |
533 | } |
534 | |
535 | Ref<StorageNamespace> EmptyStorageNamespaceProvider::createTransientLocalStorageNamespace(SecurityOrigin&, unsigned) |
536 | { |
537 | return adoptRef(*new EmptyStorageNamespace); |
538 | } |
539 | |
540 | class EmptyStorageSessionProvider : public StorageSessionProvider { |
541 | NetworkStorageSession* storageSession() const final { return nullptr; } |
542 | }; |
543 | |
544 | PageConfiguration pageConfigurationWithEmptyClients() |
545 | { |
546 | PageConfiguration pageConfiguration { |
547 | makeUniqueRef<EmptyEditorClient>(), |
548 | SocketProvider::create(), |
549 | LibWebRTCProvider::create(), |
550 | CacheStorageProvider::create(), |
551 | adoptRef(*new EmptyBackForwardClient), |
552 | CookieJar::create(adoptRef(*new EmptyStorageSessionProvider)) |
553 | }; |
554 | |
555 | static NeverDestroyed<EmptyChromeClient> dummyChromeClient; |
556 | pageConfiguration.chromeClient = &dummyChromeClient.get(); |
557 | |
558 | #if ENABLE(APPLE_PAY) |
559 | static NeverDestroyed<EmptyPaymentCoordinatorClient> dummyPaymentCoordinatorClient; |
560 | pageConfiguration.paymentCoordinatorClient = &dummyPaymentCoordinatorClient.get(); |
561 | #endif |
562 | |
563 | #if ENABLE(CONTEXT_MENUS) |
564 | static NeverDestroyed<EmptyContextMenuClient> ; |
565 | pageConfiguration.contextMenuClient = &dummyContextMenuClient.get(); |
566 | #endif |
567 | |
568 | #if ENABLE(DRAG_SUPPORT) |
569 | static NeverDestroyed<EmptyDragClient> dummyDragClient; |
570 | pageConfiguration.dragClient = &dummyDragClient.get(); |
571 | #endif |
572 | |
573 | static NeverDestroyed<EmptyInspectorClient> dummyInspectorClient; |
574 | pageConfiguration.inspectorClient = &dummyInspectorClient.get(); |
575 | |
576 | static NeverDestroyed<EmptyFrameLoaderClient> dummyFrameLoaderClient; |
577 | pageConfiguration.loaderClientForMainFrame = &dummyFrameLoaderClient.get(); |
578 | |
579 | static NeverDestroyed<EmptyProgressTrackerClient> dummyProgressTrackerClient; |
580 | pageConfiguration.progressTrackerClient = &dummyProgressTrackerClient.get(); |
581 | |
582 | pageConfiguration.diagnosticLoggingClient = std::make_unique<EmptyDiagnosticLoggingClient>(); |
583 | |
584 | pageConfiguration.applicationCacheStorage = ApplicationCacheStorage::create({ }, { }); |
585 | pageConfiguration.databaseProvider = adoptRef(*new EmptyDatabaseProvider); |
586 | pageConfiguration.pluginInfoProvider = adoptRef(*new EmptyPluginInfoProvider); |
587 | pageConfiguration.storageNamespaceProvider = adoptRef(*new EmptyStorageNamespaceProvider); |
588 | pageConfiguration.userContentProvider = adoptRef(*new EmptyUserContentProvider); |
589 | pageConfiguration.visitedLinkStore = adoptRef(*new EmptyVisitedLinkStore); |
590 | |
591 | return pageConfiguration; |
592 | } |
593 | |
594 | DiagnosticLoggingClient& emptyDiagnosticLoggingClient() |
595 | { |
596 | static NeverDestroyed<EmptyDiagnosticLoggingClient> client; |
597 | return client; |
598 | } |
599 | |
600 | } |
601 | |