Title: [199611] trunk
Revision
199611
Author
[email protected]
Date
2016-04-15 14:28:12 -0700 (Fri, 15 Apr 2016)

Log Message

[CSS Font Loading] FontFace's promise may never be resolved/rejected if Content Security Policy blocks all the URLs
https://bugs.webkit.org/show_bug.cgi?id=156605

Reviewed by Daniel Bates.

Source/WebCore:

If all the fonts are blocked, we will create a FontFace with no FontFaceSources.
Loading such a FontFace should reject the promise.

Test: fast/text/font-loading-csp-block-all.html

* css/CSSFontFace.cpp:
(WebCore::CSSFontFace::pump):

LayoutTests:

* fast/text/font-loading-csp-block-all-expected.txt: Added.
* fast/text/font-loading-csp-block-all.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (199610 => 199611)


--- trunk/LayoutTests/ChangeLog	2016-04-15 21:09:21 UTC (rev 199610)
+++ trunk/LayoutTests/ChangeLog	2016-04-15 21:28:12 UTC (rev 199611)
@@ -1,5 +1,15 @@
 2016-04-15  Myles C. Maxfield  <[email protected]>
 
+        [CSS Font Loading] FontFace's promise may never be resolved/rejected if Content Security Policy blocks all the URLs
+        https://bugs.webkit.org/show_bug.cgi?id=156605
+
+        Reviewed by Daniel Bates.
+
+        * fast/text/font-loading-csp-block-all-expected.txt: Added.
+        * fast/text/font-loading-csp-block-all.html: Added.
+
+2016-04-15  Myles C. Maxfield  <[email protected]>
+
         ASSERT when loading github.com
         https://bugs.webkit.org/show_bug.cgi?id=156604
         <rdar://problem/19890634>

Added: trunk/LayoutTests/fast/text/font-loading-csp-block-all-expected.txt (0 => 199611)


--- trunk/LayoutTests/fast/text/font-loading-csp-block-all-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/text/font-loading-csp-block-all-expected.txt	2016-04-15 21:28:12 UTC (rev 199611)
@@ -0,0 +1,11 @@
+CONSOLE MESSAGE: Refused to load Ahem.woff because it does not appear in the font-src directive of the Content Security Policy.
+This test makes sure that the promise of a FontFace with no FontFaceSources gets rejected.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS rejectedException.code is rejectedException.NETWORK_ERR
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Property changes on: trunk/LayoutTests/fast/text/font-loading-csp-block-all-expected.txt
___________________________________________________________________

Added: svn:keywords

Added: svn:eol-style

Added: trunk/LayoutTests/fast/text/font-loading-csp-block-all.html (0 => 199611)


--- trunk/LayoutTests/fast/text/font-loading-csp-block-all.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/font-loading-csp-block-all.html	2016-04-15 21:28:12 UTC (rev 199611)
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="Content-Security-Policy" content="font-src 'none'">
+<script src=""
+</head>
+<body>
+<script>
+description("This test makes sure that the promise of a FontFace with no FontFaceSources gets rejected.")
+
+window.jsTestIsAsync = true;
+
+var face = new FontFace("WebFont", "url(../../resources/Ahem.woff) format('woff')", { });
+
+var rejectedException;
+var loading = face.load().then(function() {
+    testFailed("Promise should not resolve successfully.");
+    finishJSTest();
+}, function(e) {
+    rejectedException = e;
+    shouldBe("rejectedException.code", "rejectedException.NETWORK_ERR");
+    finishJSTest();
+});
+</script>
+<script src=""
+</body>

Modified: trunk/Source/WebCore/ChangeLog (199610 => 199611)


--- trunk/Source/WebCore/ChangeLog	2016-04-15 21:09:21 UTC (rev 199610)
+++ trunk/Source/WebCore/ChangeLog	2016-04-15 21:28:12 UTC (rev 199611)
@@ -1,3 +1,18 @@
+2016-04-15  Myles C. Maxfield  <[email protected]>
+
+        [CSS Font Loading] FontFace's promise may never be resolved/rejected if Content Security Policy blocks all the URLs
+        https://bugs.webkit.org/show_bug.cgi?id=156605
+
+        Reviewed by Daniel Bates.
+
+        If all the fonts are blocked, we will create a FontFace with no FontFaceSources.
+        Loading such a FontFace should reject the promise.
+
+        Test: fast/text/font-loading-csp-block-all.html
+
+        * css/CSSFontFace.cpp:
+        (WebCore::CSSFontFace::pump):
+
 2016-04-15  Alex Christensen  <[email protected]>
 
         [WinCairo] Another unreviewed build fix.

Modified: trunk/Source/WebCore/css/CSSFontFace.cpp (199610 => 199611)


--- trunk/Source/WebCore/css/CSSFontFace.cpp	2016-04-15 21:09:21 UTC (rev 199610)
+++ trunk/Source/WebCore/css/CSSFontFace.cpp	2016-04-15 21:28:12 UTC (rev 199611)
@@ -459,6 +459,8 @@
             break;
         }
     }
+    if (m_sources.isEmpty() && m_status == Status::Pending)
+        setStatus(Status::Loading);
     if (m_status == Status::Loading || m_status == Status::TimedOut)
         setStatus(Status::Failure);
     return m_sources.size();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to