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. (http://www.t
orchmobile.com/) | 3 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 4 * (http://www.torchmobile.com/) |
4 * Copyright (C) Research In Motion Limited 2009. All rights reserved. | 5 * Copyright (C) Research In Motion Limited 2009. All rights reserved. |
5 * Copyright (C) 2011 Google Inc. All rights reserved. | 6 * Copyright (C) 2011 Google Inc. All rights reserved. |
6 * | 7 * |
7 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
8 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
9 * are met: | 10 * are met: |
10 * | 11 * |
11 * 1. Redistributions of source code must retain the above copyright | 12 * 1. Redistributions of source code must retain the above copyright |
12 * notice, this list of conditions and the following disclaimer. | 13 * notice, this list of conditions and the following disclaimer. |
13 * 2. Redistributions in binary form must reproduce the above copyright | 14 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 81 |
81 void init(); | 82 void init(); |
82 | 83 |
83 ResourceRequest resourceRequestForReload( | 84 ResourceRequest resourceRequestForReload( |
84 FrameLoadType, | 85 FrameLoadType, |
85 const KURL& overrideURL = KURL(), | 86 const KURL& overrideURL = KURL(), |
86 ClientRedirectPolicy = ClientRedirectPolicy::NotClientRedirect); | 87 ClientRedirectPolicy = ClientRedirectPolicy::NotClientRedirect); |
87 | 88 |
88 ProgressTracker& progress() const { return *m_progressTracker; } | 89 ProgressTracker& progress() const { return *m_progressTracker; } |
89 | 90 |
90 // Starts a load. It will eventually call startLoad() or | 91 // Starts a load. It will eventually call startLoad() or loadInSameDocument(). |
91 // loadInSameDocument(). For history navigations or reloads, an appropriate | 92 // For history navigations or reloads, an appropriate FrameLoadType should be |
92 // FrameLoadType should be given. Otherwise, FrameLoadTypeStandard should be | 93 // given. Otherwise, FrameLoadTypeStandard should be used (and the final |
93 // used (and the final FrameLoadType will be computed). For history | 94 // FrameLoadType will be computed). For history navigations, a history item |
94 // navigations, a history item and a HistoryLoadType should also be provided. | 95 // and a HistoryLoadType should also be provided. |
95 void load(const FrameLoadRequest&, | 96 void load(const FrameLoadRequest&, |
96 FrameLoadType = FrameLoadTypeStandard, | 97 FrameLoadType = FrameLoadTypeStandard, |
97 HistoryItem* = nullptr, | 98 HistoryItem* = nullptr, |
98 HistoryLoadType = HistoryDifferentDocumentLoad); | 99 HistoryLoadType = HistoryDifferentDocumentLoad); |
99 | 100 |
100 static void reportLocalLoadFailed(LocalFrame*, const String& url); | 101 static void reportLocalLoadFailed(LocalFrame*, const String& url); |
101 | 102 |
102 // Warning: stopAllLoaders can and will detach the LocalFrame out from under y
ou. All callers need to either protect the LocalFrame | 103 // Warning: stopAllLoaders can and will detach the LocalFrame out from under |
103 // or guarantee they won't in any way access the LocalFrame after stopAllLoade
rs returns. | 104 // you. All callers need to either protect the LocalFrame or guarantee they |
| 105 // won't in any way access the LocalFrame after stopAllLoaders returns. |
104 void stopAllLoaders(); | 106 void stopAllLoaders(); |
105 | 107 |
106 // FIXME: clear() is trying to do too many things. We should break it down int
o smaller functions. | 108 // FIXME: clear() is trying to do too many things. We should break it down |
| 109 // into smaller functions. |
107 void clear(); | 110 void clear(); |
108 | 111 |
109 void replaceDocumentWhileExecutingJavaScriptURL(const String& source, | 112 void replaceDocumentWhileExecutingJavaScriptURL(const String& source, |
110 Document* ownerDocument); | 113 Document* ownerDocument); |
111 | 114 |
112 // Notifies the client that the initial empty document has been accessed, | 115 // Notifies the client that the initial empty document has been accessed, and |
113 // and thus it is no longer safe to show a provisional URL above the | 116 // thus it is no longer safe to show a provisional URL above the document |
114 // document without risking a URL spoof. The client must not call back into | 117 // without risking a URL spoof. The client must not call back into JavaScript. |
115 // JavaScript. | |
116 void didAccessInitialDocument(); | 118 void didAccessInitialDocument(); |
117 | 119 |
118 DocumentLoader* documentLoader() const { return m_documentLoader.get(); } | 120 DocumentLoader* documentLoader() const { return m_documentLoader.get(); } |
119 DocumentLoader* provisionalDocumentLoader() const { | 121 DocumentLoader* provisionalDocumentLoader() const { |
120 return m_provisionalDocumentLoader.get(); | 122 return m_provisionalDocumentLoader.get(); |
121 } | 123 } |
122 | 124 |
123 void loadFailed(DocumentLoader*, const ResourceError&); | 125 void loadFailed(DocumentLoader*, const ResourceError&); |
124 | 126 |
125 bool isLoadingMainFrame() const; | 127 bool isLoadingMainFrame() const; |
(...skipping 17 matching lines...) Expand all Loading... |
143 | 145 |
144 void receivedFirstData(); | 146 void receivedFirstData(); |
145 | 147 |
146 String userAgent() const; | 148 String userAgent() const; |
147 | 149 |
148 void dispatchDidClearWindowObjectInMainWorld(); | 150 void dispatchDidClearWindowObjectInMainWorld(); |
149 void dispatchDidClearDocumentOfWindowObject(); | 151 void dispatchDidClearDocumentOfWindowObject(); |
150 void dispatchDocumentElementAvailable(); | 152 void dispatchDocumentElementAvailable(); |
151 void runScriptsAtDocumentElementAvailable(); | 153 void runScriptsAtDocumentElementAvailable(); |
152 | 154 |
153 // The following sandbox flags will be forced, regardless of changes to | 155 // The following sandbox flags will be forced, regardless of changes to the |
154 // the sandbox attribute of any parent frames. | 156 // sandbox attribute of any parent frames. |
155 void forceSandboxFlags(SandboxFlags flags) { m_forcedSandboxFlags |= flags; } | 157 void forceSandboxFlags(SandboxFlags flags) { m_forcedSandboxFlags |= flags; } |
156 SandboxFlags effectiveSandboxFlags() const; | 158 SandboxFlags effectiveSandboxFlags() const; |
157 | 159 |
158 WebInsecureRequestPolicy getInsecureRequestPolicy() const; | 160 WebInsecureRequestPolicy getInsecureRequestPolicy() const; |
159 SecurityContext::InsecureNavigationsSet* insecureNavigationsToUpgrade() const; | 161 SecurityContext::InsecureNavigationsSet* insecureNavigationsToUpgrade() const; |
160 void upgradeInsecureRequest(ResourceRequest&, Document*) const; | 162 void upgradeInsecureRequest(ResourceRequest&, Document*) const; |
161 | 163 |
162 Frame* opener(); | 164 Frame* opener(); |
163 void setOpener(LocalFrame*); | 165 void setOpener(LocalFrame*); |
164 | 166 |
165 void detach(); | 167 void detach(); |
166 | 168 |
167 void finishedParsing(); | 169 void finishedParsing(); |
168 void checkCompleted(); | 170 void checkCompleted(); |
169 | 171 |
170 void receivedMainResourceRedirect(const KURL& newURL); | 172 void receivedMainResourceRedirect(const KURL& newURL); |
171 | 173 |
172 void clearProvisionalHistoryItem(); | 174 void clearProvisionalHistoryItem(); |
173 | 175 |
174 // This prepares the FrameLoader for the next commit. It will dispatch | 176 // This prepares the FrameLoader for the next commit. It will dispatch unload |
175 // unload events, abort XHR requests and detach the document. Returns true | 177 // events, abort XHR requests and detach the document. Returns true if the |
176 // if the frame is ready to receive the next commit, or false otherwise. | 178 // frame is ready to receive the next commit, or false otherwise. |
177 bool prepareForCommit(); | 179 bool prepareForCommit(); |
178 | 180 |
179 void commitProvisionalLoad(); | 181 void commitProvisionalLoad(); |
180 | 182 |
181 FrameLoaderStateMachine* stateMachine() const { return &m_stateMachine; } | 183 FrameLoaderStateMachine* stateMachine() const { return &m_stateMachine; } |
182 | 184 |
183 void applyUserAgent(ResourceRequest&); | 185 void applyUserAgent(ResourceRequest&); |
184 | 186 |
185 bool shouldInterruptLoadForXFrameOptions(const String&, | 187 bool shouldInterruptLoadForXFrameOptions(const String&, |
186 const KURL&, | 188 const KURL&, |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 | 252 |
251 void scheduleCheckCompleted(); | 253 void scheduleCheckCompleted(); |
252 | 254 |
253 void detachDocumentLoader(Member<DocumentLoader>&); | 255 void detachDocumentLoader(Member<DocumentLoader>&); |
254 | 256 |
255 std::unique_ptr<TracedValue> toTracedValue() const; | 257 std::unique_ptr<TracedValue> toTracedValue() const; |
256 void takeObjectSnapshot() const; | 258 void takeObjectSnapshot() const; |
257 | 259 |
258 Member<LocalFrame> m_frame; | 260 Member<LocalFrame> m_frame; |
259 | 261 |
260 // FIXME: These should be std::unique_ptr<T> to reduce build times and simplif
y | 262 // FIXME: These should be std::unique_ptr<T> to reduce build times and |
261 // header dependencies unless performance testing proves otherwise. | 263 // simplify header dependencies unless performance testing proves otherwise. |
262 // Some of these could be lazily created for memory savings on devices. | 264 // Some of these could be lazily created for memory savings on devices. |
263 mutable FrameLoaderStateMachine m_stateMachine; | 265 mutable FrameLoaderStateMachine m_stateMachine; |
264 | 266 |
265 Member<ProgressTracker> m_progressTracker; | 267 Member<ProgressTracker> m_progressTracker; |
266 | 268 |
267 FrameLoadType m_loadType; | 269 FrameLoadType m_loadType; |
268 | 270 |
269 // Document loaders for the three phases of frame loading. Note that while | 271 // Document loaders for the three phases of frame loading. Note that while a |
270 // a new request is being loaded, the old document loader may still be referen
ced. | 272 // new request is being loaded, the old document loader may still be |
271 // E.g. while a new request is in the "policy" state, the old document loader
may | 273 // referenced. E.g. while a new request is in the "policy" state, the old |
272 // be consulted in particular as it makes sense to imply certain settings on t
he new loader. | 274 // document loader may be consulted in particular as it makes sense to imply |
| 275 // certain settings on the new loader. |
273 Member<DocumentLoader> m_documentLoader; | 276 Member<DocumentLoader> m_documentLoader; |
274 Member<DocumentLoader> m_provisionalDocumentLoader; | 277 Member<DocumentLoader> m_provisionalDocumentLoader; |
275 | 278 |
276 Member<HistoryItem> m_currentItem; | 279 Member<HistoryItem> m_currentItem; |
277 Member<HistoryItem> m_provisionalItem; | 280 Member<HistoryItem> m_provisionalItem; |
278 | 281 |
279 class DeferredHistoryLoad | 282 class DeferredHistoryLoad |
280 : public GarbageCollectedFinalized<DeferredHistoryLoad> { | 283 : public GarbageCollectedFinalized<DeferredHistoryLoad> { |
281 WTF_MAKE_NONCOPYABLE(DeferredHistoryLoad); | 284 WTF_MAKE_NONCOPYABLE(DeferredHistoryLoad); |
282 | 285 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 SandboxFlags m_forcedSandboxFlags; | 317 SandboxFlags m_forcedSandboxFlags; |
315 | 318 |
316 bool m_dispatchingDidClearWindowObjectInMainWorld; | 319 bool m_dispatchingDidClearWindowObjectInMainWorld; |
317 bool m_protectProvisionalLoader; | 320 bool m_protectProvisionalLoader; |
318 bool m_isNavigationHandledByClient; | 321 bool m_isNavigationHandledByClient; |
319 }; | 322 }; |
320 | 323 |
321 } // namespace blink | 324 } // namespace blink |
322 | 325 |
323 #endif // FrameLoader_h | 326 #endif // FrameLoader_h |
OLD | NEW |