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