Commit c388b036 authored by levin@chromium.org's avatar levin@chromium.org

WebCore:

2009-03-04  David Levin  <levin@chromium.org>

        Reviewed by Alexey Proskuryakov.

        Bug 24337: Assert when doing sync XHR in a worker for a cacheable response.
        <https://bugs.webkit.org/show_bug.cgi?id=24337>

        Tests: http/tests/xmlhttprequest/access-control-basic-denied-preflight-cache.html
               http/tests/xmlhttprequest/workers/xmlhttprequest-file-not-found.html

        * loader/mac/ResourceLoaderMac.mm:
        (WebCore::ResourceLoader::willCacheResponse):
        An identifier is only asssigned if resource load callbacks are done.  So don't send
        willCacheResponse which uses identifier if resource load callbacks aren't being sent.

LayoutTests:

2009-03-04  David Levin  <levin@chromium.org>

        Reviewed by Alexey Proskuryakov.

        Bug 24337: Assert when doing sync XHR in a worker for a cacheable response.
        <https://bugs.webkit.org/show_bug.cgi?id=24337>

        * http/tests/xmlhttprequest/access-control-basic-denied-preflight-cache-expected.txt: Added.
        * http/tests/xmlhttprequest/access-control-basic-denied-preflight-cache.html: Added.
        * http/tests/xmlhttprequest/workers/resources/xmlhttprequest-file-not-found.js: Added.
        (log):
        (done):
        * http/tests/xmlhttprequest/workers/xmlhttprequest-file-not-found-expected.txt: Added.
        * http/tests/xmlhttprequest/workers/xmlhttprequest-file-not-found.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@41434 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent e69bb611
2009-03-04 David Levin <levin@chromium.org>
Reviewed by Alexey Proskuryakov.
Bug 24337: Assert when doing sync XHR in a worker for a cacheable response.
<https://bugs.webkit.org/show_bug.cgi?id=24337>
* http/tests/xmlhttprequest/access-control-basic-denied-preflight-cache-expected.txt: Added.
* http/tests/xmlhttprequest/access-control-basic-denied-preflight-cache.html: Added.
* http/tests/xmlhttprequest/workers/resources/xmlhttprequest-file-not-found.js: Added.
(log):
(done):
* http/tests/xmlhttprequest/workers/xmlhttprequest-file-not-found-expected.txt: Added.
* http/tests/xmlhttprequest/workers/xmlhttprequest-file-not-found.html: Added.
2009-03-04 David Levin <levin@chromium.org>
Reviewed by Alexey Proskuryakov.
......
Test async xhr preflight cache denial. If this test passes, there should be a single PASS below.
PASS
<html>
<body>
<p>Test async xhr preflight cache denial. If this test passes, there should be a single PASS below.</p>
<script>
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
}
var console_messages = document.createElement("ul");
document.body.appendChild(console_messages);
function log(message)
{
var item = document.createElement("li");
item.appendChild(document.createTextNode(message));
console_messages.appendChild(item);
}
xhr = new XMLHttpRequest;
xhr.onreadystatechange = processStateChange;
try {
xhr.open("FOO", "http://localhost:8000/xmlhttprequest/resources/access-control-basic-denied.cgi");
xhr.send();
} catch (e) {
log("Got exception.");
}
function processStateChange() {
if (xhr.readyState == 1) {
log("PASS");
if (window.layoutTestController)
layoutTestController.notifyDone();
}
}
</script>
</body>
</html>
function log(message)
{
postMessage("log " + message);
}
function done()
{
postMessage("DONE");
}
req = new XMLHttpRequest;
try {
req.open("GET", "missing-file", false);
req.send();
} catch (e) {
log("Exception received.");
}
done();
Request a file that isn't present on the server in XMLHttpRequest in a worker. If this test passes, there should be a single PASS below.
PASS
<html>
<body>
<p>Request a file that isn't present on the server in XMLHttpRequest in a worker. If this test passes, there should be a single PASS below.</p>
<script>
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
}
var console_messages = document.createElement("ul");
document.body.appendChild(console_messages);
function log(message)
{
var item = document.createElement("li");
item.appendChild(document.createTextNode(message));
console_messages.appendChild(item);
}
var worker = new Worker('resources/xmlhttprequest-file-not-found.js');
worker.onmessage = function(evt)
{
if (/log .+/.test(evt.data))
log(evt.data.substr(4));
else if (/DONE/.test(evt.data)) {
log("PASS");
if (window.layoutTestController)
layoutTestController.notifyDone();
}
}
</script>
</body>
</html>
2009-03-04 David Levin <levin@chromium.org>
Reviewed by Alexey Proskuryakov.
Bug 24337: Assert when doing sync XHR in a worker for a cacheable response.
<https://bugs.webkit.org/show_bug.cgi?id=24337>
Tests: http/tests/xmlhttprequest/access-control-basic-denied-preflight-cache.html
http/tests/xmlhttprequest/workers/xmlhttprequest-file-not-found.html
* loader/mac/ResourceLoaderMac.mm:
(WebCore::ResourceLoader::willCacheResponse):
An identifier is only asssigned if resource load callbacks are done. So don't send
willCacheResponse which uses identifier if resource load callbacks aren't being sent.
2009-03-04 David Levin <levin@chromium.org>
Reviewed by Alexey Proskuryakov.
......@@ -37,6 +37,8 @@ namespace WebCore {
NSCachedURLResponse* ResourceLoader::willCacheResponse(ResourceHandle*, NSCachedURLResponse* response)
{
if (!m_sendResourceLoadCallbacks)
return 0;
return frameLoader()->client()->willCacheResponse(documentLoader(), identifier(), response);
}
......
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