Diff
Modified: trunk/LayoutTests/ChangeLog (118630 => 118631)
--- trunk/LayoutTests/ChangeLog 2012-05-27 19:51:10 UTC (rev 118630)
+++ trunk/LayoutTests/ChangeLog 2012-05-27 21:31:54 UTC (rev 118631)
@@ -1,3 +1,15 @@
+2012-05-27 Benjamin Poulain <[email protected]>
+
+ When pages are loaded from AppCache with DeferredLoading, willSendRequest() is never called
+ https://bugs.webkit.org/show_bug.cgi?id=87582
+
+ Reviewed by Darin Adler.
+
+ * http/tests/appcache/load-from-appcache-defer-resume-crash-expected.txt: Added.
+ * http/tests/appcache/load-from-appcache-defer-resume-crash.html: Added.
+ * http/tests/appcache/resources/load-from-appcache-defer-resume-bounce-back.html: Added.
+ * http/tests/appcache/resources/load-from-appcache-defer-resume-crash.manifest: Added.
+
2012-05-27 Zan Dobersek <[email protected]>
Unreviewed GTK gardening after r118618.
Added: trunk/LayoutTests/http/tests/appcache/load-from-appcache-defer-resume-crash-expected.txt (0 => 118631)
--- trunk/LayoutTests/http/tests/appcache/load-from-appcache-defer-resume-crash-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/appcache/load-from-appcache-defer-resume-crash-expected.txt 2012-05-27 21:31:54 UTC (rev 118631)
@@ -0,0 +1,3 @@
+This test loading the document itself with Application Cache, and deferred load, does not crash WebKit. The most reliable way to reproduce is in Debug where you hit assertions.
+
+SUCCESS
Added: trunk/LayoutTests/http/tests/appcache/load-from-appcache-defer-resume-crash.html (0 => 118631)
--- trunk/LayoutTests/http/tests/appcache/load-from-appcache-defer-resume-crash.html (rev 0)
+++ trunk/LayoutTests/http/tests/appcache/load-from-appcache-defer-resume-crash.html 2012-05-27 21:31:54 UTC (rev 118631)
@@ -0,0 +1,27 @@
+<html manifest="resources/load-from-appcache-defer-resume-crash.manifest">
+<head>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.setUseDeferredFrameLoading(true)
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+function finishIfNeeded() {
+ if (window.location.hash) {
+ document.getElementById('result').innerText = "SUCCESS";
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ }
+}
+function run() {
+ window.location = "resources/load-from-appcache-defer-resume-bounce-back.html";
+}
+applicationCache.addEventListener('cached', run, false);
+</script>
+</head>
+<body _onload_="finishIfNeeded()">
+<p>This test loading the document itself with Application Cache, and deferred load, does not crash WebKit. The most reliable way to reproduce is in Debug where you hit assertions.</p>
+<div id="result">
+</div>
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/appcache/resources/load-from-appcache-defer-resume-bounce-back.html (0 => 118631)
--- trunk/LayoutTests/http/tests/appcache/resources/load-from-appcache-defer-resume-bounce-back.html (rev 0)
+++ trunk/LayoutTests/http/tests/appcache/resources/load-from-appcache-defer-resume-bounce-back.html 2012-05-27 21:31:54 UTC (rev 118631)
@@ -0,0 +1,8 @@
+<html>
+<head>
+<meta http-equiv="refresh" content="0; url=""
+</head>
+<body>
+<p>The goal of this page is to cause the cached document to be loaded as the main document of the view.</p>
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/appcache/resources/load-from-appcache-defer-resume-crash.manifest (0 => 118631)
--- trunk/LayoutTests/http/tests/appcache/resources/load-from-appcache-defer-resume-crash.manifest (rev 0)
+++ trunk/LayoutTests/http/tests/appcache/resources/load-from-appcache-defer-resume-crash.manifest 2012-05-27 21:31:54 UTC (rev 118631)
@@ -0,0 +1,2 @@
+CACHE MANIFEST
+
Modified: trunk/Source/WebCore/ChangeLog (118630 => 118631)
--- trunk/Source/WebCore/ChangeLog 2012-05-27 19:51:10 UTC (rev 118630)
+++ trunk/Source/WebCore/ChangeLog 2012-05-27 21:31:54 UTC (rev 118631)
@@ -1,3 +1,32 @@
+2012-05-27 Benjamin Poulain <[email protected]>
+
+ When pages are loaded from AppCache with DeferredLoading, willSendRequest() is never called
+ https://bugs.webkit.org/show_bug.cgi?id=87582
+
+ Reviewed by Darin Adler.
+
+ Previously, there was a shortcut when a deferred MainResourceLoader is resumed: If the data
+ was coming from AppCache we could jump directly to startDataLoadTimer().
+
+ The problem with the shortcut is willSendRequest() is never called in that particular case
+ (substituteData + deferred-resume). The imbalance between willSendRequest() and didReceiveResponse()
+ causes problems.
+
+ This patch removes the shortcut so that MainResourceLoader::loadNow() is used regardless of
+ the deferred loading. The method MainResourceLoader::loadNow() handle the substituteData as if the loading
+ was not deferred.
+
+ Test: http/tests/appcache/load-from-appcache-defer-resume-crash.html
+
+ * loader/MainResourceLoader.cpp:
+ (WebCore::MainResourceLoader::continueAfterNavigationPolicy):
+ (WebCore::MainResourceLoader::handleSubstituteDataLoadSoon):
+ Rename the method to be consistent with the attribute it uses, making the naming more explicit.
+ (WebCore::MainResourceLoader::loadNow):
+ (WebCore::MainResourceLoader::setDefersLoading):
+ * loader/MainResourceLoader.h:
+ (MainResourceLoader):
+
2012-05-27 David Kilzer <[email protected]>
Use xcrun to find gperf path on platforms that use Xcode
Modified: trunk/Source/WebCore/loader/MainResourceLoader.cpp (118630 => 118631)
--- trunk/Source/WebCore/loader/MainResourceLoader.cpp 2012-05-27 19:51:10 UTC (rev 118630)
+++ trunk/Source/WebCore/loader/MainResourceLoader.cpp 2012-05-27 21:31:54 UTC (rev 118631)
@@ -167,7 +167,7 @@
// A redirect resulted in loading substitute data.
ASSERT(documentLoader()->timing()->redirectCount());
handle()->cancel();
- handleDataLoadSoon(request);
+ handleSubstituteDataLoadSoon(request);
}
deref(); // balances ref in willSendRequest
@@ -606,7 +606,7 @@
#endif
}
-void MainResourceLoader::handleDataLoadSoon(const ResourceRequest& r)
+void MainResourceLoader::handleSubstituteDataLoadSoon(const ResourceRequest& r)
{
m_initialRequest = r;
@@ -642,7 +642,7 @@
resourceLoadScheduler()->addMainResourceLoad(this);
if (m_substituteData.isValid())
- handleDataLoadSoon(r);
+ handleSubstituteDataLoadSoon(r);
else if (shouldLoadEmpty || frameLoader()->client()->representationExistsForURLScheme(url.protocol()))
handleEmptyLoad(url, !shouldLoadEmpty);
else
@@ -696,13 +696,9 @@
if (m_initialRequest.isNull())
return;
- if (m_substituteData.isValid() && m_documentLoader->deferMainResourceDataLoad())
- startDataLoadTimer();
- else {
- ResourceRequest r(m_initialRequest);
- m_initialRequest = ResourceRequest();
- loadNow(r);
- }
+ ResourceRequest initialRequest(m_initialRequest);
+ m_initialRequest = ResourceRequest();
+ loadNow(initialRequest);
}
}
Modified: trunk/Source/WebCore/loader/MainResourceLoader.h (118630 => 118631)
--- trunk/Source/WebCore/loader/MainResourceLoader.h 2012-05-27 19:51:10 UTC (rev 118630)
+++ trunk/Source/WebCore/loader/MainResourceLoader.h 2012-05-27 21:31:54 UTC (rev 118631)
@@ -84,7 +84,7 @@
bool loadNow(ResourceRequest&);
void handleEmptyLoad(const KURL&, bool forURLScheme);
- void handleDataLoadSoon(const ResourceRequest& r);
+ void handleSubstituteDataLoadSoon(const ResourceRequest&);
void startDataLoadTimer();
void handleDataLoad(ResourceRequest&);
Modified: trunk/Tools/ChangeLog (118630 => 118631)
--- trunk/Tools/ChangeLog 2012-05-27 19:51:10 UTC (rev 118630)
+++ trunk/Tools/ChangeLog 2012-05-27 21:31:54 UTC (rev 118631)
@@ -1,3 +1,24 @@
+2012-05-27 Benjamin Poulain <[email protected]>
+
+ When pages are loaded from AppCache with DeferredLoading, willSendRequest() is never called
+ https://bugs.webkit.org/show_bug.cgi?id=87582
+
+ Reviewed by Darin Adler.
+
+ Extend DumpRenderTree to support loading the main resource deferred with a delay. This makes it
+ possible to test pages in a similar way as they are loaded in Browsers.
+
+ * DumpRenderTree/LayoutTestController.cpp:
+ (LayoutTestController::LayoutTestController):
+ (setUseDeferredFrameLoadingCallback):
+ (LayoutTestController::staticFunctions):
+ * DumpRenderTree/LayoutTestController.h:
+ (LayoutTestController::useDeferredFrameLoading):
+ (LayoutTestController::setUseDeferredFrameLoading):
+ (LayoutTestController):
+ * DumpRenderTree/mac/FrameLoadDelegate.mm:
+ (-[FrameLoadDelegate webView:didStartProvisionalLoadForFrame:]):
+
2012-05-27 David Barton <[email protected]>
[watchlist] Improve MathML rule
Modified: trunk/Tools/DumpRenderTree/LayoutTestController.cpp (118630 => 118631)
--- trunk/Tools/DumpRenderTree/LayoutTestController.cpp 2012-05-27 19:51:10 UTC (rev 118630)
+++ trunk/Tools/DumpRenderTree/LayoutTestController.cpp 2012-05-27 21:31:54 UTC (rev 118631)
@@ -89,6 +89,7 @@
, m_handlesAuthenticationChallenges(false)
, m_isPrinting(false)
, m_deferMainResourceDataLoad(true)
+ , m_useDeferredFrameLoading(false)
, m_shouldPaintBrokenImage(true)
, m_shouldStayOnPageAfterHandlingBeforeUnload(false)
, m_areDesktopNotificationPermissionRequestsIgnored(false)
@@ -1231,6 +1232,17 @@
return JSValueMakeUndefined(context);
}
+static JSValueRef setUseDeferredFrameLoadingCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ if (argumentCount < 1)
+ return JSValueMakeUndefined(context);
+
+ LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+ controller->setUseDeferredFrameLoading(JSValueToBoolean(context, arguments[0]));
+
+ return JSValueMakeUndefined(context);
+}
+
static JSValueRef setDomainRelaxationForbiddenForURLSchemeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
// Has Mac and Windows implementation
@@ -2372,6 +2384,7 @@
{ "setDatabaseQuota", setDatabaseQuotaCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setDeferMainResourceDataLoad", setDeferMainResourceDataLoadCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setDefersLoading", setDefersLoadingCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "setUseDeferredFrameLoading", setUseDeferredFrameLoadingCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setDomainRelaxationForbiddenForURLScheme", setDomainRelaxationForbiddenForURLSchemeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setFrameFlatteningEnabled", setFrameFlatteningEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setGeolocationPermission", setGeolocationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
Modified: trunk/Tools/DumpRenderTree/LayoutTestController.h (118630 => 118631)
--- trunk/Tools/DumpRenderTree/LayoutTestController.h 2012-05-27 19:51:10 UTC (rev 118630)
+++ trunk/Tools/DumpRenderTree/LayoutTestController.h 2012-05-27 21:31:54 UTC (rev 118631)
@@ -282,6 +282,9 @@
bool deferMainResourceDataLoad() const { return m_deferMainResourceDataLoad; }
void setDeferMainResourceDataLoad(bool flag) { m_deferMainResourceDataLoad = flag; }
+ bool useDeferredFrameLoading() const { return m_useDeferredFrameLoading; }
+ void setUseDeferredFrameLoading(bool flag) { m_useDeferredFrameLoading = flag; }
+
const std::string& testPathOrURL() const { return m_testPathOrURL; }
const std::string& expectedPixelHash() const { return m_expectedPixelHash; }
@@ -412,6 +415,7 @@
bool m_handlesAuthenticationChallenges;
bool m_isPrinting;
bool m_deferMainResourceDataLoad;
+ bool m_useDeferredFrameLoading;
bool m_shouldPaintBrokenImage;
bool m_shouldStayOnPageAfterHandlingBeforeUnload;
bool m_areDesktopNotificationPermissionRequestsIgnored;
Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (118630 => 118631)
--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2012-05-27 19:51:10 UTC (rev 118630)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2012-05-27 21:31:54 UTC (rev 118631)
@@ -525,6 +525,7 @@
[WebView registerURLSchemeAsLocal:@"feedsearch"];
[webView setContinuousSpellCheckingEnabled:YES];
+ [webView setDefersCallbacks:NO];
[webView setGrammarCheckingEnabled:YES];
[webView setInteractiveFormValidationEnabled:YES];
[webView setValidationMessageTimerMagnification:-1];
Modified: trunk/Tools/DumpRenderTree/mac/FrameLoadDelegate.mm (118630 => 118631)
--- trunk/Tools/DumpRenderTree/mac/FrameLoadDelegate.mm 2012-05-27 19:51:10 UTC (rev 118630)
+++ trunk/Tools/DumpRenderTree/mac/FrameLoadDelegate.mm 2012-05-27 21:31:54 UTC (rev 118631)
@@ -173,6 +173,15 @@
printf ("%s\n", [string UTF8String]);
[frame stopLoading];
}
+
+ if (!done && gLayoutTestController->useDeferredFrameLoading()) {
+ [sender setDefersCallbacks:YES];
+ NSTimeInterval deferredWaitTime = 5 * NSEC_PER_MSEC;
+ dispatch_time_t when = dispatch_time(DISPATCH_TIME_NOW, deferredWaitTime);
+ dispatch_after(when, dispatch_get_main_queue(), ^{
+ [sender setDefersCallbacks:NO];
+ });
+ }
}
- (void)webView:(WebView *)sender didCommitLoadForFrame:(WebFrame *)frame