2011-07-05 Vsevolod Vlasov <vsevik@chromium.org>
authorvsevik@chromium.org <vsevik@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Jul 2011 10:16:36 +0000 (10:16 +0000)
committervsevik@chromium.org <vsevik@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Jul 2011 10:16:36 +0000 (10:16 +0000)
        Web Inspector: Show content for plugin requests in network panel.
        https://bugs.webkit.org/show_bug.cgi?id=30080

        Added GTK symbols for new window.internals methods.

        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

        Added tests for plugin content saving and replacing in NetworkResourcesData.
        Adjusted older tests to use new window.internals method setInspectorResourcesDataSizeLimits
        to ensure NetworkResourcesData is in the correct state before test.

        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-05  Vsevolod Vlasov  <vsevik@chromium.org>

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

        Now the data from didReceiveData callback is passed to inspector.
        It is then saved in NetworkResourcesData structure for plugin requests.
        Added window.internals.setInspectorResourcesDataSizeLimits() method
        for testing replacement logic.

        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-05  Vsevolod Vlasov  <vsevik@chromium.org>

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

        Added win symbols for new window.internals methods.

        Reviewed by Pavel Feldman.

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

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@90389 268f45cc-cd09-0410-ab3c-d52691b4dbfc

42 files changed:
ChangeLog
LayoutTests/ChangeLog
LayoutTests/http/tests/inspector/network/network-content-replacement-embed-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/inspector/network/network-content-replacement-embed.html [new file with mode: 0644]
LayoutTests/http/tests/inspector/network/network-content-replacement-xhr-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/inspector/network/network-content-replacement-xhr.html [new file with mode: 0644]
LayoutTests/http/tests/inspector/network/network-embed-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/inspector/network/network-embed.html [new file with mode: 0644]
LayoutTests/http/tests/inspector/network/network-xhr-async-expected.txt
LayoutTests/http/tests/inspector/network/network-xhr-async.html
LayoutTests/http/tests/inspector/network/network-xhr-sync-expected.txt
LayoutTests/http/tests/inspector/network/network-xhr-sync.html
LayoutTests/http/tests/inspector/network/resources/cp1251.xml [new file with mode: 0644]
LayoutTests/http/tests/inspector/network/resources/plugin-data.php [new file with mode: 0644]
LayoutTests/http/tests/inspector/network/resources/resource.php
LayoutTests/http/tests/inspector/network/resources/utf8.xml [new file with mode: 0644]
LayoutTests/platform/chromium/test_expectations.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/inspector/InspectorController.cpp
Source/WebCore/inspector/InspectorController.h
Source/WebCore/inspector/InspectorInstrumentation.cpp
Source/WebCore/inspector/InspectorInstrumentation.h
Source/WebCore/inspector/InspectorResourceAgent.cpp
Source/WebCore/inspector/InspectorResourceAgent.h
Source/WebCore/inspector/NetworkResourcesData.cpp
Source/WebCore/inspector/NetworkResourcesData.h
Source/WebCore/inspector/front-end/Resource.js
Source/WebCore/inspector/front-end/ResourcePreviewView.js
Source/WebCore/inspector/front-end/ResourceView.js
Source/WebCore/loader/DocumentThreadableLoader.cpp
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/ResourceLoadNotifier.cpp
Source/WebCore/loader/ResourceLoadNotifier.h
Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl
Source/WebKit2/ChangeLog
Source/WebKit2/win/WebKit2.def
Source/WebKit2/win/WebKit2CFLite.def
Source/autotools/symbols.filter

index 051888c86775cc02db09a8459e64341835873f1b..f37191d526a976cd625e9285e6e4f180576caf05 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2011-07-05  Vsevolod Vlasov  <vsevik@chromium.org>
+
+        Web Inspector: Show content for plugin requests in network panel.
+        https://bugs.webkit.org/show_bug.cgi?id=30080
+
+        Added GTK symbols for new window.internals methods.
+
+        Reviewed by Pavel Feldman.
+
+        * Source/autotools/symbols.filter:
+
 2011-07-04  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r90373.
index d5ec102e4d4a3734affc0827945477e0f3073c94..4efcb142a0ecbcd49d0cd41f267acd8e96d21a94 100644 (file)
@@ -1,3 +1,30 @@
+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
+
+        Added tests for plugin content saving and replacing in NetworkResourcesData.
+        Adjusted older tests to use new window.internals method setInspectorResourcesDataSizeLimits
+        to ensure NetworkResourcesData is in the correct state before test.
+
+        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  Kinuko Yasuda  <kinuko@chromium.org>
 
         [Chromium] LayoutTests/fast/filesystem/workers/simple-persistent-sync.html is failing on chromium worker tests
diff --git a/LayoutTests/http/tests/inspector/network/network-content-replacement-embed-expected.txt b/LayoutTests/http/tests/inspector/network/network-content-replacement-embed-expected.txt
new file mode 100644 (file)
index 0000000..2911b2e
--- /dev/null
@@ -0,0 +1,13 @@
+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: ****************************************************************************************************
+
diff --git a/LayoutTests/http/tests/inspector/network/network-content-replacement-embed.html b/LayoutTests/http/tests/inspector/network/network-content-replacement-embed.html
new file mode 100644 (file)
index 0000000..99ee3db
--- /dev/null
@@ -0,0 +1,119 @@
+<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>
+
diff --git a/LayoutTests/http/tests/inspector/network/network-content-replacement-xhr-expected.txt b/LayoutTests/http/tests/inspector/network/network-content-replacement-xhr-expected.txt
new file mode 100644 (file)
index 0000000..d1ef73f
--- /dev/null
@@ -0,0 +1,12 @@
+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: ****************************************************************************************************
+
diff --git a/LayoutTests/http/tests/inspector/network/network-content-replacement-xhr.html b/LayoutTests/http/tests/inspector/network/network-content-replacement-xhr.html
new file mode 100644 (file)
index 0000000..165cb1d
--- /dev/null
@@ -0,0 +1,97 @@
+<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>
+
diff --git a/LayoutTests/http/tests/inspector/network/network-embed-expected.txt b/LayoutTests/http/tests/inspector/network/network-embed-expected.txt
new file mode 100644 (file)
index 0000000..bdbff0f
--- /dev/null
@@ -0,0 +1,41 @@
+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>
+
+
diff --git a/LayoutTests/http/tests/inspector/network/network-embed.html b/LayoutTests/http/tests/inspector/network/network-embed.html
new file mode 100644 (file)
index 0000000..6155239
--- /dev/null
@@ -0,0 +1,133 @@
+<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>
+
index 45e55513998eb1551f07f094ab52ae8ec092cf3b..565fd778597ca0e49396a30e35e99e1f02c1ae56 100644 (file)
@@ -1,4 +1,4 @@
-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
index 32621cb5168de67c76387326a542355ad590b046..bd8b240810da17a8d03117295f4504cc2c4f8cd9 100644 (file)
@@ -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);
 }
 
index 344347c0e51e821a5c6c386749a3ac13b3f5df72..be84f43931abf92d1ffbb393f52ad404dce8be0c 100644 (file)
@@ -1,4 +1,4 @@
-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
index 8f2480e7b81bfb038ced6d8e089e1daab55d8913..00d289ddafd7679d99bbdf62fc681171e90b90a5 100644 (file)
@@ -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);
 }
 
diff --git a/LayoutTests/http/tests/inspector/network/resources/cp1251.xml b/LayoutTests/http/tests/inspector/network/resources/cp1251.xml
new file mode 100644 (file)
index 0000000..32285f3
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version='1.0' encoding='cp1251'?>
+<root>
+  <cp1251>SUÑÑÅSS - These 'CCE' are cyrillic letters.</cp1251>
+</root>
diff --git a/LayoutTests/http/tests/inspector/network/resources/plugin-data.php b/LayoutTests/http/tests/inspector/network/resources/plugin-data.php
new file mode 100644 (file)
index 0000000..321d9e8
--- /dev/null
@@ -0,0 +1,15 @@
+<?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);
+?>
index 9e5607c182c865ee232bf918bb0f8888adf4cf17..3e1f185e1fde268b2ebfefa1d0017dc093517edb 100644 (file)
@@ -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) {
diff --git a/LayoutTests/http/tests/inspector/network/resources/utf8.xml b/LayoutTests/http/tests/inspector/network/resources/utf8.xml
new file mode 100644 (file)
index 0000000..07ee481
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version='1.0' encoding='utf-8'?>
+<root>
+  <utf8>SUССЕSS - These 'CCE' are cyrillic letters.</utf8>
+</root>
index 3cb9765d0be5cca5b574a9bd8fd2ce8657604c92..fe737356642b72fd2aa69e13fa754e8a5291d89c 100644 (file)
@@ -657,6 +657,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
index 3713d7b89e2f468595c98397690792c458017c8e..81ec9b3621b9010164b7667445bd30fbadd12abe 100644 (file)
@@ -1,3 +1,87 @@
+2011-07-05  Vsevolod Vlasov  <vsevik@chromium.org>
+
+        Web Inspector: Show content for plugin requests in network panel.
+        https://bugs.webkit.org/show_bug.cgi?id=30080
+
+        Now the data from didReceiveData callback is passed to inspector.
+        It is then saved in NetworkResourcesData structure for plugin requests.
+        Added window.internals.setInspectorResourcesDataSizeLimits() method
+        for testing replacement logic.
+
+        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-05  Kent Tamura  <tkent@chromium.org>
 
         Add an assertion that percent height box is unregistered correctly.
index 4bf0255b652b3b9a903e6b143bb755c9901fdbd7..519eeda77347c2599cc59d24221b32a8dde524af 100644 (file)
@@ -1301,6 +1301,7 @@ __ZNK7WebCore8Document16dashboardRegionsEv
 __ZNK7WebCore8Document20cacheDocumentElementEv
 __ZNK7WebCore8Document31displayStringModifiedByEncodingERKN3WTF6StringE
 __ZNK7WebCore8Document4bodyEv
+__ZNK7WebCore8Document4pageEv
 __ZNK7WebCore8Document6domainEv
 __ZNK7WebCore8Document6loaderEv
 __ZNK7WebCore8IntPointcv7CGPointEv
@@ -1581,6 +1582,7 @@ __ZN7WebCore19InspectorController25evaluateForTestInFrontendElRKN3WTF6StringE
 __ZN7WebCore19InspectorController26setInspectorFrontendClientEN3WTF10PassOwnPtrINS_23InspectorFrontendClientEEE
 __ZN7WebCore19InspectorController26stopUserInitiatedProfilingEv
 __ZN7WebCore19InspectorController27startUserInitiatedProfilingEv
+__ZN7WebCore19InspectorController39setResourcesDataSizeLimitsFromInternalsEii
 __ZN7WebCore19InspectorController4showEv
 __ZN7WebCore19InspectorController5closeEv
 __ZN7WebCore28InspectorFrontendClientLocal12moveWindowByEff
index bbc48ac8e33339fe0262646d2c4f12cfa566aa44..4ab1271b5ef199bcd75e1b9ccb057c0051db2da8 100644 (file)
@@ -489,6 +489,11 @@ void InspectorController::resume()
 
 #endif
 
+void InspectorController::setResourcesDataSizeLimitsFromInternals(int maximumResourcesContentSize, int maximumSingleResourceContentSize)
+{
+    m_resourceAgent->setResourcesDataSizeLimitsFromInternals(maximumResourcesContentSize, maximumSingleResourceContentSize);
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(INSPECTOR)
index 739b00bd4ca41d89aa9bf67e207c5b3e56154b46..a68a13a7988474f4eee3181e0a33b03da9190c31 100644 (file)
@@ -120,6 +120,8 @@ public:
     void resume();
 #endif
 
+    void setResourcesDataSizeLimitsFromInternals(int maximumResourcesContentSize, int maximumSingleResourceContentSize);
+
 private:
     friend class PostWorkerNotificationToFrontendTask;
 
index a9e2caa80bbd219cac99af7fc79eda75b2b08671..2da167df209862d69d5ccb4b78ad6fd9d8ed0919 100644 (file)
@@ -492,10 +492,10 @@ void InspectorInstrumentation::continueWithPolicyIgnoreImpl(Frame* frame, Docume
     didReceiveResourceResponseButCanceledImpl(frame, loader, identifier, r);
 }
 
-void InspectorInstrumentation::didReceiveContentLengthImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, int dataLength, int encodedDataLength)
+void InspectorInstrumentation::didReceiveDataImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const char* data, int dataLength, int encodedDataLength)
 {
     if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
-        resourceAgent->didReceiveContentLength(identifier, dataLength, encodedDataLength);
+        resourceAgent->didReceiveData(identifier, data, dataLength, encodedDataLength);
 }
 
 void InspectorInstrumentation::didFinishLoadingImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, DocumentLoader* loader, double finishTime)
index 20b0eb82710487e9cc28ab7c76f52e145883e72c..e3e3274c8e1687c27c0cc54fd62940b3ddc42207 100644 (file)
@@ -126,7 +126,7 @@ public:
     static void continueAfterXFrameOptionsDenied(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
     static void continueWithPolicyDownload(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
     static void continueWithPolicyIgnore(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
-    static void didReceiveContentLength(Frame*, unsigned long identifier, int dataLength, int encodedDataLength);
+    static void didReceiveData(Frame*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength);
     static void didFinishLoading(Frame*, DocumentLoader*, unsigned long identifier, double finishTime);
     static void didFailLoading(Frame*, DocumentLoader*, unsigned long identifier, const ResourceError&);
     static void resourceRetrievedByXMLHttpRequest(ScriptExecutionContext*, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber);
@@ -254,7 +254,7 @@ private:
     static void continueAfterXFrameOptionsDeniedImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
     static void continueWithPolicyDownloadImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
     static void continueWithPolicyIgnoreImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
-    static void didReceiveContentLengthImpl(InstrumentingAgents*, unsigned long identifier, int dataLength, int encodedDataLength);
+    static void didReceiveDataImpl(InstrumentingAgents*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength);
     static void didFinishLoadingImpl(InstrumentingAgents*, unsigned long identifier, DocumentLoader*, double finishTime);
     static void didFailLoadingImpl(InstrumentingAgents*, unsigned long identifier, DocumentLoader*, const ResourceError&);
     static void resourceRetrievedByXMLHttpRequestImpl(InstrumentingAgents*, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber);
@@ -764,11 +764,11 @@ inline void InspectorInstrumentation::continueWithPolicyIgnore(Frame* frame, Doc
 #endif
 }
 
-inline void InspectorInstrumentation::didReceiveContentLength(Frame* frame, unsigned long identifier, int dataLength, int encodedDataLength)
+inline void InspectorInstrumentation::didReceiveData(Frame* frame, unsigned long identifier, const char* data, int dataLength, int encodedDataLength)
 {
 #if ENABLE(INSPECTOR)
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        didReceiveContentLengthImpl(instrumentingAgents, identifier, dataLength, encodedDataLength);
+        didReceiveDataImpl(instrumentingAgents, identifier, data, dataLength, encodedDataLength);
 #endif
 }
 
index 169ed66c1f4cffc14057c78c4497c4d33ac390f4..cc53d1bf6d1f6ed351c781ff48a798b8adfb8712 100644 (file)
@@ -251,18 +251,21 @@ void InspectorResourceAgent::didReceiveResponse(unsigned long identifier, Docume
         else if (m_loadingXHRSynchronously || m_resourcesData->resourceType(identifier) == InspectorPageAgent::XHRResource)
             type = InspectorPageAgent::XHRResource;
 
-        m_resourcesData->responseReceived(identifier, m_pageAgent->frameId(loader->frame()), response.url());
+        m_resourcesData->responseReceived(identifier, m_pageAgent->frameId(loader->frame()), response);
     }
     m_resourcesData->setResourceType(identifier, type);
     m_frontend->responseReceived(static_cast<int>(identifier), currentTime(), InspectorPageAgent::resourceTypeString(type), resourceResponse);
     // If we revalidated the resource and got Not modified, send content length following didReceiveResponse
-    // as there will be no calls to didReceiveContentLength from the network stack.
+    // as there will be no calls to didReceiveData from the network stack.
     if (cachedResourceSize && response.httpStatusCode() == 304)
-        didReceiveContentLength(identifier, cachedResourceSize, 0);
+        didReceiveData(identifier, 0, cachedResourceSize, 0);
 }
 
-void InspectorResourceAgent::didReceiveContentLength(unsigned long identifier, int dataLength, int encodedDataLength)
+void InspectorResourceAgent::didReceiveData(unsigned long identifier, const char* data, int dataLength, int encodedDataLength)
 {
+    if (data && m_resourcesData->resourceType(identifier) == InspectorPageAgent::OtherResource)
+        m_resourcesData->maybeAddResourceData(identifier, data, dataLength);
+
     m_frontend->dataReceived(static_cast<int>(identifier), currentTime(), dataLength, encodedDataLength);
 }
 
@@ -271,6 +274,8 @@ void InspectorResourceAgent::didFinishLoading(unsigned long identifier, Document
     if (m_resourcesData->resourceType(identifier) == InspectorPageAgent::DocumentResource)
         m_resourcesData->addResourceSharedBuffer(identifier, loader->frameLoader()->documentLoader()->mainResourceData(), loader->frame()->document()->inputEncoding());
 
+    m_resourcesData->maybeDecodeDataToContent(identifier);
+
     if (!finishTime)
         finishTime = currentTime();
 
@@ -297,7 +302,7 @@ void InspectorResourceAgent::setInitialScriptContent(unsigned long identifier, c
 
 void InspectorResourceAgent::setInitialXHRContent(unsigned long identifier, const String& sourceString)
 {
-    m_resourcesData->addResourceContent(identifier, sourceString);
+    m_resourcesData->setResourceContent(identifier, sourceString);
 }
 
 void InspectorResourceAgent::didReceiveXHRResponse(unsigned long identifier)
@@ -398,6 +403,12 @@ void InspectorResourceAgent::setBackgroundEventsCollectionEnabled(ErrorString*,
     return m_state->setBoolean(ResourceAgentState::backgroundEventsCollectionEnabled, enabled);
 }
 
+// called from Internals for layout test purposes.
+void InspectorResourceAgent::setResourcesDataSizeLimitsFromInternals(int maximumResourcesContentSize, int maximumSingleResourceContentSize)
+{
+    m_resourcesData->setResourcesDataSizeLimits(maximumResourcesContentSize, maximumSingleResourceContentSize);
+}
+
 void InspectorResourceAgent::enable(ErrorString*)
 {
     enable();
@@ -437,7 +448,7 @@ void InspectorResourceAgent::initializeBackgroundCollection()
 
 void InspectorResourceAgent::getResourceContent(ErrorString* errorString, unsigned long identifier, String* content, bool* base64Encoded)
 {
-    NetworkResourcesData::ResourceData* resourceData = m_resourcesData->data(identifier);
+    NetworkResourcesData::ResourceData const* resourceData = m_resourcesData->data(identifier);
     if (!resourceData) {
         *errorString = "No resource with given identifier found";
         return;
index b4410b375caf1d2e6fa62efe994caebb9ce19116..b802af43d6e49a1ee505543b9110ad4cb48ed9eb 100644 (file)
@@ -90,7 +90,7 @@ public:
     void willSendRequest(unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse);
     void markResourceAsCached(unsigned long identifier);
     void didReceiveResponse(unsigned long identifier, DocumentLoader* laoder, const ResourceResponse&);
-    void didReceiveContentLength(unsigned long identifier, int dataLength, int encodedDataLength);
+    void didReceiveData(unsigned long identifier, const char* data, int dataLength, int encodedDataLength);
     void didFinishLoading(unsigned long identifier, DocumentLoader*, double finishTime);
     void didFailLoading(unsigned long identifier, DocumentLoader*, const ResourceError&);
     void didLoadResourceFromMemoryCache(DocumentLoader*, const CachedResource*);
@@ -113,6 +113,9 @@ public:
     void isBackgroundEventsCollectionEnabled(ErrorString*, bool* enabled);
     void setBackgroundEventsCollectionEnabled(ErrorString*, bool enabled);
 
+    // called from Internals for layout test purposes.
+    void setResourcesDataSizeLimitsFromInternals(int maximumResourcesContentSize, int maximumSingleResourceContentSize);
+
     // Called from frontend
     void enable(ErrorString*);
     void disable(ErrorString*);
index 588d1eb404f7e69f089d31297b720a69d02aef9c..346b299fc169dcd1d0e5496fd57ac159ba27b686 100644 (file)
 #include "config.h"
 #include "NetworkResourcesData.h"
 
+#include "DOMImplementation.h"
+#include "SharedBuffer.h"
+#include "TextResourceDecoder.h"
+
 #if ENABLE(INSPECTOR)
 
 namespace {
 // 10MB
 static int maximumResourcesContentSize = 10 * 1000 * 1000;
+
+// 1MB
+static int maximumSingleResourceContentSize = 1000 * 1000;
 }
 
 namespace WebCore {
 
+
 // ResourceData
 NetworkResourcesData::ResourceData::ResourceData(unsigned long identifier, const String& loaderId)
     : m_identifier(identifier)
     , m_loaderId(loaderId)
-    , m_hasContent(false)
     , m_isContentPurged(false)
     , m_type(InspectorPageAgent::OtherResource)
 {
 }
 
-String NetworkResourcesData::ResourceData::content()
+void NetworkResourcesData::ResourceData::setContent(const String& content)
 {
-    return m_hasContent ? m_contentBuilder.toString() : String();
+    ASSERT(!hasData());
+    ASSERT(!hasContent());
+    m_content = content;
 }
 
-void NetworkResourcesData::ResourceData::appendContent(const String& content)
+unsigned NetworkResourcesData::ResourceData::purgeContent()
 {
-    m_contentBuilder.append(content);
-    m_hasContent = true;
+    unsigned result = 0;
+    if (hasData()) {
+        ASSERT(!hasContent());
+        result = m_dataBuffer->size();
+        m_dataBuffer = nullptr;
+    }
+
+    if (hasContent()) {
+        ASSERT(!hasData());
+        result = 2 * m_content.length();
+        m_content = String();
+    }
+    m_isContentPurged = true;
+    return result;
 }
 
-unsigned NetworkResourcesData::ResourceData::purgeContent()
+void NetworkResourcesData::ResourceData::createDecoder(const String& mimeType, const String& textEncodingName)
 {
-    unsigned length = m_contentBuilder.toStringPreserveCapacity().length();
-    m_contentBuilder.clear();
-    m_isContentPurged = true;
-    m_hasContent = false;
-    return length;
+    if (!textEncodingName.isEmpty())
+        m_decoder = TextResourceDecoder::create("text/plain", textEncodingName);
+    else if (mimeType == "text/plain")
+        m_decoder = TextResourceDecoder::create("text/plain", "ISO-8859-1");
+    else if (mimeType == "text/html")
+        m_decoder = TextResourceDecoder::create("text/html", "UTF-8");
+    else if (DOMImplementation::isXMLMIMEType(mimeType)) {
+        m_decoder = TextResourceDecoder::create("application/xml");
+        m_decoder->useLenientXMLDecoding();
+    }
+}
+
+int NetworkResourcesData::ResourceData::dataLength() const
+{
+    return m_dataBuffer ? m_dataBuffer->size() : 0;
+}
+
+void NetworkResourcesData::ResourceData::appendData(const char* data, int dataLength)
+{
+    ASSERT(!hasContent());
+    if (!m_dataBuffer)
+        m_dataBuffer = SharedBuffer::create(data, dataLength);
+    else
+        m_dataBuffer->append(data, dataLength);
+}
+
+int NetworkResourcesData::ResourceData::decodeDataToContent()
+{
+    ASSERT(!hasContent());
+    int dataLength = m_dataBuffer->size();
+    m_content = m_decoder->decode(m_dataBuffer->data(), m_dataBuffer->size());
+    m_dataBuffer = nullptr;
+    return 2 * m_content.length() - dataLength;
 }
 
 // NetworkResourcesData
 NetworkResourcesData::NetworkResourcesData()
     : m_contentSize(0)
+    , m_maximumResourcesContentSize(maximumResourcesContentSize)
+    , m_maximumSingleResourceContentSize(maximumSingleResourceContentSize)
 {
 }
 
@@ -85,13 +136,14 @@ void NetworkResourcesData::resourceCreated(unsigned long identifier, const Strin
     m_identifierToResourceDataMap.set(identifier, new ResourceData(identifier, loaderId));
 }
 
-void NetworkResourcesData::responseReceived(unsigned long identifier, const String& frameId, const String& url)
+void NetworkResourcesData::responseReceived(unsigned long identifier, const String& frameId, const ResourceResponse& response)
 {
     ResourceData* resourceData = m_identifierToResourceDataMap.get(identifier);
     if (!resourceData)
         return;
     resourceData->setFrameId(frameId);
-    resourceData->setUrl(url);
+    resourceData->setUrl(response.url());
+    resourceData->createDecoder(response.mimeType(), response.textEncodingName());
 }
 
 void NetworkResourcesData::setResourceType(unsigned long identifier, InspectorPageAgent::ResourceType type)
@@ -110,21 +162,54 @@ InspectorPageAgent::ResourceType NetworkResourcesData::resourceType(unsigned lon
     return resourceData->type();
 }
 
-void NetworkResourcesData::addResourceContent(unsigned long identifier, const String& content)
+void NetworkResourcesData::setResourceContent(unsigned long identifier, const String& content)
 {
     ResourceData* resourceData = m_identifierToResourceDataMap.get(identifier);
     if (!resourceData)
         return;
+    int dataLength = 2 * content.length();
+    if (dataLength > m_maximumSingleResourceContentSize)
+        return;
     if (resourceData->isContentPurged())
         return;
-    if (ensureFreeSpace(content.length()) && !resourceData->isContentPurged()) {
-        if (!resourceData->hasContent())
-            m_identifiersDeque.append(identifier);
-        resourceData->appendContent(content);
-        m_contentSize += content.length();
+    if (ensureFreeSpace(dataLength) && !resourceData->isContentPurged()) {
+        m_identifiersDeque.append(identifier);
+        resourceData->setContent(content);
+        m_contentSize += dataLength;
     }
 }
 
+void NetworkResourcesData::maybeAddResourceData(unsigned long identifier, const char* data, int dataLength)
+{
+    ResourceData* resourceData = m_identifierToResourceDataMap.get(identifier);
+    if (!resourceData)
+        return;
+    if (!resourceData->decoder())
+        return;
+    if (resourceData->dataLength() + dataLength > m_maximumSingleResourceContentSize)
+        m_contentSize -= resourceData->purgeContent();
+    if (resourceData->isContentPurged())
+        return;
+    if (ensureFreeSpace(dataLength) && !resourceData->isContentPurged()) {
+        m_identifiersDeque.append(identifier);
+        resourceData->appendData(data, dataLength);
+        m_contentSize += dataLength;
+    }
+}
+
+void NetworkResourcesData::maybeDecodeDataToContent(unsigned long identifier)
+{
+    ResourceData* resourceData = m_identifierToResourceDataMap.get(identifier);
+    if (!resourceData)
+        return;
+    if (!resourceData->hasData())
+        return;
+    m_contentSize += resourceData->decodeDataToContent();
+    int dataLength = 2 * resourceData->content().length();
+    if (dataLength > m_maximumSingleResourceContentSize)
+        m_contentSize -= resourceData->purgeContent();
+}
+
 void NetworkResourcesData::addCachedResource(unsigned long identifier, CachedResource* cachedResource)
 {
     if (!m_identifierToResourceDataMap.contains(identifier))
@@ -143,7 +228,7 @@ void NetworkResourcesData::addResourceSharedBuffer(unsigned long identifier, Pas
     resourceData->setTextEncodingName(textEncodingName);
 }
 
-NetworkResourcesData::ResourceData* NetworkResourcesData::data(unsigned long identifier)
+NetworkResourcesData::ResourceData const* NetworkResourcesData::data(unsigned long identifier)
 {
     return m_identifierToResourceDataMap.get(identifier);
 }
@@ -151,6 +236,7 @@ NetworkResourcesData::ResourceData* NetworkResourcesData::data(unsigned long ide
 void NetworkResourcesData::clear(const String& preservedLoaderId)
 {
     m_identifiersDeque.clear();
+    m_contentSize = 0;
 
     ResourceDataMap preservedMap;
 
@@ -166,11 +252,19 @@ void NetworkResourcesData::clear(const String& preservedLoaderId)
     m_identifierToResourceDataMap.swap(preservedMap);
 }
 
+void NetworkResourcesData::setResourcesDataSizeLimits(int maximumResourcesContentSize, int maximumSingleResourceContentSize)
+{
+    clear();
+    m_maximumResourcesContentSize = maximumResourcesContentSize;
+    m_maximumSingleResourceContentSize = maximumSingleResourceContentSize;
+}
+
+
 void NetworkResourcesData::ensureNoDataForIdentifier(unsigned long identifier)
 {
     ResourceData* resourceData = m_identifierToResourceDataMap.get(identifier);
     if (resourceData) {
-        if (resourceData->hasContent())
+        if (resourceData->hasContent() || resourceData->hasData())
             m_contentSize -= resourceData->purgeContent();
         delete resourceData;
         m_identifierToResourceDataMap.remove(identifier);
@@ -179,10 +273,10 @@ void NetworkResourcesData::ensureNoDataForIdentifier(unsigned long identifier)
 
 bool NetworkResourcesData::ensureFreeSpace(int size)
 {
-    if (size > maximumResourcesContentSize)
+    if (size > m_maximumResourcesContentSize)
         return false;
 
-    while (size > maximumResourcesContentSize - m_contentSize) {
+    while (size > m_maximumResourcesContentSize - m_contentSize) {
         unsigned long identifier = m_identifiersDeque.takeFirst();
         ResourceData* resourceData = m_identifierToResourceDataMap.get(identifier);
         if (resourceData)
index 78cdbebfaa73f6818e802fa039baf9ec75c79a95..d547aa7911e69083de3894275b427ed83dd186d7 100644 (file)
@@ -31,7 +31,6 @@
 
 #include "CachedResourceHandle.h"
 #include "InspectorPageAgent.h"
-#include "SharedBuffer.h"
 
 #include <wtf/Deque.h>
 #include <wtf/HashMap.h>
 
 namespace WebCore {
 
-class SharedBuffer;
 class CachedResource;
+class SharedBuffer;
+class TextResourceDecoder;
 
 class NetworkResourcesData {
 public:
     class ResourceData {
+        friend class NetworkResourcesData;
     public:
         ResourceData(unsigned long identifier, const String& loaderId);
 
@@ -61,38 +62,47 @@ public:
         String url() const { return m_url; }
         void setUrl(const String& url) { m_url = url; }
 
-        bool hasContent() const { return m_hasContent; }
-        String content();
-        void appendContent(const String&);
+        bool hasContent() const { return !m_content.isNull(); }
+        String content() const { return m_content; }
+        void setContent(const String&);
 
         bool isContentPurged() const { return m_isContentPurged; }
-        void setIsContentPurged(bool isContentPurged) { m_isContentPurged = isContentPurged; }
         unsigned purgeContent();
 
         InspectorPageAgent::ResourceType type() const { return m_type; }
         void setType(InspectorPageAgent::ResourceType type) { m_type = type; }
 
-        PassRefPtr<SharedBuffer> buffer() const { return m_buffer; }
-        void setBuffer(PassRefPtr<SharedBuffer> buffer) { m_buffer = buffer; }
-
         String textEncodingName() const { return m_textEncodingName; }
         void setTextEncodingName(const String& textEncodingName) { m_textEncodingName = textEncodingName; }
 
+        TextResourceDecoder* decoder() const { return m_decoder.get(); }
+        void createDecoder(const String& mimeType, const String& textEncodingName);
+
+        PassRefPtr<SharedBuffer> buffer() const { return m_buffer; }
+        void setBuffer(PassRefPtr<SharedBuffer> buffer) { m_buffer = buffer; }
+
         CachedResource* cachedResource() const { return m_cachedResource.get(); }
         void setCachedResource(CachedResource* cachedResource) { m_cachedResource = cachedResource; }
 
     private:
+        bool hasData() const { return m_dataBuffer; }
+        int dataLength() const;
+        void appendData(const char* data, int dataLength);
+        int decodeDataToContent();
+
         unsigned long m_identifier;
         String m_loaderId;
         String m_frameId;
         String m_url;
-        bool m_hasContent;
-        StringBuilder m_contentBuilder;
+        String m_content;
+        RefPtr<SharedBuffer> m_dataBuffer;
         bool m_isContentPurged;
         InspectorPageAgent::ResourceType m_type;
 
-        RefPtr<SharedBuffer> m_buffer;
         String m_textEncodingName;
+        RefPtr<TextResourceDecoder> m_decoder;
+
+        RefPtr<SharedBuffer> m_buffer;
         CachedResourceHandle<CachedResource> m_cachedResource;
     };
 
@@ -101,15 +111,19 @@ public:
     ~NetworkResourcesData();
 
     void resourceCreated(unsigned long identifier, const String& loaderId);
-    void responseReceived(unsigned long identifier, const String& frameId, const String& url);
+    void responseReceived(unsigned long identifier, const String& frameId, const ResourceResponse&);
     void setResourceType(unsigned long identifier, InspectorPageAgent::ResourceType);
     InspectorPageAgent::ResourceType resourceType(unsigned long identifier);
-    void addResourceContent(unsigned long identifier, const String& content);
+    void setResourceContent(unsigned long identifier, const String& content);
+    void maybeAddResourceData(unsigned long identifier, const char* data, int dataLength);
+    void maybeDecodeDataToContent(unsigned long identifier);
     void addCachedResource(unsigned long identifier, CachedResource*);
     void addResourceSharedBuffer(unsigned long identifier, PassRefPtr<SharedBuffer>, const String& textEncodingName);
-    ResourceData* data(unsigned long identifier);
+    ResourceData const* data(unsigned long identifier);
     void clear(const String& preservedLoaderId = String());
 
+    void setResourcesDataSizeLimits(int maximumResourcesContentSize, int maximumSingleResourceContentSize);
+
 private:
     void ensureNoDataForIdentifier(unsigned long identifier);
     bool ensureFreeSpace(int size);
@@ -119,6 +133,8 @@ private:
     typedef HashMap<unsigned long, ResourceData*> ResourceDataMap;
     ResourceDataMap m_identifierToResourceDataMap;
     int m_contentSize;
+    int m_maximumResourcesContentSize;
+    int m_maximumSingleResourceContentSize;
 };
 
 } // namespace WebCore
index ec1d148d5ad0af3213ffff2673276f803aa8c673..a104035aa9c451008d55ed46577af31fb48d3975 100644 (file)
@@ -782,6 +782,11 @@ WebInspector.Resource.prototype = {
         return this._content;
     },
 
+    get contentEncoded()
+    {
+        return this._contentEncoded;
+    },
+
     get contentTimestamp()
     {
         return this._contentTimestamp;
index 3fbce479353176b61c62d7926f1022bde89f421b..58c617fb6d64907c67acc8a3d26ee6cec8ac4e74 100644 (file)
@@ -39,7 +39,7 @@ WebInspector.ResourcePreviewView.prototype = {
     {
         if (!this.resource.content) {
             if (!this._emptyView) {
-                this._emptyView = new WebInspector.EmptyView(WebInspector.UIString("This request has no preview available."));
+                this._emptyView = this._createEmptyView();
                 this._emptyView.show(this.element);
             }
         } else {
@@ -47,13 +47,18 @@ WebInspector.ResourcePreviewView.prototype = {
                 this._emptyView.detach();
                 delete this._emptyView;
             }
-            if (!this._view)
-                this._view = this._createInnerView();
-            this._view.show(this.element);
+            if (!this._previewView)
+                this._previewView = this._createPreviewView();
+            this._previewView.show(this.element);
         }
     },
 
-    _createInnerView: function()
+    _createEmptyView: function()
+    {
+        return new WebInspector.EmptyView(WebInspector.UIString("This request has no preview available."));
+    },
+    
+    _createPreviewView: function()
     {
         if (this.resource.hasErrorStatusCode() && this.resource.content)
             return new WebInspector.ResourceHTMLView(this.resource);
@@ -66,6 +71,9 @@ WebInspector.ResourcePreviewView.prototype = {
 
         if (this._responseView.sourceView)
             return this._responseView.sourceView;
+        
+        if (this.resource.category === WebInspector.resourceCategories.other)
+            return this._createEmptyView();
 
         return WebInspector.ResourceView.nonSourceViewForResource(this.resource);
     }
index 7226f6732e33e06182f0702e4cec0b1436cb778f..106e8b125399394909e86692e182fc0345ec81d5 100644 (file)
@@ -51,6 +51,8 @@ WebInspector.ResourceView.hasTextContent = function(resource)
     case WebInspector.resourceCategories.xhr:
     case WebInspector.resourceCategories.stylesheets:
         return true;
+    case WebInspector.resourceCategories.other:
+        return resource.content && !resource.contentEncoded;
     default:
         return false;
     }
index eff63996daa1fea8ac51c12d2a96eaed0692469b..4656d2c4aca1cb2edc9cc231bff2c79e364b1588 100644 (file)
@@ -229,7 +229,7 @@ void DocumentThreadableLoader::didReceiveData(SubresourceLoader* loader, const c
 
 #if ENABLE(INSPECTOR)
     if (m_preflightRequestIdentifier)
-        InspectorInstrumentation::didReceiveContentLength(m_document->frame(), m_preflightRequestIdentifier, 0, dataLength);
+        InspectorInstrumentation::didReceiveData(m_document->frame(), m_preflightRequestIdentifier, 0, 0, dataLength);
 #endif
 
     // Preflight data should be invisible to clients.
index e2f283f27d87598fcbe859134b33ec51aa77a765..960cafeff93c862e973ba6332610a8831b262f44 100644 (file)
@@ -1382,7 +1382,7 @@ bool FrameLoader::willLoadMediaElementURL(KURL& url)
     unsigned long identifier;
     ResourceError error;
     requestFromDelegate(request, identifier, error);
-    notifier()->sendRemainingDelegateMessages(m_documentLoader.get(), identifier, ResourceResponse(url, String(), -1, String(), String()), -1, -1, error);
+    notifier()->sendRemainingDelegateMessages(m_documentLoader.get(), identifier, ResourceResponse(url, String(), -1, String(), String()), 0, -1, -1, error);
 
     url = request.url();
 
@@ -1780,7 +1780,7 @@ void FrameLoader::commitProvisionalLoad()
             // FIXME: If we get a resource with more than 2B bytes, this code won't do the right thing.
             // However, with today's computers and networking speeds, this won't happen in practice.
             // Could be an issue with a giant local file.
-            notifier()->sendRemainingDelegateMessages(m_documentLoader.get(), identifier, response, static_cast<int>(response.expectedContentLength()), 0, error);
+            notifier()->sendRemainingDelegateMessages(m_documentLoader.get(), identifier, response, 0, static_cast<int>(response.expectedContentLength()), 0, error);
         }
         
         pageCache()->remove(history()->currentItem());
@@ -2590,7 +2590,7 @@ unsigned long FrameLoader::loadResourceSynchronously(const ResourceRequest& requ
 #endif
     }
     int encodedDataLength = response.resourceLoadInfo() ? static_cast<int>(response.resourceLoadInfo()->encodedDataLength) : -1;
-    notifier()->sendRemainingDelegateMessages(m_documentLoader.get(), identifier, response, data.size(), encodedDataLength, error);
+    notifier()->sendRemainingDelegateMessages(m_documentLoader.get(), identifier, response, data.data(), data.size(), encodedDataLength, error);
     return identifier;
 }
 
@@ -2883,7 +2883,7 @@ void FrameLoader::loadedResourceFromMemoryCache(const CachedResource* resource)
     ResourceError error;
     requestFromDelegate(request, identifier, error);
     InspectorInstrumentation::markResourceAsCached(page, identifier);
-    notifier()->sendRemainingDelegateMessages(m_documentLoader.get(), identifier, resource->response(), resource->encodedSize(), 0, error);
+    notifier()->sendRemainingDelegateMessages(m_documentLoader.get(), identifier, resource->response(), 0, resource->encodedSize(), 0, error);
 }
 
 void FrameLoader::applyUserAgent(ResourceRequest& request)
index a4163ca4f4560dddd81d7afbd24a639b6231b1a7..96bd5f6c7f80940ad40d0afba0e95d18294c2a80 100644 (file)
@@ -79,7 +79,7 @@ void ResourceLoadNotifier::didReceiveData(ResourceLoader* loader, const char* da
     if (Page* page = m_frame->page())
         page->progress()->incrementProgress(loader->identifier(), data, dataLength);
 
-    dispatchDidReceiveContentLength(loader->documentLoader(), loader->identifier(), dataLength, encodedDataLength);
+    dispatchDidReceiveData(loader->documentLoader(), loader->identifier(), data, dataLength, encodedDataLength);
 }
 
 void ResourceLoadNotifier::didFinishLoad(ResourceLoader* loader, double finishTime)
@@ -130,11 +130,11 @@ void ResourceLoadNotifier::dispatchDidReceiveResponse(DocumentLoader* loader, un
     InspectorInstrumentation::didReceiveResourceResponse(cookie, identifier, loader, r);
 }
 
-void ResourceLoadNotifier::dispatchDidReceiveContentLength(DocumentLoader* loader, unsigned long identifier, int dataLength, int encodedDataLength)
+void ResourceLoadNotifier::dispatchDidReceiveData(DocumentLoader* loader, unsigned long identifier, const char* data, int dataLength, int encodedDataLength)
 {
     m_frame->loader()->client()->dispatchDidReceiveContentLength(loader, identifier, dataLength);
 
-    InspectorInstrumentation::didReceiveContentLength(m_frame, identifier, dataLength, encodedDataLength);
+    InspectorInstrumentation::didReceiveData(m_frame, identifier, data, dataLength, encodedDataLength);
 }
 
 void ResourceLoadNotifier::dispatchDidFinishLoading(DocumentLoader* loader, unsigned long identifier, double finishTime)
@@ -152,13 +152,13 @@ void ResourceLoadNotifier::dispatchTransferLoadingResourceFromPage(unsigned long
     oldPage->progress()->completeProgress(identifier);
 }
 
-void ResourceLoadNotifier::sendRemainingDelegateMessages(DocumentLoader* loader, unsigned long identifier, const ResourceResponse& response, int dataLength, int encodedDataLength, const ResourceError& error)
+void ResourceLoadNotifier::sendRemainingDelegateMessages(DocumentLoader* loader, unsigned long identifier, const ResourceResponse& response, const char* data, int dataLength, int encodedDataLength, const ResourceError& error)
 {
     if (!response.isNull())
         dispatchDidReceiveResponse(loader, identifier, response);
 
     if (dataLength > 0)
-        dispatchDidReceiveContentLength(loader, identifier, dataLength, encodedDataLength);
+        dispatchDidReceiveData(loader, identifier, data, dataLength, encodedDataLength);
 
     if (error.isNull())
         dispatchDidFinishLoading(loader, identifier, 0);
index dafd6194ccec83245e28a2cb8abb896a252bc035..6a9296c312b58d2df77dea55bf6b1ba64bcadce4 100644 (file)
@@ -60,11 +60,11 @@ public:
     void assignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader*, const ResourceRequest&);
     void dispatchWillSendRequest(DocumentLoader*, unsigned long identifier, ResourceRequest&, const ResourceResponse& redirectResponse);
     void dispatchDidReceiveResponse(DocumentLoader*, unsigned long identifier, const ResourceResponse&);
-    void dispatchDidReceiveContentLength(DocumentLoader*, unsigned long identifier, int dataLength, int encodedDataLength);
+    void dispatchDidReceiveData(DocumentLoader*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength);
     void dispatchDidFinishLoading(DocumentLoader*, unsigned long identifier, double finishTime);
     void dispatchTransferLoadingResourceFromPage(unsigned long, DocumentLoader*, const ResourceRequest&, Page*);
 
-    void sendRemainingDelegateMessages(DocumentLoader*, unsigned long identifier, const ResourceResponse&, int dataLength, int encodedDataLength, const ResourceError&);
+    void sendRemainingDelegateMessages(DocumentLoader*, unsigned long identifier, const ResourceResponse&, const char* data, int dataLength, int encodedDataLength, const ResourceError&);
 
 private:
     Frame* m_frame;
index 45b184cff997022a0a72e47fdb38d89ea9923442..64f7b685dd9c8fd762720cc2e7a2d65c9343f597 100644 (file)
@@ -571,7 +571,7 @@ void ApplicationCacheGroup::didReceiveData(ResourceHandle* handle, const char* d
     UNUSED_PARAM(encodedDataLength);
 
 #if ENABLE(INSPECTOR)
-    InspectorInstrumentation::didReceiveContentLength(m_frame, m_currentResourceIdentifier, length, 0);
+    InspectorInstrumentation::didReceiveData(m_frame, m_currentResourceIdentifier, 0, length, 0);
 #endif
 
     if (handle == m_manifestHandle) {
index 86cdcbeb90f0f2c36eb9c4d5edbf4bf32c9c8a1f..fb95e1b96e83ab3f5f165d0a1f69bc4fcf3d80a7 100644 (file)
@@ -30,6 +30,8 @@
 #include "Document.h"
 #include "Element.h"
 #include "ExceptionCode.h"
+#include "InspectorController.h"
+#include "Page.h"
 #include "RenderTreeAsText.h"
 #include "ShadowContentElement.h"
 #include "ShadowRoot.h"
@@ -123,4 +125,15 @@ String Internals::shadowPseudoId(Element* element, ExceptionCode& ec)
     return element->shadowPseudoId().string();
 }
 
+#if ENABLE(INSPECTOR)
+void Internals::setInspectorResourcesDataSizeLimits(Document* document, int maximumResourcesContentSize, int maximumSingleResourceContentSize, ExceptionCode& ec)
+{
+    if (!document || !document->page() || !document->page()->inspectorController()) {
+        ec = INVALID_ACCESS_ERR;
+        return;
+    }
+    document->page()->inspectorController()->setResourcesDataSizeLimitsFromInternals(maximumResourcesContentSize, maximumSingleResourceContentSize);
+}
+#endif
+
 }
index e677e32f089dcca718b242bab70581d00f566be4..150ab8ec4bf0891701be1d38e1d2bbb124213b55 100644 (file)
@@ -53,6 +53,10 @@ public:
     String shadowPseudoId(Element*, ExceptionCode&);
     PassRefPtr<Element> createShadowContentElement(Document*, ExceptionCode&);
 
+#if ENABLE(INSPECTOR)
+    void setInspectorResourcesDataSizeLimits(Document*, int maximumResourcesContentSize, int maximumSingleResourceContentSize, ExceptionCode&);
+#endif
+
 private:
     Internals();
 };
index b82871e5242f4f4bc9ee7584dd5979d7e0da2346..2cca57fe2fd7bb81b0026392394baa4fd7ec09c6 100644 (file)
@@ -35,6 +35,8 @@ module window {
         void removeShadowRoot(in Element host) raises (DOMException);
         DOMString shadowPseudoId(in Element element) raises (DOMException);
         Element createShadowContentElement(in Document document) raises(DOMException);
+
+        [Conditional=INSPECTOR] void setInspectorResourcesDataSizeLimits(in Document document, in long maximumResourcesContentSize, in long maximumSingleResourceContentSize) raises(DOMException);
     };
 }
 
index a30d21943111cd1e3ba8a5924f65ee695f8151c8..fa9e517c6c40cfba487c4a2ee40dbd51558c87e0 100644 (file)
@@ -1,3 +1,15 @@
+2011-07-05  Vsevolod Vlasov  <vsevik@chromium.org>
+
+        Web Inspector: Show content for plugin requests in network panel.
+        https://bugs.webkit.org/show_bug.cgi?id=30080
+
+        Added win symbols for new window.internals methods.
+
+        Reviewed by Pavel Feldman.
+
+        * win/WebKit2.def:
+        * win/WebKit2CFLite.def:
+
 2011-07-04  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r90373.
index 668755d13d3fb282d23fc2ca4571fafec71e507f..1967fb0db3d53df0aa3db00dfaf3843f1d815ee9 100644 (file)
@@ -144,8 +144,10 @@ EXPORTS
         ?getCachedDOMStructure@WebCore@@YAPAVStructure@JSC@@PAVJSDOMGlobalObject@1@PBUClassInfo@3@@Z
         ?isPreloaded@CachedResourceLoader@WebCore@@QBE_NABVString@WTF@@@Z
         ?jsStringSlowCase@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@AAV?$HashMap@PAVStringImpl@WTF@@V?$Weak@VJSString@JSC@@@JSC@@UStringHash@2@U?$HashTraits@PAVStringImpl@WTF@@@2@U?$HashTraits@V?$Weak@VJSString@JSC@@@JSC@@@2@@WTF@@PAVStringImpl@6@@Z
+        ?page@Document@WebCore@@QBEPAVPage@2@XZ
         ?removeShadowRoot@Element@WebCore@@QAEXXZ
         ?setDOMException@WebCore@@YAXPAVExecState@JSC@@H@Z
+        ?setResourcesDataSizeLimitsFromInternals@InspectorController@WebCore@@QAEXHH@Z
         ?shadowRoot@Element@WebCore@@QBEPAVShadowRoot@2@XZ
         ?toDocument@WebCore@@YAPAVDocument@1@VJSValue@JSC@@@Z
         ?toElement@WebCore@@YAPAVElement@1@VJSValue@JSC@@@Z
index 1871ce72f32f1935422d58496a0b28425bd1b1f0..a1876dd77cb744f4803817219fe75cb9fbd5143d 100644 (file)
@@ -137,8 +137,10 @@ EXPORTS
         ?getCachedDOMStructure@WebCore@@YAPAVStructure@JSC@@PAVJSDOMGlobalObject@1@PBUClassInfo@3@@Z
         ?isPreloaded@CachedResourceLoader@WebCore@@QBE_NABVString@WTF@@@Z
         ?jsStringSlowCase@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@AAV?$HashMap@PAVStringImpl@WTF@@V?$Weak@VJSString@JSC@@@JSC@@UStringHash@2@U?$HashTraits@PAVStringImpl@WTF@@@2@U?$HashTraits@V?$Weak@VJSString@JSC@@@JSC@@@2@@WTF@@PAVStringImpl@6@@Z
+        ?page@Document@WebCore@@QBEPAVPage@2@XZ
         ?removeShadowRoot@Element@WebCore@@QAEXXZ
         ?setDOMException@WebCore@@YAXPAVExecState@JSC@@H@Z
+        ?setResourcesDataSizeLimitsFromInternals@InspectorController@WebCore@@QAEXHH@Z
         ?shadowRoot@Element@WebCore@@QBEPAVShadowRoot@2@XZ
         ?toDocument@WebCore@@YAPAVDocument@1@VJSValue@JSC@@@Z
         ?toElement@WebCore@@YAPAVElement@1@VJSValue@JSC@@@Z
index 16842deea85bc4f9755e4a1841433147416f0876..bc920a9723d163d5400273a8d9be95cb2e7a4fbc 100644 (file)
@@ -36,6 +36,7 @@ _ZN7WebCore13createWrapperEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_4NodeE;
 _ZN7WebCore15setDOMExceptionEPN3JSC9ExecStateEi;
 _ZN7WebCore16jsStringSlowCaseEPN3JSC9ExecStateERN3WTF7HashMapIPNS3_10StringImplENS0_4WeakINS0_8JSStringEEENS3_10StringHashENS3_10HashTraitsIS6_EENSB_IS9_EEEES6_;
 _ZN7WebCore17cacheDOMStructureEPNS_17JSDOMGlobalObjectEPN3JSC9StructureEPKNS2_9ClassInfoE;
+_ZN7WebCore19InspectorController39setResourcesDataSizeLimitsFromInternalsEii;
 _ZN7WebCore20ShadowContentElement6createEPNS_8DocumentE;
 _ZN7WebCore21getCachedDOMStructureEPNS_17JSDOMGlobalObjectEPKN3JSC9ClassInfoE;
 _ZN7WebCore22externalRepresentationEPNS_7ElementEj;
@@ -50,6 +51,7 @@ _ZN7WebCore9toElementEN3JSC7JSValueE;
 _ZNK7WebCore20CachedResourceLoader11isPreloadedERKN3WTF6StringE;
 _ZNK7WebCore6JSNode21pushEventHandlerScopeEPN3JSC9ExecStateEPNS1_14ScopeChainNodeE;
 _ZNK7WebCore7Element10shadowRootEv;
+_ZNK7WebCore8Document4pageEv;
 local:
 _Z*;
 cti*;