REGRESSION (173394): Support for webcam is broken
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 6 Dec 2014 10:39:51 +0000 (10:39 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 6 Dec 2014 10:39:51 +0000 (10:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=139313

Reviewed by Alexey Proskuryakov.

Source/WebKit2:

* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::didReceiveResponseAsync):

    Don't buffer when handling multipart/x-mixed-replace. Multiple calls to didReceiveResponseAsync break assumptions.

LayoutTests:

We had no coverage for actually rendering multipart content.

* http/tests/multipart/multipart-image-expected.html: Added.
* http/tests/multipart/multipart-image.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/http/tests/multipart/multipart-image-expected.html [new file with mode: 0644]
LayoutTests/http/tests/multipart/multipart-image.html [new file with mode: 0644]
Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp

index 0240322..b43978f 100644 (file)
@@ -1,3 +1,15 @@
+2014-12-05  Antti Koivisto  <antti@apple.com>
+
+        REGRESSION (173394): Support for webcam is broken
+        https://bugs.webkit.org/show_bug.cgi?id=139313
+
+        Reviewed by Alexey Proskuryakov.
+
+        We had no coverage for actually rendering multipart content.
+
+        * http/tests/multipart/multipart-image-expected.html: Added.
+        * http/tests/multipart/multipart-image.html: Added.
+
 2014-12-05  Chris Fleizach  <cfleizach@apple.com>
 
         AX: I cannot activate links on the mobile version of news.google.com
diff --git a/LayoutTests/http/tests/multipart/multipart-image-expected.html b/LayoutTests/http/tests/multipart/multipart-image-expected.html
new file mode 100644 (file)
index 0000000..8f735b7
--- /dev/null
@@ -0,0 +1 @@
+<img src="resources/abe.png">
diff --git a/LayoutTests/http/tests/multipart/multipart-image.html b/LayoutTests/http/tests/multipart/multipart-image.html
new file mode 100644 (file)
index 0000000..3288eac
--- /dev/null
@@ -0,0 +1,27 @@
+<html>
+<head>
+<script>
+if (window.testRunner)
+    testRunner.waitUntilDone();
+
+function loadedFirstPart()
+{
+    if (!window.testRunner)
+        return;
+    var count = 0;
+    setInterval(function() {
+        var img = document.getElementById("test");
+        /* width of abe.png */
+        if (img.offsetWidth == 76)
+            testRunner.notifyDone();
+        if (++count > 20)
+            testRunner.notifyDone();
+    }, 100);
+}
+</script>
+</head>
+<body>
+<!-- The last image is repeated due to a WebCore side bug that causes last part to not render. -->
+<img id=test src="resources/multipart.php?interval=0.1&img1=green-100x100.png&img2=abe.png&img3=abe.png" onload="loadedFirstPart()">
+</body>
+</html>
index 971fbff..04ae182 100644 (file)
@@ -1,3 +1,15 @@
+2014-12-05  Antti Koivisto  <antti@apple.com>
+
+        REGRESSION (173394): Support for webcam is broken
+        https://bugs.webkit.org/show_bug.cgi?id=139313
+
+        Reviewed by Alexey Proskuryakov.
+
+        * NetworkProcess/NetworkResourceLoader.cpp:
+        (WebKit::NetworkResourceLoader::didReceiveResponseAsync):
+
+            Don't buffer when handling multipart/x-mixed-replace. Multiple calls to didReceiveResponseAsync break assumptions.
+
 2014-12-05  Yongjun Zhang  <yongjun_zhang@apple.com>
 
         Add a delegate method for didReceiveServerRedirectForProvisionalLoadForFrame.
index d8c6fe6..89e12f7 100644 (file)
@@ -198,6 +198,10 @@ void NetworkResourceLoader::didReceiveResponseAsync(ResourceHandle* handle, cons
     if (isSynchronous())
         m_synchronousLoadData->response = response;
     else {
+        // For multipart/x-mixed-replace didReceiveResponseAsync gets called multiple times and buffering would require special handling.
+        if (response.isMultipart())
+            m_bufferedData = nullptr;
+
         if (!sendAbortingOnFailure(Messages::WebResourceLoader::DidReceiveResponse(response, m_parameters.isMainResource)))
             return;
     }