Commit ba3782cc authored by ap@apple.com's avatar ap@apple.com

2011-05-13 Alexey Proskuryakov <ap@apple.com>

        Unreviewed test changes.

        Web Inspector: Show Error Messages for Application Cache Errors
        https://bugs.webkit.org/show_bug.cgi?id=41642

        * http/tests/appcache/404-resource-expected.txt:
        * http/tests/appcache/manifest-redirect-expected.txt:
        * http/tests/appcache/origin-quota-expected.txt:
        * http/tests/appcache/resource-redirect-2-expected.txt:
        * http/tests/appcache/resource-redirect-expected.txt:
        * http/tests/appcache/wrong-content-type-expected.txt:
        * http/tests/appcache/wrong-signature-2-expected.txt:
        * http/tests/appcache/wrong-signature-expected.txt:
2011-05-13  Alexey Proskuryakov  <ap@apple.com>

        Reviewed by Pavel Feldman.

        Web Inspector: Show Error Messages for Application Cache Errors
        https://bugs.webkit.org/show_bug.cgi?id=41642

        * loader/appcache/ApplicationCacheGroup.cpp:
        (WebCore::ApplicationCacheGroup::didReceiveResponse):
        (WebCore::ApplicationCacheGroup::didFail):
        (WebCore::ApplicationCacheGroup::didReceiveManifestResponse):
        (WebCore::ApplicationCacheGroup::didFinishLoadingManifest):
        (WebCore::ApplicationCacheGroup::cacheUpdateFailedDueToOriginQuota):
        Added console error logging.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@86417 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8b666474
2011-05-13 Alexey Proskuryakov <ap@apple.com>
Unreviewed test changes.
Web Inspector: Show Error Messages for Application Cache Errors
https://bugs.webkit.org/show_bug.cgi?id=41642
* http/tests/appcache/404-resource-expected.txt:
* http/tests/appcache/manifest-redirect-expected.txt:
* http/tests/appcache/origin-quota-expected.txt:
* http/tests/appcache/resource-redirect-2-expected.txt:
* http/tests/appcache/resource-redirect-expected.txt:
* http/tests/appcache/wrong-content-type-expected.txt:
* http/tests/appcache/wrong-signature-2-expected.txt:
* http/tests/appcache/wrong-signature-expected.txt:
2011-05-12 Ben Wells <benwells@chromium.org>
Reviewed by Simon Fraser.
CONSOLE MESSAGE: line 0: Application Cache update failed, because http://127.0.0.1:8000/appcache/resources/does-not-exist.txt could not be fetched.
Test that a missing explicit resource makes caching fail.
Should say SUCCESS:
......
CONSOLE MESSAGE: line 0: Application Cache manifest could not be fetched, because a redirection was attempted.
Test that a redirect makes resource caching fail.
Should say SUCCESS:
......
UI DELEGATE APPLICATION CACHE CALLBACK: exceededApplicationCacheOriginQuotaForSecurityOrigin:{http, 127.0.0.1, 8000}
CONSOLE MESSAGE: line 0: Application Cache update failed, because size quota was exceeded.
This test checks that per-origin application cache quotas are enforced.
This test sets the quota for the origin to 20kb, and attempts to fill it up with 2 iframes that are 13kb each. The application cache download process should fail on the 2nd iframe and the UI Delegate should be informed of the exceeded quota. Increasing the size to 40kb. A 3rd iframe is added, which should succeed.
......
CONSOLE MESSAGE: line 0: Application Cache update failed, because http://127.0.0.1:8000/appcache/resources/resource-redirect-2.php could not be fetched.
Test that a redirect makes resource caching fail.
Should say SUCCESS:
......
CONSOLE MESSAGE: line 0: Application Cache update failed, because http://127.0.0.1:8000/appcache/resources/resource-redirect.php was redirected.
Test that a redirect makes resource caching fail.
Should say SUCCESS:
......
CONSOLE MESSAGE: line 0: Application Cache manifest had an incorrect MIME type: text/plain.
Test that a manifest served with a wrong content-type isn't treated as such.
Should say SUCCESS:
......
CONSOLE MESSAGE: line 0: Application Cache manifest could not be parsed. Does it start with CACHE MANIFEST?
Test that a manifest served with a wrong signature isn't treated as such.
Should say SUCCESS:
......
CONSOLE MESSAGE: line 0: Application Cache manifest could not be parsed. Does it start with CACHE MANIFEST?
Test that a manifest served with a wrong signature isn't treated as such.
Should say SUCCESS:
......
2011-05-13 Alexey Proskuryakov <ap@apple.com>
Reviewed by Pavel Feldman.
Web Inspector: Show Error Messages for Application Cache Errors
https://bugs.webkit.org/show_bug.cgi?id=41642
* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::didReceiveResponse):
(WebCore::ApplicationCacheGroup::didFail):
(WebCore::ApplicationCacheGroup::didReceiveManifestResponse):
(WebCore::ApplicationCacheGroup::didFinishLoadingManifest):
(WebCore::ApplicationCacheGroup::cacheUpdateFailedDueToOriginQuota):
Added console error logging.
2011-05-12 Pratik Solanki <psolanki@apple.com>
Reviewed by Antti Koivisto.
......@@ -34,6 +34,7 @@
#include "ApplicationCacheStorage.h"
#include "Chrome.h"
#include "ChromeClient.h"
#include "Console.h"
#include "DOMApplicationCache.h"
#include "DOMWindow.h"
#include "DocumentLoader.h"
......@@ -525,6 +526,8 @@ void ApplicationCacheGroup::didReceiveResponse(ResourceHandle* handle, const Res
if (response.httpStatusCode() / 100 != 2 || response.url() != m_currentHandle->firstRequest().url()) {
if ((type & ApplicationCacheResource::Explicit) || (type & ApplicationCacheResource::Fallback)) {
m_frame->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache update failed, because " + m_currentHandle->firstRequest().url().string() +
((response.httpStatusCode() / 100 != 2) ? " could not be fetched." : " was redirected."), 0, String());
// Note that cacheUpdateFailed() can cause the cache group to be deleted.
cacheUpdateFailed();
} else if (response.httpStatusCode() == 404 || response.httpStatusCode() == 410) {
......@@ -622,6 +625,7 @@ void ApplicationCacheGroup::didFail(ResourceHandle* handle, const ResourceError&
#endif
if (handle == m_manifestHandle) {
// A network error is logged elsewhere, no need to log again. Also, it's normal for manifest fetching to fail when working offline.
cacheUpdateFailed();
return;
}
......@@ -636,6 +640,7 @@ void ApplicationCacheGroup::didFail(ResourceHandle* handle, const ResourceError&
m_pendingEntries.remove(url);
if ((type & ApplicationCacheResource::Explicit) || (type & ApplicationCacheResource::Fallback)) {
m_frame->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache update failed, because " + url.string() + " could not be fetched.", 0, String());
// Note that cacheUpdateFailed() can cause the cache group to be deleted.
cacheUpdateFailed();
} else {
......@@ -663,7 +668,20 @@ void ApplicationCacheGroup::didReceiveManifestResponse(const ResourceResponse& r
if (response.httpStatusCode() == 304)
return;
if (response.httpStatusCode() / 100 != 2 || response.url() != m_manifestHandle->firstRequest().url() || !equalIgnoringCase(response.mimeType(), "text/cache-manifest")) {
if (response.httpStatusCode() / 100 != 2) {
m_frame->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache manifest could not be fetched.", 0, String());
cacheUpdateFailed();
return;
}
if (response.url() != m_manifestHandle->firstRequest().url()) {
m_frame->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache manifest could not be fetched, because a redirection was attempted.", 0, String());
cacheUpdateFailed();
return;
}
if (!equalIgnoringCase(response.mimeType(), "text/cache-manifest")) {
m_frame->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache manifest had an incorrect MIME type: " + response.mimeType() + ".", 0, String());
cacheUpdateFailed();
return;
}
......@@ -683,6 +701,7 @@ void ApplicationCacheGroup::didFinishLoadingManifest()
if (!isUpgradeAttempt && !m_manifestResource) {
// The server returned 304 Not Modified even though we didn't send a conditional request.
m_frame->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache manifest could not be fetched because of an unexpected 304 Not Modified server response.", 0, String());
cacheUpdateFailed();
return;
}
......@@ -707,6 +726,8 @@ void ApplicationCacheGroup::didFinishLoadingManifest()
Manifest manifest;
if (!parseManifest(m_manifestURL, m_manifestResource->data()->data(), m_manifestResource->data()->size(), manifest)) {
// At the time of this writing, lack of "CACHE MANIFEST" signature is the only reason for parseManifest to fail.
m_frame->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache manifest could not be parsed. Does it start with CACHE MANIFEST?", 0, String());
cacheUpdateFailed();
return;
}
......@@ -786,6 +807,9 @@ void ApplicationCacheGroup::cacheUpdateFailedDueToOriginQuota()
scheduleReachedOriginQuotaCallback();
}
m_frame->domWindow()->console()->addMessage(OtherMessageSource, LogMessageType, ErrorMessageLevel, "Application Cache update failed, because size quota was exceeded.", 0, String());
// FIXME: Should not abort cache update - the user may choose to increase the quota.
cacheUpdateFailed();
}
......
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