Bug 1526852 [wpt PR 15300] - Remove OriginalTimingAllowOrigin from ResourceTimingInfo, a=testonly
authorNicolas Pena <npm@chromium.org>
Tue, 19 Feb 2019 11:46:28 +0000
changeset 519218 f750854e9708c7e13db89436f404aa3812df4324
parent 519217 a5965112ab0f2f3fdd6dde49af8081ebb9a2edeb
child 519219 f52b7a1404d8cd15997cd714e4fca53640c6fb6e
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1526852, 15300, 929453, 1459333, 630441
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1526852 [wpt PR 15300] - Remove OriginalTimingAllowOrigin from ResourceTimingInfo, a=testonly Automatic update from web-platform-tests Remove OriginalTimingAllowOrigin from ResourceTimingInfo The OriginalTimingAllowOrigin attribute was added in https://codereview.chromium.org/271083002 to ensure TAO headers are preserved on cached resources (304 responses). This CL removes it because it seems that it is no longer needed. It also moves the corresponding test to WPT. Bug: 929453 Change-Id: I41e0c84b04a94acc27c22e375f55398d9fc411e5 Reviewed-on: https://chromium-review.googlesource.com/c/1459333 Commit-Queue: Nicolás Peña Moreno <npm@chromium.org> Reviewed-by: Yoav Weiss <yoavweiss@chromium.org> Cr-Commit-Position: refs/heads/master@{#630441} -- wpt-commits: f84a067164651cc9069c36d6098d6a6b03d63816 wpt-pr: 15300
testing/web-platform/tests/resource-timing/resource-reload-TAO.sub.html
testing/web-platform/tests/resource-timing/resources/cors-ahem.py
testing/web-platform/tests/resource-timing/resources/iframe-reload-TAO.sub.html
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/resource-timing/resource-reload-TAO.sub.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<html>
+<head>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<iframe src="resources/iframe-reload-TAO.sub.html"></iframe>
+<script>
+async_test(t => {
+    window.onmessage = t.step_func(e => {
+        const data = e.data;
+        assert_greater_than(data.domainLookupStart, 0,
+            "domainLookupStart should be greater than 0.");
+        assert_greater_than(data.domainLookupEnd, 0,
+            "domainLookupEnd should be greater than 0.");
+        assert_greater_than(data.connectStart, 0,
+            "connectStart should be greater than 0.");
+        assert_greater_than(data.connectEnd, 0,
+            "connectEnd should be greater than 0.");
+        t.done();
+    });
+}, "Test that TAO headers are reused on reloads.");
+</script>
+</body>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/resource-timing/resources/cors-ahem.py
@@ -0,0 +1,17 @@
+import os.path
+
+def main(request, response):
+    etag = "123abc"
+    if etag == request.headers.get("If-None-Match", None):
+        response.headers.set("X-HTTP-STATUS", 304)
+        response.status = (304, "Not Modified")
+        return ""
+
+    response.headers.set("Cache-Control", "public, max-age=86400")
+    response.headers.set("Content-Type", "font/truetype")
+    response.headers.set("Access-Control-Allow-Origin", "*")
+    response.headers.set("Timing-Allow-Origin", "*")
+    response.headers.set("ETag", etag)
+    font = "../../fonts/Ahem.ttf"
+    path = os.path.join(os.path.dirname(__file__), font)
+    response.content = open(path, "rb").read()
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/resource-timing/resources/iframe-reload-TAO.sub.html
@@ -0,0 +1,28 @@
+<style>
+@font-face {
+    font-family: ahem;
+    src: url(http://{{domains[www]}}:{{ports[http][1]}}/resource-timing/resources/cors-ahem.py);
+}
+</style>
+<div style="font-family: ahem;">This fetches ahem font.</div>
+<script>
+  if (location.hash === '#check') {
+      document.fonts.ready.then(()=> {
+        const entries = performance.getEntriesByName('http://{{domains[www]}}:{{ports[http][1]}}/resource-timing/resources/cors-ahem.py');
+        if (entries.length != 1)
+          return;
+        const entry = entries[0];
+        window.parent.postMessage({
+            "domainLookupStart": entry.domainLookupStart,
+            "domainLookupEnd": entry.domainLookupEnd,
+            "connectStart": entry.connectStart,
+            "connectEnd": entry.connectEnd
+          }, "*");
+      });
+  } else {
+      document.fonts.ready.then(() => {
+        location.hash = 'check';
+        location.reload();
+      });
+  }
+</script>