1 | /*
|
---|
2 | * Copyright (C) 2006-2016 Apple Inc. All rights reserved.
|
---|
3 | * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
|
---|
4 | * Copyright (C) Research In Motion Limited 2009. All rights reserved.
|
---|
5 | * Copyright (C) 2011 Google Inc. All rights reserved.
|
---|
6 | *
|
---|
7 | * Redistribution and use in source and binary forms, with or without
|
---|
8 | * modification, are permitted provided that the following conditions
|
---|
9 | * are met:
|
---|
10 | *
|
---|
11 | * 1. Redistributions of source code must retain the above copyright
|
---|
12 | * notice, this list of conditions and the following disclaimer.
|
---|
13 | * 2. Redistributions in binary form must reproduce the above copyright
|
---|
14 | * notice, this list of conditions and the following disclaimer in the
|
---|
15 | * documentation and/or other materials provided with the distribution.
|
---|
16 | * 3. Neither the name of Apple Inc. ("Apple") nor the names of
|
---|
17 | * its contributors may be used to endorse or promote products derived
|
---|
18 | * from this software without specific prior written permission.
|
---|
19 | *
|
---|
20 | * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
|
---|
21 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
---|
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
---|
23 | * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
|
---|
24 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
---|
25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
---|
26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
---|
27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
29 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
30 | */
|
---|
31 |
|
---|
32 | #pragma once
|
---|
33 |
|
---|
34 | #include "FrameIdentifier.h"
|
---|
35 | #include "FrameLoaderStateMachine.h"
|
---|
36 | #include "FrameLoaderTypes.h"
|
---|
37 | #include "LayoutMilestone.h"
|
---|
38 | #include "PageIdentifier.h"
|
---|
39 | #include "PrivateClickMeasurement.h"
|
---|
40 | #include "ReferrerPolicy.h"
|
---|
41 | #include "ResourceLoadNotifier.h"
|
---|
42 | #include "ResourceLoaderOptions.h"
|
---|
43 | #include "ResourceRequestBase.h"
|
---|
44 | #include "SecurityContext.h"
|
---|
45 | #include "StoredCredentialsPolicy.h"
|
---|
46 | #include "Timer.h"
|
---|
47 | #include <wtf/CompletionHandler.h>
|
---|
48 | #include <wtf/Forward.h>
|
---|
49 | #include <wtf/HashSet.h>
|
---|
50 | #include <wtf/OptionSet.h>
|
---|
51 | #include <wtf/UniqueRef.h>
|
---|
52 | #include <wtf/WallTime.h>
|
---|
53 | #include <wtf/WeakHashSet.h>
|
---|
54 |
|
---|
55 | namespace WebCore {
|
---|
56 |
|
---|
57 | class Archive;
|
---|
58 | class CachedFrameBase;
|
---|
59 | class CachedPage;
|
---|
60 | class CachedResource;
|
---|
61 | class Chrome;
|
---|
62 | class SharedBuffer;
|
---|
63 | class DOMWrapperWorld;
|
---|
64 | class Document;
|
---|
65 | class DocumentLoader;
|
---|
66 | class Event;
|
---|
67 | class FormState;
|
---|
68 | class FormSubmission;
|
---|
69 | class FrameLoadRequest;
|
---|
70 | class FrameLoaderClient;
|
---|
71 | class FrameNetworkingContext;
|
---|
72 | class HistoryItem;
|
---|
73 | class NavigationAction;
|
---|
74 | class NetworkingContext;
|
---|
75 | class Node;
|
---|
76 | class ResourceError;
|
---|
77 | class ResourceRequest;
|
---|
78 | class ResourceResponse;
|
---|
79 | class SerializedScriptValue;
|
---|
80 | class SubstituteData;
|
---|
81 |
|
---|
82 | enum class CachePolicy : uint8_t;
|
---|
83 | enum class NewLoadInProgress : bool;
|
---|
84 | enum class NavigationPolicyDecision : uint8_t;
|
---|
85 | enum class ShouldTreatAsContinuingLoad : uint8_t;
|
---|
86 | enum class UsedLegacyTLS : bool;
|
---|
87 | enum class IsMainResource : bool { No, Yes };
|
---|
88 | enum class ShouldUpdateAppInitiatedValue : bool { No, Yes };
|
---|
89 |
|
---|
90 | struct WindowFeatures;
|
---|
91 |
|
---|
92 | WEBCORE_EXPORT bool isBackForwardLoadType(FrameLoadType);
|
---|
93 | WEBCORE_EXPORT bool isReload(FrameLoadType);
|
---|
94 |
|
---|
95 | using ContentPolicyDecisionFunction = Function<void(PolicyAction, PolicyCheckIdentifier)>;
|
---|
96 |
|
---|
97 | class FrameLoader final {
|
---|
98 | WTF_MAKE_FAST_ALLOCATED;
|
---|
99 | WTF_MAKE_NONCOPYABLE(FrameLoader);
|
---|
100 | public:
|
---|
101 | FrameLoader(Frame&, UniqueRef<FrameLoaderClient>&&);
|
---|
102 | ~FrameLoader();
|
---|
103 |
|
---|
104 | WEBCORE_EXPORT void init();
|
---|
105 | void initForSynthesizedDocument(const URL&);
|
---|
106 |
|
---|
107 | Frame& frame() const { return m_frame; }
|
---|
108 |
|
---|
109 | class PolicyChecker;
|
---|
110 | PolicyChecker& policyChecker() const { return *m_policyChecker; }
|
---|
111 |
|
---|
112 | class HistoryController;
|
---|
113 | HistoryController& history() const { return *m_history; }
|
---|
114 | ResourceLoadNotifier& notifier() const { return m_notifier; }
|
---|
115 |
|
---|
116 | class SubframeLoader;
|
---|
117 | SubframeLoader& subframeLoader() { return *m_subframeLoader; }
|
---|
118 | const SubframeLoader& subframeLoader() const { return *m_subframeLoader; }
|
---|
119 |
|
---|
120 | void setupForReplace();
|
---|
121 |
|
---|
122 | // FIXME: These are all functions which start loads. We have too many.
|
---|
123 | WEBCORE_EXPORT void loadFrameRequest(FrameLoadRequest&&, Event*, RefPtr<FormState>&&, std::optional<PrivateClickMeasurement>&& = std::nullopt); // Called by submitForm, calls loadPostRequest and loadURL.
|
---|
124 |
|
---|
125 | WEBCORE_EXPORT void load(FrameLoadRequest&&);
|
---|
126 |
|
---|
127 | #if ENABLE(WEB_ARCHIVE) || ENABLE(MHTML)
|
---|
128 | WEBCORE_EXPORT void loadArchive(Ref<Archive>&&);
|
---|
129 | #endif
|
---|
130 | ResourceLoaderIdentifier loadResourceSynchronously(const ResourceRequest&, ClientCredentialPolicy, const FetchOptions&, const HTTPHeaderMap&, ResourceError&, ResourceResponse&, RefPtr<SharedBuffer>& data);
|
---|
131 |
|
---|
132 | WEBCORE_EXPORT void changeLocation(const URL&, const AtomString& target, Event*, const ReferrerPolicy&, ShouldOpenExternalURLsPolicy, std::optional<NewFrameOpenerPolicy> = std::nullopt, const AtomString& downloadAttribute = nullAtom(), const SystemPreviewInfo& = { }, std::optional<PrivateClickMeasurement>&& = std::nullopt);
|
---|
133 | void changeLocation(FrameLoadRequest&&, Event* = nullptr, std::optional<PrivateClickMeasurement>&& = std::nullopt);
|
---|
134 | void submitForm(Ref<FormSubmission>&&);
|
---|
135 |
|
---|
136 | WEBCORE_EXPORT void reload(OptionSet<ReloadOption> = { });
|
---|
137 | WEBCORE_EXPORT void reloadWithOverrideEncoding(const String& overrideEncoding);
|
---|
138 |
|
---|
139 | void open(CachedFrameBase&);
|
---|
140 |
|
---|
141 | void retryAfterFailedCacheOnlyMainResourceLoad();
|
---|
142 |
|
---|
143 | static void reportLocalLoadFailed(Frame*, const String& url);
|
---|
144 | static void reportBlockedLoadFailed(Frame&, const URL&);
|
---|
145 |
|
---|
146 | // FIXME: These are all functions which stop loads. We have too many.
|
---|
147 | void stopAllLoadersAndCheckCompleteness();
|
---|
148 | WEBCORE_EXPORT void stopAllLoaders(ClearProvisionalItem = ClearProvisionalItem::Yes, StopLoadingPolicy = StopLoadingPolicy::PreventDuringUnloadEvents);
|
---|
149 | WEBCORE_EXPORT void stopForUserCancel(bool deferCheckLoadComplete = false);
|
---|
150 | void stopForBackForwardCache();
|
---|
151 | void stop();
|
---|
152 | void stopLoading(UnloadEventPolicy);
|
---|
153 | void closeURL();
|
---|
154 | // FIXME: clear() is trying to do too many things. We should break it down into smaller functions (ideally with fewer raw Boolean parameters).
|
---|
155 | void clear(RefPtr<Document>&& newDocument, bool clearWindowProperties = true, bool clearScriptObjects = true, bool clearFrameView = true, Function<void()>&& handleDOMWindowCreation = nullptr);
|
---|
156 |
|
---|
157 | bool isLoading() const;
|
---|
158 | WEBCORE_EXPORT bool frameHasLoaded() const;
|
---|
159 |
|
---|
160 | WEBCORE_EXPORT int numPendingOrLoadingRequests(bool recurse) const;
|
---|
161 |
|
---|
162 | ReferrerPolicy effectiveReferrerPolicy() const;
|
---|
163 | String referrer() const;
|
---|
164 | WEBCORE_EXPORT String outgoingReferrer() const;
|
---|
165 | String outgoingOrigin() const;
|
---|
166 |
|
---|
167 | WEBCORE_EXPORT DocumentLoader* activeDocumentLoader() const;
|
---|
168 | DocumentLoader* documentLoader() const { return m_documentLoader.get(); }
|
---|
169 | DocumentLoader* policyDocumentLoader() const { return m_policyDocumentLoader.get(); }
|
---|
170 | DocumentLoader* provisionalDocumentLoader() const { return m_provisionalDocumentLoader.get(); }
|
---|
171 | FrameState state() const { return m_state; }
|
---|
172 |
|
---|
173 | bool shouldReportResourceTimingToParentFrame() const { return m_shouldReportResourceTimingToParentFrame; };
|
---|
174 |
|
---|
175 | #if PLATFORM(IOS_FAMILY)
|
---|
176 | RetainPtr<CFDictionaryRef> connectionProperties(ResourceLoader*);
|
---|
177 | #endif
|
---|
178 | void receivedMainResourceError(const ResourceError&);
|
---|
179 |
|
---|
180 | bool willLoadMediaElementURL(URL&, Node&);
|
---|
181 |
|
---|
182 | WEBCORE_EXPORT ResourceError cancelledError(const ResourceRequest&) const;
|
---|
183 | WEBCORE_EXPORT ResourceError blockedByContentBlockerError(const ResourceRequest&) const;
|
---|
184 | ResourceError blockedError(const ResourceRequest&) const;
|
---|
185 | #if ENABLE(CONTENT_FILTERING)
|
---|
186 | ResourceError blockedByContentFilterError(const ResourceRequest&) const;
|
---|
187 | #endif
|
---|
188 |
|
---|
189 | bool isReplacing() const;
|
---|
190 | void setReplacing();
|
---|
191 | bool subframeIsLoading() const;
|
---|
192 | void willChangeTitle(DocumentLoader*);
|
---|
193 | void didChangeTitle(DocumentLoader*);
|
---|
194 |
|
---|
195 | bool shouldTreatURLAsSrcdocDocument(const URL&) const;
|
---|
196 |
|
---|
197 | WEBCORE_EXPORT FrameLoadType loadType() const;
|
---|
198 |
|
---|
199 | CachePolicy subresourceCachePolicy(const URL&) const;
|
---|
200 |
|
---|
201 | void didReachLayoutMilestone(OptionSet<LayoutMilestone>);
|
---|
202 | void didFirstLayout();
|
---|
203 | void didReachVisuallyNonEmptyState();
|
---|
204 |
|
---|
205 | void loadedResourceFromMemoryCache(CachedResource&, ResourceRequest& newRequest, ResourceError&);
|
---|
206 | void tellClientAboutPastMemoryCacheLoads();
|
---|
207 |
|
---|
208 | void checkLoadComplete();
|
---|
209 | WEBCORE_EXPORT void detachFromParent();
|
---|
210 | void detachViewsAndDocumentLoader();
|
---|
211 |
|
---|
212 | static void addHTTPOriginIfNeeded(ResourceRequest&, const String& origin);
|
---|
213 | static void addSameSiteInfoToRequestIfNeeded(ResourceRequest&, const Document* initiator = nullptr);
|
---|
214 |
|
---|
215 | const FrameLoaderClient& client() const { return m_client.get(); }
|
---|
216 | FrameLoaderClient& client() { return m_client.get(); }
|
---|
217 |
|
---|
218 | WEBCORE_EXPORT std::optional<PageIdentifier> pageID() const;
|
---|
219 | WEBCORE_EXPORT std::optional<FrameIdentifier> frameID() const;
|
---|
220 |
|
---|
221 | void setDefersLoading(bool);
|
---|
222 |
|
---|
223 | void checkContentPolicy(const ResourceResponse&, PolicyCheckIdentifier, ContentPolicyDecisionFunction&&);
|
---|
224 |
|
---|
225 | void didExplicitOpen();
|
---|
226 |
|
---|
227 | // Callbacks from DocumentWriter
|
---|
228 | void didBeginDocument(bool dispatchWindowObjectAvailable);
|
---|
229 |
|
---|
230 | void receivedFirstData();
|
---|
231 |
|
---|
232 | void dispatchOnloadEvents();
|
---|
233 | String userAgent(const URL&) const;
|
---|
234 | String navigatorPlatform() const;
|
---|
235 |
|
---|
236 | void dispatchDidClearWindowObjectInWorld(DOMWrapperWorld&);
|
---|
237 | void dispatchDidClearWindowObjectsInAllWorlds();
|
---|
238 |
|
---|
239 | // The following sandbox flags will be forced, regardless of changes to
|
---|
240 | // the sandbox attribute of any parent frames.
|
---|
241 | void forceSandboxFlags(SandboxFlags flags) { m_forcedSandboxFlags |= flags; }
|
---|
242 | WEBCORE_EXPORT SandboxFlags effectiveSandboxFlags() const;
|
---|
243 |
|
---|
244 | bool checkIfFormActionAllowedByCSP(const URL&, bool didReceiveRedirectResponse, const URL& preRedirectURL) const;
|
---|
245 |
|
---|
246 | WEBCORE_EXPORT Frame* opener();
|
---|
247 | WEBCORE_EXPORT const Frame* opener() const;
|
---|
248 | WEBCORE_EXPORT void setOpener(Frame*);
|
---|
249 | WEBCORE_EXPORT void detachFromAllOpenedFrames();
|
---|
250 |
|
---|
251 | void resetMultipleFormSubmissionProtection();
|
---|
252 |
|
---|
253 | void checkCallImplicitClose();
|
---|
254 |
|
---|
255 | void frameDetached();
|
---|
256 |
|
---|
257 | void setOutgoingReferrer(const URL&);
|
---|
258 |
|
---|
259 | void loadDone(LoadCompletionType);
|
---|
260 | void subresourceLoadDone(LoadCompletionType);
|
---|
261 | void finishedParsing();
|
---|
262 | void checkCompleted();
|
---|
263 |
|
---|
264 | WEBCORE_EXPORT bool isComplete() const;
|
---|
265 |
|
---|
266 | void commitProvisionalLoad();
|
---|
267 |
|
---|
268 | void setLoadsSynchronously(bool loadsSynchronously) { m_loadsSynchronously = loadsSynchronously; }
|
---|
269 | bool loadsSynchronously() const { return m_loadsSynchronously; }
|
---|
270 |
|
---|
271 | FrameLoaderStateMachine& stateMachine() { return m_stateMachine; }
|
---|
272 | const FrameLoaderStateMachine& stateMachine() const { return m_stateMachine; }
|
---|
273 |
|
---|
274 | // FIXME: should return RefPtr.
|
---|
275 | WEBCORE_EXPORT Frame* findFrameForNavigation(const AtomString& name, Document* activeDocument = nullptr);
|
---|
276 |
|
---|
277 | void applyUserAgentIfNeeded(ResourceRequest&);
|
---|
278 |
|
---|
279 | bool shouldInterruptLoadForXFrameOptions(const String&, const URL&, ResourceLoaderIdentifier);
|
---|
280 |
|
---|
281 | void completed();
|
---|
282 | bool allAncestorsAreComplete() const; // including this
|
---|
283 | void clientRedirected(const URL&, double delay, WallTime fireDate, LockBackForwardList);
|
---|
284 | void clientRedirectCancelledOrFinished(NewLoadInProgress);
|
---|
285 |
|
---|
286 | WEBCORE_EXPORT void setOriginalURLForDownloadRequest(ResourceRequest&);
|
---|
287 |
|
---|
288 | bool quickRedirectComing() const { return m_quickRedirectComing; }
|
---|
289 |
|
---|
290 | WEBCORE_EXPORT bool shouldClose();
|
---|
291 |
|
---|
292 | enum class PageDismissalType { None, BeforeUnload, PageHide, Unload };
|
---|
293 | PageDismissalType pageDismissalEventBeingDispatched() const { return m_pageDismissalEventBeingDispatched; }
|
---|
294 |
|
---|
295 | WEBCORE_EXPORT NetworkingContext* networkingContext() const;
|
---|
296 |
|
---|
297 | void loadProgressingStatusChanged();
|
---|
298 |
|
---|
299 | const URL& previousURL() const { return m_previousURL; }
|
---|
300 |
|
---|
301 | WEBCORE_EXPORT void completePageTransitionIfNeeded();
|
---|
302 |
|
---|
303 | void setOverrideCachePolicyForTesting(ResourceRequestCachePolicy policy) { m_overrideCachePolicyForTesting = policy; }
|
---|
304 | void setOverrideResourceLoadPriorityForTesting(ResourceLoadPriority priority) { m_overrideResourceLoadPriorityForTesting = priority; }
|
---|
305 | void setStrictRawResourceValidationPolicyDisabledForTesting(bool disabled) { m_isStrictRawResourceValidationPolicyDisabledForTesting = disabled; }
|
---|
306 | bool isStrictRawResourceValidationPolicyDisabledForTesting() { return m_isStrictRawResourceValidationPolicyDisabledForTesting; }
|
---|
307 |
|
---|
308 | WEBCORE_EXPORT void clearTestingOverrides();
|
---|
309 |
|
---|
310 | const URL& provisionalLoadErrorBeingHandledURL() const { return m_provisionalLoadErrorBeingHandledURL; }
|
---|
311 | void setProvisionalLoadErrorBeingHandledURL(const URL& url) { m_provisionalLoadErrorBeingHandledURL = url; }
|
---|
312 |
|
---|
313 | bool shouldSuppressTextInputFromEditing() const;
|
---|
314 | bool isReloadingFromOrigin() const { return m_loadType == FrameLoadType::ReloadFromOrigin; }
|
---|
315 |
|
---|
316 | // Used in webarchive loading tests.
|
---|
317 | void setAlwaysAllowLocalWebarchive(bool alwaysAllowLocalWebarchive) { m_alwaysAllowLocalWebarchive = alwaysAllowLocalWebarchive; }
|
---|
318 | bool alwaysAllowLocalWebarchive() const { return m_alwaysAllowLocalWebarchive; }
|
---|
319 |
|
---|
320 | enum class IsServiceWorkerNavigationLoad : bool { No, Yes };
|
---|
321 | // For subresource requests the FrameLoadType parameter has no effect and can be skipped.
|
---|
322 | void updateRequestAndAddExtraFields(ResourceRequest&, IsMainResource, FrameLoadType = FrameLoadType::Standard, ShouldUpdateAppInitiatedValue = ShouldUpdateAppInitiatedValue::Yes, IsServiceWorkerNavigationLoad = IsServiceWorkerNavigationLoad::No, Document* = nullptr);
|
---|
323 |
|
---|
324 | void scheduleRefreshIfNeeded(Document&, const String& content, IsMetaRefresh);
|
---|
325 |
|
---|
326 | void switchBrowsingContextsGroup();
|
---|
327 |
|
---|
328 | private:
|
---|
329 | enum FormSubmissionCacheLoadPolicy {
|
---|
330 | MayAttemptCacheOnlyLoadForFormSubmissionItem,
|
---|
331 | MayNotAttemptCacheOnlyLoadForFormSubmissionItem
|
---|
332 | };
|
---|
333 |
|
---|
334 | bool allChildrenAreComplete() const; // immediate children, not all descendants
|
---|
335 |
|
---|
336 | void checkTimerFired();
|
---|
337 | void checkCompletenessNow();
|
---|
338 |
|
---|
339 | void loadSameDocumentItem(HistoryItem&);
|
---|
340 | void loadDifferentDocumentItem(HistoryItem&, HistoryItem* fromItem, FrameLoadType, FormSubmissionCacheLoadPolicy, ShouldTreatAsContinuingLoad);
|
---|
341 |
|
---|
342 | void loadProvisionalItemFromCachedPage();
|
---|
343 |
|
---|
344 | void updateFirstPartyForCookies();
|
---|
345 | void setFirstPartyForCookies(const URL&);
|
---|
346 |
|
---|
347 | ResourceRequestCachePolicy defaultRequestCachingPolicy(const ResourceRequest&, FrameLoadType, bool isMainResource);
|
---|
348 |
|
---|
349 | void clearProvisionalLoad();
|
---|
350 | void transitionToCommitted(CachedPage*);
|
---|
351 | void frameLoadCompleted();
|
---|
352 |
|
---|
353 | SubstituteData defaultSubstituteDataForURL(const URL&);
|
---|
354 |
|
---|
355 | bool dispatchBeforeUnloadEvent(Chrome&, FrameLoader* frameLoaderBeingNavigated);
|
---|
356 | void dispatchUnloadEvents(UnloadEventPolicy);
|
---|
357 |
|
---|
358 | void continueLoadAfterNavigationPolicy(const ResourceRequest&, FormState*, NavigationPolicyDecision, AllowNavigationToInvalidURL);
|
---|
359 | void continueLoadAfterNewWindowPolicy(const ResourceRequest&, FormState*, const AtomString& frameName, const NavigationAction&, ShouldContinuePolicyCheck, AllowNavigationToInvalidURL, NewFrameOpenerPolicy);
|
---|
360 | void continueFragmentScrollAfterNavigationPolicy(const ResourceRequest&, bool shouldContinue);
|
---|
361 |
|
---|
362 | bool shouldPerformFragmentNavigation(bool isFormSubmission, const String& httpMethod, FrameLoadType, const URL&);
|
---|
363 | void scrollToFragmentWithParentBoundary(const URL&, bool isNewNavigation = true);
|
---|
364 |
|
---|
365 | void dispatchDidFailProvisionalLoad(DocumentLoader& provisionalDocumentLoader, const ResourceError&);
|
---|
366 | void checkLoadCompleteForThisFrame();
|
---|
367 |
|
---|
368 | void setDocumentLoader(DocumentLoader*);
|
---|
369 | void setPolicyDocumentLoader(DocumentLoader*);
|
---|
370 | void setProvisionalDocumentLoader(DocumentLoader*);
|
---|
371 |
|
---|
372 | void setState(FrameState);
|
---|
373 |
|
---|
374 | void closeOldDataSources();
|
---|
375 | void willRestoreFromCachedPage();
|
---|
376 |
|
---|
377 | bool shouldReloadToHandleUnreachableURL(DocumentLoader&);
|
---|
378 |
|
---|
379 | void dispatchDidCommitLoad(std::optional<HasInsecureContent> initialHasInsecureContent, std::optional<UsedLegacyTLS> initialUsedLegacyTLS);
|
---|
380 |
|
---|
381 | void loadWithDocumentLoader(DocumentLoader*, FrameLoadType, RefPtr<FormState>&&, AllowNavigationToInvalidURL, CompletionHandler<void()>&& = [] { }); // Calls continueLoadAfterNavigationPolicy
|
---|
382 | void load(DocumentLoader&); // Calls loadWithDocumentLoader
|
---|
383 |
|
---|
384 | void loadWithNavigationAction(const ResourceRequest&, NavigationAction&&, FrameLoadType, RefPtr<FormState>&&, AllowNavigationToInvalidURL, ShouldTreatAsContinuingLoad, CompletionHandler<void()>&& = [] { }); // Calls loadWithDocumentLoader
|
---|
385 |
|
---|
386 | void loadPostRequest(FrameLoadRequest&&, const String& referrer, FrameLoadType, Event*, RefPtr<FormState>&&, CompletionHandler<void()>&&);
|
---|
387 | void loadURL(FrameLoadRequest&&, const String& referrer, FrameLoadType, Event*, RefPtr<FormState>&&, std::optional<PrivateClickMeasurement>&&, CompletionHandler<void()>&&);
|
---|
388 |
|
---|
389 | bool shouldReload(const URL& currentURL, const URL& destinationURL);
|
---|
390 |
|
---|
391 | void requestFromDelegate(ResourceRequest&, ResourceLoaderIdentifier&, ResourceError&);
|
---|
392 |
|
---|
393 | WEBCORE_EXPORT void detachChildren();
|
---|
394 | void closeAndRemoveChild(Frame&);
|
---|
395 |
|
---|
396 | void loadInSameDocument(URL, RefPtr<SerializedScriptValue> stateObject, bool isNewNavigation);
|
---|
397 |
|
---|
398 | void prepareForLoadStart();
|
---|
399 | void provisionalLoadStarted();
|
---|
400 |
|
---|
401 | bool didOpenURL();
|
---|
402 |
|
---|
403 | void scheduleCheckCompleted();
|
---|
404 | void scheduleCheckLoadComplete();
|
---|
405 | void startCheckCompleteTimer();
|
---|
406 |
|
---|
407 | bool shouldTreatURLAsSameAsCurrent(const URL&) const;
|
---|
408 |
|
---|
409 | void dispatchGlobalObjectAvailableInAllWorlds();
|
---|
410 |
|
---|
411 | bool isNavigationAllowed() const;
|
---|
412 | bool isStopLoadingAllowed() const;
|
---|
413 |
|
---|
414 | enum class LoadContinuingState : uint8_t { NotContinuing, ContinuingWithRequest, ContinuingWithHistoryItem };
|
---|
415 | bool shouldTreatCurrentLoadAsContinuingLoad() const { return m_currentLoadContinuingState != LoadContinuingState::NotContinuing; }
|
---|
416 |
|
---|
417 | // HistoryController specific.
|
---|
418 | void loadItem(HistoryItem&, HistoryItem* fromItem, FrameLoadType, ShouldTreatAsContinuingLoad);
|
---|
419 | HistoryItem* requestedHistoryItem() const { return m_requestedHistoryItem.get(); }
|
---|
420 |
|
---|
421 | // SubframeLoader specific.
|
---|
422 | void loadURLIntoChildFrame(const URL&, const String& referer, Frame*);
|
---|
423 | void started();
|
---|
424 |
|
---|
425 | // PolicyChecker specific.
|
---|
426 | void clearProvisionalLoadForPolicyCheck();
|
---|
427 | bool hasOpenedFrames() const;
|
---|
428 |
|
---|
429 | bool preventsParentFromBeingComplete(const Frame&) const;
|
---|
430 |
|
---|
431 | Frame& m_frame;
|
---|
432 | UniqueRef<FrameLoaderClient> m_client;
|
---|
433 |
|
---|
434 | const std::unique_ptr<PolicyChecker> m_policyChecker;
|
---|
435 | const std::unique_ptr<HistoryController> m_history;
|
---|
436 | mutable ResourceLoadNotifier m_notifier;
|
---|
437 | const std::unique_ptr<SubframeLoader> m_subframeLoader;
|
---|
438 | mutable FrameLoaderStateMachine m_stateMachine;
|
---|
439 |
|
---|
440 | class FrameProgressTracker;
|
---|
441 | std::unique_ptr<FrameProgressTracker> m_progressTracker;
|
---|
442 |
|
---|
443 | FrameState m_state;
|
---|
444 | FrameLoadType m_loadType;
|
---|
445 |
|
---|
446 | // Document loaders for the three phases of frame loading. Note that while
|
---|
447 | // a new request is being loaded, the old document loader may still be referenced.
|
---|
448 | // E.g. while a new request is in the "policy" state, the old document loader may
|
---|
449 | // be consulted in particular as it makes sense to imply certain settings on the new loader.
|
---|
450 | RefPtr<DocumentLoader> m_documentLoader;
|
---|
451 | RefPtr<DocumentLoader> m_provisionalDocumentLoader;
|
---|
452 | RefPtr<DocumentLoader> m_policyDocumentLoader;
|
---|
453 |
|
---|
454 | URL m_provisionalLoadErrorBeingHandledURL;
|
---|
455 |
|
---|
456 | bool m_quickRedirectComing;
|
---|
457 | bool m_sentRedirectNotification;
|
---|
458 | bool m_inStopAllLoaders;
|
---|
459 | bool m_inClearProvisionalLoadForPolicyCheck { false };
|
---|
460 | bool m_shouldReportResourceTimingToParentFrame { true };
|
---|
461 |
|
---|
462 | String m_outgoingReferrer;
|
---|
463 |
|
---|
464 | bool m_isExecutingJavaScriptFormAction;
|
---|
465 |
|
---|
466 | bool m_didCallImplicitClose;
|
---|
467 | bool m_wasUnloadEventEmitted;
|
---|
468 |
|
---|
469 | PageDismissalType m_pageDismissalEventBeingDispatched { PageDismissalType::None };
|
---|
470 | bool m_isComplete;
|
---|
471 |
|
---|
472 | RefPtr<SerializedScriptValue> m_pendingStateObject;
|
---|
473 |
|
---|
474 | bool m_needsClear;
|
---|
475 |
|
---|
476 | URL m_submittedFormURL;
|
---|
477 |
|
---|
478 | Timer m_checkTimer;
|
---|
479 | bool m_shouldCallCheckCompleted;
|
---|
480 | bool m_shouldCallCheckLoadComplete;
|
---|
481 |
|
---|
482 | WeakPtr<Frame> m_opener;
|
---|
483 | WeakHashSet<Frame> m_openedFrames;
|
---|
484 |
|
---|
485 | bool m_loadingFromCachedPage;
|
---|
486 |
|
---|
487 | bool m_currentNavigationHasShownBeforeUnloadConfirmPanel;
|
---|
488 |
|
---|
489 | bool m_loadsSynchronously;
|
---|
490 |
|
---|
491 | SandboxFlags m_forcedSandboxFlags;
|
---|
492 |
|
---|
493 | RefPtr<FrameNetworkingContext> m_networkingContext;
|
---|
494 |
|
---|
495 | std::optional<ResourceRequestCachePolicy> m_overrideCachePolicyForTesting;
|
---|
496 | std::optional<ResourceLoadPriority> m_overrideResourceLoadPriorityForTesting;
|
---|
497 | bool m_isStrictRawResourceValidationPolicyDisabledForTesting { false };
|
---|
498 |
|
---|
499 | LoadContinuingState m_currentLoadContinuingState { LoadContinuingState::NotContinuing };
|
---|
500 |
|
---|
501 | bool m_checkingLoadCompleteForDetachment { false };
|
---|
502 |
|
---|
503 | URL m_previousURL;
|
---|
504 | RefPtr<HistoryItem> m_requestedHistoryItem;
|
---|
505 |
|
---|
506 | bool m_alwaysAllowLocalWebarchive { false };
|
---|
507 |
|
---|
508 | bool m_inStopForBackForwardCache { false };
|
---|
509 | };
|
---|
510 |
|
---|
511 | // This function is called by createWindow() in JSDOMWindowBase.cpp, for example, for
|
---|
512 | // modal dialog creation. The lookupFrame is for looking up the frame name in case
|
---|
513 | // the frame name references a frame different from the openerFrame, e.g. when it is
|
---|
514 | // "_self" or "_parent".
|
---|
515 | //
|
---|
516 | // FIXME: Consider making this function part of an appropriate class (not FrameLoader)
|
---|
517 | // and moving it to a more appropriate location.
|
---|
518 | RefPtr<Frame> createWindow(Frame& openerFrame, Frame& lookupFrame, FrameLoadRequest&&, WindowFeatures&, bool& created);
|
---|
519 |
|
---|
520 | } // namespace WebCore
|
---|