summaryrefslogtreecommitdiffstats
path: root/WebCore/loader/FrameLoader.h
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/loader/FrameLoader.h')
-rw-r--r--WebCore/loader/FrameLoader.h201
1 files changed, 95 insertions, 106 deletions
diff --git a/WebCore/loader/FrameLoader.h b/WebCore/loader/FrameLoader.h
index 07acff3..07e530e 100644
--- a/WebCore/loader/FrameLoader.h
+++ b/WebCore/loader/FrameLoader.h
@@ -31,9 +31,9 @@
#define FrameLoader_h
#include "CachePolicy.h"
-#include "FormState.h"
#include "FrameLoaderTypes.h"
#include "ResourceRequest.h"
+#include "ThreadableLoader.h"
#include "Timer.h"
namespace WebCore {
@@ -47,9 +47,9 @@ namespace WebCore {
class CachedResource;
class Document;
class DocumentLoader;
- class Element;
class Event;
class FormData;
+ class FormState;
class Frame;
class FrameLoaderClient;
class HistoryItem;
@@ -64,6 +64,7 @@ namespace WebCore {
class ResourceLoader;
class ResourceResponse;
class ScriptSourceCode;
+ class ScriptString;
class ScriptValue;
class SecurityOrigin;
class SharedBuffer;
@@ -71,7 +72,6 @@ namespace WebCore {
class TextResourceDecoder;
class Widget;
- struct FormSubmission;
struct FrameLoadRequest;
struct ScheduledRedirection;
struct WindowFeatures;
@@ -122,56 +122,40 @@ namespace WebCore {
Frame* frame() const { return m_frame; }
- // FIXME: This is not cool, people. We should aim to consolidate these variety of loading related methods into a smaller set,
- // and try to reuse more of the same logic by extracting common code paths.
+ // FIXME: This is not cool, people. There are too many different functions that all start loads.
+ // We should aim to consolidate these into a smaller set of functions, and try to reuse more of
+ // the logic by extracting common code paths.
+
void prepareForLoadStart();
void setupForReplace();
void setupForReplaceByMIMEType(const String& newMIMEType);
- void loadWithDocumentLoader(DocumentLoader*, FrameLoadType, PassRefPtr<FormState>); // Calls continueLoadAfterNavigationPolicy
- void load(DocumentLoader*); // Calls loadWithDocumentLoader
-
- void loadWithNavigationAction(const ResourceRequest&, const NavigationAction&, // Calls loadWithDocumentLoader()
- bool lockHistory, FrameLoadType, PassRefPtr<FormState>);
-
-#ifdef ANDROID_USER_GESTURE
- void loadPostRequest(const ResourceRequest&, const String& referrer, // Called by loadFrameRequestWithFormAndValues(), calls loadWithNavigationAction
- const String& frameName, bool lockHistory, FrameLoadType, Event*, PassRefPtr<FormState>, bool userGesture);
-
- void loadURL(const KURL& newURL, const String& referrer, const String& frameName, // Called by loadFrameRequestWithFormAndValues(), calls loadWithNavigationAction or else dispatches to navigation policy delegate
- bool lockHistory, FrameLoadType, Event*, PassRefPtr<FormState>, bool userGesture);
-#else
- void loadPostRequest(const ResourceRequest&, const String& referrer, // Called by loadFrameRequestWithFormAndValues(), calls loadWithNavigationAction
- const String& frameName, bool lockHistory, FrameLoadType, Event*, PassRefPtr<FormState>);
-
- void loadURL(const KURL& newURL, const String& referrer, const String& frameName, // Called by loadFrameRequestWithFormAndValues(), calls loadWithNavigationAction or else dispatches to navigation policy delegate
- bool lockHistory, FrameLoadType, Event*, PassRefPtr<FormState>);
-#endif
void loadURLIntoChildFrame(const KURL&, const String& referer, Frame*);
- void loadFrameRequestWithFormAndValues(const FrameLoadRequest&, bool lockHistory, bool lockBackForwardList, // Called by submitForm, calls loadPostRequest()
- Event*, HTMLFormElement*, const HashMap<String, String>& formValues);
+ void loadFrameRequest(const FrameLoadRequest&, bool lockHistory, bool lockBackForwardList, // Called by submitForm, calls loadPostRequest and loadURL.
+ PassRefPtr<Event>, PassRefPtr<FormState>);
- void load(const ResourceRequest&, bool lockHistory); // Called by WebFrame, calls (ResourceRequest, SubstituteData)
- void load(const ResourceRequest&, const SubstituteData&, bool lockHistory); // Called both by WebFrame and internally, calls (DocumentLoader*)
- void load(const ResourceRequest&, const String& frameName, bool lockHistory); // Called by WebPluginController
+ void load(const ResourceRequest&, bool lockHistory); // Called by WebFrame, calls load(ResourceRequest, SubstituteData).
+ void load(const ResourceRequest&, const SubstituteData&, bool lockHistory); // Called both by WebFrame and internally, calls load(DocumentLoader*).
+ void load(const ResourceRequest&, const String& frameName, bool lockHistory); // Called by WebPluginController.
#if ENABLE(ARCHIVE) // ANDROID extension: disabled to reduce code size
- void loadArchive(PassRefPtr<Archive> archive);
+ void loadArchive(PassRefPtr<Archive>);
#endif
- // Returns true for any non-local URL. If Document parameter is supplied, its local load policy dictates,
+ // Returns true for any non-local URL. If document parameter is supplied, its local load policy dictates,
// otherwise if referrer is non-empty and represents a local file, then the local load is allowed.
- static bool canLoad(const KURL&, const String& referrer, const Document* theDocument = 0);
+ static bool canLoad(const KURL&, const String& referrer, const Document*);
+ static bool canLoad(const KURL&, const String& referrer, const SecurityOrigin* = 0);
static void reportLocalLoadFailed(Frame*, const String& url);
- static bool shouldHideReferrer(const KURL& url, const String& referrer);
+ static bool shouldHideReferrer(const KURL&, const String& referrer);
// Called by createWindow in JSDOMWindowBase.cpp, e.g. to fulfill a modal dialog creation
Frame* createWindow(FrameLoader* frameLoaderForFrameLookup, const FrameLoadRequest&, const WindowFeatures&, bool& created);
- unsigned long loadResourceSynchronously(const ResourceRequest&, ResourceError&, ResourceResponse&, Vector<char>& data);
+ unsigned long loadResourceSynchronously(const ResourceRequest&, StoredCredentials, ResourceError&, ResourceResponse&, Vector<char>& data);
bool canHandleRequest(const ResourceRequest&);
@@ -187,7 +171,6 @@ namespace WebCore {
String referrer() const;
String outgoingReferrer() const;
String outgoingOrigin() const;
- void loadEmptyDocumentSynchronously();
DocumentLoader* activeDocumentLoader() const;
DocumentLoader* documentLoader() const { return m_documentLoader.get(); }
@@ -206,6 +189,7 @@ namespace WebCore {
void didReceiveData(ResourceLoader*, const char*, int, int lengthReceived);
void didFinishLoad(ResourceLoader*);
void didFailToLoad(ResourceLoader*, const ResourceError&);
+ void didLoadResourceByXMLHttpRequest(unsigned long identifier, const ScriptString& sourceString);
const ResourceRequest& originalRequest() const;
const ResourceRequest& initialRequest() const;
void receivedMainResourceError(const ResourceError&, bool isComplete);
@@ -230,8 +214,6 @@ namespace WebCore {
bool representationExistsForURLScheme(const String& URLScheme);
String generatedMIMETypeForURLScheme(const String& URLScheme);
- void notifyIconChanged();
-
void checkNavigationPolicy(const ResourceRequest&, NavigationPolicyDecisionFunction function, void* argument);
void checkContentPolicy(const String& MIMEType, ContentPolicyDecisionFunction, void* argument);
void cancelContentPolicyCheck();
@@ -252,32 +234,22 @@ namespace WebCore {
void didChangeTitle(DocumentLoader*);
FrameLoadType loadType() const;
- CachePolicy cachePolicy() const;
+ CachePolicy subresourceCachePolicy() const;
void didFirstLayout();
bool firstLayoutDone() const;
void didFirstVisuallyNonEmptyLayout();
- void clientRedirectCancelledOrFinished(bool cancelWithLoadInProgress);
- void clientRedirected(const KURL&, double delay, double fireDate, bool lockBackForwardList, bool isJavaScriptFormAction);
- bool shouldReload(const KURL& currentURL, const KURL& destinationURL);
#if ENABLE(WML)
void setForceReloadWmlDeck(bool);
#endif
- bool isQuickRedirectComing() const;
-
- void sendRemainingDelegateMessages(unsigned long identifier, const ResourceResponse&, int length, const ResourceError&);
- void requestFromDelegate(ResourceRequest&, unsigned long& identifier, ResourceError&);
void loadedResourceFromMemoryCache(const CachedResource*);
void tellClientAboutPastMemoryCacheLoads();
- void recursiveCheckLoadComplete();
void checkLoadComplete();
void detachFromParent();
- void detachChildren();
- void closeAndRemoveChild(Frame*);
void addExtraFieldsToSubresourceRequest(ResourceRequest&);
void addExtraFieldsToMainResourceRequest(ResourceRequest&);
@@ -288,17 +260,13 @@ namespace WebCore {
void setDefersLoading(bool);
- void changeLocation(const String& url, const String& referrer, bool lockHistory = true, bool lockBackForwardList = true, bool userGesture = false, bool refresh = false);
void changeLocation(const KURL&, const String& referrer, bool lockHistory = true, bool lockBackForwardList = true, bool userGesture = false, bool refresh = false);
- void urlSelected(const ResourceRequest&, const String& target, Event*, bool lockHistory, bool lockBackForwardList, bool userGesture);
- void urlSelected(const FrameLoadRequest&, Event*, bool lockHistory, bool lockBackForwardList);
-
+ void urlSelected(const ResourceRequest&, const String& target, PassRefPtr<Event>, bool lockHistory, bool lockBackForwardList, bool userGesture);
bool requestFrame(HTMLFrameOwnerElement*, const String& url, const AtomicString& frameName);
- Frame* loadSubframe(HTMLFrameOwnerElement*, const KURL&, const String& name, const String& referrer);
- void submitForm(const char* action, const String& url, PassRefPtr<FormData>, const String& target, const String& contentType, const String& boundary, Event*, bool lockHistory, bool lockBackForwardList);
- void submitFormAgain();
- void submitForm(const FrameLoadRequest&, Event*, bool lockHistory, bool lockBackForwardList);
+ void submitForm(const char* action, const String& url,
+ PassRefPtr<FormData>, const String& target, const String& contentType, const String& boundary,
+ bool lockHistory, bool lockBackForwardList, PassRefPtr<Event>, PassRefPtr<FormState>);
void stop();
void stopLoading(bool sendUnload, DatabasePolicy = DatabasePolicyStop);
@@ -310,8 +278,6 @@ namespace WebCore {
void commitIconURLToIconDatabase(const KURL&);
KURL baseURL() const;
- String baseTarget() const;
- KURL dataURLBaseFromRequest(const ResourceRequest& request) const;
bool isScheduledLocationChangePending() const { return m_scheduledRedirection && isLocationChange(*m_scheduledRedirection); }
void scheduleHTTPRedirection(double delay, const String& url);
@@ -322,12 +288,11 @@ namespace WebCore {
bool canGoBackOrForward(int distance) const;
void goBackOrForward(int distance);
int getHistoryLength();
- KURL historyURL(int distance);
void begin();
void begin(const KURL&, bool dispatchWindowObjectAvailable = true, SecurityOrigin* forcedSecurityOrigin = 0);
- void write(const char* str, int len = -1, bool flush = false);
+ void write(const char* string, int length = -1, bool flush = false);
void write(const String&);
void end();
void endIfNotLoadingMainResource();
@@ -335,15 +300,10 @@ namespace WebCore {
void setEncoding(const String& encoding, bool userChosen);
String encoding() const;
- // Returns true if url is a JavaScript URL.
- bool executeIfJavaScriptURL(const KURL& url, bool userGesture = false, bool replaceDocument = true);
-
ScriptValue executeScript(const ScriptSourceCode&);
ScriptValue executeScript(const String& script, bool forceUserGesture = false);
void gotoAnchor();
- bool gotoAnchor(const String& name); // returns true if the anchor was found
- void scrollToAnchor(const KURL&);
void tokenizerProcessedData();
@@ -361,26 +321,18 @@ namespace WebCore {
bool openedByDOM() const;
void setOpenedByDOM();
- void provisionalLoadStarted();
-
bool userGestureHint();
void resetMultipleFormSubmissionProtection();
- void didNotOpenURL(const KURL&);
void addData(const char* bytes, int length);
- bool canCachePage();
-
void checkCallImplicitClose();
- bool didOpenURL(const KURL&);
void frameDetached();
const KURL& url() const { return m_URL; }
- void updateBaseURLForEmptyDocument();
-
void setResponseMIMEType(const String&);
const String& responseMIMEType() const;
@@ -389,12 +341,6 @@ namespace WebCore {
void loadDone();
void finishedParsing();
void checkCompleted();
- void scheduleCheckCompleted();
- void scheduleCheckLoadComplete();
-
- void clearRecordedFormValues();
- void setFormAboutToBeSubmitted(PassRefPtr<HTMLFormElement> element);
- void recordFormValue(const String& name, const String& value);
bool isComplete() const;
@@ -403,32 +349,22 @@ namespace WebCore {
KURL completeURL(const String& url);
- KURL originalRequestURL() const;
-
void cancelAndClear();
void setTitle(const String&);
-
- bool shouldTreatURLAsSameAsCurrent(const KURL&) const;
void commitProvisionalLoad(PassRefPtr<CachedPage>);
void goToItem(HistoryItem*, FrameLoadType);
void saveDocumentAndScrollState();
- void saveScrollPositionAndViewStateToItem(HistoryItem*);
- // FIXME: These accessors are here for a dwindling number of users in WebKit, WebFrame
- // being the primary one. After they're no longer needed there, they can be removed!
HistoryItem* currentHistoryItem();
void setCurrentHistoryItem(PassRefPtr<HistoryItem>);
- void setProvisionalHistoryItem(PassRefPtr<HistoryItem>);
-
- void continueLoadWithData(SharedBuffer*, const String& mimeType, const String& textEncoding, const KURL&);
enum LocalLoadPolicy {
- AllowLocalLoadsForAll, // No restriction on local loads.
- AllowLocalLoadsForLocalAndSubstituteData,
- AllowLocalLoadsForLocalOnly,
+ AllowLocalLoadsForAll, // No restriction on local loads.
+ AllowLocalLoadsForLocalAndSubstituteData,
+ AllowLocalLoadsForLocalOnly,
};
static void setLocalLoadPolicy(LocalLoadPolicy);
static bool restrictAccessToLocal();
@@ -452,6 +388,8 @@ namespace WebCore {
void applyUserAgent(ResourceRequest& request);
+ bool shouldInterruptLoadForXFrameOptions(const String&, const KURL&);
+
private:
PassRefPtr<HistoryItem> createHistoryItem(bool useOriginal);
PassRefPtr<HistoryItem> createHistoryItemTree(Frame* targetFrame, bool clipAtTarget);
@@ -499,8 +437,8 @@ namespace WebCore {
void receivedFirstData();
- void updatePolicyBaseURL();
- void setPolicyBaseURL(const KURL&);
+ void updateFirstPartyForCookies();
+ void setFirstPartyForCookies(const KURL&);
void addExtraFieldsToRequest(ResourceRequest&, FrameLoadType loadType, bool isMainResource, bool cookiePolicyURLFromRequest);
@@ -516,10 +454,8 @@ namespace WebCore {
void setLoadType(FrameLoadType);
- void checkNavigationPolicy(const ResourceRequest&, DocumentLoader*, PassRefPtr<FormState>,
- NavigationPolicyDecisionFunction, void* argument);
- void checkNewWindowPolicy(const NavigationAction&, const ResourceRequest&,
- PassRefPtr<FormState>, const String& frameName);
+ void checkNavigationPolicy(const ResourceRequest&, DocumentLoader*, PassRefPtr<FormState>, NavigationPolicyDecisionFunction, void* argument);
+ void checkNewWindowPolicy(const NavigationAction&, const ResourceRequest&, PassRefPtr<FormState>, const String& frameName);
void continueAfterNavigationPolicy(PolicyAction);
void continueAfterNewWindowPolicy(PolicyAction);
@@ -532,13 +468,11 @@ namespace WebCore {
void continueLoadAfterNewWindowPolicy(const ResourceRequest&, PassRefPtr<FormState>, const String& frameName, bool shouldContinue);
static void callContinueFragmentScrollAfterNavigationPolicy(void*, const ResourceRequest&, PassRefPtr<FormState>, bool shouldContinue);
void continueFragmentScrollAfterNavigationPolicy(const ResourceRequest&, bool shouldContinue);
- bool shouldScrollToAnchor(bool isFormSubmission, FrameLoadType loadType, const KURL& url);
+ bool shouldScrollToAnchor(bool isFormSubmission, FrameLoadType, const KURL&);
void addHistoryItemForFragmentScroll();
void stopPolicyCheck();
- void closeDocument();
-
void checkLoadCompleteForThisFrame();
void setDocumentLoader(DocumentLoader*);
@@ -570,6 +504,65 @@ namespace WebCore {
void dispatchDidFinishLoading(DocumentLoader*, unsigned long identifier);
static bool isLocationChange(const ScheduledRedirection&);
+ void scheduleFormSubmission(const FrameLoadRequest&, bool lockHistory, bool lockBackForwardList, PassRefPtr<Event>, PassRefPtr<FormState>);
+
+ void loadWithDocumentLoader(DocumentLoader*, FrameLoadType, PassRefPtr<FormState>); // Calls continueLoadAfterNavigationPolicy
+ void load(DocumentLoader*); // Calls loadWithDocumentLoader
+
+ void loadWithNavigationAction(const ResourceRequest&, const NavigationAction&, // Calls loadWithDocumentLoader
+ bool lockHistory, FrameLoadType, PassRefPtr<FormState>);
+
+#ifdef ANDROID_USER_GESTURE
+// FIXME (klobag): WebKit/android/jni/WebCoreFrameBridge.cpp uses
+// loadPostRequest, figure out if we can use load(...) instead of
+// making loadPostRequest public.
+public:
+ void loadPostRequest(const ResourceRequest&, const String& referrer, // Called by loadFrameRequest, calls loadWithNavigationAction
+ const String& frameName, bool lockHistory, FrameLoadType, PassRefPtr<Event>, PassRefPtr<FormState>, bool userGesture);
+private:
+ void loadURL(const KURL&, const String& referrer, const String& frameName, // Called by loadFrameRequest, calls loadWithNavigationAction or dispatches to navigation policy delegate
+ bool lockHistory, FrameLoadType, PassRefPtr<Event>, PassRefPtr<FormState>, bool userGesture);
+#endif // ANDROID_USER_GESTURE
+
+ void loadPostRequest(const ResourceRequest&, const String& referrer, // Called by loadFrameRequest, calls loadWithNavigationAction
+ const String& frameName, bool lockHistory, FrameLoadType, PassRefPtr<Event>, PassRefPtr<FormState>);
+ void loadURL(const KURL&, const String& referrer, const String& frameName, // Called by loadFrameRequest, calls loadWithNavigationAction or dispatches to navigation policy delegate
+ bool lockHistory, FrameLoadType, PassRefPtr<Event>, PassRefPtr<FormState>);
+
+ void clientRedirectCancelledOrFinished(bool cancelWithLoadInProgress);
+ void clientRedirected(const KURL&, double delay, double fireDate, bool lockBackForwardList);
+ bool shouldReload(const KURL& currentURL, const KURL& destinationURL);
+
+ void sendRemainingDelegateMessages(unsigned long identifier, const ResourceResponse&, int length, const ResourceError&);
+ void requestFromDelegate(ResourceRequest&, unsigned long& identifier, ResourceError&);
+
+ void recursiveCheckLoadComplete();
+
+ void detachChildren();
+ void closeAndRemoveChild(Frame*);
+
+ Frame* loadSubframe(HTMLFrameOwnerElement*, const KURL&, const String& name, const String& referrer);
+
+ // Returns true if argument is a JavaScript URL.
+ bool executeIfJavaScriptURL(const KURL&, bool userGesture = false, bool replaceDocument = true);
+
+ bool gotoAnchor(const String& name); // returns true if the anchor was found
+ void scrollToAnchor(const KURL&);
+
+ void provisionalLoadStarted();
+
+ bool canCachePage();
+
+ bool didOpenURL(const KURL&);
+
+ void scheduleCheckCompleted();
+ void scheduleCheckLoadComplete();
+
+ KURL originalRequestURL() const;
+
+ bool shouldTreatURLAsSameAsCurrent(const KURL&) const;
+
+ void saveScrollPositionAndViewStateToItem(HistoryItem*);
Frame* m_frame;
FrameLoaderClient* m_client;
@@ -599,12 +592,9 @@ namespace WebCore {
bool m_quickRedirectComing;
bool m_sentRedirectNotification;
bool m_inStopAllLoaders;
- bool m_navigationDuringLoad;
String m_outgoingReferrer;
- OwnPtr<FormSubmission> m_deferredFormSubmission;
-
bool m_isExecutingJavaScriptFormAction;
bool m_isRunningScript;
@@ -612,6 +602,7 @@ namespace WebCore {
bool m_didCallImplicitClose;
bool m_wasUnloadEventEmitted;
+ bool m_unloadEventBeingDispatched;
bool m_isComplete;
bool m_isLoadingMainResource;
@@ -634,8 +625,6 @@ namespace WebCore {
bool m_containsPlugIns;
- RefPtr<HTMLFormElement> m_formAboutToBeSubmitted;
- HashMap<String, String> m_formValuesAboutToBeSubmitted;
KURL m_submittedFormURL;
Timer<FrameLoader> m_redirectionTimer;