Commit 5d1a968f authored by abarth@webkit.org's avatar abarth@webkit.org

2009-10-01 Adam Barth <abarth@webkit.org>

        Reviewed by Darin Adler.

        Remove FrameLoader::schedule* APIs
        https://bugs.webkit.org/show_bug.cgi?id=29950

        Change clients of FrameLoader::schedule* to call redirectScheduler
        directly.

        No behavior change.

        * bindings/js/JSDOMWindowCustom.cpp:
        (WebCore::JSDOMWindow::setLocation):
        (WebCore::createWindow):
        (WebCore::JSDOMWindow::open):
        * bindings/js/JSDocumentCustom.cpp:
        (WebCore::JSDocument::setLocation):
        * bindings/js/JSLocationCustom.cpp:
        (WebCore::navigateIfAllowed):
        (WebCore::JSLocation::reload):
        * bindings/v8/V8Utilities.cpp:
        (WebCore::navigateIfAllowed):
        * bindings/v8/custom/V8DOMWindowCustom.cpp:
        (WebCore::createWindow):
        (WebCore::CALLBACK_FUNC_DECL):
        * bindings/v8/custom/V8LocationCustom.cpp:
        (WebCore::CALLBACK_FUNC_DECL):
        * dom/Document.cpp:
        (WebCore::Document::implicitClose):
        (WebCore::Document::processHttpEquiv):
        * html/HTMLTokenizer.cpp:
        (WebCore::HTMLTokenizer::write):
        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::requestFrame):
        (WebCore::FrameLoader::submitForm):
        (WebCore::FrameLoader::receivedFirstData):
        * loader/FrameLoader.h:
        * loader/appcache/ApplicationCacheGroup.cpp:
        (WebCore::ApplicationCacheGroup::selectCache):
        * page/History.cpp:
        (WebCore::History::back):
        (WebCore::History::forward):
        (WebCore::History::go):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48994 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1a1e4d53
2009-10-01 Adam Barth <abarth@webkit.org>
Reviewed by Darin Adler.
Remove FrameLoader::schedule* APIs
https://bugs.webkit.org/show_bug.cgi?id=29950
Change clients of FrameLoader::schedule* to call redirectScheduler
directly.
No behavior change.
* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::setLocation):
(WebCore::createWindow):
(WebCore::JSDOMWindow::open):
* bindings/js/JSDocumentCustom.cpp:
(WebCore::JSDocument::setLocation):
* bindings/js/JSLocationCustom.cpp:
(WebCore::navigateIfAllowed):
(WebCore::JSLocation::reload):
* bindings/v8/V8Utilities.cpp:
(WebCore::navigateIfAllowed):
* bindings/v8/custom/V8DOMWindowCustom.cpp:
(WebCore::createWindow):
(WebCore::CALLBACK_FUNC_DECL):
* bindings/v8/custom/V8LocationCustom.cpp:
(WebCore::CALLBACK_FUNC_DECL):
* dom/Document.cpp:
(WebCore::Document::implicitClose):
(WebCore::Document::processHttpEquiv):
* html/HTMLTokenizer.cpp:
(WebCore::HTMLTokenizer::write):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::requestFrame):
(WebCore::FrameLoader::submitForm):
(WebCore::FrameLoader::receivedFirstData):
* loader/FrameLoader.h:
* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::selectCache):
* page/History.cpp:
(WebCore::History::back):
(WebCore::History::forward):
(WebCore::History::go):
2009-10-01 Beth Dakin <bdakin@apple.com>
Just removing a comment I accidentally committed earlier.
......@@ -589,7 +589,7 @@ void JSDOMWindow::setLocation(ExecState* exec, JSValue value)
if (!protocolIsJavaScript(url) || allowsAccessFrom(exec)) {
// We want a new history item if this JS was called via a user gesture
frame->loader()->scheduleLocationChange(url, lexicalFrame->loader()->outgoingReferrer(), !lexicalFrame->script()->anyPageIsProcessingUserGesture(), false, processingUserGesture(exec));
frame->redirectScheduler()->scheduleLocationChange(url, lexicalFrame->loader()->outgoingReferrer(), !lexicalFrame->script()->anyPageIsProcessingUserGesture(), false, processingUserGesture(exec));
}
}
......@@ -781,7 +781,7 @@ static Frame* createWindow(ExecState* exec, Frame* lexicalFrame, Frame* dynamicF
if (created)
newFrame->loader()->changeLocation(completedURL, referrer, false, false, userGesture);
else if (!url.isEmpty())
newFrame->loader()->scheduleLocationChange(completedURL.string(), referrer, !lexicalFrame->script()->anyPageIsProcessingUserGesture(), false, userGesture);
newFrame->redirectScheduler()->scheduleLocationChange(completedURL.string(), referrer, !lexicalFrame->script()->anyPageIsProcessingUserGesture(), false, userGesture);
}
return newFrame;
......@@ -838,7 +838,7 @@ JSValue JSDOMWindow::open(ExecState* exec, const ArgList& args)
// here.
String referrer = dynamicFrame->loader()->outgoingReferrer();
frame->loader()->scheduleLocationChange(completedURL, referrer, !lexicalFrame->script()->anyPageIsProcessingUserGesture(), false, userGesture);
frame->redirectScheduler()->scheduleLocationChange(completedURL, referrer, !lexicalFrame->script()->anyPageIsProcessingUserGesture(), false, userGesture);
}
return toJS(exec, frame->domWindow());
}
......
......@@ -88,7 +88,7 @@ void JSDocument::setLocation(ExecState* exec, JSValue value)
str = activeFrame->document()->completeURL(str).string();
bool userGesture = activeFrame->script()->processingUserGesture();
frame->loader()->scheduleLocationChange(str, activeFrame->loader()->outgoingReferrer(), !activeFrame->script()->anyPageIsProcessingUserGesture(), false, userGesture);
frame->redirectScheduler()->scheduleLocationChange(str, activeFrame->loader()->outgoingReferrer(), !activeFrame->script()->anyPageIsProcessingUserGesture(), false, userGesture);
}
JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, Document* document)
......
......@@ -196,7 +196,7 @@ static void navigateIfAllowed(ExecState* exec, Frame* frame, const KURL& url, bo
return;
if (!protocolIsJavaScript(url) || allowsAccessFromFrame(exec, frame))
frame->loader()->scheduleLocationChange(url.string(), lexicalFrame->loader()->outgoingReferrer(), lockHistory, lockBackForwardList, processingUserGesture(exec));
frame->redirectScheduler()->scheduleLocationChange(url.string(), lexicalFrame->loader()->outgoingReferrer(), lockHistory, lockBackForwardList, processingUserGesture(exec));
}
void JSLocation::setHref(ExecState* exec, JSValue value)
......@@ -326,7 +326,7 @@ JSValue JSLocation::reload(ExecState* exec, const ArgList&)
return jsUndefined();
if (!protocolIsJavaScript(frame->loader()->url()))
frame->loader()->scheduleRefresh(processingUserGesture(exec));
frame->redirectScheduler()->scheduleRefresh(processingUserGesture(exec));
return jsUndefined();
}
......
......@@ -105,7 +105,7 @@ void navigateIfAllowed(Frame* frame, const KURL& url, bool lockHistory, bool loc
return;
if (!protocolIsJavaScript(url) || ScriptController::isSafeScript(frame))
frame->loader()->scheduleLocationChange(url.string(), callingFrame->loader()->outgoingReferrer(), lockHistory, lockBackForwardList, processingUserGesture());
frame->redirectScheduler()->scheduleLocationChange(url.string(), callingFrame->loader()->outgoingReferrer(), lockHistory, lockBackForwardList, processingUserGesture());
}
ScriptExecutionContext* getScriptExecutionContext(ScriptState* scriptState)
......
......@@ -515,7 +515,7 @@ static Frame* createWindow(Frame* callingFrame,
if (created)
newFrame->loader()->changeLocation(completedUrl, referrer, false, false, userGesture);
else if (!url.isEmpty())
newFrame->loader()->scheduleLocationChange(completedUrl.string(), referrer, false, userGesture);
newFrame->redirectScheduler()->scheduleLocationChange(completedUrl.string(), referrer, false, userGesture);
}
return newFrame;
......@@ -673,7 +673,7 @@ CALLBACK_FUNC_DECL(DOMWindowOpen)
// the outgoingReferrer. We replicate that behavior here.
String referrer = enteredFrame->loader()->outgoingReferrer();
frame->loader()->scheduleLocationChange(completedUrl, referrer, false, userGesture);
frame->redirectScheduler()->scheduleLocationChange(completedUrl, referrer, false, userGesture);
}
return V8DOMWrapper::convertToV8Object(V8ClassIndex::DOMWINDOW, frame->domWindow());
}
......
......@@ -274,7 +274,7 @@ CALLBACK_FUNC_DECL(LocationReload)
return v8::Undefined();
if (!protocolIsJavaScript(frame->loader()->url()))
frame->loader()->scheduleRefresh(processingUserGesture());
frame->redirectScheduler()->scheduleRefresh(processingUserGesture());
return v8::Undefined();
}
......
......@@ -1664,7 +1664,7 @@ void Document::implicitClose()
return;
}
bool wasLocationChangePending = frame() && frame()->loader()->isScheduledLocationChangePending();
bool wasLocationChangePending = frame() && frame()->redirectScheduler()->locationChangePending();
bool doload = !parsing() && m_tokenizer && !m_processingLoadEvent && !wasLocationChangePending;
if (!doload)
......@@ -1731,7 +1731,7 @@ void Document::implicitClose()
// fires. This will improve onload scores, and other browsers do it.
// If they wanna cheat, we can too. -dwh
if (frame()->loader()->isScheduledLocationChangePending() && elapsedTime() < cLayoutScheduleThreshold) {
if (frame()->redirectScheduler()->locationChangePending() && elapsedTime() < cLayoutScheduleThreshold) {
// Just bail out. Before or during the onload we were shifted to another page.
// The old i-Bench suite does this. When this happens don't bother painting or laying out.
view()->unscheduleRelayout();
......@@ -2160,7 +2160,7 @@ void Document::processHttpEquiv(const String& equiv, const String& content)
url = frame->loader()->url().string();
else
url = completeURL(url).string();
frame->loader()->scheduleHTTPRedirection(delay, url);
frame->redirectScheduler()->scheduleRedirect(delay, url);
}
} else if (equalIgnoringCase(equiv, "set-cookie")) {
// FIXME: make setCookie work on XML documents too; e.g. in case of <html:meta .....>
......@@ -2174,7 +2174,7 @@ void Document::processHttpEquiv(const String& equiv, const String& content)
FrameLoader* frameLoader = frame->loader();
if (frameLoader->shouldInterruptLoadForXFrameOptions(content, url())) {
frameLoader->stopAllLoaders();
frameLoader->scheduleLocationChange(blankURL(), String());
frame->redirectScheduler()->scheduleLocationChange(blankURL(), String());
}
}
}
......
......@@ -1673,7 +1673,7 @@ void HTMLTokenizer::write(const SegmentedString& str, bool appendData)
State state = m_state;
while (!m_src.isEmpty() && (!frame || !frame->loader()->isScheduledLocationChangePending())) {
while (!m_src.isEmpty() && (!frame || !frame->redirectScheduler()->locationChangePending())) {
if (!continueProcessing(processedCount, startTime, state))
break;
......
......@@ -460,7 +460,7 @@ bool FrameLoader::requestFrame(HTMLFrameOwnerElement* ownerElement, const String
Frame* frame = ownerElement->contentFrame();
if (frame)
frame->loader()->scheduleLocationChange(url.string(), m_outgoingReferrer, true, true, isProcessingUserGesture());
frame->redirectScheduler()->scheduleLocationChange(url.string(), m_outgoingReferrer, true, true, isProcessingUserGesture());
else
frame = loadSubframe(ownerElement, url, frameName, m_outgoingReferrer);
......@@ -595,7 +595,7 @@ void FrameLoader::submitForm(const char* action, const String& url, PassRefPtr<F
frameRequest.resourceRequest().setURL(u);
addHTTPOriginIfNeeded(frameRequest.resourceRequest(), outgoingOrigin());
targetFrame->loader()->scheduleFormSubmission(frameRequest, lockHistory, event, formState);
targetFrame->redirectScheduler()->scheduleFormSubmission(frameRequest, lockHistory, event, formState);
}
void FrameLoader::stopLoading(UnloadEventPolicy unloadEventPolicy, DatabasePolicy databasePolicy)
......@@ -906,7 +906,7 @@ void FrameLoader::receivedFirstData()
else
url = m_frame->document()->completeURL(url).string();
scheduleHTTPRedirection(delay, url);
m_frame->redirectScheduler()->scheduleRedirect(delay, url);
}
const String& FrameLoader::responseMIMEType() const
......@@ -1374,16 +1374,6 @@ KURL FrameLoader::completeURL(const String& url)
return m_frame->document()->completeURL(url);
}
bool FrameLoader::isScheduledLocationChangePending() const
{
return m_frame->redirectScheduler()->locationChangePending();
}
void FrameLoader::scheduleHTTPRedirection(double delay, const String& url)
{
m_frame->redirectScheduler()->scheduleRedirect(delay, url);
}
void RedirectScheduler::scheduleRedirect(double delay, const String& url)
{
if (delay < 0 || delay > INT_MAX / 1000)
......@@ -1414,11 +1404,6 @@ bool RedirectScheduler::mustLockBackForwardList(Frame* targetFrame)
return false;
}
void FrameLoader::scheduleLocationChange(const String& url, const String& referrer, bool lockHistory, bool lockBackForwardList, bool wasUserGesture)
{
m_frame->redirectScheduler()->scheduleLocationChange(url, referrer, lockHistory, lockBackForwardList, wasUserGesture);
}
void RedirectScheduler::scheduleLocationChange(const String& url, const String& referrer, bool lockHistory, bool lockBackForwardList, bool wasUserGesture)
{
if (!m_frame->page())
......@@ -1446,12 +1431,6 @@ void RedirectScheduler::scheduleLocationChange(const String& url, const String&
schedule(new ScheduledRedirection(url, referrer, lockHistory, lockBackForwardList, wasUserGesture, false, duringLoad));
}
void FrameLoader::scheduleFormSubmission(const FrameLoadRequest& frameRequest,
bool lockHistory, PassRefPtr<Event> event, PassRefPtr<FormState> formState)
{
m_frame->redirectScheduler()->scheduleFormSubmission(frameRequest, lockHistory, event, formState);
}
void RedirectScheduler::scheduleFormSubmission(const FrameLoadRequest& frameRequest,
bool lockHistory, PassRefPtr<Event> event, PassRefPtr<FormState> formState)
{
......@@ -1468,11 +1447,6 @@ void RedirectScheduler::scheduleFormSubmission(const FrameLoadRequest& frameRequ
schedule(new ScheduledRedirection(frameRequest, lockHistory, mustLockBackForwardList(m_frame), event, formState, duringLoad));
}
void FrameLoader::scheduleRefresh(bool wasUserGesture)
{
m_frame->redirectScheduler()->scheduleRefresh(wasUserGesture);
}
void RedirectScheduler::scheduleRefresh(bool wasUserGesture)
{
if (!m_frame->page())
......@@ -1503,11 +1477,6 @@ bool RedirectScheduler::locationChangePending()
return false;
}
void FrameLoader::scheduleHistoryNavigation(int steps)
{
m_frame->redirectScheduler()->scheduleHistoryNavigation(steps);
}
void RedirectScheduler::scheduleHistoryNavigation(int steps)
{
if (!m_frame->page())
......
......@@ -121,9 +121,9 @@ namespace WebCore {
bool locationChangePending();
void scheduleRedirect(double delay, const String& url);
void scheduleLocationChange(const String& url, const String& referrer, bool lockHistory, bool lockBackForwardList, bool wasUserGesture);
void scheduleLocationChange(const String& url, const String& referrer, bool lockHistory = true, bool lockBackForwardList = true, bool userGesture = false);
void scheduleFormSubmission(const FrameLoadRequest&, bool lockHistory, PassRefPtr<Event>, PassRefPtr<FormState>);
void scheduleRefresh(bool wasUserGesture);
void scheduleRefresh(bool userGesture = false);
void scheduleHistoryNavigation(int steps);
void startTimer();
......@@ -302,12 +302,6 @@ namespace WebCore {
KURL baseURL() const;
bool isScheduledLocationChangePending() const;
void scheduleHTTPRedirection(double delay, const String& url);
void scheduleLocationChange(const String& url, const String& referrer, bool lockHistory = true, bool lockBackForwardList = true, bool userGesture = false);
void scheduleRefresh(bool userGesture = false);
void scheduleHistoryNavigation(int steps);
bool canGoBackOrForward(int distance) const;
void goBackOrForward(int distance);
int getHistoryLength();
......@@ -524,8 +518,6 @@ namespace WebCore {
void dispatchDidReceiveContentLength(DocumentLoader*, unsigned long identifier, int length);
void dispatchDidFinishLoading(DocumentLoader*, unsigned long identifier);
void scheduleFormSubmission(const FrameLoadRequest&, bool lockHistory, PassRefPtr<Event>, PassRefPtr<FormState>);
void loadWithDocumentLoader(DocumentLoader*, FrameLoadType, PassRefPtr<FormState>); // Calls continueLoadAfterNavigationPolicy
void load(DocumentLoader*); // Calls loadWithDocumentLoader
......
......@@ -158,7 +158,7 @@ void ApplicationCacheGroup::selectCache(Frame* frame, const KURL& passedManifest
// Restart the current navigation from the top of the navigation algorithm, undoing any changes that were made
// as part of the initial load.
// The navigation will not result in the same resource being loaded, because "foreign" entries are never picked during navigation.
frame->loader()->scheduleLocationChange(documentLoader->url(), frame->loader()->referrer(), true);
frame->redirectScheduler()->scheduleLocationChange(documentLoader->url(), frame->loader()->referrer(), true);
}
return;
......
......@@ -57,21 +57,21 @@ void History::back()
{
if (!m_frame)
return;
m_frame->loader()->scheduleHistoryNavigation(-1);
m_frame->redirectScheduler()->scheduleHistoryNavigation(-1);
}
void History::forward()
{
if (!m_frame)
return;
m_frame->loader()->scheduleHistoryNavigation(1);
m_frame->redirectScheduler()->scheduleHistoryNavigation(1);
}
void History::go(int distance)
{
if (!m_frame)
return;
m_frame->loader()->scheduleHistoryNavigation(distance);
m_frame->redirectScheduler()->scheduleHistoryNavigation(distance);
}
} // namespace WebCore
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment