REGRESSION (r207754): LayoutTest http/tests/security/svg-image-with-css-cross-domain...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 29 Oct 2016 13:46:52 +0000 (13:46 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 29 Oct 2016 13:46:52 +0000 (13:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=163922

Patch by Youenn Fablet <youenn@apple.com> on 2016-10-29
Reviewed by Alex Christensen.

Source/WebCore:

Test: http/tests/security/cached-svg-image-with-css-cross-domain.html

Raw data was not copied in cloned CachedCSSStyleSheet while it is used by some of its clients.
Updated CachedCSSStyleSheet and CachedImage cloning to copy its raw data.

* loader/cache/CachedCSSStyleSheet.cpp:
(WebCore::CachedCSSStyleSheet::setBodyDataFrom):
* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::setBodyDataFrom):
* loader/cache/CachedResource.h:
(WebCore::CachedResource::mayTryReplaceEncodedData):

LayoutTests:

* http/tests/security/cached-svg-image-with-css-cross-domain-expected.html: Added.
* http/tests/security/cached-svg-image-with-css-cross-domain.html: Added.
* platform/mac/TestExpectations:

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

LayoutTests/ChangeLog
LayoutTests/http/tests/security/cached-svg-image-with-css-cross-domain-expected.html [new file with mode: 0644]
LayoutTests/http/tests/security/cached-svg-image-with-css-cross-domain.html [new file with mode: 0644]
LayoutTests/platform/mac/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp
Source/WebCore/loader/cache/CachedImage.cpp
Source/WebCore/loader/cache/CachedResource.h

index 2af1e19..0c5b39e 100644 (file)
@@ -1,5 +1,16 @@
 2016-10-29  Youenn Fablet  <youenn@apple.com>
 
+        REGRESSION (r207754): LayoutTest http/tests/security/svg-image-with-css-cross-domain.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=163922
+
+        Reviewed by Alex Christensen.
+
+        * http/tests/security/cached-svg-image-with-css-cross-domain-expected.html: Added.
+        * http/tests/security/cached-svg-image-with-css-cross-domain.html: Added.
+        * platform/mac/TestExpectations:
+
+2016-10-29  Youenn Fablet  <youenn@apple.com>
+
         REGRESSION (Safari 10 / r189445): WKWebView and WebView no longer allow async XMLHttpRequest timeout to exceed 60 seconds
         https://bugs.webkit.org/show_bug.cgi?id=163814
         <rdar://problem/28917420>
diff --git a/LayoutTests/http/tests/security/cached-svg-image-with-css-cross-domain-expected.html b/LayoutTests/http/tests/security/cached-svg-image-with-css-cross-domain-expected.html
new file mode 100644 (file)
index 0000000..04bdd56
--- /dev/null
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <link rel="stylesheet" type="text/css" href="svg-image-with-css-cross-domain.css"/>
+  </head>
+  <body>
+    <h1>WebKit bug</h1>
+    <h3>SVG circle with different-origin CSS. Ensure reuse caching over different origins work</h3>
+    <p>Expected: 2 orange circles.</p>
+    <p>
+      <span class="image">
+        <svg height="68" width="68" viewBox="-34 -34 68 68">
+          <circle cx="0" cy="0" r="24" stroke="red" stroke-width="2" fill="orange" />
+        </svg> 
+      </span>
+    </p>
+    <p>
+      <span class="image">
+        <svg height="68" width="68" viewBox="-34 -34 68 68">
+          <circle cx="0" cy="0" r="24" stroke="red" stroke-width="2" fill="orange" />
+        </svg> 
+      </span>
+    </p>
+  </body>
+</html>
diff --git a/LayoutTests/http/tests/security/cached-svg-image-with-css-cross-domain.html b/LayoutTests/http/tests/security/cached-svg-image-with-css-cross-domain.html
new file mode 100644 (file)
index 0000000..941cdf7
--- /dev/null
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <link rel="stylesheet" type="text/css" href="svg-image-with-css-cross-domain.css"/>
+  </head>
+   <body>
+    <h1>WebKit bug</h1>
+    <h3>SVG circle with different-origin CSS. Ensure reuse caching over different origins work</h3>
+    <p>Expected: 2 orange circles.</p>
+    <script>
+function onFirstFrameLoaded()
+{
+    document.getElementById("frame2").innerHTML =
+        '<iframe src="resources/image-with-css-cross-domain.svg" width="68" height="68" sandbox="" onload="onSecondFrameLoaded()"></iframe>';
+}
+
+function onSecondFrameLoaded()
+{
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+if (window.testRunner)
+    testRunner.waitUntilDone();
+    </script>
+    <p id="frame1">
+      <iframe src="resources/image-with-css-cross-domain.svg" width="68" height="68" onload="onFirstFrameLoaded()"></iframe>
+    </p>
+    <p id="frame2">
+    </p>
+  </body>
+</html>
index 8f1832d..d298328 100644 (file)
@@ -1456,7 +1456,5 @@ webkit.org/b/163307 [ Debug ] loader/stateobjects/pushstate-size.html [ Skip ]
 webkit.org/b/163307 [ Debug ] loader/stateobjects/replacestate-size-iframe.html [ Skip ]
 webkit.org/b/163307 [ Debug ] loader/stateobjects/replacestate-size.html [ Skip ]
 
-webkit.org/b/163922 http/tests/security/svg-image-with-css-cross-domain.html [ Pass ImageOnlyFailure ]
-
 webkit.org/b/164088 [ Yosemite ] media/modern-media-controls/scrubber-support/scrubber-support-click.html [ Skip ]
 webkit.org/b/164088 [ Yosemite ] media/modern-media-controls/scrubber-support/scrubber-support-drag.html [ Skip ]
index e52eedc..a5e6c53 100644 (file)
@@ -1,5 +1,24 @@
 2016-10-29  Youenn Fablet  <youenn@apple.com>
 
+        REGRESSION (r207754): LayoutTest http/tests/security/svg-image-with-css-cross-domain.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=163922
+
+        Reviewed by Alex Christensen.
+
+        Test: http/tests/security/cached-svg-image-with-css-cross-domain.html
+
+        Raw data was not copied in cloned CachedCSSStyleSheet while it is used by some of its clients.
+        Updated CachedCSSStyleSheet and CachedImage cloning to copy its raw data.
+
+        * loader/cache/CachedCSSStyleSheet.cpp:
+        (WebCore::CachedCSSStyleSheet::setBodyDataFrom):
+        * loader/cache/CachedImage.cpp:
+        (WebCore::CachedImage::setBodyDataFrom):
+        * loader/cache/CachedResource.h:
+        (WebCore::CachedResource::mayTryReplaceEncodedData):
+
+2016-10-29  Youenn Fablet  <youenn@apple.com>
+
         REGRESSION (Safari 10 / r189445): WKWebView and WebView no longer allow async XMLHttpRequest timeout to exceed 60 seconds
         https://bugs.webkit.org/show_bug.cgi?id=163814
         <rdar://problem/28917420>
index dac425d..8bf0691 100644 (file)
@@ -92,6 +92,8 @@ void CachedCSSStyleSheet::setBodyDataFrom(const CachedResource& resource)
     ASSERT(resource.type() == type());
     const CachedCSSStyleSheet& sheet = static_cast<const CachedCSSStyleSheet&>(resource);
 
+    CachedResource::setBodyDataFrom(resource);
+
     m_decoder = sheet.m_decoder;
     m_decodedSheetText = sheet.m_decodedSheetText;
     if (sheet.m_parsedStyleSheetCache)
index 790a6cd..1ddefe3 100644 (file)
@@ -96,6 +96,8 @@ void CachedImage::setBodyDataFrom(const CachedResource& resource)
     ASSERT(resource.type() == type());
     const CachedImage& image = static_cast<const CachedImage&>(resource);
 
+    CachedResource::setBodyDataFrom(resource);
+
     m_image = image.m_image;
 
     if (m_image && is<SVGImage>(*m_image))
index 15c3803..8468953 100644 (file)
@@ -282,6 +282,8 @@ protected:
 
     virtual void didReplaceSharedBufferContents() { }
 
+    virtual void setBodyDataFrom(const CachedResource&);
+
     // FIXME: Make the rest of these data members private and use functions in derived classes instead.
     HashCountedSet<CachedResourceClient*> m_clients;
     ResourceRequest m_resourceRequest;
@@ -301,7 +303,6 @@ private:
 
     virtual void checkNotify();
     virtual bool mayTryReplaceEncodedData() const { return false; }
-    virtual void setBodyDataFrom(const CachedResource&);
 
     std::chrono::microseconds freshnessLifetime(const ResourceResponse&) const;