Commit 169a9b5d authored by vsevik@chromium.org's avatar vsevik@chromium.org

2011-07-04 Vsevolod Vlasov <vsevik@chromium.org>

        Web Inspector: Show content for plugin requests in network panel.
        https://bugs.webkit.org/show_bug.cgi?id=30080

        Reviewed by Pavel Feldman.

        * Source/autotools/symbols.filter:
2011-07-04  Vsevolod Vlasov  <vsevik@chromium.org>

        Web Inspector: Show content for plugin requests in network panel.
        https://bugs.webkit.org/show_bug.cgi?id=30080

        Reviewed by Pavel Feldman.

        * http/tests/inspector/network/network-content-replacement-embed-expected.txt: Added.
        * http/tests/inspector/network/network-content-replacement-embed.html: Added.
        * http/tests/inspector/network/network-content-replacement-xhr-expected.txt: Added.
        * http/tests/inspector/network/network-content-replacement-xhr.html: Added.
        * http/tests/inspector/network/network-embed-expected.txt: Added.
        * http/tests/inspector/network/network-embed.html: Added.
        * http/tests/inspector/network/network-xhr-async-expected.txt:
        * http/tests/inspector/network/network-xhr-async.html:
        * http/tests/inspector/network/network-xhr-sync-expected.txt:
        * http/tests/inspector/network/network-xhr-sync.html:
        * http/tests/inspector/network/resources/cp1251.xml: Added.
        * http/tests/inspector/network/resources/plugin-data.php: Added.
        * http/tests/inspector/network/resources/resource.php:
        * http/tests/inspector/network/resources/utf8.xml: Added.
        * platform/chromium/test_expectations.txt:
2011-07-04  Vsevolod Vlasov  <vsevik@chromium.org>

        Web Inspector: Show content for plugin requests in network panel.
        https://bugs.webkit.org/show_bug.cgi?id=30080

        Reviewed by Pavel Feldman.

        Tests: http/tests/inspector/network/network-content-replacement-embed.html
               http/tests/inspector/network/network-content-replacement-xhr.html
               http/tests/inspector/network/network-embed.html

        * WebCore.exp.in:
        * inspector/InspectorController.cpp:
        (WebCore::InspectorController::setResourcesDataSizeLimitsFromInternals):
        * inspector/InspectorController.h:
        * inspector/InspectorInstrumentation.cpp:
        (WebCore::InspectorInstrumentation::didReceiveDataImpl):
        * inspector/InspectorInstrumentation.h:
        (WebCore::InspectorInstrumentation::didReceiveData):
        * inspector/InspectorResourceAgent.cpp:
        (WebCore::InspectorResourceAgent::didReceiveResponse):
        (WebCore::InspectorResourceAgent::didReceiveData):
        (WebCore::InspectorResourceAgent::didFinishLoading):
        (WebCore::InspectorResourceAgent::setInitialXHRContent):
        (WebCore::InspectorResourceAgent::setResourcesDataSizeLimitsFromInternals):
        (WebCore::InspectorResourceAgent::getResourceContent):
        * inspector/InspectorResourceAgent.h:
        * inspector/NetworkResourcesData.cpp:
        (WebCore::NetworkResourcesData::ResourceData::ResourceData):
        (WebCore::NetworkResourcesData::ResourceData::setContent):
        (WebCore::NetworkResourcesData::ResourceData::purgeContent):
        (WebCore::NetworkResourcesData::ResourceData::createDecoder):
        (WebCore::NetworkResourcesData::ResourceData::dataLength):
        (WebCore::NetworkResourcesData::ResourceData::appendData):
        (WebCore::NetworkResourcesData::ResourceData::decodeDataToContent):
        (WebCore::NetworkResourcesData::NetworkResourcesData):
        (WebCore::NetworkResourcesData::responseReceived):
        (WebCore::NetworkResourcesData::setResourceContent):
        (WebCore::NetworkResourcesData::maybeAddResourceData):
        (WebCore::NetworkResourcesData::maybeDecodeDataToContent):
        (WebCore::NetworkResourcesData::data):
        (WebCore::NetworkResourcesData::clear):
        (WebCore::NetworkResourcesData::setResourcesDataSizeLimits):
        (WebCore::NetworkResourcesData::ensureNoDataForIdentifier):
        (WebCore::NetworkResourcesData::ensureFreeSpace):
        * inspector/NetworkResourcesData.h:
        (WebCore::NetworkResourcesData::ResourceData::hasContent):
        (WebCore::NetworkResourcesData::ResourceData::content):
        (WebCore::NetworkResourcesData::ResourceData::decoder):
        (WebCore::NetworkResourcesData::ResourceData::buffer):
        (WebCore::NetworkResourcesData::ResourceData::setBuffer):
        (WebCore::NetworkResourcesData::ResourceData::hasData):
        * inspector/front-end/Resource.js:
        (WebInspector.Resource.prototype.get contentEncoded):
        * inspector/front-end/ResourcePreviewView.js:
        (WebInspector.ResourcePreviewView.prototype.contentLoaded):
        (WebInspector.ResourcePreviewView.prototype._createEmptyView):
        (WebInspector.ResourcePreviewView.prototype._createPreviewView):
        * inspector/front-end/ResourceView.js:
        (WebInspector.ResourceView.hasTextContent):
        * loader/DocumentThreadableLoader.cpp:
        (WebCore::DocumentThreadableLoader::didReceiveData):
        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::willLoadMediaElementURL):
        (WebCore::FrameLoader::commitProvisionalLoad):
        (WebCore::FrameLoader::loadResourceSynchronously):
        (WebCore::FrameLoader::loadedResourceFromMemoryCache):
        * loader/ResourceLoadNotifier.cpp:
        (WebCore::ResourceLoadNotifier::didReceiveData):
        (WebCore::ResourceLoadNotifier::dispatchDidReceiveData):
        (WebCore::ResourceLoadNotifier::sendRemainingDelegateMessages):
        * loader/ResourceLoadNotifier.h:
        * loader/appcache/ApplicationCacheGroup.cpp:
        (WebCore::ApplicationCacheGroup::didReceiveData):
        * testing/Internals.cpp:
        (WebCore::Internals::setInspectorResourcesDataSizeLimits):
        * testing/Internals.h:
        * testing/Internals.idl:
2011-07-04  Vsevolod Vlasov  <vsevik@chromium.org>

        Web Inspector: Show content for plugin requests in network panel.
        https://bugs.webkit.org/show_bug.cgi?id=30080

        Reviewed by Pavel Feldman.

        * win/WebKit2.def:
        * win/WebKit2CFLite.def:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@90373 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 41707f46
2011-07-04 Vsevolod Vlasov <vsevik@chromium.org>
Web Inspector: Show content for plugin requests in network panel.
https://bugs.webkit.org/show_bug.cgi?id=30080
Reviewed by Pavel Feldman.
* Source/autotools/symbols.filter:
2011-07-01 Tony Chang <tony@chromium.org>
Add chromium sql directory to git ignore.
......
2011-07-04 Vsevolod Vlasov <vsevik@chromium.org>
Web Inspector: Show content for plugin requests in network panel.
https://bugs.webkit.org/show_bug.cgi?id=30080
Reviewed by Pavel Feldman.
* http/tests/inspector/network/network-content-replacement-embed-expected.txt: Added.
* http/tests/inspector/network/network-content-replacement-embed.html: Added.
* http/tests/inspector/network/network-content-replacement-xhr-expected.txt: Added.
* http/tests/inspector/network/network-content-replacement-xhr.html: Added.
* http/tests/inspector/network/network-embed-expected.txt: Added.
* http/tests/inspector/network/network-embed.html: Added.
* http/tests/inspector/network/network-xhr-async-expected.txt:
* http/tests/inspector/network/network-xhr-async.html:
* http/tests/inspector/network/network-xhr-sync-expected.txt:
* http/tests/inspector/network/network-xhr-sync.html:
* http/tests/inspector/network/resources/cp1251.xml: Added.
* http/tests/inspector/network/resources/plugin-data.php: Added.
* http/tests/inspector/network/resources/resource.php:
* http/tests/inspector/network/resources/utf8.xml: Added.
* platform/chromium/test_expectations.txt:
2011-07-04 Anders Carlsson <andersca@apple.com>
NP_RemoveProperty is not called back by Safari when delete npObject.prop is encountered in JavaScript
......
CONSOLE MESSAGE: line 60: Done.
Tests NetworkResourcesData logic for embed content replacement.
http://127.0.0.1:8000/inspector/network/resources/resource.php?size=200
resource.content after requesting content: null
http://127.0.0.1:8000/inspector/network/resources/resource.php?size=100
resource.content after requesting content: ****************************************************************************************************
http://127.0.0.1:8000/inspector/network/resources/resource.php?size=201
resource.content after requesting content: null
http://127.0.0.1:8000/inspector/network/resources/resource.php?size=100
resource.content after requesting content: ****************************************************************************************************
<html>
<head>
<script src="../inspector-test.js"></script>
<script>
var loadedFirstURL = false;
function streamLoaded()
{
if (loadedFirstURL)
return;
loadedFirstURL = true;
loadURLs();
}
var snifferInstalled = false;
function onSnifferInstalled()
{
snifferInstalled = true;
loadURLs();
}
function loadURLs()
{
if (!snifferInstalled || !loadedFirstURL)
return;
if (!window.internals) {
console.log("This test can not be run as window.internals is not available.");
return;
}
// Each '*' symbol in original data will use two bytes in String object
// after decoding, hence multiplying by two.
internals.setInspectorResourcesDataSizeLimits(document, 2*300, 2*200);
// Here we test replacement logic. We save first two resources content,
// discard third resource content once we see its size exceeds limit,
// and finally replace first resource content with the last resource content.
plg.getURLNotify("resources/resource.php?size=200", null, "loadURL2");
}
function loadURL2()
{
plg.getURLNotify("resources/resource.php?size=100", null, "loadURL3");
}
function loadURL3()
{
plg.getURLNotify("resources/resource.php?size=201", null, "loadURL4");
}
function loadURL4()
{
plg.getURLNotify("resources/resource.php?size=100", null, "allURLsLoaded");
}
function allURLsLoaded()
{
console.log("Done.");
}
function test()
{
InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step1);
InspectorTest.evaluateInPage("onSnifferInstalled()");
function dumpResource(resource, callback)
{
if (!resource)
return callback();
InspectorTest.addResult(resource.url);
function contentLoaded()
{
InspectorTest.addResult("resource.content after requesting content: " + resource.content);
callback();
}
resource.requestContent(contentLoaded);
}
function step1()
{
var resource = WebInspector.panels.network.resources[WebInspector.panels.network.resources.length - 4];
dumpResource(resource, step2);
}
function step2()
{
var resource = WebInspector.panels.network.resources[WebInspector.panels.network.resources.length - 3];
dumpResource(resource, step3);
}
function step3()
{
var resource = WebInspector.panels.network.resources[WebInspector.panels.network.resources.length - 2];
dumpResource(resource, step4);
}
function step4()
{
var resource = WebInspector.panels.network.resources[WebInspector.panels.network.resources.length - 1];
dumpResource(resource, step5);
}
function step5()
{
InspectorTest.completeTest();
}
}
</script>
</head>
<body onload="runTest()">
<p>Tests NetworkResourcesData logic for embed content replacement.</p>
<embed name="plg" type="application/x-webkit-test-netscape" src="resources/resource.php?type=image" onstreamload="streamLoaded()"></embed>
</body>
</html>
CONSOLE MESSAGE: line 39: Done.
Tests NetworkResourcesData logic for XHR content replacement.
http://127.0.0.1:8000/inspector/network/resources/resource.php?size=200
resource.content: null
http://127.0.0.1:8000/inspector/network/resources/resource.php?size=100
resource.content: ****************************************************************************************************
http://127.0.0.1:8000/inspector/network/resources/resource.php?size=201
resource.content: null
http://127.0.0.1:8000/inspector/network/resources/resource.php?size=100
resource.content: ****************************************************************************************************
<html>
<head>
<script src="../inspector-test.js"></script>
<script src="../network-test.js"></script>
<script>
function loadData()
{
if (!window.internals) {
console.log("This test can not be run as window.internals is not available.");
return;
}
// Each '*' symbol will use two bytes in String object, hence multiplying by two.
internals.setInspectorResourcesDataSizeLimits(document, 2*300, 2*200);
// Here we test replacement logic. We save first two resources content,
// discard third resource content once we see its size exceeds limit,
// and finally replace first resource content with the last resource content.
doXHR("GET", "resources/resource.php?size=200", true, xhrLoaded1);
}
function xhrLoaded1()
{
doXHR("GET", "resources/resource.php?size=100", true, xhrLoaded2);
}
function xhrLoaded2()
{
doXHR("GET", "resources/resource.php?size=201", true, xhrLoaded3);
}
function xhrLoaded3()
{
doXHR("GET", "resources/resource.php?size=100", true, allXHRsLoaded);
}
function allXHRsLoaded()
{
console.log("Done.");
}
function test()
{
InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step1);
InspectorTest.evaluateInPage("loadData()");
function dumpResource(resource, callback)
{
if (!resource)
return callback();
InspectorTest.addResult(resource.url);
function contentLoaded()
{
InspectorTest.addResult("resource.content: " + resource.content);
callback();
}
resource.requestContent(contentLoaded);
}
function step1()
{
var resource = WebInspector.panels.network.resources[WebInspector.panels.network.resources.length - 4];
dumpResource(resource, step2);
}
function step2()
{
var resource = WebInspector.panels.network.resources[WebInspector.panels.network.resources.length - 3];
dumpResource(resource, step3);
}
function step3()
{
var resource = WebInspector.panels.network.resources[WebInspector.panels.network.resources.length - 2];
dumpResource(resource, step4);
}
function step4()
{
var resource = WebInspector.panels.network.resources[WebInspector.panels.network.resources.length - 1];
dumpResource(resource, step5);
}
function step5()
{
InspectorTest.completeTest();
}
}
</script>
</head>
<body onload="runTest()">
<p> Tests NetworkResourcesData logic for XHR content replacement.</p>
</body>
</html>
CONSOLE MESSAGE: line 66: Done.
Tests that network panel shows content for embed objects.
http://127.0.0.1:8000/inspector/network/resources/resource.php?type=image
resource.type: 8
resource.content before requesting content: undefined
resource.content after requesting content: null
http://127.0.0.1:8000/inspector/network/resources/plugin-data.php?filename=utf8.xml&mimetype=text/html&charset=utf8
resource.type: 8
resource.content before requesting content: undefined
resource.content after requesting content: <?xml version='1.0' encoding='utf-8'?>
<root>
<utf8>SUССЕSS - These 'CCE' are cyrillic letters.</utf8>
</root>
http://127.0.0.1:8000/inspector/network/resources/plugin-data.php?filename=cp1251.xml&mimetype=text/html&charset=cp1251
resource.type: 8
resource.content before requesting content: undefined
resource.content after requesting content: <?xml version='1.0' encoding='cp1251'?>
<root>
<cp1251>SUССЕSS - These 'CCE' are cyrillic letters.</cp1251>
</root>
http://127.0.0.1:8000/inspector/network/resources/plugin-data.php?filename=utf8.xml&mimetype=application/xml
resource.type: 8
resource.content before requesting content: undefined
resource.content after requesting content: <?xml version='1.0' encoding='utf-8'?>
<root>
<utf8>SUССЕSS - These 'CCE' are cyrillic letters.</utf8>
</root>
http://127.0.0.1:8000/inspector/network/resources/plugin-data.php?filename=cp1251.xml&mimetype=application/xml
resource.type: 8
resource.content before requesting content: undefined
resource.content after requesting content: <?xml version='1.0' encoding='cp1251'?>
<root>
<cp1251>SUССЕSS - These 'CCE' are cyrillic letters.</cp1251>
</root>
<html>
<head>
<script src="../inspector-test.js"></script>
<script>
var loadedFirstURL = false;
function streamLoaded()
{
if (loadedFirstURL)
return;
loadedFirstURL = true;
loadURLs();
}
var snifferInstalled = false;
function onSnifferInstalled()
{
snifferInstalled = true;
loadURLs();
}
function loadURLs()
{
if (!snifferInstalled || !loadedFirstURL)
return;
if (!window.internals) {
console.log("This test can not be run as window.internals is not available.");
return;
}
// Since this test could be run together with other inspector backend cache
// tests, we need to reset size limits to default ones.
internals.setInspectorResourcesDataSizeLimits(document, 10 * 1000 * 1000, 1000 * 1000);
// Binary content should not be available.
plg.getURLNotify("resources/resource.php?type=image", null, "loadURL2");
}
function loadURL2()
{
// This resource content should be correctly decoded.
plg.getURLNotify("resources/plugin-data.php?filename=utf8.xml&mimetype=text/html&charset=utf8", null, "loadURL3");
}
function loadURL3()
{
// This resource content should be correctly decoded.
plg.getURLNotify("resources/plugin-data.php?filename=cp1251.xml&mimetype=text/html&charset=cp1251", null, "loadURL4");
}
function loadURL4()
{
// This resource content should be correctly decoded.
plg.getURLNotify("resources/plugin-data.php?filename=utf8.xml&mimetype=application/xml", null, "loadURL5");
}
function loadURL5()
{
// This resource content should be correctly decoded.
plg.getURLNotify("resources/plugin-data.php?filename=cp1251.xml&mimetype=application/xml", null, "allURLsLoaded");
}
function allURLsLoaded()
{
console.log("Done.");
}
function test()
{
InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step1);
InspectorTest.evaluateInPage("onSnifferInstalled()");
function dumpResource(resource, callback)
{
if (!resource)
return callback();
InspectorTest.addResult(resource.url);
InspectorTest.addResult("resource.type: " + resource.type);
InspectorTest.addResult("resource.content before requesting content: " + resource.content);
function contentLoaded()
{
InspectorTest.addResult("resource.content after requesting content: " + resource.content);
callback();
}
resource.requestContent(contentLoaded);
}
function step1()
{
var resource = WebInspector.panels.network.resources[WebInspector.panels.network.resources.length - 5];
dumpResource(resource, step2);
}
function step2()
{
var resource = WebInspector.panels.network.resources[WebInspector.panels.network.resources.length - 4];
dumpResource(resource, step3);
}
function step3()
{
var resource = WebInspector.panels.network.resources[WebInspector.panels.network.resources.length - 3];
dumpResource(resource, step4);
}
function step4()
{
var resource = WebInspector.panels.network.resources[WebInspector.panels.network.resources.length - 2];
dumpResource(resource, step5);
}
function step5()
{
var resource = WebInspector.panels.network.resources[WebInspector.panels.network.resources.length - 1];
dumpResource(resource, step6);
}
function step6()
{
InspectorTest.completeTest();
}
}
</script>
</head>
<body onload="runTest()">
<p>Tests that network panel shows content for embed objects.</p>
<embed name="plg" type="application/x-webkit-test-netscape" src="resources/resource.php?type=image" onstreamload="streamLoaded()"></embed>
</body>
</html>
CONSOLE MESSAGE: line 13: Done.
CONSOLE MESSAGE: line 21: Done.
Tests XHR network resource type and content for asynchronous requests. Bug 61205
http://127.0.0.1:8000/inspector/network/resources/resource.php
......
......@@ -5,6 +5,14 @@
<script>
function loadData()
{
if (!window.internals) {
console.log("This test can not be run as window.internals is not available.");
return;
}
// Since this test could be run together with other inspector backend cache
// tests, we need to reset size limits to default ones.
internals.setInspectorResourcesDataSizeLimits(document, 10 * 1000 * 1000, 1000 * 1000);
doXHR("GET", "resources/resource.php", true, resourceLoaded);
}
......
CONSOLE MESSAGE: line 13: Done.
CONSOLE MESSAGE: line 21: Done.
Tests XHR network resource type and content for synchronous requests. Bug 61205
http://127.0.0.1:8000/inspector/network/resources/resource.php
......
......@@ -5,6 +5,14 @@
<script>
function loadData()
{
if (!window.internals) {
console.log("This test can not be run as window.internals is not available.");
return;
}
// Since this test could be run together with other inspector backend cache
// tests, we need to reset size limits to default ones.
internals.setInspectorResourcesDataSizeLimits(document, 10 * 1000 * 1000, 1000 * 1000);
doXHR("GET", "resources/resource.php", false, resourceLoaded);
}
......
<?xml version='1.0' encoding='cp1251'?>
<root>
<cp1251>SUSS - These 'CCE' are cyrillic letters.</cp1251>
</root>
<?php
$mimetype = $_GET["mimetype"];
$filename = $_GET["filename"];
$charset = $_GET["charset"];
header("Expires: Thu, 01 Dec 2003 16:00:00 GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Pragma: no-cache");
if ($charset)
header("Content-Type: " . $mimetype . "; charset=" . $charset);
else
header("Content-Type: " . $mimetype);
readfile($filename);
?>
......@@ -26,7 +26,7 @@
else if ($type == "image")
header("Content-Type: image/png");
else
header("Content-Type: text/html");
header("Content-Type: text/plain");
# Flush headers and sleep bofore sending response
if ($send) {
......
<?xml version='1.0' encoding='utf-8'?>
<root>
<utf8>SUССЕSS - These 'CCE' are cyrillic letters.</utf8>
</root>
......@@ -656,6 +656,10 @@ WONTFIX SKIP : inspector/extensions = FAIL
WONTFIX SKIP : http/tests/inspector/extensions-headers.html = FAIL
WONTFIX SKIP : http/tests/inspector/extensions-resources-redirect.html = FAIL
// There is no enough plugins support in DRT
WONTFIX SKIP : http/tests/inspector/network/network-embed.html = FAIL
WONTFIX SKIP : http/tests/inspector/network/network-content-replacement-embed.html = FAIL
// Inspector tests in Debug build are very slow.
BUG_DRT WIN LINUX DEBUG SLOW : inspector = PASS
BUG_DRT WIN LINUX DEBUG SLOW : http/tests/inspector = PASS
......
2011-07-04 Vsevolod Vlasov <vsevik@chromium.org>
Web Inspector: Show content for plugin requests in network panel.
https://bugs.webkit.org/show_bug.cgi?id=30080
Reviewed by Pavel Feldman.
Tests: http/tests/inspector/network/network-content-replacement-embed.html
http/tests/inspector/network/network-content-replacement-xhr.html
http/tests/inspector/network/network-embed.html
* WebCore.exp.in:
* inspector/InspectorController.cpp:
(WebCore::InspectorController::setResourcesDataSizeLimitsFromInternals):
* inspector/InspectorController.h:
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::didReceiveDataImpl):
* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::didReceiveData):
* inspector/InspectorResourceAgent.cpp:
(WebCore::InspectorResourceAgent::didReceiveResponse):
(WebCore::InspectorResourceAgent::didReceiveData):
(WebCore::InspectorResourceAgent::didFinishLoading):
(WebCore::InspectorResourceAgent::setInitialXHRContent):
(WebCore::InspectorResourceAgent::setResourcesDataSizeLimitsFromInternals):
(WebCore::InspectorResourceAgent::getResourceContent):
* inspector/InspectorResourceAgent.h:
* inspector/NetworkResourcesData.cpp:
(WebCore::NetworkResourcesData::ResourceData::ResourceData):
(WebCore::NetworkResourcesData::ResourceData::setContent):
(WebCore::NetworkResourcesData::ResourceData::purgeContent):
(WebCore::NetworkResourcesData::ResourceData::createDecoder):
(WebCore::NetworkResourcesData::ResourceData::dataLength):
(WebCore::NetworkResourcesData::ResourceData::appendData):
(WebCore::NetworkResourcesData::ResourceData::decodeDataToContent):
(WebCore::NetworkResourcesData::NetworkResourcesData):
(WebCore::NetworkResourcesData::responseReceived):
(WebCore::NetworkResourcesData::setResourceContent):
(WebCore::NetworkResourcesData::maybeAddResourceData):
(WebCore::NetworkResourcesData::maybeDecodeDataToContent):
(WebCore::NetworkResourcesData::data):
(WebCore::NetworkResourcesData::clear):
(WebCore::NetworkResourcesData::setResourcesDataSizeLimits):
(WebCore::NetworkResourcesData::ensureNoDataForIdentifier):