summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/WebCore/loader
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/webkit/WebCore/loader')
-rw-r--r--src/3rdparty/webkit/WebCore/loader/CachedResourceHandle.h15
-rw-r--r--src/3rdparty/webkit/WebCore/loader/EmptyClients.h2
-rw-r--r--src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp193
-rw-r--r--src/3rdparty/webkit/WebCore/loader/FrameLoader.h16
-rw-r--r--src/3rdparty/webkit/WebCore/loader/ImageDocument.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheGroup.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheHost.cpp9
-rw-r--r--src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheHost.h2
-rw-r--r--src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.cpp94
-rw-r--r--src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.h58
-rw-r--r--src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.idl2
11 files changed, 170 insertions, 229 deletions
diff --git a/src/3rdparty/webkit/WebCore/loader/CachedResourceHandle.h b/src/3rdparty/webkit/WebCore/loader/CachedResourceHandle.h
index 13c03c7..feb59b9 100644
--- a/src/3rdparty/webkit/WebCore/loader/CachedResourceHandle.h
+++ b/src/3rdparty/webkit/WebCore/loader/CachedResourceHandle.h
@@ -38,7 +38,8 @@ namespace WebCore {
bool operator!() const { return !m_resource; }
// This conversion operator allows implicit conversion to bool but not to other integer types.
- typedef CachedResource* CachedResourceHandleBase::*UnspecifiedBoolType;
+ // Parenthesis is needed for winscw compiler to resolve class qualifier in this case.
+ typedef CachedResource* (CachedResourceHandleBase::*UnspecifiedBoolType);
operator UnspecifiedBoolType() const { return m_resource ? &CachedResourceHandleBase::m_resource : 0; }
protected:
@@ -59,7 +60,7 @@ namespace WebCore {
template <class R> class CachedResourceHandle : public CachedResourceHandleBase {
public:
CachedResourceHandle() { }
- CachedResourceHandle(R* res) : CachedResourceHandleBase(res) { }
+ CachedResourceHandle(R* res);
CachedResourceHandle(const CachedResourceHandle<R>& o) : CachedResourceHandleBase(o) { }
R* get() const { return reinterpret_cast<R*>(CachedResourceHandleBase::get()); }
@@ -70,6 +71,16 @@ namespace WebCore {
bool operator==(const CachedResourceHandleBase& o) const { return get() == o.get(); }
bool operator!=(const CachedResourceHandleBase& o) const { return get() != o.get(); }
};
+
+ // Don't inline for winscw compiler to prevent the compiler agressively resolving
+ // the base class of R* when CachedResourceHandler<T>(R*) is inlined.
+ template <class R>
+#if !COMPILER(WINSCW)
+ inline
+#endif
+ CachedResourceHandle<R>::CachedResourceHandle(R* res) : CachedResourceHandleBase(res)
+ {
+ }
template <class R, class RR> bool operator==(const CachedResourceHandle<R>& h, const RR* res)
{
diff --git a/src/3rdparty/webkit/WebCore/loader/EmptyClients.h b/src/3rdparty/webkit/WebCore/loader/EmptyClients.h
index 4172c06..41b6ebc 100644
--- a/src/3rdparty/webkit/WebCore/loader/EmptyClients.h
+++ b/src/3rdparty/webkit/WebCore/loader/EmptyClients.h
@@ -120,7 +120,7 @@ public:
virtual void scroll(const IntSize&, const IntRect&, const IntRect&) { }
virtual IntPoint screenToWindow(const IntPoint& p) const { return p; }
virtual IntRect windowToScreen(const IntRect& r) const { return r; }
- virtual PlatformWidget platformWindow() const { return 0; }
+ virtual PlatformPageClient platformPageClient() const { return 0; }
virtual void contentsSizeChanged(Frame*, const IntSize&) const { }
virtual void scrollbarsModeDidChange() const { }
diff --git a/src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp b/src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp
index 4321be0..807edef 100644
--- a/src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp
+++ b/src/3rdparty/webkit/WebCore/loader/FrameLoader.cpp
@@ -71,6 +71,7 @@
#include "Page.h"
#include "PageCache.h"
#include "PageGroup.h"
+#include "PageTransitionEvent.h"
#include "PlaceholderDocument.h"
#include "PluginData.h"
#include "PluginDocument.h"
@@ -138,6 +139,7 @@ struct ScheduledRedirection {
const bool wasUserGesture;
const bool wasRefresh;
const bool wasDuringLoad;
+ bool toldClient;
ScheduledRedirection(double delay, const String& url, bool lockHistory, bool lockBackForwardList, bool wasUserGesture, bool refresh)
: type(redirection)
@@ -149,6 +151,7 @@ struct ScheduledRedirection {
, wasUserGesture(wasUserGesture)
, wasRefresh(refresh)
, wasDuringLoad(false)
+ , toldClient(false)
{
ASSERT(!url.isEmpty());
}
@@ -164,6 +167,7 @@ struct ScheduledRedirection {
, wasUserGesture(wasUserGesture)
, wasRefresh(refresh)
, wasDuringLoad(duringLoad)
+ , toldClient(false)
{
ASSERT(!url.isEmpty());
}
@@ -177,6 +181,7 @@ struct ScheduledRedirection {
, wasUserGesture(false)
, wasRefresh(false)
, wasDuringLoad(false)
+ , toldClient(false)
{
}
@@ -194,6 +199,7 @@ struct ScheduledRedirection {
, wasUserGesture(false)
, wasRefresh(false)
, wasDuringLoad(duringLoad)
+ , toldClient(false)
{
ASSERT(!frameRequest.isEmpty());
ASSERT(this->formState);
@@ -267,8 +273,9 @@ FrameLoader::FrameLoader(Frame* frame, FrameLoaderClient* client)
, m_encodingWasChosenByUser(false)
, m_containsPlugIns(false)
, m_redirectionTimer(this, &FrameLoader::redirectionTimerFired)
- , m_checkCompletedTimer(this, &FrameLoader::checkCompletedTimerFired)
- , m_checkLoadCompleteTimer(this, &FrameLoader::checkLoadCompleteTimerFired)
+ , m_checkTimer(this, &FrameLoader::checkTimerFired)
+ , m_shouldCallCheckCompleted(false)
+ , m_shouldCallCheckLoadComplete(false)
, m_opener(0)
, m_openedByDOM(false)
, m_creatingInitialEmptyDocument(false)
@@ -318,6 +325,11 @@ void FrameLoader::setDefersLoading(bool defers)
m_provisionalDocumentLoader->setDefersLoading(defers);
if (m_policyDocumentLoader)
m_policyDocumentLoader->setDefersLoading(defers);
+
+ if (!defers) {
+ startRedirectionTimer();
+ startCheckCompleteTimer();
+ }
}
Frame* FrameLoader::createWindow(FrameLoader* frameLoaderForFrameLookup, const FrameLoadRequest& request, const WindowFeatures& features, bool& created)
@@ -581,9 +593,9 @@ void FrameLoader::stopLoading(UnloadEventPolicy unloadEventPolicy, DatabasePolic
m_unloadEventBeingDispatched = true;
if (m_frame->domWindow()) {
if (unloadEventPolicy == UnloadEventPolicyUnloadAndPageHide)
- m_frame->domWindow()->dispatchPageTransitionEvent(EventNames().pagehideEvent, m_frame->document()->inPageCache());
+ m_frame->domWindow()->dispatchEvent(PageTransitionEvent::create(EventNames().pagehideEvent, m_frame->document()->inPageCache()), m_frame->document());
if (!m_frame->document()->inPageCache())
- m_frame->domWindow()->dispatchUnloadEvent();
+ m_frame->domWindow()->dispatchEvent(Event::create(eventNames().unloadEvent, false, false), m_frame->domWindow()->document());
}
m_unloadEventBeingDispatched = false;
if (m_frame->document())
@@ -597,7 +609,7 @@ void FrameLoader::stopLoading(UnloadEventPolicy unloadEventPolicy, DatabasePolic
m_frame->document()->removeAllEventListeners();
}
- m_isComplete = true; // to avoid calling completed() in finishedParsing() (David)
+ m_isComplete = true; // to avoid calling completed() in finishedParsing()
m_isLoadingMainResource = false;
m_didCallImplicitClose = true; // don't want that one either
@@ -656,8 +668,6 @@ void FrameLoader::cancelRedirection(bool cancelWithLoadInProgress)
m_cancellingWithLoadInProgress = cancelWithLoadInProgress;
stopRedirectionTimer();
-
- m_scheduledRedirection.clear();
}
KURL FrameLoader::iconURL()
@@ -743,8 +753,10 @@ bool FrameLoader::executeIfJavaScriptURL(const KURL& url, bool userGesture, bool
const int javascriptSchemeLength = sizeof("javascript:") - 1;
- String script = decodeURLEscapeSequences(url.string().substring(javascriptSchemeLength));
- ScriptValue result = executeScript(script, userGesture);
+ String script = url.string().substring(javascriptSchemeLength);
+ ScriptValue result;
+ if (m_frame->script()->xssAuditor()->canEvaluateJavaScriptURL(script))
+ result = executeScript(decodeURLEscapeSequences(script), userGesture);
String scriptResult;
if (!result.getString(scriptResult))
@@ -844,8 +856,9 @@ void FrameLoader::clear(bool clearWindowProperties, bool clearScriptObjects, boo
m_redirectionTimer.stop();
m_scheduledRedirection.clear();
- m_checkCompletedTimer.stop();
- m_checkLoadCompleteTimer.stop();
+ m_checkTimer.stop();
+ m_shouldCallCheckCompleted = false;
+ m_shouldCallCheckLoadComplete = false;
m_receivedData = false;
m_isDisplayingInitialEmptyDocument = false;
@@ -1238,15 +1251,34 @@ void FrameLoader::loadDone()
checkCompleted();
}
+bool FrameLoader::allChildrenAreComplete() const
+{
+ for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling()) {
+ if (!child->loader()->m_isComplete)
+ return false;
+ }
+ return true;
+}
+
+bool FrameLoader::allAncestorsAreComplete() const
+{
+ for (Frame* ancestor = m_frame; ancestor; ancestor = ancestor->tree()->parent()) {
+ if (!ancestor->loader()->m_isComplete)
+ return false;
+ }
+ return true;
+}
+
void FrameLoader::checkCompleted()
{
+ m_shouldCallCheckCompleted = false;
+
if (m_frame->view())
m_frame->view()->checkStopDelayingDeferredRepaints();
// Any frame that hasn't completed yet?
- for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling())
- if (!child->loader()->m_isComplete)
- return;
+ if (!allChildrenAreComplete())
+ return;
// Have we completed before?
if (m_isComplete)
@@ -1266,38 +1298,44 @@ void FrameLoader::checkCompleted()
RefPtr<Frame> protect(m_frame);
checkCallImplicitClose(); // if we didn't do it before
- // Do not start a redirection timer for subframes here.
- // That is deferred until the parent is completed.
- if (m_scheduledRedirection && !m_frame->tree()->parent())
- startRedirectionTimer();
+ startRedirectionTimer();
completed();
if (m_frame->page())
checkLoadComplete();
}
-void FrameLoader::checkCompletedTimerFired(Timer<FrameLoader>*)
+void FrameLoader::checkTimerFired(Timer<FrameLoader>*)
{
- checkCompleted();
+ if (Page* page = m_frame->page()) {
+ if (page->defersLoading())
+ return;
+ }
+ if (m_shouldCallCheckCompleted)
+ checkCompleted();
+ if (m_shouldCallCheckLoadComplete)
+ checkLoadComplete();
}
-void FrameLoader::scheduleCheckCompleted()
+void FrameLoader::startCheckCompleteTimer()
{
- if (!m_checkCompletedTimer.isActive())
- m_checkCompletedTimer.startOneShot(0);
+ if (!(m_shouldCallCheckCompleted || m_shouldCallCheckLoadComplete))
+ return;
+ if (m_checkTimer.isActive())
+ return;
+ m_checkTimer.startOneShot(0);
}
-void FrameLoader::checkLoadCompleteTimerFired(Timer<FrameLoader>*)
+void FrameLoader::scheduleCheckCompleted()
{
- if (!m_frame->page())
- return;
- checkLoadComplete();
+ m_shouldCallCheckCompleted = true;
+ startCheckCompleteTimer();
}
void FrameLoader::scheduleCheckLoadComplete()
{
- if (!m_checkLoadCompleteTimer.isActive())
- m_checkLoadCompleteTimer.startOneShot(0);
+ m_shouldCallCheckLoadComplete = true;
+ startCheckCompleteTimer();
}
void FrameLoader::checkCallImplicitClose()
@@ -1305,9 +1343,8 @@ void FrameLoader::checkCallImplicitClose()
if (m_didCallImplicitClose || m_frame->document()->parsing())
return;
- for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling())
- if (!child->loader()->m_isComplete) // still got a frame running -> too early
- return;
+ if (!allChildrenAreComplete())
+ return; // still got a frame running -> too early
m_didCallImplicitClose = true;
m_wasUnloadEventEmitted = false;
@@ -1427,12 +1464,6 @@ void FrameLoader::scheduleHistoryNavigation(int steps)
if (!m_frame->page())
return;
- // navigation will always be allowed in the 0 steps case, which is OK because that's supposed to force a reload.
- if (!canGoBackOrForward(steps)) {
- cancelRedirection();
- return;
- }
-
scheduleRedirection(new ScheduledRedirection(steps));
}
@@ -1470,6 +1501,9 @@ void FrameLoader::redirectionTimerFired(Timer<FrameLoader>*)
{
ASSERT(m_frame->page());
+ if (m_frame->page()->defersLoading())
+ return;
+
OwnPtr<ScheduledRedirection> redirection(m_scheduledRedirection.release());
switch (redirection->type) {
@@ -1486,7 +1520,8 @@ void FrameLoader::redirectionTimerFired(Timer<FrameLoader>*)
}
// go(i!=0) from a frame navigates into the history of the frame only,
// in both IE and NS (but not in Mozilla). We can't easily do that.
- goBackOrForward(redirection->historySteps);
+ if (canGoBackOrForward(redirection->historySteps))
+ goBackOrForward(redirection->historySteps);
return;
case ScheduledRedirection::formSubmission:
// The submitForm function will find a target frame before using the redirection timer.
@@ -1710,12 +1745,6 @@ bool FrameLoader::loadPlugin(RenderPart* renderer, const KURL& url, const String
return widget != 0;
}
-void FrameLoader::parentCompleted()
-{
- if (m_scheduledRedirection && !m_redirectionTimer.isActive())
- startRedirectionTimer();
-}
-
String FrameLoader::outgoingReferrer() const
{
return m_outgoingReferrer;
@@ -1854,7 +1883,7 @@ bool FrameLoader::canCachePageContainingThisFrame()
&& !m_containsPlugIns
&& !m_URL.protocolIs("https")
#ifndef PAGE_CACHE_ACCEPTS_UNLOAD_HANDLERS
- && (!m_frame->domWindow() || !m_frame->domWindow()->hasEventListener(eventNames().unloadEvent))
+ && (!m_frame->domWindow() || !m_frame->domWindow()->hasEventListeners(eventNames().unloadEvent))
#endif
#if ENABLE(DATABASE)
&& !m_frame->document()->hasOpenDatabases()
@@ -2001,7 +2030,7 @@ bool FrameLoader::logCanCacheFrameDecision(int indentLevel)
if (m_URL.protocolIs("https"))
{ PCLOG(" -Frame is HTTPS"); cannotCache = true; }
#ifndef PAGE_CACHE_ACCEPTS_UNLOAD_HANDLERS
- if (m_frame->domWindow() && m_frame->domWindow()->hasEventListener(eventNames().unloadEvent))
+ if (m_frame->domWindow() && m_frame->domWindow()->hasEventListeners(eventNames().unloadEvent))
{ PCLOG(" -Frame has an unload event listener"); cannotCache = true; }
#endif
#if ENABLE(DATABASE)
@@ -2068,7 +2097,7 @@ public:
virtual void performTask(ScriptExecutionContext* context)
{
ASSERT_UNUSED(context, context->isDocument());
- m_document->dispatchWindowEvent(eventNames().hashchangeEvent, false, false);
+ m_document->dispatchWindowEvent(Event::create(eventNames().hashchangeEvent, false, false));
}
private:
@@ -2110,7 +2139,7 @@ bool FrameLoader::isComplete() const
return m_isComplete;
}
-void FrameLoader::scheduleRedirection(ScheduledRedirection* redirection)
+void FrameLoader::scheduleRedirection(PassOwnPtr<ScheduledRedirection> redirection)
{
ASSERT(m_frame->page());
@@ -2124,24 +2153,33 @@ void FrameLoader::scheduleRedirection(ScheduledRedirection* redirection)
}
stopRedirectionTimer();
- m_scheduledRedirection.set(redirection);
- if (!m_isComplete && redirection->type != ScheduledRedirection::redirection)
+ m_scheduledRedirection = redirection;
+ if (!m_isComplete && m_scheduledRedirection->type != ScheduledRedirection::redirection)
completed();
- if (m_isComplete || redirection->type != ScheduledRedirection::redirection)
- startRedirectionTimer();
+ startRedirectionTimer();
}
void FrameLoader::startRedirectionTimer()
{
+ if (!m_scheduledRedirection)
+ return;
+
ASSERT(m_frame->page());
- ASSERT(m_scheduledRedirection);
- m_redirectionTimer.stop();
+ if (m_redirectionTimer.isActive())
+ return;
+
+ if (m_scheduledRedirection->type == ScheduledRedirection::redirection && !allAncestorsAreComplete())
+ return;
+
m_redirectionTimer.startOneShot(m_scheduledRedirection->delay);
switch (m_scheduledRedirection->type) {
case ScheduledRedirection::locationChange:
case ScheduledRedirection::redirection:
+ if (m_scheduledRedirection->toldClient)
+ return;
+ m_scheduledRedirection->toldClient = true;
clientRedirected(KURL(ParsedURLString, m_scheduledRedirection->url),
m_scheduledRedirection->delay,
currentTime() + m_redirectionTimer.nextFireInterval(),
@@ -2161,35 +2199,18 @@ void FrameLoader::startRedirectionTimer()
void FrameLoader::stopRedirectionTimer()
{
- if (!m_redirectionTimer.isActive())
- return;
-
m_redirectionTimer.stop();
- if (m_scheduledRedirection) {
- switch (m_scheduledRedirection->type) {
- case ScheduledRedirection::locationChange:
- case ScheduledRedirection::redirection:
- clientRedirectCancelledOrFinished(m_cancellingWithLoadInProgress);
- return;
- case ScheduledRedirection::formSubmission:
- // FIXME: It would make sense to report form submissions as client redirects too.
- // But we didn't do that in the past when form submission used a separate delay
- // mechanism, so doing it will be a behavior change.
- return;
- case ScheduledRedirection::historyNavigation:
- // Don't report history navigations.
- return;
- }
- ASSERT_NOT_REACHED();
- }
+ OwnPtr<ScheduledRedirection> redirection(m_scheduledRedirection.release());
+ if (redirection && redirection->toldClient)
+ clientRedirectCancelledOrFinished(m_cancellingWithLoadInProgress);
}
void FrameLoader::completed()
{
RefPtr<Frame> protect(m_frame);
for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling())
- child->loader()->parentCompleted();
+ child->loader()->startRedirectionTimer();
if (Frame* parent = m_frame->tree()->parent())
parent->loader()->checkCompleted();
if (m_frame->view())
@@ -2291,6 +2312,9 @@ void FrameLoader::loadFrameRequest(const FrameLoadRequest& request, bool lockHis
void FrameLoader::loadURL(const KURL& newURL, const String& referrer, const String& frameName, bool lockHistory, FrameLoadType newLoadType,
PassRefPtr<Event> event, PassRefPtr<FormState> prpFormState)
{
+ if (m_unloadEventBeingDispatched)
+ return;
+
RefPtr<FormState> formState = prpFormState;
bool isFormSubmission = formState;
@@ -2330,6 +2354,7 @@ void FrameLoader::loadURL(const KURL& newURL, const String& referrer, const Stri
if (shouldScrollToAnchor(isFormSubmission, newLoadType, newURL)) {
oldDocumentLoader->setTriggeringAction(action);
stopPolicyCheck();
+ m_policyLoadType = newLoadType;
checkNavigationPolicy(request, oldDocumentLoader.get(), formState.release(),
callContinueFragmentScrollAfterNavigationPolicy, this);
} else {
@@ -2434,6 +2459,9 @@ void FrameLoader::loadWithDocumentLoader(DocumentLoader* loader, FrameLoadType t
ASSERT(m_frame->view());
+ if (m_unloadEventBeingDispatched)
+ return;
+
m_policyLoadType = type;
RefPtr<FormState> formState = prpFormState;
bool isFormSubmission = formState;
@@ -2670,7 +2698,8 @@ bool FrameLoader::shouldAllowNavigation(Frame* targetFrame) const
//
// Or the target frame is:
// - a top-level frame in the frame hierarchy and the active frame can
- // navigate the target frame's opener per above.
+ // navigate the target frame's opener per above or it is the opener of
+ // the target frame.
if (!targetFrame)
return true;
@@ -2685,6 +2714,10 @@ bool FrameLoader::shouldAllowNavigation(Frame* targetFrame) const
if (targetFrame == m_frame->tree()->top())
return true;
+ // Let a frame navigate its opener if the opener is a top-level window.
+ if (!targetFrame->tree()->parent() && m_frame->loader()->opener() == targetFrame)
+ return true;
+
Document* activeDocument = m_frame->document();
ASSERT(activeDocument);
const SecurityOrigin* activeSecurityOrigin = activeDocument->securityOrigin();
@@ -2900,7 +2933,7 @@ void FrameLoader::commitProvisionalLoad(PassRefPtr<CachedPage> prpCachedPage)
m_frame->document()->documentDidBecomeActive();
// Force a layout to update view size and thereby update scrollbars.
- m_client->forceLayout();
+ m_frame->view()->forceLayout();
const ResponseVector& responses = m_documentLoader->responses();
size_t count = responses.size();
@@ -3554,6 +3587,8 @@ void FrameLoader::checkLoadComplete()
{
ASSERT(m_client->hasWebView());
+ m_shouldCallCheckLoadComplete = false;
+
// FIXME: Always traversing the entire frame tree is a bit inefficient, but
// is currently needed in order to null out the previous history item for all frames.
if (Page* page = m_frame->page())
@@ -4288,7 +4323,7 @@ void FrameLoader::pageHidden()
{
m_unloadEventBeingDispatched = true;
if (m_frame->domWindow())
- m_frame->domWindow()->dispatchPageTransitionEvent(EventNames().pagehideEvent, true);
+ m_frame->domWindow()->dispatchEvent(PageTransitionEvent::create(EventNames().pagehideEvent, true), m_frame->document());
m_unloadEventBeingDispatched = false;
// Send pagehide event for subframes as well
diff --git a/src/3rdparty/webkit/WebCore/loader/FrameLoader.h b/src/3rdparty/webkit/WebCore/loader/FrameLoader.h
index 26206e6..4b4959b 100644
--- a/src/3rdparty/webkit/WebCore/loader/FrameLoader.h
+++ b/src/3rdparty/webkit/WebCore/loader/FrameLoader.h
@@ -35,6 +35,7 @@
#include "ResourceRequest.h"
#include "ThreadableLoader.h"
#include "Timer.h"
+#include <wtf/Forward.h>
namespace WebCore {
@@ -411,15 +412,13 @@ namespace WebCore {
void updateHistoryForAnchorScroll();
void redirectionTimerFired(Timer<FrameLoader>*);
- void checkCompletedTimerFired(Timer<FrameLoader>*);
- void checkLoadCompleteTimerFired(Timer<FrameLoader>*);
+ void checkTimerFired(Timer<FrameLoader>*);
void cancelRedirection(bool newLoadInProgress = false);
void started();
void completed();
- void parentCompleted();
bool shouldUsePlugin(const KURL&, const String& mimeType, bool hasFallback, bool& useFallback);
bool loadPlugin(RenderPart*, const KURL&, const String& mimeType,
@@ -485,7 +484,7 @@ namespace WebCore {
bool shouldReloadToHandleUnreachableURL(DocumentLoader*);
void handleUnimplementablePolicy(const ResourceError&);
- void scheduleRedirection(ScheduledRedirection*);
+ void scheduleRedirection(PassOwnPtr<ScheduledRedirection>);
void startRedirectionTimer();
void stopRedirectionTimer();
@@ -538,6 +537,7 @@ namespace WebCore {
void scheduleCheckCompleted();
void scheduleCheckLoadComplete();
+ void startCheckCompleteTimer();
KURL originalRequestURL() const;
@@ -545,6 +545,9 @@ namespace WebCore {
void saveScrollPositionAndViewStateToItem(HistoryItem*);
+ bool allAncestorsAreComplete() const; // including this
+ bool allChildrenAreComplete() const; // immediate children, not all descendants
+
Frame* m_frame;
FrameLoaderClient* m_client;
@@ -609,8 +612,9 @@ namespace WebCore {
KURL m_submittedFormURL;
Timer<FrameLoader> m_redirectionTimer;
- Timer<FrameLoader> m_checkCompletedTimer;
- Timer<FrameLoader> m_checkLoadCompleteTimer;
+ Timer<FrameLoader> m_checkTimer;
+ bool m_shouldCallCheckCompleted;
+ bool m_shouldCallCheckLoadComplete;
Frame* m_opener;
HashSet<Frame*> m_openedFrames;
diff --git a/src/3rdparty/webkit/WebCore/loader/ImageDocument.cpp b/src/3rdparty/webkit/WebCore/loader/ImageDocument.cpp
index d2b1dd6..8078ccd 100644
--- a/src/3rdparty/webkit/WebCore/loader/ImageDocument.cpp
+++ b/src/3rdparty/webkit/WebCore/loader/ImageDocument.cpp
@@ -70,7 +70,7 @@ private:
{
}
- virtual void handleEvent(Event*, bool isWindowEvent);
+ virtual void handleEvent(Event*);
ImageDocument* m_doc;
};
@@ -358,7 +358,7 @@ bool ImageDocument::shouldShrinkToFit() const
// --------
-void ImageEventListener::handleEvent(Event* event, bool)
+void ImageEventListener::handleEvent(Event* event)
{
if (event->type() == eventNames().resizeEvent)
m_doc->windowSizeChanged();
diff --git a/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheGroup.cpp b/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheGroup.cpp
index d18dcf2..ed27ba0 100644
--- a/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheGroup.cpp
+++ b/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheGroup.cpp
@@ -774,7 +774,7 @@ void ApplicationCacheGroup::checkIfLoadIsComplete()
ASSERT(cacheStorage().isMaximumSizeReached() && m_calledReachedMaxAppCacheSize);
}
- RefPtr<ApplicationCache> oldNewestCache = (m_newestCache == m_cacheBeingUpdated) ? 0 : m_newestCache;
+ RefPtr<ApplicationCache> oldNewestCache = (m_newestCache == m_cacheBeingUpdated) ? RefPtr<ApplicationCache>(0) : m_newestCache;
setNewestCache(m_cacheBeingUpdated.release());
if (cacheStorage().storeNewestCache(this)) {
@@ -962,7 +962,7 @@ public:
ASSERT(frame->loader()->documentLoader() == m_documentLoader.get());
- m_documentLoader->applicationCacheHost()->notifyEventListener(m_eventID);
+ m_documentLoader->applicationCacheHost()->notifyDOMApplicationCache(m_eventID);
}
private:
diff --git a/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheHost.cpp b/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheHost.cpp
index 992f9e9..751efc1 100644
--- a/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheHost.cpp
+++ b/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheHost.cpp
@@ -227,10 +227,13 @@ void ApplicationCacheHost::setDOMApplicationCache(DOMApplicationCache* domApplic
m_domApplicationCache = domApplicationCache;
}
-void ApplicationCacheHost::notifyEventListener(EventID id)
+void ApplicationCacheHost::notifyDOMApplicationCache(EventID id)
{
- if (m_domApplicationCache)
- m_domApplicationCache->callEventListener(id);
+ if (m_domApplicationCache) {
+ ExceptionCode ec = 0;
+ m_domApplicationCache->dispatchEvent(Event::create(DOMApplicationCache::toEventType(id), false, false), ec);
+ ASSERT(!ec);
+ }
}
void ApplicationCacheHost::setCandidateApplicationCacheGroup(ApplicationCacheGroup* group)
diff --git a/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheHost.h b/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheHost.h
index cb68862..236013d 100644
--- a/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheHost.h
+++ b/src/3rdparty/webkit/WebCore/loader/appcache/ApplicationCacheHost.h
@@ -108,7 +108,7 @@ namespace WebCore {
bool swapCache();
void setDOMApplicationCache(DOMApplicationCache* domApplicationCache);
- void notifyEventListener(EventID id);
+ void notifyDOMApplicationCache(EventID id);
private:
bool isApplicationCacheEnabled();
diff --git a/src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.cpp b/src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.cpp
index dd0aed9..29c1bd5 100644
--- a/src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.cpp
+++ b/src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.cpp
@@ -91,73 +91,6 @@ ScriptExecutionContext* DOMApplicationCache::scriptExecutionContext() const
return m_frame->document();
}
-void DOMApplicationCache::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> eventListener, bool)
-{
- EventListenersMap::iterator iter = m_eventListeners.find(eventType);
- if (iter == m_eventListeners.end()) {
- ListenerVector listeners;
- listeners.append(eventListener);
- m_eventListeners.add(eventType, listeners);
- } else {
- ListenerVector& listeners = iter->second;
- for (ListenerVector::iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) {
- if (**listenerIter == *eventListener)
- return;
- }
-
- listeners.append(eventListener);
- m_eventListeners.add(eventType, listeners);
- }
-}
-
-void DOMApplicationCache::removeEventListener(const AtomicString& eventType, EventListener* eventListener, bool)
-{
- EventListenersMap::iterator iter = m_eventListeners.find(eventType);
- if (iter == m_eventListeners.end())
- return;
-
- ListenerVector& listeners = iter->second;
- for (ListenerVector::const_iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) {
- if (**listenerIter == *eventListener) {
- listeners.remove(listenerIter - listeners.begin());
- return;
- }
- }
-}
-
-bool DOMApplicationCache::dispatchEvent(PassRefPtr<Event> event, ExceptionCode& ec)
-{
- if (!event || event->type().isEmpty()) {
- ec = EventException::UNSPECIFIED_EVENT_TYPE_ERR;
- return true;
- }
-
- ListenerVector listenersCopy = m_eventListeners.get(event->type());
- for (ListenerVector::const_iterator listenerIter = listenersCopy.begin(); listenerIter != listenersCopy.end(); ++listenerIter) {
- event->setTarget(this);
- event->setCurrentTarget(this);
- listenerIter->get()->handleEvent(event.get(), false);
- }
-
- return !event->defaultPrevented();
-}
-
-void DOMApplicationCache::callListener(const AtomicString& eventType, EventListener* listener)
-{
- ASSERT(m_frame);
-
- RefPtr<Event> event = Event::create(eventType, false, false);
- if (listener) {
- event->setTarget(this);
- event->setCurrentTarget(this);
- listener->handleEvent(event.get(), false);
- }
-
- ExceptionCode ec = 0;
- dispatchEvent(event.release(), ec);
- ASSERT(!ec);
-}
-
const AtomicString& DOMApplicationCache::toEventType(ApplicationCacheHost::EventID id)
{
switch (id) {
@@ -182,27 +115,14 @@ const AtomicString& DOMApplicationCache::toEventType(ApplicationCacheHost::Event
return eventNames().errorEvent;
}
-ApplicationCacheHost::EventID DOMApplicationCache::toEventID(const AtomicString& eventType)
+EventTargetData* DOMApplicationCache::eventTargetData()
{
- if (eventType == eventNames().checkingEvent)
- return ApplicationCacheHost::CHECKING_EVENT;
- if (eventType == eventNames().errorEvent)
- return ApplicationCacheHost::ERROR_EVENT;
- if (eventType == eventNames().noupdateEvent)
- return ApplicationCacheHost::NOUPDATE_EVENT;
- if (eventType == eventNames().downloadingEvent)
- return ApplicationCacheHost::DOWNLOADING_EVENT;
- if (eventType == eventNames().progressEvent)
- return ApplicationCacheHost::PROGRESS_EVENT;
- if (eventType == eventNames().updatereadyEvent)
- return ApplicationCacheHost::UPDATEREADY_EVENT;
- if (eventType == eventNames().cachedEvent)
- return ApplicationCacheHost::CACHED_EVENT;
- if (eventType == eventNames().obsoleteEvent)
- return ApplicationCacheHost::OBSOLETE_EVENT;
-
- ASSERT_NOT_REACHED();
- return ApplicationCacheHost::ERROR_EVENT;
+ return &m_eventTargetData;
+}
+
+EventTargetData* DOMApplicationCache::ensureEventTargetData()
+{
+ return &m_eventTargetData;
}
} // namespace WebCore
diff --git a/src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.h b/src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.h
index 09e9a03..077cae0 100644
--- a/src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.h
+++ b/src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.h
@@ -30,8 +30,9 @@
#include "ApplicationCacheHost.h"
#include "AtomicStringHash.h"
-#include "EventTarget.h"
#include "EventListener.h"
+#include "EventNames.h"
+#include "EventTarget.h"
#include <wtf/HashMap.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
@@ -55,72 +56,39 @@ public:
void update(ExceptionCode&);
void swapCache(ExceptionCode&);
- // Event listener attributes by EventID
-
- void setAttributeEventListener(ApplicationCacheHost::EventID id, PassRefPtr<EventListener> eventListener) { m_attributeEventListeners[id] = eventListener; }
- EventListener* getAttributeEventListener(ApplicationCacheHost::EventID id) const { return m_attributeEventListeners[id].get(); }
- void clearAttributeEventListener(ApplicationCacheHost::EventID id) { m_attributeEventListeners[id] = 0; }
- void callEventListener(ApplicationCacheHost::EventID id) { callListener(toEventType(id), getAttributeEventListener(id)); }
-
// EventTarget impl
- virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture);
- virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture);
- virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&);
- typedef Vector<RefPtr<EventListener> > ListenerVector;
- typedef HashMap<AtomicString, ListenerVector> EventListenersMap;
- EventListenersMap& eventListeners() { return m_eventListeners; }
-
using RefCounted<DOMApplicationCache>::ref;
using RefCounted<DOMApplicationCache>::deref;
// Explicitly named attribute event listener helpers
- void setOnchecking(PassRefPtr<EventListener> listener) { setAttributeEventListener(ApplicationCacheHost::CHECKING_EVENT, listener); }
- EventListener* onchecking() const { return getAttributeEventListener(ApplicationCacheHost::CHECKING_EVENT); }
-
- void setOnerror(PassRefPtr<EventListener> listener) { setAttributeEventListener(ApplicationCacheHost::ERROR_EVENT, listener);}
- EventListener* onerror() const { return getAttributeEventListener(ApplicationCacheHost::ERROR_EVENT); }
-
- void setOnnoupdate(PassRefPtr<EventListener> listener) { setAttributeEventListener(ApplicationCacheHost::NOUPDATE_EVENT, listener); }
- EventListener* onnoupdate() const { return getAttributeEventListener(ApplicationCacheHost::NOUPDATE_EVENT); }
-
- void setOndownloading(PassRefPtr<EventListener> listener) { setAttributeEventListener(ApplicationCacheHost::DOWNLOADING_EVENT, listener); }
- EventListener* ondownloading() const { return getAttributeEventListener(ApplicationCacheHost::DOWNLOADING_EVENT); }
-
- void setOnprogress(PassRefPtr<EventListener> listener) { setAttributeEventListener(ApplicationCacheHost::PROGRESS_EVENT, listener); }
- EventListener* onprogress() const { return getAttributeEventListener(ApplicationCacheHost::PROGRESS_EVENT); }
-
- void setOnupdateready(PassRefPtr<EventListener> listener) { setAttributeEventListener(ApplicationCacheHost::UPDATEREADY_EVENT, listener); }
- EventListener* onupdateready() const { return getAttributeEventListener(ApplicationCacheHost::UPDATEREADY_EVENT); }
-
- void setOncached(PassRefPtr<EventListener> listener) { setAttributeEventListener(ApplicationCacheHost::CACHED_EVENT, listener); }
- EventListener* oncached() const { return getAttributeEventListener(ApplicationCacheHost::CACHED_EVENT); }
-
- void setOnobsolete(PassRefPtr<EventListener> listener) { setAttributeEventListener(ApplicationCacheHost::OBSOLETE_EVENT, listener); }
- EventListener* onobsolete() const { return getAttributeEventListener(ApplicationCacheHost::OBSOLETE_EVENT); }
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(checking);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(noupdate);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(downloading);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(progress);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(updateready);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(cached);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(obsolete);
virtual ScriptExecutionContext* scriptExecutionContext() const;
DOMApplicationCache* toDOMApplicationCache() { return this; }
static const AtomicString& toEventType(ApplicationCacheHost::EventID id);
- static ApplicationCacheHost::EventID toEventID(const AtomicString& eventType);
private:
DOMApplicationCache(Frame*);
- void callListener(const AtomicString& eventType, EventListener*);
-
virtual void refEventTarget() { ref(); }
virtual void derefEventTarget() { deref(); }
+ virtual EventTargetData* eventTargetData();
+ virtual EventTargetData* ensureEventTargetData();
ApplicationCacheHost* applicationCacheHost() const;
-
- RefPtr<EventListener> m_attributeEventListeners[ApplicationCacheHost::OBSOLETE_EVENT + 1];
-
- EventListenersMap m_eventListeners;
Frame* m_frame;
+ EventTargetData m_eventTargetData;
};
} // namespace WebCore
diff --git a/src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.idl b/src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.idl
index ebc1d19..dd5468a 100644
--- a/src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.idl
+++ b/src/3rdparty/webkit/WebCore/loader/appcache/DOMApplicationCache.idl
@@ -27,7 +27,7 @@ module offline {
interface [
Conditional=OFFLINE_WEB_APPLICATIONS,
- CustomMarkFunction
+ EventTarget
] DOMApplicationCache {
// update status
const unsigned short UNCACHED = 0;