Title: [238770] trunk/LayoutTests
- Revision
- 238770
- Author
- you...@apple.com
- Date
- 2018-11-30 19:25:50 -0800 (Fri, 30 Nov 2018)
Log Message
Test that CSS subresource loading are exposed to resource timing in case of a CORS loaded CSS stylesheet but not imported stylesheets
https://bugs.webkit.org/show_bug.cgi?id=192232
Reviewed by Dean Jackson.
* http/tests/security/cross-origin-clean-css-resource-timing-expected.txt: Added.
* http/tests/security/cross-origin-clean-css-resource-timing.html: Added.
* http/tests/security/resources/loading-subresources.php: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (238769 => 238770)
--- trunk/LayoutTests/ChangeLog 2018-12-01 03:09:40 UTC (rev 238769)
+++ trunk/LayoutTests/ChangeLog 2018-12-01 03:25:50 UTC (rev 238770)
@@ -1,3 +1,14 @@
+2018-11-30 Youenn Fablet <you...@apple.com>
+
+ Test that CSS subresource loading are exposed to resource timing in case of a CORS loaded CSS stylesheet but not imported stylesheets
+ https://bugs.webkit.org/show_bug.cgi?id=192232
+
+ Reviewed by Dean Jackson.
+
+ * http/tests/security/cross-origin-clean-css-resource-timing-expected.txt: Added.
+ * http/tests/security/cross-origin-clean-css-resource-timing.html: Added.
+ * http/tests/security/resources/loading-subresources.php: Added.
+
2018-11-30 Truitt Savell <tsav...@apple.com>
Rebaseline test after https://trac.webkit.org/changeset/238725/webkit
Added: trunk/LayoutTests/http/tests/security/cross-origin-clean-css-resource-timing-expected.txt (0 => 238770)
--- trunk/LayoutTests/http/tests/security/cross-origin-clean-css-resource-timing-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/security/cross-origin-clean-css-resource-timing-expected.txt 2018-12-01 03:25:50 UTC (rev 238770)
@@ -0,0 +1,3 @@
+
+PASS CSS subresources of a clean stylesheet should populate resource timing entries, but not for imported stylesheets
+
Added: trunk/LayoutTests/http/tests/security/cross-origin-clean-css-resource-timing.html (0 => 238770)
--- trunk/LayoutTests/http/tests/security/cross-origin-clean-css-resource-timing.html (rev 0)
+++ trunk/LayoutTests/http/tests/security/cross-origin-clean-css-resource-timing.html 2018-12-01 03:25:50 UTC (rev 238770)
@@ -0,0 +1,51 @@
+<!doctype html>
+<html>
+<head>
+<title>CSS subresources of a clean stylesheet should populate resource timing entries, but not for imported stylesheets</title>
+<script src=""
+<script src=""
+<link href='' rel='stylesheet' type='text/css' crossorigin="anonymous">
+</head>
+<body>
+<div id="mydiv" style="font: 12px 'ahem'">Test</div>
+<script>
+const waitOnLoad = new Promise((resolve) => {
+ window._onload_ = resolve;
+})
+
+function waitFor(delay)
+{
+ return new Promise(resolve => setTimeout(resolve, delay));
+}
+
+document.fonts.ready.then(async () => {
+ await waitOnLoad;
+ let hasImport = false;
+ let hasImage = false;
+ let hasCursor = false;
+ let hasFont = false;
+ let counter = 0;
+ while (++counter < 20) {
+ const entries = performance.getEntries();
+ if (!hasImport)
+ hasImport = entries.some(entry => entry.name.includes('imported-loading-subresources.css'));
+ if (!hasImage)
+ hasImage = entries.some(entry => entry.name.includes('abe-allow-star.php?image'));
+ if (!hasCursor)
+ hasCursor = entries.some(entry => entry.name.includes('abe-allow-star.php?cursor'));
+ if (!hasFont)
+ hasFont = entries.some(entry => entry.name.includes('Ahem.woff'));
+ if (hasImport && hasFont && hasCursor)
+ break;
+ await waitFor(50);
+ }
+ mydiv.innerHTML = "";
+ assert_true(hasImport, "import");
+ assert_false(hasImage, "image");
+ assert_true(hasCursor, "cursor");
+ assert_true(hasFont, "font");
+ done();
+})
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/security/resources/loading-subresources.php (0 => 238770)
--- trunk/LayoutTests/http/tests/security/resources/loading-subresources.php (rev 0)
+++ trunk/LayoutTests/http/tests/security/resources/loading-subresources.php 2018-12-01 03:25:50 UTC (rev 238770)
@@ -0,0 +1,11 @@
+<?php
+header("Access-Control-Allow-Origin: *");
+
+$name = 'loading-subresources.css';
+$fp = fopen($name, 'rb');
+header("Content-Type: text/css");
+header("Content-Length: " . filesize($name));
+
+fpassthru($fp);
+exit;
+?>
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes