| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 3 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 4 * (http://www.torchmobile.com/) | 4 * (http://www.torchmobile.com/) |
| 5 * Copyright (C) Research In Motion Limited 2009. All rights reserved. | 5 * Copyright (C) Research In Motion Limited 2009. All rights reserved. |
| 6 * Copyright (C) 2011 Google Inc. All rights reserved. | 6 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 7 * | 7 * |
| 8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
| 9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
| 10 * are met: | 10 * are met: |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 #include "platform/loader/fetch/ResourceLoaderOptions.h" | 48 #include "platform/loader/fetch/ResourceLoaderOptions.h" |
| 49 #include "platform/loader/fetch/ResourceRequest.h" | 49 #include "platform/loader/fetch/ResourceRequest.h" |
| 50 #include "public/platform/WebInsecureRequestPolicy.h" | 50 #include "public/platform/WebInsecureRequestPolicy.h" |
| 51 #include "wtf/Forward.h" | 51 #include "wtf/Forward.h" |
| 52 #include "wtf/HashSet.h" | 52 #include "wtf/HashSet.h" |
| 53 | 53 |
| 54 #include <memory> | 54 #include <memory> |
| 55 | 55 |
| 56 namespace blink { | 56 namespace blink { |
| 57 | 57 |
| 58 class Document; |
| 58 class DocumentLoader; | 59 class DocumentLoader; |
| 59 class HTMLFormElement; | 60 class HTMLFormElement; |
| 60 class Frame; | 61 class Frame; |
| 61 class LocalFrameClient; | 62 class LocalFrameClient; |
| 62 class ProgressTracker; | 63 class ProgressTracker; |
| 63 class ResourceError; | 64 class ResourceError; |
| 64 class SerializedScriptValue; | 65 class SerializedScriptValue; |
| 65 class SubstituteData; | 66 class SubstituteData; |
| 66 enum class WebCachePolicy; | |
| 67 struct FrameLoadRequest; | 67 struct FrameLoadRequest; |
| 68 | 68 |
| 69 CORE_EXPORT bool isBackForwardLoadType(FrameLoadType); | 69 CORE_EXPORT bool isBackForwardLoadType(FrameLoadType); |
| 70 CORE_EXPORT bool isReloadLoadType(FrameLoadType); | 70 CORE_EXPORT bool isReloadLoadType(FrameLoadType); |
| 71 | 71 |
| 72 class CORE_EXPORT FrameLoader final { | 72 class CORE_EXPORT FrameLoader final { |
| 73 WTF_MAKE_NONCOPYABLE(FrameLoader); | 73 WTF_MAKE_NONCOPYABLE(FrameLoader); |
| 74 DISALLOW_NEW(); | 74 DISALLOW_NEW(); |
| 75 | 75 |
| 76 public: | 76 public: |
| 77 static ResourceRequest resourceRequestFromHistoryItem(HistoryItem*, | |
| 78 WebCachePolicy); | |
| 79 | |
| 80 explicit FrameLoader(LocalFrame*); | 77 explicit FrameLoader(LocalFrame*); |
| 81 ~FrameLoader(); | 78 ~FrameLoader(); |
| 82 | 79 |
| 83 void init(); | 80 void init(); |
| 84 | 81 |
| 85 ResourceRequest resourceRequestForReload( | 82 ResourceRequest resourceRequestForReload( |
| 86 FrameLoadType, | 83 FrameLoadType, |
| 87 const KURL& overrideURL = KURL(), | 84 const KURL& overrideURL = KURL(), |
| 88 ClientRedirectPolicy = ClientRedirectPolicy::NotClientRedirect); | 85 ClientRedirectPolicy = ClientRedirectPolicy::NotClientRedirect); |
| 89 | 86 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 | 126 |
| 130 bool shouldTreatURLAsSameAsCurrent(const KURL&) const; | 127 bool shouldTreatURLAsSameAsCurrent(const KURL&) const; |
| 131 bool shouldTreatURLAsSrcdocDocument(const KURL&) const; | 128 bool shouldTreatURLAsSrcdocDocument(const KURL&) const; |
| 132 | 129 |
| 133 LocalFrameClient* client() const; | 130 LocalFrameClient* client() const; |
| 134 | 131 |
| 135 void setDefersLoading(bool); | 132 void setDefersLoading(bool); |
| 136 | 133 |
| 137 void didExplicitOpen(); | 134 void didExplicitOpen(); |
| 138 | 135 |
| 139 // Callbacks from DocumentWriter | |
| 140 void didInstallNewDocument(); | |
| 141 | |
| 142 void receivedFirstData(); | |
| 143 | |
| 144 String userAgent() const; | 136 String userAgent() const; |
| 145 | 137 |
| 146 void dispatchDidClearWindowObjectInMainWorld(); | 138 void dispatchDidClearWindowObjectInMainWorld(); |
| 147 void dispatchDidClearDocumentOfWindowObject(); | 139 void dispatchDidClearDocumentOfWindowObject(); |
| 148 void dispatchDocumentElementAvailable(); | 140 void dispatchDocumentElementAvailable(); |
| 149 void runScriptsAtDocumentElementAvailable(); | 141 void runScriptsAtDocumentElementAvailable(); |
| 150 | 142 |
| 151 // The following sandbox flags will be forced, regardless of changes to the | 143 // The following sandbox flags will be forced, regardless of changes to the |
| 152 // sandbox attribute of any parent frames. | 144 // sandbox attribute of any parent frames. |
| 153 void forceSandboxFlags(SandboxFlags flags) { m_forcedSandboxFlags |= flags; } | 145 void forceSandboxFlags(SandboxFlags flags) { m_forcedSandboxFlags |= flags; } |
| 154 SandboxFlags effectiveSandboxFlags() const; | 146 SandboxFlags effectiveSandboxFlags() const; |
| 155 | 147 |
| 156 WebInsecureRequestPolicy getInsecureRequestPolicy() const; | 148 WebInsecureRequestPolicy getInsecureRequestPolicy() const; |
| 157 SecurityContext::InsecureNavigationsSet* insecureNavigationsToUpgrade() const; | 149 SecurityContext::InsecureNavigationsSet* insecureNavigationsToUpgrade() const; |
| 158 void modifyRequestForCSP(ResourceRequest&, Document*) const; | 150 void modifyRequestForCSP(ResourceRequest&, Document*) const; |
| 159 | 151 |
| 160 Frame* opener(); | 152 Frame* opener(); |
| 161 void setOpener(LocalFrame*); | 153 void setOpener(LocalFrame*); |
| 162 | 154 |
| 163 const AtomicString& requiredCSP() const { return m_requiredCSP; } | 155 const AtomicString& requiredCSP() const { return m_requiredCSP; } |
| 164 void recordLatestRequiredCSP(); | 156 void recordLatestRequiredCSP(); |
| 165 | 157 |
| 166 void detach(); | 158 void detach(); |
| 167 | 159 |
| 168 void finishedParsing(); | 160 void finishedParsing(); |
| 169 void checkCompleted(); | 161 void checkCompleted(); |
| 170 | 162 |
| 171 void clearProvisionalHistoryItem(); | |
| 172 | |
| 173 // This prepares the FrameLoader for the next commit. It will dispatch unload | 163 // This prepares the FrameLoader for the next commit. It will dispatch unload |
| 174 // events, abort XHR requests and detach the document. Returns true if the | 164 // events, abort XHR requests and detach the document. Returns true if the |
| 175 // frame is ready to receive the next commit, or false otherwise. | 165 // frame is ready to receive the next commit, or false otherwise. |
| 176 bool prepareForCommit(); | 166 bool prepareForCommit(); |
| 177 | 167 |
| 178 void commitProvisionalLoad(); | 168 void commitProvisionalLoad(); |
| 179 | 169 |
| 180 FrameLoaderStateMachine* stateMachine() const { return &m_stateMachine; } | 170 FrameLoaderStateMachine* stateMachine() const { return &m_stateMachine; } |
| 181 | 171 |
| 182 void applyUserAgent(ResourceRequest&); | 172 void applyUserAgent(ResourceRequest&); |
| 183 | 173 |
| 184 bool allAncestorsAreComplete() const; // including this | 174 bool allAncestorsAreComplete() const; // including this |
| 185 | 175 |
| 186 bool shouldClose(bool isReload = false); | 176 bool shouldClose(bool isReload = false); |
| 187 void dispatchUnloadEvent(); | 177 void dispatchUnloadEvent(); |
| 188 | 178 |
| 189 bool allowPlugins(ReasonForCallingAllowPlugins); | 179 bool allowPlugins(ReasonForCallingAllowPlugins); |
| 190 | 180 |
| 191 void updateForSameDocumentNavigation(const KURL&, | 181 void updateForSameDocumentNavigation(const KURL&, |
| 192 SameDocumentNavigationSource, | 182 SameDocumentNavigationSource, |
| 193 PassRefPtr<SerializedScriptValue>, | 183 PassRefPtr<SerializedScriptValue>, |
| 194 HistoryScrollRestorationType, | 184 HistoryScrollRestorationType, |
| 195 FrameLoadType, | 185 FrameLoadType, |
| 196 Document*); | 186 Document*); |
| 197 | 187 |
| 198 HistoryItem* currentItem() const { return m_currentItem.get(); } | |
| 199 void saveScrollState(); | 188 void saveScrollState(); |
| 200 | |
| 201 void restoreScrollPositionAndViewState(); | 189 void restoreScrollPositionAndViewState(); |
| 202 | 190 |
| 203 // The navigation should only be continued immediately in this frame if this | 191 // The navigation should only be continued immediately in this frame if this |
| 204 // returns NavigationPolicyCurrentTab. | 192 // returns NavigationPolicyCurrentTab. |
| 205 NavigationPolicy shouldContinueForNavigationPolicy( | 193 NavigationPolicy shouldContinueForNavigationPolicy( |
| 206 const ResourceRequest&, | 194 const ResourceRequest&, |
| 207 const SubstituteData&, | 195 const SubstituteData&, |
| 208 DocumentLoader*, | 196 DocumentLoader*, |
| 209 ContentSecurityPolicyDisposition, | 197 ContentSecurityPolicyDisposition, |
| 210 NavigationType, | 198 NavigationType, |
| 211 NavigationPolicy, | 199 NavigationPolicy, |
| 212 FrameLoadType, | 200 FrameLoadType, |
| 213 bool isClientRedirect, | 201 bool isClientRedirect, |
| 214 HTMLFormElement*); | 202 HTMLFormElement*); |
| 215 | 203 |
| 216 // Note: When a PlzNavigtate navigation is handled by the client, we will | 204 // Note: When a PlzNavigtate navigation is handled by the client, we will |
| 217 // have created a dummy provisional DocumentLoader, so this will return true | 205 // have created a dummy provisional DocumentLoader, so this will return true |
| 218 // while the client handles the navigation. | 206 // while the client handles the navigation. |
| 219 bool hasProvisionalNavigation() const { return provisionalDocumentLoader(); } | 207 bool hasProvisionalNavigation() const { return provisionalDocumentLoader(); } |
| 220 | 208 |
| 209 void detachProvisionalDocumentLoader(DocumentLoader*); |
| 210 |
| 221 DECLARE_TRACE(); | 211 DECLARE_TRACE(); |
| 222 | 212 |
| 223 static void setReferrerForFrameRequest(FrameLoadRequest&); | 213 static void setReferrerForFrameRequest(FrameLoadRequest&); |
| 224 | 214 |
| 225 private: | 215 private: |
| 226 void checkTimerFired(TimerBase*); | 216 void checkTimerFired(TimerBase*); |
| 227 | 217 |
| 228 bool prepareRequestForThisFrame(FrameLoadRequest&); | 218 bool prepareRequestForThisFrame(FrameLoadRequest&); |
| 229 FrameLoadType determineFrameLoadType(const FrameLoadRequest&); | 219 FrameLoadType determineFrameLoadType(const FrameLoadRequest&); |
| 230 | 220 |
| 231 SubstituteData defaultSubstituteDataForURL(const KURL&); | 221 SubstituteData defaultSubstituteDataForURL(const KURL&); |
| 232 | 222 |
| 233 bool shouldPerformFragmentNavigation(bool isFormSubmission, | 223 bool shouldPerformFragmentNavigation(bool isFormSubmission, |
| 234 const String& httpMethod, | 224 const String& httpMethod, |
| 235 FrameLoadType, | 225 FrameLoadType, |
| 236 const KURL&); | 226 const KURL&); |
| 237 void processFragment(const KURL&, FrameLoadType, LoadStartType); | 227 void processFragment(const KURL&, FrameLoadType, LoadStartType); |
| 238 | 228 |
| 239 NavigationPolicy checkLoadCanStart(FrameLoadRequest&, | 229 NavigationPolicy checkLoadCanStart(FrameLoadRequest&, |
| 240 FrameLoadType, | 230 FrameLoadType, |
| 241 NavigationPolicy, | 231 NavigationPolicy, |
| 242 NavigationType); | 232 NavigationType); |
| 243 void startLoad(FrameLoadRequest&, FrameLoadType, NavigationPolicy); | 233 void startLoad(FrameLoadRequest&, |
| 244 | 234 FrameLoadType, |
| 245 enum class HistoryNavigationType { DifferentDocument, Fragment, HistoryApi }; | 235 NavigationPolicy, |
| 246 void setHistoryItemStateForCommit(FrameLoadType, | 236 HistoryItem*); |
| 247 HistoryCommitType, | |
| 248 HistoryNavigationType); | |
| 249 | 237 |
| 250 void loadInSameDocument(const KURL&, | 238 void loadInSameDocument(const KURL&, |
| 251 PassRefPtr<SerializedScriptValue> stateObject, | 239 PassRefPtr<SerializedScriptValue> stateObject, |
| 252 FrameLoadType, | 240 FrameLoadType, |
| 253 HistoryLoadType, | 241 HistoryItem*, |
| 254 ClientRedirectPolicy, | 242 ClientRedirectPolicy, |
| 255 Document*); | 243 Document*); |
| 256 void restoreScrollPositionAndViewStateForLoadType(FrameLoadType); | 244 void restoreScrollPositionAndViewStateForLoadType(FrameLoadType); |
| 257 | 245 |
| 258 void scheduleCheckCompleted(); | 246 void scheduleCheckCompleted(); |
| 259 | 247 |
| 260 void detachDocumentLoader(Member<DocumentLoader>&); | 248 void detachDocumentLoader(Member<DocumentLoader>&); |
| 261 | 249 |
| 262 void upgradeInsecureRequest(ResourceRequest&, Document*) const; | 250 void upgradeInsecureRequest(ResourceRequest&, Document*) const; |
| 263 | 251 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 280 Member<ProgressTracker> m_progressTracker; | 268 Member<ProgressTracker> m_progressTracker; |
| 281 | 269 |
| 282 // Document loaders for the three phases of frame loading. Note that while a | 270 // Document loaders for the three phases of frame loading. Note that while a |
| 283 // new request is being loaded, the old document loader may still be | 271 // new request is being loaded, the old document loader may still be |
| 284 // referenced. E.g. while a new request is in the "policy" state, the old | 272 // referenced. E.g. while a new request is in the "policy" state, the old |
| 285 // document loader may be consulted in particular as it makes sense to imply | 273 // document loader may be consulted in particular as it makes sense to imply |
| 286 // certain settings on the new loader. | 274 // certain settings on the new loader. |
| 287 Member<DocumentLoader> m_documentLoader; | 275 Member<DocumentLoader> m_documentLoader; |
| 288 Member<DocumentLoader> m_provisionalDocumentLoader; | 276 Member<DocumentLoader> m_provisionalDocumentLoader; |
| 289 | 277 |
| 290 Member<HistoryItem> m_currentItem; | |
| 291 Member<HistoryItem> m_provisionalItem; | |
| 292 | |
| 293 class DeferredHistoryLoad | 278 class DeferredHistoryLoad |
| 294 : public GarbageCollectedFinalized<DeferredHistoryLoad> { | 279 : public GarbageCollectedFinalized<DeferredHistoryLoad> { |
| 295 WTF_MAKE_NONCOPYABLE(DeferredHistoryLoad); | 280 WTF_MAKE_NONCOPYABLE(DeferredHistoryLoad); |
| 296 | 281 |
| 297 public: | 282 public: |
| 298 static DeferredHistoryLoad* create(ResourceRequest request, | 283 static DeferredHistoryLoad* create(ResourceRequest request, |
| 299 HistoryItem* item, | 284 HistoryItem* item, |
| 300 FrameLoadType loadType, | 285 FrameLoadType loadType, |
| 301 HistoryLoadType historyLoadType) { | 286 HistoryLoadType historyLoadType) { |
| 302 return new DeferredHistoryLoad(request, item, loadType, historyLoadType); | 287 return new DeferredHistoryLoad(request, item, loadType, historyLoadType); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 327 | 312 |
| 328 SandboxFlags m_forcedSandboxFlags; | 313 SandboxFlags m_forcedSandboxFlags; |
| 329 | 314 |
| 330 bool m_dispatchingDidClearWindowObjectInMainWorld; | 315 bool m_dispatchingDidClearWindowObjectInMainWorld; |
| 331 bool m_protectProvisionalLoader; | 316 bool m_protectProvisionalLoader; |
| 332 }; | 317 }; |
| 333 | 318 |
| 334 } // namespace blink | 319 } // namespace blink |
| 335 | 320 |
| 336 #endif // FrameLoader_h | 321 #endif // FrameLoader_h |
| OLD | NEW |