OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. | |
3 * | |
4 * Redistribution and use in source and binary forms, with or without | |
5 * modification, are permitted provided that the following conditions | |
6 * are met: | |
7 * | |
8 * 1. Redistributions of source code must retain the above copyright | |
9 * notice, this list of conditions and the following disclaimer. | |
10 * 2. Redistributions in binary form must reproduce the above copyright | |
11 * notice, this list of conditions and the following disclaimer in the | |
12 * documentation and/or other materials provided with the distribution. | |
13 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of | |
14 * its contributors may be used to endorse or promote products derived | |
15 * from this software without specific prior written permission. | |
16 * | |
17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY | |
18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY | |
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
27 */ | |
28 | |
29 #ifndef FrameLoader_h | |
30 #define FrameLoader_h | |
31 | |
32 #include "CachedResource.h" | |
33 #include "CachePolicy.h" | |
34 #include "FormState.h" | |
35 #include "FrameLoaderTypes.h" | |
36 #include "KURL.h" | |
37 #include "StringHash.h" | |
38 #include "Timer.h" | |
39 #include <wtf/Forward.h> | |
40 #include <wtf/HashSet.h> | |
41 #include <wtf/HashMap.h> | |
42 #include <wtf/Noncopyable.h> | |
43 #include <wtf/OwnPtr.h> | |
44 #include <wtf/RefPtr.h> | |
45 #include "ResourceRequest.h" | |
46 #if USE(LOW_BANDWIDTH_DISPLAY) | |
47 #include "CachedResourceClient.h" | |
48 #endif | |
49 | |
50 namespace WebCore { | |
51 | |
52 class Archive; | |
53 class ArchiveResource; | |
54 class AuthenticationChallenge; | |
55 class CachedPage; | |
56 class Document; | |
57 class DocumentLoader; | |
58 class Element; | |
59 class Event; | |
60 class FormData; | |
61 class Frame; | |
62 class FrameLoaderClient; | |
63 class HistoryItem; | |
64 class HTMLFormElement; | |
65 class HTMLFrameOwnerElement; | |
66 class IconLoader; | |
67 class IntSize; | |
68 class NavigationAction; | |
69 class Node; | |
70 class Page; | |
71 class RenderPart; | |
72 class ResourceError; | |
73 class ResourceLoader; | |
74 class ResourceRequest; | |
75 class ResourceResponse; | |
76 class SecurityOrigin; | |
77 class SharedBuffer; | |
78 class SubstituteData; | |
79 class TextResourceDecoder; | |
80 class Widget; | |
81 | |
82 struct FormSubmission; | |
83 struct FrameLoadRequest; | |
84 struct ScheduledRedirection; | |
85 struct WindowFeatures; | |
86 | |
87 bool isBackForwardLoadType(FrameLoadType); | |
88 | |
89 typedef void (*NavigationPolicyDecisionFunction)(void* argument, | |
90 const ResourceRequest&, PassRefPtr<FormState>, bool shouldContinue); | |
91 typedef void (*NewWindowPolicyDecisionFunction)(void* argument, | |
92 const ResourceRequest&, PassRefPtr<FormState>, const String& frameName,
bool shouldContinue); | |
93 typedef void (*ContentPolicyDecisionFunction)(void* argument, PolicyAction); | |
94 | |
95 class PolicyCheck { | |
96 public: | |
97 PolicyCheck(); | |
98 | |
99 void clear(); | |
100 void set(const ResourceRequest&, PassRefPtr<FormState>, | |
101 NavigationPolicyDecisionFunction, void* argument); | |
102 void set(const ResourceRequest&, PassRefPtr<FormState>, const String& fr
ameName, | |
103 NewWindowPolicyDecisionFunction, void* argument); | |
104 void set(ContentPolicyDecisionFunction, void* argument); | |
105 | |
106 const ResourceRequest& request() const { return m_request; } | |
107 void clearRequest(); | |
108 | |
109 void call(bool shouldContinue); | |
110 void call(PolicyAction); | |
111 void cancel(); | |
112 | |
113 private: | |
114 ResourceRequest m_request; | |
115 RefPtr<FormState> m_formState; | |
116 String m_frameName; | |
117 | |
118 NavigationPolicyDecisionFunction m_navigationFunction; | |
119 NewWindowPolicyDecisionFunction m_newWindowFunction; | |
120 ContentPolicyDecisionFunction m_contentFunction; | |
121 void* m_argument; | |
122 }; | |
123 | |
124 class FrameLoader : Noncopyable | |
125 #if USE(LOW_BANDWIDTH_DISPLAY) | |
126 , private CachedResourceClient | |
127 #endif | |
128 { | |
129 public: | |
130 FrameLoader(Frame*, FrameLoaderClient*); | |
131 ~FrameLoader(); | |
132 | |
133 void init(); | |
134 | |
135 Frame* frame() const { return m_frame; } | |
136 | |
137 // FIXME: This is not cool, people. We should aim to consolidate these v
ariety of loading related methods into a smaller set, | |
138 // and try to reuse more of the same logic by extracting common code pat
hs. | |
139 void prepareForLoadStart(); | |
140 void setupForReplace(); | |
141 void setupForReplaceByMIMEType(const String& newMIMEType); | |
142 | |
143 void loadWithDocumentLoader(DocumentLoader*, FrameLoadType, PassRefPtr<F
ormState>); // Calls continueLoadAfterNavigationPolicy | |
144 void load(DocumentLoader*);
// Calls loadWithDocumentLoader | |
145 | |
146 void loadWithNavigationAction(const ResourceRequest&, const NavigationAc
tion&, // Calls loadWithDocumentLoader() | |
147 FrameLoadType, PassRefPtr<FormState>); | |
148 | |
149 void loadPostRequest(const ResourceRequest& inRequest, const String& ref
errer, // Called by loadFrameRequestWithFormAndValues(), calls load
WithNavigationAction | |
150 const String& frameName, Event* event, PassRefPtr<FormState> prpForm
State); | |
151 | |
152 void loadURL(const KURL& newURL, const String& referrer, const String& f
rameName, // Called by loadFrameRequestWithFormAndValues(), calls load
WithNavigationAction or else dispatches to navigation policy delegate | |
153 FrameLoadType, Event* event, PassRefPtr<FormState> prpFormState);
| |
154 void loadURLIntoChildFrame(const KURL&, const String& referer, Frame*); | |
155 | |
156 void loadFrameRequestWithFormState(const FrameLoadRequest&, bool lockHis
tory, Event*, PassRefPtr<FormState>); | |
157 void loadFrameRequestWithFormAndValues(const FrameLoadRequest&, bool loc
kHistory, // Called by submitForm, calls loadPostRequest() | |
158 Event*, HTMLFormElement*, const HashMap<String, String>& formValues)
; | |
159 | |
160 void load(const ResourceRequest&);
// Called by WebFrame, calls (ResourceRequest, SubstituteDat
a) | |
161 void load(const ResourceRequest&, const SubstituteData&);
// Called both by WebFrame and internally, calls (DocumentLo
ader*) | |
162 void load(const ResourceRequest&, const String& frameName);
// Called by WebPluginController | |
163 | |
164 void loadArchive(PassRefPtr<Archive> archive); | |
165 | |
166 // Returns true for any non-local URL. If Document parameter is supplied
, its local load policy dictates, | |
167 // otherwise if referrer is non-empty and represents a local file, then
the local load is allowed. | |
168 static bool canLoad(const KURL&, const String& referrer, const Document*
theDocument = 0); | |
169 static void reportLocalLoadFailed(Frame*, const String& url); | |
170 | |
171 static bool shouldHideReferrer(const KURL& url, const String& referrer); | |
172 | |
173 // Called by createWindow in JSDOMWindowBase.cpp, e.g. to fulfill a moda
l dialog creation | |
174 Frame* createWindow(FrameLoader* frameLoaderForFrameLookup, const FrameL
oadRequest&, const WindowFeatures&, bool& created); | |
175 | |
176 unsigned long loadResourceSynchronously(const ResourceRequest&, Resource
Error&, ResourceResponse&, Vector<char>& data); | |
177 | |
178 bool canHandleRequest(const ResourceRequest&); | |
179 | |
180 // Also not cool. | |
181 void stopAllLoaders(); | |
182 void stopForUserCancel(bool deferCheckLoadComplete = false); | |
183 | |
184 bool isLoadingMainResource() const { return m_isLoadingMainResource; } | |
185 bool isLoading() const; | |
186 bool frameHasLoaded() const; | |
187 | |
188 int numPendingOrLoadingRequests(bool recurse) const; | |
189 bool isReloading() const; | |
190 String referrer() const; | |
191 String outgoingReferrer() const; | |
192 void loadEmptyDocumentSynchronously(); | |
193 | |
194 DocumentLoader* activeDocumentLoader() const; | |
195 DocumentLoader* documentLoader() const; | |
196 DocumentLoader* policyDocumentLoader() const; | |
197 DocumentLoader* provisionalDocumentLoader() const; | |
198 DocumentLoader* policyDocumentLoader(); | |
199 FrameState state() const; | |
200 static double timeOfLastCompletedLoad(); | |
201 | |
202 void didReceiveAuthenticationChallenge(ResourceLoader*, const Authentica
tionChallenge&); | |
203 void didCancelAuthenticationChallenge(ResourceLoader*, const Authenticat
ionChallenge&); | |
204 | |
205 void assignIdentifierToInitialRequest(unsigned long identifier, const Re
sourceRequest&); | |
206 void willSendRequest(ResourceLoader*, ResourceRequest&, const ResourceRe
sponse& redirectResponse); | |
207 void didReceiveResponse(ResourceLoader*, const ResourceResponse&); | |
208 void didReceiveData(ResourceLoader*, const char*, int, int lengthReceive
d); | |
209 void didFinishLoad(ResourceLoader*); | |
210 void didFailToLoad(ResourceLoader*, const ResourceError&); | |
211 const ResourceRequest& originalRequest() const; | |
212 const ResourceRequest& initialRequest() const; | |
213 void receivedMainResourceError(const ResourceError&, bool isComplete); | |
214 void receivedData(const char*, int); | |
215 | |
216 void handleFallbackContent(); | |
217 bool isStopping() const; | |
218 | |
219 void finishedLoading(); | |
220 | |
221 ResourceError cancelledError(const ResourceRequest&) const; | |
222 ResourceError fileDoesNotExistError(const ResourceResponse&) const; | |
223 ResourceError blockedError(const ResourceRequest&) const; | |
224 ResourceError cannotShowURLError(const ResourceRequest&) const; | |
225 | |
226 void cannotShowMIMEType(const ResourceResponse&); | |
227 ResourceError interruptionForPolicyChangeError(const ResourceRequest&); | |
228 | |
229 bool isHostedByObjectElement() const; | |
230 bool isLoadingMainFrame() const; | |
231 bool canShowMIMEType(const String& MIMEType) const; | |
232 bool representationExistsForURLScheme(const String& URLScheme); | |
233 String generatedMIMETypeForURLScheme(const String& URLScheme); | |
234 | |
235 void notifyIconChanged(); | |
236 | |
237 void checkNavigationPolicy(const ResourceRequest&, NavigationPolicyDecis
ionFunction function, void* argument); | |
238 void checkContentPolicy(const String& MIMEType, ContentPolicyDecisionFun
ction, void* argument); | |
239 void cancelContentPolicyCheck(); | |
240 | |
241 void reload(); | |
242 void reloadAllowingStaleData(const String& overrideEncoding); | |
243 | |
244 void didReceiveServerRedirectForProvisionalLoadForFrame(); | |
245 void finishedLoadingDocument(DocumentLoader*); | |
246 void committedLoad(DocumentLoader*, const char*, int); | |
247 bool isReplacing() const; | |
248 void setReplacing(); | |
249 void revertToProvisional(DocumentLoader*); | |
250 void setMainDocumentError(DocumentLoader*, const ResourceError&); | |
251 void mainReceivedCompleteError(DocumentLoader*, const ResourceError&); | |
252 bool subframeIsLoading() const; | |
253 void willChangeTitle(DocumentLoader*); | |
254 void didChangeTitle(DocumentLoader*); | |
255 | |
256 FrameLoadType loadType() const; | |
257 FrameLoadType policyLoadType() const { return m_policyLoadType; } | |
258 | |
259 void didFirstLayout(); | |
260 bool firstLayoutDone() const; | |
261 | |
262 void clientRedirectCancelledOrFinished(bool cancelWithLoadInProgress); | |
263 void clientRedirected(const KURL&, double delay, double fireDate, bool l
ockHistory, bool isJavaScriptFormAction); | |
264 bool shouldReload(const KURL& currentURL, const KURL& destinationURL); | |
265 | |
266 bool isQuickRedirectComing() const; | |
267 | |
268 void sendRemainingDelegateMessages(unsigned long identifier, const Resou
rceResponse&, int length, const ResourceError&); | |
269 void requestFromDelegate(ResourceRequest&, unsigned long& identifier, Re
sourceError&); | |
270 void loadedResourceFromMemoryCache(const CachedResource*); | |
271 | |
272 void recursiveCheckLoadComplete(); | |
273 void checkLoadComplete(); | |
274 void detachFromParent(); | |
275 void detachChildren(); | |
276 | |
277 void addExtraFieldsToRequest(ResourceRequest&, bool isMainResource, bool
alwaysFromRequest); | |
278 | |
279 FrameLoaderClient* client() const; | |
280 | |
281 void setDefersLoading(bool); | |
282 | |
283 void changeLocation(const String& url, const String& referrer, bool lock
History = true, bool userGesture = false); | |
284 void changeLocation(const KURL&, const String& referrer, bool lockHistor
y = true, bool userGesture = false); | |
285 void urlSelected(const ResourceRequest&, const String& target, Event*, b
ool lockHistory, bool userGesture); | |
286 void urlSelected(const FrameLoadRequest&, Event*, bool lockHistory); | |
287 | |
288 bool requestFrame(HTMLFrameOwnerElement*, const String& url, const Atomi
cString& frameName); | |
289 Frame* loadSubframe(HTMLFrameOwnerElement*, const KURL&, const String& n
ame, const String& referrer); | |
290 | |
291 void submitForm(const char* action, const String& url, PassRefPtr<FormDa
ta>, const String& target, const String& contentType, const String& boundary, Ev
ent*); | |
292 void submitFormAgain(); | |
293 void submitForm(const FrameLoadRequest&, Event*); | |
294 | |
295 void stop(); | |
296 void stopLoading(bool sendUnload); | |
297 bool closeURL(); | |
298 | |
299 void didExplicitOpen(); | |
300 | |
301 KURL iconURL(); | |
302 void commitIconURLToIconDatabase(const KURL&); | |
303 | |
304 KURL baseURL() const; | |
305 String baseTarget() const; | |
306 KURL dataURLBaseFromRequest(const ResourceRequest& request) const; | |
307 | |
308 bool isScheduledLocationChangePending() const { return m_scheduledRedire
ction && isLocationChange(*m_scheduledRedirection); } | |
309 void scheduleHTTPRedirection(double delay, const String& url); | |
310 void scheduleLocationChange(const String& url, const String& referrer, b
ool lockHistory = true, bool userGesture = false); | |
311 void scheduleRefresh(bool userGesture = false); | |
312 void scheduleHistoryNavigation(int steps); | |
313 | |
314 bool canGoBackOrForward(int distance) const; | |
315 void goBackOrForward(int distance); | |
316 void goToHistoryItem(HistoryItem* item); | |
317 int getHistoryLength(); | |
318 KURL historyURL(int distance); | |
319 | |
320 void begin(); | |
321 void begin(const KURL&, bool dispatchWindowObjectAvailable = true, Secur
ityOrigin* forcedSecurityOrigin = 0); | |
322 | |
323 void write(const char* str, int len = -1, bool flush = false); | |
324 void write(const String&); | |
325 void end(); | |
326 void endIfNotLoadingMainResource(); | |
327 | |
328 void setEncoding(const String& encoding, bool userChosen); | |
329 String encoding() const; | |
330 | |
331 // Returns true if url is a JavaScript URL. | |
332 bool executeIfJavaScriptURL(const KURL& url, bool userGesture = false, b
ool replaceDocument = true); | |
333 | |
334 // Executes a script, ignore the result. For back compability. | |
335 void executeScript(const String& url, int baseLine, const String& script
); | |
336 void executeScript(const String& script, bool forceUserGesture = false); | |
337 | |
338 // Executes a script, returns results as a string, and sets succ | |
339 // to true if no errors. | |
340 String executeScript(const String& url, int baseLine, const String& scri
pt, bool* succ); | |
341 String executeScript(const String& script, bool* succ, bool forceUserGes
ture = false); | |
342 | |
343 void gotoAnchor(); | |
344 bool gotoAnchor(const String& name); // returns true if the anchor was f
ound | |
345 void scrollToAnchor(const KURL&); | |
346 | |
347 void tokenizerProcessedData(); | |
348 | |
349 void handledOnloadEvents(); | |
350 String userAgent(const KURL&) const; | |
351 | |
352 Widget* createJavaAppletWidget(const IntSize&, Element*, const HashMap<S
tring, String>& args); | |
353 | |
354 void dispatchWindowObjectAvailable(); | |
355 void restoreDocumentState(); | |
356 | |
357 Frame* opener(); | |
358 void setOpener(Frame*); | |
359 bool openedByDOM() const; | |
360 void setOpenedByDOM(); | |
361 | |
362 void provisionalLoadStarted(); | |
363 | |
364 bool userGestureHint(); | |
365 | |
366 void resetMultipleFormSubmissionProtection(); | |
367 void didNotOpenURL(const KURL&); | |
368 | |
369 void addData(const char* bytes, int length); | |
370 | |
371 bool canCachePage(); | |
372 | |
373 void checkCallImplicitClose(); | |
374 bool didOpenURL(const KURL&); | |
375 | |
376 void frameDetached(); | |
377 | |
378 const KURL& url() const { return m_URL; } | |
379 | |
380 void updateBaseURLForEmptyDocument(); | |
381 | |
382 void setResponseMIMEType(const String&); | |
383 const String& responseMIMEType() const; | |
384 | |
385 bool containsPlugins() const; | |
386 | |
387 void loadDone(); | |
388 void finishedParsing(); | |
389 void checkCompleted(); | |
390 void scheduleCheckCompleted(); | |
391 void scheduleCheckLoadComplete(); | |
392 | |
393 void clearRecordedFormValues(); | |
394 void setFormAboutToBeSubmitted(PassRefPtr<HTMLFormElement> element); | |
395 void recordFormValue(const String& name, const String& value); | |
396 | |
397 bool isComplete() const; | |
398 | |
399 bool requestObject(RenderPart* frame, const String& url, const AtomicStr
ing& frameName, | |
400 const String& serviceType, const Vector<String>& paramNames, const V
ector<String>& paramValues); | |
401 | |
402 KURL completeURL(const String& url); | |
403 | |
404 void didTellClientAboutLoad(const String& url); | |
405 bool haveToldClientAboutLoad(const String& url); | |
406 | |
407 KURL originalRequestURL() const; | |
408 | |
409 void cancelAndClear(); | |
410 | |
411 void setTitle(const String&); | |
412 | |
413 bool shouldTreatURLAsSameAsCurrent(const KURL&) const; | |
414 | |
415 void commitProvisionalLoad(PassRefPtr<CachedPage>); | |
416 | |
417 void goToItem(HistoryItem*, FrameLoadType); | |
418 void saveDocumentAndScrollState(); | |
419 void saveScrollPositionAndViewStateToItem(HistoryItem*); | |
420 | |
421 // FIXME: These accessors are here for a dwindling number of users in We
bKit, WebFrame | |
422 // being the primary one. After they're no longer needed there, they ca
n be removed! | |
423 HistoryItem* currentHistoryItem(); | |
424 HistoryItem* previousHistoryItem(); | |
425 HistoryItem* provisionalHistoryItem(); | |
426 void setCurrentHistoryItem(PassRefPtr<HistoryItem>); | |
427 void setPreviousHistoryItem(PassRefPtr<HistoryItem>); | |
428 void setProvisionalHistoryItem(PassRefPtr<HistoryItem>); | |
429 | |
430 void continueLoadWithData(SharedBuffer*, const String& mimeType, const S
tring& textEncoding, const KURL&); | |
431 | |
432 enum LocalLoadPolicy { | |
433 AllowLocalLoadsForAll, // No restriction on local loads. | |
434 AllowLocalLoadsForLocalAndSubstituteData, | |
435 AllowLocalLoadsForLocalOnly, | |
436 }; | |
437 static void setLocalLoadPolicy(LocalLoadPolicy); | |
438 static bool restrictAccessToLocal(); | |
439 static bool allowSubstituteDataAccessToLocal(); | |
440 | |
441 static void registerURLSchemeAsLocal(const String& scheme); | |
442 static bool shouldTreatURLAsLocal(const String&); | |
443 static bool shouldTreatSchemeAsLocal(const String&); | |
444 | |
445 #if USE(LOW_BANDWIDTH_DISPLAY) | |
446 bool addLowBandwidthDisplayRequest(CachedResource*); | |
447 void needToSwitchOutLowBandwidthDisplay() { m_needToSwitchOutLowBandwidt
hDisplay = true; } | |
448 | |
449 // Client can control whether to use low bandwidth display on a per fram
e basis. | |
450 // However, this should only be used for the top frame, not sub-frame. | |
451 void setUseLowBandwidthDisplay(bool lowBandwidth) { m_useLowBandwidthDis
play = lowBandwidth; } | |
452 bool useLowBandwidthDisplay() const { return m_useLowBandwidthDisplay; } | |
453 #endif | |
454 | |
455 bool committingFirstRealLoad() const { return !m_creatingInitialEmptyDoc
ument && !m_committedFirstRealDocumentLoad; } | |
456 | |
457 void iconLoadDecisionAvailable(); | |
458 | |
459 bool shouldAllowNavigation(Frame* targetFrame) const; | |
460 Frame* findFrameForNavigation(const AtomicString& name); | |
461 | |
462 void startIconLoader(); | |
463 | |
464 void applyUserAgent(ResourceRequest& request); | |
465 | |
466 bool firingUnloadEvents() { return m_firingUnloadEvents; } | |
467 void setFiringUnloadEvents(bool value) { m_firingUnloadEvents = value; } | |
468 | |
469 void unloadListenerChanged(); | |
470 | |
471 private: | |
472 PassRefPtr<HistoryItem> createHistoryItem(bool useOriginal); | |
473 PassRefPtr<HistoryItem> createHistoryItemTree(Frame* targetFrame, bool c
lipAtTarget); | |
474 | |
475 void addBackForwardItemClippedAtTarget(bool doClip); | |
476 void restoreScrollPositionAndViewState(); | |
477 void saveDocumentState(); | |
478 void loadItem(HistoryItem*, FrameLoadType); | |
479 bool urlsMatchItem(HistoryItem*) const; | |
480 void invalidateCurrentItemCachedPage(); | |
481 void recursiveGoToItem(HistoryItem*, HistoryItem*, FrameLoadType); | |
482 bool childFramesMatchItem(HistoryItem*) const; | |
483 | |
484 void updateHistoryForBackForwardNavigation(); | |
485 void updateHistoryForReload(); | |
486 void updateHistoryForStandardLoad(); | |
487 void updateHistoryForRedirectWithLockedHistory(); | |
488 void updateHistoryForClientRedirect(); | |
489 void updateHistoryForCommit(); | |
490 void updateHistoryForAnchorScroll(); | |
491 | |
492 void redirectionTimerFired(Timer<FrameLoader>*); | |
493 void checkCompletedTimerFired(Timer<FrameLoader>*); | |
494 void checkLoadCompleteTimerFired(Timer<FrameLoader>*); | |
495 | |
496 void cancelRedirection(bool newLoadInProgress = false); | |
497 | |
498 void started(); | |
499 | |
500 void completed(); | |
501 void parentCompleted(); | |
502 | |
503 bool shouldUsePlugin(const KURL&, const String& mimeType, bool hasFallba
ck, bool& useFallback); | |
504 bool loadPlugin(RenderPart*, const KURL&, const String& mimeType, | |
505 const Vector<String>& paramNames, const Vector<String>& paramValues, boo
l useFallback); | |
506 | |
507 bool loadProvisionalItemFromCachedPage(); | |
508 void cachePageForHistoryItem(HistoryItem*); | |
509 | |
510 void receivedFirstData(); | |
511 | |
512 void updatePolicyBaseURL(); | |
513 void setPolicyBaseURL(const KURL&); | |
514 | |
515 // Also not cool. | |
516 void stopLoadingSubframes(); | |
517 | |
518 void clearProvisionalLoad(); | |
519 void markLoadComplete(); | |
520 void transitionToCommitted(PassRefPtr<CachedPage>); | |
521 void frameLoadCompleted(); | |
522 | |
523 void mainReceivedError(const ResourceError&, bool isComplete); | |
524 | |
525 void setLoadType(FrameLoadType); | |
526 | |
527 void checkNavigationPolicy(const ResourceRequest&, DocumentLoader*, Pass
RefPtr<FormState>, | |
528 NavigationPolicyDecisionFunction, void* argum
ent); | |
529 void checkNewWindowPolicy(const NavigationAction&, const ResourceRequest
&, | |
530 PassRefPtr<FormState>, const String& frameName
); | |
531 | |
532 void continueAfterNavigationPolicy(PolicyAction); | |
533 void continueAfterNewWindowPolicy(PolicyAction); | |
534 void continueAfterContentPolicy(PolicyAction); | |
535 void continueLoadAfterWillSubmitForm(PolicyAction = PolicyUse); | |
536 | |
537 static void callContinueLoadAfterNavigationPolicy(void*, const ResourceR
equest&, PassRefPtr<FormState>, bool shouldContinue); | |
538 void continueLoadAfterNavigationPolicy(const ResourceRequest&, PassRefPt
r<FormState>, bool shouldContinue); | |
539 static void callContinueLoadAfterNewWindowPolicy(void*, const ResourceRe
quest&, PassRefPtr<FormState>, const String& frameName, bool shouldContinue); | |
540 void continueLoadAfterNewWindowPolicy(const ResourceRequest&, PassRefPtr
<FormState>, const String& frameName, bool shouldContinue); | |
541 static void callContinueFragmentScrollAfterNavigationPolicy(void*, const
ResourceRequest&, PassRefPtr<FormState>, bool shouldContinue); | |
542 void continueFragmentScrollAfterNavigationPolicy(const ResourceRequest&,
bool shouldContinue); | |
543 bool shouldScrollToAnchor(bool isFormSubmission, FrameLoadType loadType,
const KURL& url); | |
544 void addHistoryItemForFragmentScroll(); | |
545 | |
546 void stopPolicyCheck(); | |
547 | |
548 void closeDocument(); | |
549 | |
550 void checkLoadCompleteForThisFrame(); | |
551 | |
552 void setDocumentLoader(DocumentLoader*); | |
553 void setPolicyDocumentLoader(DocumentLoader*); | |
554 void setProvisionalDocumentLoader(DocumentLoader*); | |
555 | |
556 void setState(FrameState); | |
557 | |
558 void closeOldDataSources(); | |
559 void open(CachedPage&); | |
560 void opened(); | |
561 void updateHistoryAfterClientRedirect(); | |
562 | |
563 void clear(bool clearWindowProperties = true, bool clearScriptObjects =
true); | |
564 | |
565 bool shouldReloadToHandleUnreachableURL(DocumentLoader*); | |
566 void handleUnimplementablePolicy(const ResourceError&); | |
567 | |
568 void scheduleRedirection(ScheduledRedirection*); | |
569 void startRedirectionTimer(); | |
570 void stopRedirectionTimer(); | |
571 | |
572 #if USE(LOW_BANDWIDTH_DISPLAY) | |
573 // implementation of CachedResourceClient | |
574 virtual void notifyFinished(CachedResource*); | |
575 | |
576 void removeAllLowBandwidthDisplayRequests(); | |
577 void switchOutLowBandwidthDisplayIfReady(); | |
578 #endif | |
579 | |
580 void dispatchDidCommitLoad(); | |
581 void dispatchAssignIdentifierToInitialRequest(unsigned long identifier,
DocumentLoader*, const ResourceRequest&); | |
582 void dispatchWillSendRequest(DocumentLoader*, unsigned long identifier,
ResourceRequest&, const ResourceResponse& redirectResponse); | |
583 void dispatchDidReceiveResponse(DocumentLoader*, unsigned long identifie
r, const ResourceResponse&); | |
584 void dispatchDidReceiveContentLength(DocumentLoader*, unsigned long iden
tifier, int length); | |
585 void dispatchDidFinishLoading(DocumentLoader*, unsigned long identifier)
; | |
586 | |
587 static bool isLocationChange(const ScheduledRedirection&); | |
588 | |
589 Frame* m_frame; | |
590 FrameLoaderClient* m_client; | |
591 | |
592 FrameState m_state; | |
593 FrameLoadType m_loadType; | |
594 | |
595 // Document loaders for the three phases of frame loading. Note that whi
le | |
596 // a new request is being loaded, the old document loader may still be r
eferenced. | |
597 // E.g. while a new request is in the "policy" state, the old document l
oader may | |
598 // be consulted in particular as it makes sense to imply certain setting
s on the new loader. | |
599 RefPtr<DocumentLoader> m_documentLoader; | |
600 RefPtr<DocumentLoader> m_provisionalDocumentLoader; | |
601 RefPtr<DocumentLoader> m_policyDocumentLoader; | |
602 | |
603 // This identifies the type of navigation action which prompted this loa
d. Note | |
604 // that WebKit conveys this value as the WebActionNavigationTypeKey valu
e | |
605 // on navigation action delegate callbacks. | |
606 FrameLoadType m_policyLoadType; | |
607 PolicyCheck m_policyCheck; | |
608 | |
609 bool m_delegateIsHandlingProvisionalLoadError; | |
610 bool m_delegateIsDecidingNavigationPolicy; | |
611 bool m_delegateIsHandlingUnimplementablePolicy; | |
612 | |
613 bool m_firstLayoutDone; | |
614 bool m_quickRedirectComing; | |
615 bool m_sentRedirectNotification; | |
616 bool m_inStopAllLoaders; | |
617 bool m_navigationDuringLoad; | |
618 | |
619 String m_outgoingReferrer; | |
620 | |
621 CachePolicy m_cachePolicy; | |
622 | |
623 HashSet<String> m_urlsClientKnowsAbout; | |
624 | |
625 OwnPtr<FormSubmission> m_deferredFormSubmission; | |
626 | |
627 bool m_isExecutingJavaScriptFormAction; | |
628 bool m_isRunningScript; | |
629 | |
630 String m_responseMIMEType; | |
631 | |
632 bool m_didCallImplicitClose; | |
633 bool m_wasUnloadEventEmitted; | |
634 bool m_isComplete; | |
635 bool m_isLoadingMainResource; | |
636 bool m_firingUnloadEvents; // frame or loader is firing unload or befor
eUnload events. | |
637 | |
638 KURL m_URL; | |
639 KURL m_workingURL; | |
640 | |
641 OwnPtr<IconLoader> m_iconLoader; | |
642 bool m_mayLoadIconLater; | |
643 | |
644 bool m_cancellingWithLoadInProgress; | |
645 | |
646 OwnPtr<ScheduledRedirection> m_scheduledRedirection; | |
647 | |
648 bool m_needsClear; | |
649 bool m_receivedData; | |
650 | |
651 bool m_encodingWasChosenByUser; | |
652 String m_encoding; | |
653 RefPtr<TextResourceDecoder> m_decoder; | |
654 | |
655 bool m_containsPlugIns; | |
656 | |
657 RefPtr<HTMLFormElement> m_formAboutToBeSubmitted; | |
658 HashMap<String, String> m_formValuesAboutToBeSubmitted; | |
659 KURL m_submittedFormURL; | |
660 | |
661 Timer<FrameLoader> m_redirectionTimer; | |
662 Timer<FrameLoader> m_checkCompletedTimer; | |
663 Timer<FrameLoader> m_checkLoadCompleteTimer; | |
664 | |
665 Frame* m_opener; | |
666 HashSet<Frame*> m_openedFrames; | |
667 | |
668 bool m_openedByDOM; | |
669 | |
670 bool m_creatingInitialEmptyDocument; | |
671 bool m_isDisplayingInitialEmptyDocument; | |
672 bool m_committedFirstRealDocumentLoad; | |
673 | |
674 RefPtr<HistoryItem> m_currentHistoryItem; | |
675 RefPtr<HistoryItem> m_previousHistoryItem; | |
676 RefPtr<HistoryItem> m_provisionalHistoryItem; | |
677 | |
678 bool m_didPerformFirstNavigation; | |
679 | |
680 #ifndef NDEBUG | |
681 bool m_didDispatchDidCommitLoad; | |
682 #endif | |
683 | |
684 #if USE(LOW_BANDWIDTH_DISPLAY) | |
685 // whether to use low bandwidth dislay, set by client | |
686 bool m_useLowBandwidthDisplay; | |
687 | |
688 // whether to call finishParsing() in switchOutLowBandwidthDisplayIfRead
y() | |
689 bool m_finishedParsingDuringLowBandwidthDisplay; | |
690 | |
691 // whether to call switchOutLowBandwidthDisplayIfReady; | |
692 // true if there is external css, javascript, or subframe/plugin | |
693 bool m_needToSwitchOutLowBandwidthDisplay; | |
694 | |
695 String m_pendingSourceInLowBandwidthDisplay; | |
696 HashSet<CachedResource*> m_externalRequestsInLowBandwidthDisplay; | |
697 #endif | |
698 }; | |
699 | |
700 } | |
701 | |
702 #endif | |
OLD | NEW |