Import current Resource-Timing WPTs
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Jan 2019 00:00:04 +0000 (00:00 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Jan 2019 00:00:04 +0000 (00:00 +0000)
https://bugs.webkit.org/show_bug.cgi?id=193302

Patch by Charles Vazac <cvazac@akamai.com> on 2019-01-14
Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

* web-platform-tests/resource-timing/SyntheticResponse.py:
(main):
* web-platform-tests/resource-timing/buffer-full-add-after-full-event-expected.txt: Added.
* web-platform-tests/resource-timing/buffer-full-add-after-full-event.html: Added.
* web-platform-tests/resource-timing/buffer-full-add-entries-during-callback-expected.txt: Added.
* web-platform-tests/resource-timing/buffer-full-add-entries-during-callback-that-drop.html: Added.
* web-platform-tests/resource-timing/buffer-full-add-entries-during-callback.html: Added.
* web-platform-tests/resource-timing/buffer-full-add-then-clear-expected.txt: Added.
* web-platform-tests/resource-timing/buffer-full-add-then-clear.html: Added.
* web-platform-tests/resource-timing/buffer-full-decrease-buffer-during-callback.html: Added.
* web-platform-tests/resource-timing/buffer-full-increase-buffer-during-callback-expected.txt: Added.
* web-platform-tests/resource-timing/buffer-full-increase-buffer-during-callback.html: Added.
* web-platform-tests/resource-timing/buffer-full-inspect-buffer-during-callback-expected.txt: Added.
* web-platform-tests/resource-timing/buffer-full-inspect-buffer-during-callback.html: Added.
* web-platform-tests/resource-timing/buffer-full-set-to-current-buffer-expected.txt: Added.
* web-platform-tests/resource-timing/buffer-full-set-to-current-buffer.html: Added.
* web-platform-tests/resource-timing/buffer-full-store-and-clear-during-callback-expected.txt: Added.
* web-platform-tests/resource-timing/buffer-full-store-and-clear-during-callback.html: Added.
* web-platform-tests/resource-timing/buffer-full-then-increased-expected.txt: Added.
* web-platform-tests/resource-timing/buffer-full-then-increased.html: Added.
* web-platform-tests/resource-timing/buffer-full-when-populate-entries-expected.txt: Added.
* web-platform-tests/resource-timing/buffer-full-when-populate-entries.html: Added.
* web-platform-tests/resource-timing/document-domain-no-impact-loader.sub-expected.txt: Added.
* web-platform-tests/resource-timing/document-domain-no-impact-loader.sub.html: Added.
* web-platform-tests/resource-timing/no-entries-for-cross-origin-css-fetched.sub-expected.txt: Added.
* web-platform-tests/resource-timing/no-entries-for-cross-origin-css-fetched.sub.html: Added.
* web-platform-tests/resource-timing/resource-timing-level1.js: Renamed from LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource-timing.js.
(assertInvariants):
(window.onload):
* web-platform-tests/resource-timing/resource-timing-level1.sub-expected.txt: Added.
* web-platform-tests/resource-timing/resource-timing-level1.sub.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource-timing.html.
* web-platform-tests/resource-timing/resource_connection_reuse.html:
* web-platform-tests/resource-timing/resource_timing.worker.js:
* web-platform-tests/resource-timing/resource_timing_buffer_full_when_populate_entries-expected.txt: Removed.
* web-platform-tests/resource-timing/resource_timing_buffer_full_when_populate_entries.html: Removed.
* web-platform-tests/resource-timing/resource_timing_store_and_clear_during_callback-expected.txt: Removed.
* web-platform-tests/resource-timing/resource_timing_store_and_clear_during_callback.html: Removed.
* web-platform-tests/resource-timing/resources/buffer-full-utilities.js: Added.
(let.appendScript):
(let.waitForNextTask):
(let.waitForEventToFire.return.new.Promise):
(let.waitForEventToFire):
* web-platform-tests/resource-timing/resources/document-domain-no-impact.sub.html: Added.
* web-platform-tests/resource-timing/resources/iframe-setdomain.sub.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/resource-timing/iframe-setdomain.sub.html.
* web-platform-tests/resource-timing/resources/w3c-import.log:
* web-platform-tests/resource-timing/resources/webperftestharness.js:
(wp_test):
(test_namespace):
* web-platform-tests/resource-timing/resources/webperftestharnessextension.js:
(test_resource_entries):
(performance_entrylist_checker): Deleted.
* web-platform-tests/resource-timing/single-entry-per-resource.html:
* web-platform-tests/resource-timing/supported_resource_type.any-expected.txt: Added.
* web-platform-tests/resource-timing/supported_resource_type.any.html: Added.
* web-platform-tests/resource-timing/supported_resource_type.any.js: Added.
(test):
* web-platform-tests/resource-timing/supported_resource_type.any.worker-expected.txt: Added.
* web-platform-tests/resource-timing/supported_resource_type.any.worker.html: Added.
* web-platform-tests/resource-timing/test_resource_timing.https-expected.txt: Added.
* web-platform-tests/resource-timing/test_resource_timing.https.html: Added.
* web-platform-tests/resource-timing/test_resource_timing.js:
(resource_load):
* web-platform-tests/resource-timing/w3c-import.log:

LayoutTests:

* TestExpectations:
* tests-options.json:

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

62 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/resource-timing/SyntheticResponse.py
LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-add-after-full-event-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-add-after-full-event.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-add-entries-during-callback-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-add-entries-during-callback-that-drop.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-add-entries-during-callback.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-add-then-clear-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-add-then-clear.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-decrease-buffer-during-callback.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-increase-buffer-during-callback-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-increase-buffer-during-callback.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-inspect-buffer-during-callback-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-inspect-buffer-during-callback.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-set-to-current-buffer-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-set-to-current-buffer.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-store-and-clear-during-callback-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-store-and-clear-during-callback.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-then-increased-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-then-increased.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-when-populate-entries-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-when-populate-entries.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/document-domain-no-impact-loader.sub-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/document-domain-no-impact-loader.sub.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/no-entries-for-cross-origin-css-fetched.sub-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/no-entries-for-cross-origin-css-fetched.sub.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource-timing-level1.js [moved from LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource-timing.js with 84% similarity]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource-timing-level1.sub-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource-timing-level1.sub.html [moved from LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource-timing.html with 85% similarity]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_connection_reuse.html
LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_connection_reuse.https-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_connection_reuse.https.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_dynamic_insertion-expected.txt
LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_memory_cached.sub-expected.txt
LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_memory_cached.sub.html
LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_redirects-expected.txt
LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_script_types-expected.txt
LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_timing.worker-expected.txt
LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_timing.worker.js
LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_timing_buffer_full_when_populate_entries-expected.txt [deleted file]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_timing_buffer_full_when_populate_entries.html [deleted file]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_timing_store_and_clear_during_callback-expected.txt [deleted file]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_timing_store_and_clear_during_callback.html [deleted file]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/buffer-full-utilities.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/document-domain-no-impact.sub.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/iframe-setdomain.sub.html [moved from LayoutTests/imported/w3c/web-platform-tests/resource-timing/iframe-setdomain.sub.html with 54% similarity]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/w3c-import.log
LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/webperftestharness.js
LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/webperftestharnessextension.js
LayoutTests/imported/w3c/web-platform-tests/resource-timing/single-entry-per-resource.html
LayoutTests/imported/w3c/web-platform-tests/resource-timing/supported_resource_type.any-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/supported_resource_type.any.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/supported_resource_type.any.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/supported_resource_type.any.worker-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/supported_resource_type.any.worker.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/test_resource_timing.https-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/test_resource_timing.https.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/resource-timing/test_resource_timing.js
LayoutTests/imported/w3c/web-platform-tests/resource-timing/w3c-import.log
LayoutTests/tests-options.json

index 0c27705..b622ccb 100644 (file)
@@ -1,3 +1,13 @@
+2019-01-14  Charles Vazac  <cvazac@akamai.com>
+
+        Import current Resource-Timing WPTs
+        https://bugs.webkit.org/show_bug.cgi?id=193302
+
+        Reviewed by Youenn Fablet.
+
+        * TestExpectations:
+        * tests-options.json:
+
 2019-01-14  Jiewen Tan  <jiewen_tan@apple.com>
 
         Unreviewed, test fixes after r239852.
index 354e0d6..e54523a 100644 (file)
@@ -378,7 +378,6 @@ imported/w3c/web-platform-tests/mediacapture-fromelement/creation.html [ Pass Fa
 webkit.org/b/180240 imported/w3c/web-platform-tests/resource-timing/single-entry-per-resource.html [ Pass Failure ]
 webkit.org/b/189906 imported/w3c/web-platform-tests/resource-timing/resource_timing_buffer_full_eventually.html [ Skip ]
 webkit.org/b/189905 imported/w3c/web-platform-tests/resource-timing/resource_initiator_types.html [ Pass Failure ]
-webkit.org/b/189910 imported/w3c/web-platform-tests/resource-timing/resource_timing_store_and_clear_during_callback.html [ Pass Failure ]
 webkit.org/b/190523 imported/w3c/web-platform-tests/resource-timing/resource_timing_cross_origin_redirect_chain.html [ Pass Failure ]
 
 # These fetch tests are flaky or fail.
@@ -771,8 +770,14 @@ imported/w3c/web-platform-tests/fetch/content-type/script.window.html [ DumpJSCo
 imported/w3c/web-platform-tests/fetch/api/request/request-init-stream.any.html [ DumpJSConsoleLogInStdErr ]
 imported/w3c/web-platform-tests/fetch/api/response/response-error-from-stream.html [ DumpJSConsoleLogInStdErr ]
 
-webkit.org/b/161088 imported/w3c/web-platform-tests/resource-timing/resource-timing.html [ Pass Failure ]
 imported/w3c/web-platform-tests/resource-timing/test_resource_timing.html [ Pass Failure ]
+imported/w3c/web-platform-tests/resource-timing/test_resource_timing.https.html [ Pass Failure ]
+imported/w3c/web-platform-tests/resource-timing/buffer-full-add-entries-during-callback-that-drop.html [ Skip ]
+imported/w3c/web-platform-tests/resource-timing/buffer-full-decrease-buffer-during-callback.html [ Skip ]
+
+imported/w3c/web-platform-tests/resource-timing/resource_connection_reuse.html [ Failure ]
+imported/w3c/web-platform-tests/resource-timing/resource_connection_reuse.https.html [ Failure ]
+imported/w3c/web-platform-tests/resource-timing/resource_reparenting.html [ Failure ]
 
 webkit.org/b/168357 http/wpt/resource-timing/rt-initiatorType-media.html [ Failure ]
 webkit.org/b/168448 http/wpt/resource-timing/rt-shared-resource-in-frames.html [ Pass Failure ]
@@ -2906,8 +2911,6 @@ fast/gradients/conic-two-hints.html [ Skip ]
 
 webkit.org/b/187773 http/tests/webAPIStatistics [ Skip ]
 
-webkit.org/b/189997 imported/w3c/web-platform-tests/resource-timing/resource_timing.worker.html [ Failure ]
-
 # This is fallout from turning Web Animations on.
 webkit.org/b/190032 animations/animation-playstate-paused-style-resolution.html [ Failure ]
 webkit.org/b/190032 compositing/backing/backing-store-attachment-fill-forwards-animation.html [ Failure ]
index 0fd799d..02d3c2e 100644 (file)
@@ -1,3 +1,73 @@
+2019-01-14  Charles Vazac  <cvazac@akamai.com>
+
+        Import current Resource-Timing WPTs
+        https://bugs.webkit.org/show_bug.cgi?id=193302
+
+        Reviewed by Youenn Fablet.
+
+        * web-platform-tests/resource-timing/SyntheticResponse.py:
+        (main):
+        * web-platform-tests/resource-timing/buffer-full-add-after-full-event-expected.txt: Added.
+        * web-platform-tests/resource-timing/buffer-full-add-after-full-event.html: Added.
+        * web-platform-tests/resource-timing/buffer-full-add-entries-during-callback-expected.txt: Added.
+        * web-platform-tests/resource-timing/buffer-full-add-entries-during-callback-that-drop.html: Added.
+        * web-platform-tests/resource-timing/buffer-full-add-entries-during-callback.html: Added.
+        * web-platform-tests/resource-timing/buffer-full-add-then-clear-expected.txt: Added.
+        * web-platform-tests/resource-timing/buffer-full-add-then-clear.html: Added.
+        * web-platform-tests/resource-timing/buffer-full-decrease-buffer-during-callback.html: Added.
+        * web-platform-tests/resource-timing/buffer-full-increase-buffer-during-callback-expected.txt: Added.
+        * web-platform-tests/resource-timing/buffer-full-increase-buffer-during-callback.html: Added.
+        * web-platform-tests/resource-timing/buffer-full-inspect-buffer-during-callback-expected.txt: Added.
+        * web-platform-tests/resource-timing/buffer-full-inspect-buffer-during-callback.html: Added.
+        * web-platform-tests/resource-timing/buffer-full-set-to-current-buffer-expected.txt: Added.
+        * web-platform-tests/resource-timing/buffer-full-set-to-current-buffer.html: Added.
+        * web-platform-tests/resource-timing/buffer-full-store-and-clear-during-callback-expected.txt: Added.
+        * web-platform-tests/resource-timing/buffer-full-store-and-clear-during-callback.html: Added.
+        * web-platform-tests/resource-timing/buffer-full-then-increased-expected.txt: Added.
+        * web-platform-tests/resource-timing/buffer-full-then-increased.html: Added.
+        * web-platform-tests/resource-timing/buffer-full-when-populate-entries-expected.txt: Added.
+        * web-platform-tests/resource-timing/buffer-full-when-populate-entries.html: Added.
+        * web-platform-tests/resource-timing/document-domain-no-impact-loader.sub-expected.txt: Added.
+        * web-platform-tests/resource-timing/document-domain-no-impact-loader.sub.html: Added.
+        * web-platform-tests/resource-timing/no-entries-for-cross-origin-css-fetched.sub-expected.txt: Added.
+        * web-platform-tests/resource-timing/no-entries-for-cross-origin-css-fetched.sub.html: Added.
+        * web-platform-tests/resource-timing/resource-timing-level1.js: Renamed from LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource-timing.js.
+        (assertInvariants):
+        (window.onload):
+        * web-platform-tests/resource-timing/resource-timing-level1.sub-expected.txt: Added.
+        * web-platform-tests/resource-timing/resource-timing-level1.sub.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource-timing.html.
+        * web-platform-tests/resource-timing/resource_connection_reuse.html:
+        * web-platform-tests/resource-timing/resource_timing.worker.js:
+        * web-platform-tests/resource-timing/resource_timing_buffer_full_when_populate_entries-expected.txt: Removed.
+        * web-platform-tests/resource-timing/resource_timing_buffer_full_when_populate_entries.html: Removed.
+        * web-platform-tests/resource-timing/resource_timing_store_and_clear_during_callback-expected.txt: Removed.
+        * web-platform-tests/resource-timing/resource_timing_store_and_clear_during_callback.html: Removed.
+        * web-platform-tests/resource-timing/resources/buffer-full-utilities.js: Added.
+        (let.appendScript):
+        (let.waitForNextTask):
+        (let.waitForEventToFire.return.new.Promise):
+        (let.waitForEventToFire):
+        * web-platform-tests/resource-timing/resources/document-domain-no-impact.sub.html: Added.
+        * web-platform-tests/resource-timing/resources/iframe-setdomain.sub.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/resource-timing/iframe-setdomain.sub.html.
+        * web-platform-tests/resource-timing/resources/w3c-import.log:
+        * web-platform-tests/resource-timing/resources/webperftestharness.js:
+        (wp_test):
+        (test_namespace):
+        * web-platform-tests/resource-timing/resources/webperftestharnessextension.js:
+        (test_resource_entries):
+        (performance_entrylist_checker): Deleted.
+        * web-platform-tests/resource-timing/single-entry-per-resource.html:
+        * web-platform-tests/resource-timing/supported_resource_type.any-expected.txt: Added.
+        * web-platform-tests/resource-timing/supported_resource_type.any.html: Added.
+        * web-platform-tests/resource-timing/supported_resource_type.any.js: Added.
+        (test):
+        * web-platform-tests/resource-timing/supported_resource_type.any.worker-expected.txt: Added.
+        * web-platform-tests/resource-timing/supported_resource_type.any.worker.html: Added.
+        * web-platform-tests/resource-timing/test_resource_timing.https-expected.txt: Added.
+        * web-platform-tests/resource-timing/test_resource_timing.https.html: Added.
+        * web-platform-tests/resource-timing/test_resource_timing.js:
+        (resource_load):
+        * web-platform-tests/resource-timing/w3c-import.log:
 2019-01-10  Oriol Brufau  <obrufau@igalia.com>
 
         [css-grid] Let abspos items reference implicit grid lines
index a17a3e9..26e0a80 100644 (file)
@@ -1,26 +1,48 @@
 import urllib
-import time
+import sys, os
+sys.path.append(os.path.join(os.path.dirname(__file__), "../common/"))
+import sleep
 
 def main(request, response):
     index = request.request_path.index("?")
     args = request.request_path[index+1:].split("&")
-    headersSent = 0
+    headers = []
+    statusSent = False
+    headersSent = False
     for arg in args:
         if arg.startswith("ignored"):
             continue
         elif arg.endswith("ms"):
-            time.sleep(float(arg[0:-2]) / 1E3);
+            sleep.sleep_at_least(float(arg[0:-2]))
         elif arg.startswith("redirect:"):
             return (302, "WEBPERF MARKETING"), [("Location", urllib.unquote(arg[9:]))], "TEST"
         elif arg.startswith("mime:"):
-            response.headers.set("Content-Type", urllib.unquote(arg[5:]))
+            headers.append(("Content-Type", urllib.unquote(arg[5:])))
         elif arg.startswith("send:"):
             text = urllib.unquote(arg[5:])
-            if headersSent == 0:
-                response.write_status_headers()
-                headersSent = 1
+
+            if not statusSent:
+                # Default to a 200 status code.
+                response.writer.write_status(200)
+                statusSent = True
+            if not headersSent:
+                for key, value in headers:
+                    response.writer.write_header(key, value)
+                response.writer.end_headers()
+                headersSent = True
 
             response.writer.write_content(text)
+        elif arg.startswith("status:"):
+            code = int(urllib.unquote(arg[7:]))
+            response.writer.write_status(code)
+            if code // 100 == 1:
+                # Terminate informational 1XX responses with an empty line.
+                response.writer.end_headers()
+            else:
+                statusSent = True
+        elif arg == "flush":
+            response.writer.flush()
+
 #        else:
 #            error "  INVALID ARGUMENT %s" % arg
 
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-add-after-full-event-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-add-after-full-event-expected.txt
new file mode 100644 (file)
index 0000000..6fa3aca
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS Test that entry was added to the buffer after a buffer full event 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-add-after-full-event.html b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-add-after-full-event.html
new file mode 100644 (file)
index 0000000..46264ac
--- /dev/null
@@ -0,0 +1,80 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<meta charset="utf-8">
+<link rel="help" href="https://w3c.github.io/resource-timing/#dom-performance-setresourcetimingbuffersize">
+<title>This test validates that setResourceTimingBufferFull behaves appropriately when set to the current buffer level.</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/buffer-full-utilities.js"></script>
+</head>
+<body>
+<script>
+let eventFired = false;
+let loadRandomResource = () => {
+    return fetch(window.location.href + "?" + Math.random());
+}
+
+setup(() => {
+    // Get the browser into a consistent state.
+    clearBufferAndSetSize(100);
+});
+
+let loadResourcesToFillFutureBuffer = () => {
+    return new Promise(resolve => {
+        // Gather up 3 Resource Entries to kick off the rest of test behavior.
+        let resources = 0;
+        let observer = new PerformanceObserver(function(list) {
+            resources += list.getEntriesByType("resource").length;
+            if (resources !== 3)
+                return;
+            observer.disconnect();
+            resolve();
+        });
+        observer.observe({entryTypes: ["resource"]});
+        for (let i = 0; i < 3; ++i)
+            loadRandomResource();
+    });
+};
+
+let setBufferFullEventAndBufferSize = () => {
+    performance.setResourceTimingBufferSize(3);
+    performance.onresourcetimingbufferfull = function() {
+        eventFired = true;
+        performance.clearResourceTimings();
+    };
+};
+
+let clearAndAddAnotherEntryToBuffer = () => {
+    return new Promise(resolve => {
+        performance.clearResourceTimings();
+        loadRandomResource().then(resolve);
+    });
+};
+
+let testThatEntryWasAdded = () => {
+    return new Promise((resolve, reject) => {
+        let waitForIt = function() {
+            if (performance.getEntriesByType("resource").length) {
+                resolve();
+            } else {
+                reject("After buffer full, entry never added to primary");
+            }
+        }
+        step_timeout(waitForIt, 250);
+    });
+};
+
+promise_test(async () => {
+    await loadResourcesToFillFutureBuffer();
+    setBufferFullEventAndBufferSize();
+    // Overflow the buffer.
+    await loadRandomResource();
+    await waitForEventToFire();
+    await clearAndAddAnotherEntryToBuffer();
+    // Since we have no strict guarantees when an entry will be added to the
+    // buffer, waiting till next task to try to avoid flakiness.
+    await waitForNextTask();
+    await testThatEntryWasAdded();
+}, "Test that entry was added to the buffer after a buffer full event");
+</script>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-add-entries-during-callback-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-add-entries-during-callback-expected.txt
new file mode 100644 (file)
index 0000000..9428c86
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS Test that entries synchronously added to the buffer during the callback don't get dropped if the buffer is increased 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-add-entries-during-callback-that-drop.html b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-add-entries-during-callback-that-drop.html
new file mode 100644 (file)
index 0000000..d61d2af
--- /dev/null
@@ -0,0 +1,51 @@
+<!DOCTYPE HTML>
+<html>
+<head onload>
+<meta charset="utf-8" />
+<title>This test validates that synchronously adding entries in onresourcetimingbufferfull callback results in these entries being properly handled.</title>
+<link rel="help" href="http://www.w3.org/TR/resource-timing/#performanceresourcetiming"/>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/buffer-full-utilities.js"></script>
+</head>
+<body>
+<script>
+const resource_timing_buffer_size = 1;
+
+setup(() => {
+    // Get the browser into a consistent state.
+    clearBufferAndSetSize(resource_timing_buffer_size);
+});
+
+let overflowTheBufferAndWaitForEvent = () => {
+    return new Promise(resolve => {
+        var add_entry = () => {
+            performance.setResourceTimingBufferSize(resource_timing_buffer_size + 1);
+            // The sync entry is added to the secondary buffer, so will be the last one there and eventually dropped.
+            xhrScript("resources/empty.js?xhr");
+            resolve();
+        }
+        performance.addEventListener('resourcetimingbufferfull', add_entry);
+        // This resource overflows the entry buffer, and goes into the secondary buffer.
+        appendScript('resources/empty_script.js');
+    });
+};
+
+let testThatBufferContainsTheRightResources = () => {
+    let entries = performance.getEntriesByType('resource');
+    assert_equals(entries.length, 2,
+                  'Both entries should be stored in resource timing buffer since its increases size once it overflows.');
+    assert_true(entries[0].name.includes('empty.js'), "empty.js is in the entries buffer");
+    assert_true(entries[1].name.includes('empty_script.js'), "empty_script.js is in the entries buffer");
+};
+
+promise_test(async () => {
+    await fillUpTheBufferWithSingleResource("resources/empty.js");
+    await overflowTheBufferAndWaitForEvent();
+    // TODO(yoav): Figure out why this task is needed
+    await waitForNextTask();
+    testThatBufferContainsTheRightResources();
+}, "Test that entries synchronously added to the buffer during the callback are dropped");
+</script>
+</body>
+</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-add-entries-during-callback.html b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-add-entries-during-callback.html
new file mode 100644 (file)
index 0000000..b37c47b
--- /dev/null
@@ -0,0 +1,50 @@
+<!DOCTYPE HTML>
+<html>
+<head onload>
+<meta charset="utf-8" />
+<title>This test validates that synchronously adding entries in onresourcetimingbufferfull callback results in these entries being properly handled.</title>
+<link rel="help" href="http://www.w3.org/TR/resource-timing/#performanceresourcetiming"/>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/buffer-full-utilities.js"></script>
+</head>
+<body>
+<script>
+const resource_timing_buffer_size = 1;
+
+setup(() => {
+    // Get the browser into a consistent state.
+    clearBufferAndSetSize(resource_timing_buffer_size);
+});
+
+let overflowTheBufferAndWaitForEvent = () => {
+    return new Promise(resolve => {
+        var add_entry = () => {
+            performance.setResourceTimingBufferSize(resource_timing_buffer_size + 2);
+            xhrScript("resources/empty.js?xhr");
+            resolve();
+        }
+        performance.addEventListener('resourcetimingbufferfull', add_entry);
+        // This resource overflows the entry buffer, and goes into the secondary buffer.
+        appendScript('resources/empty_script.js');
+    });
+};
+
+let testThatBufferContainsTheRightResources = () => {
+    let entries = performance.getEntriesByType('resource');
+    assert_equals(entries.length, 3,
+                  'All entries should be stored in resource timing buffer since its increases size once it overflows.');
+    assert_true(entries[0].name.includes('empty.js'), "empty.js is in the entries buffer");
+    assert_true(entries[1].name.includes('empty_script.js'), "empty_script.js is in the entries buffer");
+    assert_true(entries[2].name.includes('empty.js?xhr'), "empty.js?xhr is in the entries buffer");
+};
+
+promise_test(async () => {
+    await fillUpTheBufferWithSingleResource("resources/empty.js");
+    await overflowTheBufferAndWaitForEvent();
+    await waitForNextTask();
+    testThatBufferContainsTheRightResources();
+}, "Test that entries synchronously added to the buffer during the callback don't get dropped if the buffer is increased");
+</script>
+</body>
+</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-add-then-clear-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-add-then-clear-expected.txt
new file mode 100644 (file)
index 0000000..a0ea4c3
--- /dev/null
@@ -0,0 +1,6 @@
+CONSOLE MESSAGE: line 2659: Error: assert_unreached: resourcetimingbufferfull should not fire Reached unreachable code
+
+Harness Error (FAIL), message = Error: assert_unreached: resourcetimingbufferfull should not fire Reached unreachable code
+
+FAIL Test that if the buffer is cleared after entries were added to the secondary buffer, those entries make it into the primary one assert_equals: the last 3 resources should be in the buffer, since the first one was cleared expected 3 but got 0
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-add-then-clear.html b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-add-then-clear.html
new file mode 100644 (file)
index 0000000..710852c
--- /dev/null
@@ -0,0 +1,49 @@
+<!DOCTYPE HTML>
+<html>
+<head onload>
+<meta charset="utf-8" />
+<title>This test validates that synchronously adding entries in onresourcetimingbufferfull callback results in these entries being properly handled.</title>
+<link rel="help" href="http://www.w3.org/TR/resource-timing/#performanceresourcetiming"/>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/buffer-full-utilities.js"></script>
+</head>
+<body>
+<script>
+const resource_timing_buffer_size = 1;
+
+setup(() => {
+    // Get the browser into a consistent state.
+    clearBufferAndSetSize(resource_timing_buffer_size);
+    performance.addEventListener('resourcetimingbufferfull', () => { assert_unreached("resourcetimingbufferfull should not fire")});
+});
+
+let overflowTheBuffer = () => {
+    // These resources overflow the entry buffer, and go into the secondary buffer.
+    xhrScript('resources/empty.js?xhr2');
+    xhrScript('resources/empty.js?xhr3');
+    performance.clearResourceTimings();
+    performance.setResourceTimingBufferSize(3);
+    xhrScript('resources/empty.js?xhr4');
+    window.entriesAfterAddition = performance.getEntriesByType('resource');
+};
+
+let testThatBufferContainsTheRightResources = () => {
+    let entries = performance.getEntriesByType('resource');
+    assert_equals(entries.length, 3,
+                  'the last 3 resources should be in the buffer, since the first one was cleared');
+    assert_true(entries[0].name.includes('empty.js?xhr2'), "empty.js?xhr2 is in the entries buffer");
+    assert_true(entries[1].name.includes('empty.js?xhr3'), "empty.js?xhr3 is in the entries buffer");
+    assert_true(entries[2].name.includes('empty.js?xhr4'), "empty.js?xhr4 is in the entries buffer");
+    assert_equals(entriesAfterAddition.length, 0, "No entries should have been added to the primary buffer before the task to 'fire a buffer full event'.");
+};
+
+promise_test(async () => {
+    await fillUpTheBufferWithSingleResource("resources/empty.js");
+    overflowTheBuffer();
+    await waitForNextTask();
+    testThatBufferContainsTheRightResources();
+}, "Test that if the buffer is cleared after entries were added to the secondary buffer, those entries make it into the primary one");
+</script>
+</body>
+</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-decrease-buffer-during-callback.html b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-decrease-buffer-during-callback.html
new file mode 100644 (file)
index 0000000..e6de33d
--- /dev/null
@@ -0,0 +1,49 @@
+<!DOCTYPE HTML>
+<html>
+<head onload>
+<meta charset="utf-8" />
+<title>This test validates that decreasing the buffer size in onresourcetimingbufferfull callback does not result in extra entries being dropped.</title>
+<link rel="help" href="http://www.w3.org/TR/resource-timing/#performanceresourcetiming"/>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/buffer-full-utilities.js"></script>
+</head>
+<body>
+<script>
+const resource_timing_buffer_size = 2;
+let eventFired = false;
+setup(() => {
+    // Get the browser into a consistent state.
+    clearBufferAndSetSize(resource_timing_buffer_size);
+    let resize = () => {
+        performance.setResourceTimingBufferSize(resource_timing_buffer_size - 1);
+        eventFired = true;
+    }
+    performance.addEventListener('resourcetimingbufferfull', resize);
+});
+
+let overflowTheBuffer = () => {
+    return new Promise(resolve => {
+        // This resource overflows the entry buffer, and goes into the secondary buffer.
+        // Since the buffer size doesn't increase, it will eventually be dropped.
+        appendScript('resources/empty_script.js', resolve);
+    });
+};
+
+let testThatBufferContainsTheRightResources = () => {
+    let entries = performance.getEntriesByType('resource');
+    assert_equals(entries.length, 2,
+                  'Both entries should be stored in resource timing buffer since it decreased its limit only after it overflowed.');
+    assert_true(entries[0].name.includes('empty.js'), "empty.js is in the entries buffer");
+    assert_true(entries[1].name.includes('empty.js?second'), "empty.js?second is in the entries buffer");
+};
+
+promise_test(async () => {
+    await fillUpTheBufferWithTwoResources('resources/empty.js');
+    await overflowTheBuffer();
+    await waitForEventToFire();
+    testThatBufferContainsTheRightResources();
+}, "Test that decreasing the buffer limit during the callback does not drop entries");
+</script>
+</body>
+</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-increase-buffer-during-callback-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-increase-buffer-during-callback-expected.txt
new file mode 100644 (file)
index 0000000..acccc24
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS Test that increasing the buffer during the callback is enough for entries not to be dropped 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-increase-buffer-during-callback.html b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-increase-buffer-during-callback.html
new file mode 100644 (file)
index 0000000..b46d2d6
--- /dev/null
@@ -0,0 +1,49 @@
+<!DOCTYPE HTML>
+<html>
+<head onload>
+<meta charset="utf-8" />
+<title>This test validates increasing the buffer size in onresourcetimingbufferfull callback of resource timing.</title>
+<link rel="help" href="http://www.w3.org/TR/resource-timing/#performanceresourcetiming"/>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/buffer-full-utilities.js"></script>
+</head>
+<body>
+<script>
+const resource_timing_buffer_size = 1;
+let eventFired = false;
+
+setup(() => {
+    // Get the browser into a consistent state.
+    clearBufferAndSetSize(resource_timing_buffer_size);
+    var increase = function() {
+        performance.setResourceTimingBufferSize(resource_timing_buffer_size * 2);
+        eventFired = true;
+    }
+    performance.addEventListener('resourcetimingbufferfull', increase);
+});
+
+let overflowTheBuffer = () => {
+    return new Promise(resolve => {
+        // This resource overflows the entry buffer, and goes into the secondary buffer.
+        appendScript('resources/empty_script.js', resolve);
+    });
+};
+
+let testThatBufferContainsTheRightResources = () => {
+    let entries = performance.getEntriesByType('resource');
+    assert_equals(entries.length, 2,
+                  'Both entries should be stored in resource timing buffer since its increases size once it overflows.');
+    assert_true(entries[0].name.includes('empty.js'), "empty.js is in the entries buffer");
+    assert_true(entries[1].name.includes('empty_script.js'), "empty_script.js is in the entries buffer");
+};
+
+promise_test(async () => {
+    await fillUpTheBufferWithSingleResource("resources/empty.js");
+    await overflowTheBuffer();
+    await waitForEventToFire();
+    testThatBufferContainsTheRightResources();
+}, "Test that increasing the buffer during the callback is enough for entries not to be dropped");
+</script>
+</body>
+</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-inspect-buffer-during-callback-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-inspect-buffer-during-callback-expected.txt
new file mode 100644 (file)
index 0000000..14cdeef
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS Test that entries in the secondary buffer are not exposed during the callback and before they are copied to the primary buffer 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-inspect-buffer-during-callback.html b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-inspect-buffer-during-callback.html
new file mode 100644 (file)
index 0000000..d46d469
--- /dev/null
@@ -0,0 +1,56 @@
+<!DOCTYPE HTML>
+<html>
+<head onload>
+<meta charset="utf-8" />
+<title>This test validates the buffer doesn't contain more entries than it should inside onresourcetimingbufferfull callback.</title>
+<link rel="help" href="http://www.w3.org/TR/resource-timing/#performanceresourcetiming"/>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/buffer-full-utilities.js"></script>
+</head>
+<body>
+<script>
+let resource_timing_buffer_size = 2;
+let eventFired = false;
+
+setup(() => {
+    clearBufferAndSetSize(resource_timing_buffer_size);
+    var resize = function() {
+        assert_equals(performance.getEntriesByType("resource").length, resource_timing_buffer_size, "resource timing buffer in resourcetimingbufferfull is the size of the limit");
+        ++resource_timing_buffer_size;
+        performance.setResourceTimingBufferSize(resource_timing_buffer_size);
+        xhrScript("resources/empty.js?xhr");
+        assert_equals(performance.getEntriesByType("resource").length, resource_timing_buffer_size - 1, "A sync request was not added to the primary buffer just yet, because it is full");
+        ++resource_timing_buffer_size;
+        performance.setResourceTimingBufferSize(resource_timing_buffer_size);
+        eventFired = true;
+    }
+    performance.addEventListener('resourcetimingbufferfull', resize);
+});
+
+let overflowTheBuffer = () => {
+    return new Promise(resolve => {
+        // This resource overflows the entry buffer, and goes into the secondary buffer.
+        appendScript('resources/empty_script.js', resolve);
+    });
+};
+
+let testThatBufferContainsTheRightResources = () => {
+    let entries = performance.getEntriesByType('resource');
+    assert_equals(entries.length, resource_timing_buffer_size,
+                  'All 4 entries should be stored in resource timing buffer.');
+    assert_true(entries[0].name.includes('empty.js'), "empty.js is in the entries buffer");
+    assert_true(entries[1].name.includes('empty.js?second'), "empty.js?second is in the entries buffer");
+    assert_true(entries[2].name.includes('empty_script.js'), "empty_script.js is in the entries buffer");
+    assert_true(entries[3].name.includes('empty.js?xhr'), "empty.js?xhr is in the entries buffer");
+};
+
+promise_test(async () => {
+    await fillUpTheBufferWithTwoResources('resources/empty.js');
+    await overflowTheBuffer();
+    await waitForEventToFire();
+    testThatBufferContainsTheRightResources();
+}, "Test that entries in the secondary buffer are not exposed during the callback and before they are copied to the primary buffer");
+</script>
+</body>
+</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-set-to-current-buffer-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-set-to-current-buffer-expected.txt
new file mode 100644 (file)
index 0000000..d44ef50
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS Test that entries added and event firing happened in the right sequence 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-set-to-current-buffer.html b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-set-to-current-buffer.html
new file mode 100644 (file)
index 0000000..1e5486e
--- /dev/null
@@ -0,0 +1,82 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<meta charset="utf-8">
+<link rel="help" href="https://w3c.github.io/resource-timing/#dom-performance-setresourcetimingbuffersize">
+<title>This test validates that setResourceTimingBufferFull behaves appropriately when set to the current buffer level.</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/buffer-full-utilities.js"></script>
+</head>
+<body>
+<script>
+let eventFired = false;
+
+let loadRandomResource = () => {
+    return fetch(window.location.href + "?" + Math.random());
+};
+
+setup(() => {
+    // Get the browser into a consistent state.
+    clearBufferAndSetSize(100);
+    window.result = "";
+});
+
+let fillUpTheBuffer = () => {
+    return new Promise(resolve => {
+        // Gather up 3 Resource Entries to kick off the rest of test behavior.
+        let resources = 0;
+        let observer = new PerformanceObserver(list => {
+            resources += list.getEntriesByType("resource").length;
+            if (resources !== 3)
+                return;
+            observer.disconnect();
+            resolve();
+        });
+        observer.observe({entryTypes: ["resource"]});
+        for (let i = 0; i < 3; ++i)
+            loadRandomResource();
+    });
+};
+
+let setBufferSize = () => {
+    performance.onresourcetimingbufferfull = () => {
+        eventFired = true;
+        window.result += "Event Fired with "  + performance.getEntriesByType("resource").length + " entries. ";
+        performance.clearResourceTimings();
+    };
+    window.result += "before setLimit(3). ";
+    performance.setResourceTimingBufferSize(3);
+    window.result += "after setLimit(3). ";
+};
+
+let overflowTheBuffer = () => {
+    return new Promise(resolve => {
+        loadRandomResource().then(() => {
+            window.result += "after loading 4th resource. ";
+            resolve();
+        });
+    });
+};
+
+let checkResult = () => {
+    return new Promise((resolve, reject) => {
+        if (window.result != "before setLimit(3). after setLimit(3). after loading 4th resource. Event Fired with 3 entries. ") {
+            reject("Non matching value: " + window.result);
+        }
+        let entries = performance.getEntriesByType("resource");
+        if (entries.length != 1) {
+            reject("Number of entries in resource timing buffer is unexpected: " + entries.length);
+        }
+        resolve();
+    });
+};
+
+promise_test(async () => {
+    await fillUpTheBuffer();
+    setBufferSize();
+    await overflowTheBuffer();
+    await waitForEventToFire();
+    await checkResult();
+}, "Test that entries added and event firing happened in the right sequence");
+</script>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-store-and-clear-during-callback-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-store-and-clear-during-callback-expected.txt
new file mode 100644 (file)
index 0000000..aa3808a
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS Test that entries overflowing the buffer trigger the buffer full event, can be stored, and find themselves in the primary buffer after it's cleared. 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-store-and-clear-during-callback.html b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-store-and-clear-during-callback.html
new file mode 100644 (file)
index 0000000..f0791cb
--- /dev/null
@@ -0,0 +1,55 @@
+<!DOCTYPE HTML>
+<html>
+<head onload>
+<meta charset="utf-8" />
+<title>This test validates the behavior of read and clear operation in onresourcetimingbufferfull callback of resource timing.</title>
+<link rel="author" title="Intel" href="http://www.intel.com/" />
+<link rel="help" href="http://www.w3.org/TR/resource-timing/#performanceresourcetiming"/>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/buffer-full-utilities.js"></script>
+</head>
+<body>
+<script>
+const resource_timing_buffer_size = 1;
+let global_buffer = [];
+let eventFired = false;
+
+setup(() => {
+    clearBufferAndSetSize(resource_timing_buffer_size);
+    let store_and_clear = function() {
+        const entryList = performance.getEntriesByType('resource');
+        entryList.forEach(function (entry) {
+            global_buffer.push(entry);
+        });
+        performance.clearResourceTimings();
+        eventFired = true;
+    }
+    performance.addEventListener('resourcetimingbufferfull', store_and_clear);
+});
+
+let overflowTheBuffer = () => {
+    return new Promise(resolve => {
+        // This resource overflows the entry buffer, and goes into the secondary buffer.
+        appendScript('resources/empty_script.js', resolve);
+    });
+};
+
+let testThatBufferContainsTheRightResources = () => {
+    let entries = performance.getEntriesByType('resource');
+    assert_equals(entries.length, 1,
+                  "Only the last entry should be stored in resource timing buffer since it's cleared once it overflows.");
+    assert_equals(global_buffer.length, 1, '1 resource timing entry should be moved to global buffer.');
+    assert_true(global_buffer[0].name.includes('empty.js'), "empty.js is in the global buffer");
+    assert_true(entries[0].name.includes('empty_script.js'), "empty_script.js is in the entries buffer");
+};
+
+promise_test(async () => {
+    await fillUpTheBufferWithSingleResource("resources/empty.js");
+    await overflowTheBuffer();
+    await waitForEventToFire();
+    testThatBufferContainsTheRightResources();
+}, "Test that entries overflowing the buffer trigger the buffer full event, can be stored, and find themselves in the primary buffer after it's cleared.");
+</script>
+</body>
+</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-then-increased-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-then-increased-expected.txt
new file mode 100644 (file)
index 0000000..b47fa53
--- /dev/null
@@ -0,0 +1,6 @@
+CONSOLE MESSAGE: line 2659: Error: assert_unreached: resourcetimingbufferfull should not fire Reached unreachable code
+
+Harness Error (FAIL), message = Error: assert_unreached: resourcetimingbufferfull should not fire Reached unreachable code
+
+FAIL Test that overflowing the buffer and immediately increasing its limit does not trigger the resourcetimingbufferfull event assert_equals: All resources should be in the buffer, since its size was increased expected 3 but got 1
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-then-increased.html b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-then-increased.html
new file mode 100644 (file)
index 0000000..2265077
--- /dev/null
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML>
+<html>
+<head onload>
+<meta charset="utf-8" />
+<title>This test validates that synchronously adding entries in onresourcetimingbufferfull callback results in these entries being properly handled.</title>
+<link rel="help" href="http://www.w3.org/TR/resource-timing/#performanceresourcetiming"/>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/buffer-full-utilities.js"></script>
+</head>
+<body>
+<script>
+const resource_timing_buffer_size = 1;
+
+setup(() => {
+    clearBufferAndSetSize(resource_timing_buffer_size);
+    performance.addEventListener('resourcetimingbufferfull', () => { assert_unreached("resourcetimingbufferfull should not fire"); });
+});
+
+let overflowTheBuffer = () => {
+    // These resources overflow the entry buffer, and go into the secondary buffer.
+    xhrScript('resources/empty.js?xhr2');
+    xhrScript('resources/empty.js?xhr3');
+    performance.setResourceTimingBufferSize(3);
+};
+
+let testThatBufferContainsTheRightResources = () => {
+        let entries = performance.getEntriesByType('resource');
+        assert_equals(entries.length, 3,
+                      'All resources should be in the buffer, since its size was increased');
+        assert_true(entries[0].name.includes('empty.js'), "empty.js?xhr2 is in the entries buffer");
+        assert_true(entries[1].name.includes('empty.js?xhr2'), "empty.js?xhr3 is in the entries buffer");
+        assert_true(entries[2].name.includes('empty.js?xhr3'), "empty.js?xhr3 is in the entries buffer");
+};
+
+promise_test(async () => {
+    await fillUpTheBufferWithSingleResource("resources/empty.js");
+    overflowTheBuffer();
+    await waitForNextTask();
+    testThatBufferContainsTheRightResources();
+}, "Test that overflowing the buffer and immediately increasing its limit does not trigger the resourcetimingbufferfull event");
+</script>
+</body>
+</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-when-populate-entries-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-when-populate-entries-expected.txt
new file mode 100644 (file)
index 0000000..88ccc9d
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS Test that a buffer full event does not bubble and that resourcetimingbufferfull is called only once per overflow 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-when-populate-entries.html b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-when-populate-entries.html
new file mode 100644 (file)
index 0000000..00d2ae0
--- /dev/null
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<meta charset="utf-8" />
+<link rel="author" title="Intel" href="http://www.intel.com/" />
+<link rel="help" href="http://www.w3.org/TR/resource-timing/#performanceresourcetiming"/>
+<title>This test validates the functionality of onresourcetimingbufferfull in resource timing.</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/buffer-full-utilities.js"></script>
+</head>
+<body>
+<script>
+const resource_timing_buffer_size = 2;
+let bufferFullCount = 0;
+let eventFired = false;
+setup(() => {
+    clearBufferAndSetSize(resource_timing_buffer_size);
+    performance.addEventListener('resourcetimingbufferfull', e => {
+        assert_equals(e.bubbles, false, "Event bubbles attribute is false");
+        bufferFullCount++;
+        eventFired = true;
+    });
+});
+
+let overflowTheBuffer = () => {
+    return new Promise(resolve => {
+        // This resource overflows the entry buffer, and goes into the secondary buffer.
+        appendScript('resources/empty_script.js', resolve);
+    });
+};
+
+let testThatBufferContainsTheRightResources = () => {
+    assert_equals(performance.getEntriesByType('resource').length, resource_timing_buffer_size, 'There should only be |bufferSize| resource entries.');
+    assert_equals(bufferFullCount, 1, 'onresourcetimingbufferfull should have been invoked once.');
+};
+
+promise_test(async () => {
+    await fillUpTheBufferWithTwoResources('resources/empty.js');
+    await overflowTheBuffer();
+    await waitForEventToFire();
+    testThatBufferContainsTheRightResources();
+}, "Test that a buffer full event does not bubble and that resourcetimingbufferfull is called only once per overflow");
+</script>
+</body>
+</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/document-domain-no-impact-loader.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/document-domain-no-impact-loader.sub-expected.txt
new file mode 100644 (file)
index 0000000..782ee5e
--- /dev/null
@@ -0,0 +1,6 @@
+Blocked access to external URL http://www.localhost:8801/resource-timing/resources/document-domain-no-impact.sub.html
+
+Harness Error (TIMEOUT), message = null
+
+NOTRUN Finite resource timing entries buffer size 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/document-domain-no-impact-loader.sub.html b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/document-domain-no-impact-loader.sub.html
new file mode 100644 (file)
index 0000000..8a1c433
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<meta charset="utf-8">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<script>
+    const t = async_test("Finite resource timing entries buffer size");
+    addEventListener("message", t.step_func_done(e => {
+        assert_equals(e.data, "PASS", "Document domain had no impact on the timing-allow check");
+    }));
+window.open("//{{domains[www]}}:{{ports[http][1]}}/resource-timing/resources/document-domain-no-impact.sub.html");
+</script>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/no-entries-for-cross-origin-css-fetched.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/no-entries-for-cross-origin-css-fetched.sub-expected.txt
new file mode 100644 (file)
index 0000000..457a763
--- /dev/null
@@ -0,0 +1,4 @@
+Some content
+
+PASS Make sure that resources fetched by cross origin CSS are not in the timeline. 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/no-entries-for-cross-origin-css-fetched.sub.html b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/no-entries-for-cross-origin-css-fetched.sub.html
new file mode 100644 (file)
index 0000000..63f9e06
--- /dev/null
@@ -0,0 +1,39 @@
+<!DOCTYPE HTML>
+<meta charset=utf-8>
+<title>Make sure that resources fetched by cross origin CSS are not in the timeline.</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/get-host-info.sub.js"></script>
+<body>
+<script>
+    const host = get_host_info();
+
+    const link = document.createElement("LINK");
+    link.rel = "stylesheet";
+    link.id = "cross_origin_style";
+
+    /*
+        This stylesheet is fetched from one of:
+            //www1.web–platform.test:64941/resource-timing/resources/nested.css
+            //127.0.0.1:64941/resource-timing/resources/nested.css
+     */
+    link.href = "//" + host.REMOTE_HOST + ":{{ports[http][1]}}{{location[path]}}/../resources/nested.css"
+    document.currentScript.parentNode.insertBefore(link, document.currentScript);
+</script>
+<script>
+  const t = async_test("Make sure that resources fetched by cross origin CSS are not in the timeline.");
+  window.addEventListener("load", function() {
+    // A timeout is needed as entries are not guaranteed to be in the timeline before onload triggers.
+    t.step_timeout(function() {
+          const url = (new URL(document.getElementById("cross_origin_style").href));
+          const prefix = url.protocol + "//" + url.host;
+          assert_equals(performance.getEntriesByName(prefix + "/resource-timing/resources/resource_timing_test0.css?id=n1").length, 0, "Import should not be in timeline");
+          assert_equals(performance.getEntriesByName(prefix + "/fonts/Ahem.ttf?id=n1").length, 0, "Font should not be in timeline");
+          assert_equals(performance.getEntriesByName(prefix + "/resource-timing/resources/blue.png?id=n1").length, 0, "Image should not be in timeline");
+          t.done();
+    }, 200);
+  });
+</script>
+<ol>Some content</ol>
+</body>
+
@@ -53,34 +53,6 @@ window.onload =
                             "'Src' of new <iframe> must be 'about:blank'.");
                     }
             },
-            {
-                description: "Setting 'document.domain' does not effect same-origin checks",
-                test:
-                    function (test) {
-                        initiateFetch(
-                            test,
-                            "iframe",
-                            canonicalize("iframe-setdomain.sub.html"),
-                            function (initiator, entry) {
-                                // Ensure that the script inside the IFrame has successfully changed the IFrame's domain.
-                                assert_throws(
-                                    null,
-                                    function () {
-                                        assert_not_equals(frame.contentWindow.document, null);
-                                    },
-                                    "Test Error: IFrame is not recognized as cross-domain.");
-
-                                // To verify that setting 'document.domain' did not change the results of the timing allow check,
-                                // verify that the following non-zero properties return their value.
-                                ["domainLookupStart", "domainLookupEnd", "connectStart", "connectEnd"]
-                                    .forEach(function(property) {
-                                        assert_greater_than(entry.connectEnd, 0,
-                                            "Property should be non-zero because timing allow check ignores 'document.domain'.");
-                                    });
-                                test.done();
-                            });
-                    }
-            }
         ];
 
         // Create cached/uncached tests from the following array of templates.  For each template entry,
@@ -224,6 +196,86 @@ window.onload =
                 });
             });
 
+        // Ensure that responseStart only measures the time up to the first few
+        // bytes of the header response. This is tested by writing an HTTP 1.1
+        // status line, followed by a flush, then a pause before the end of the
+        // headers. The test makes sure that responseStart is not delayed by
+        // this pause.
+        [
+            { initiator: "iframe",         response: "(done)",    mime: mimeHtml },
+            { initiator: "xmlhttprequest", response: "(done)",    mime: mimeText },
+            { initiator: "script",         response: '"";',       mime: mimeScript },
+            { initiator: "link",           response: ".unused{}", mime: mimeCss },
+        ]
+        .forEach(function (template) {
+            testCases.push({
+                description: "'" + template.initiator + " " + serverStepDelay + "ms delay in headers does not affect responseStart'",
+                test: function (test) {
+                    initiateFetch(
+                        test,
+                        template.initiator,
+                        getSyntheticUrl("status:200"
+                                        + "&flush"
+                                        + "&" + serverStepDelay + "ms"
+                                        + "&mime:" + template.mime
+                                        + "&send:" + encodeURIComponent(template.response)),
+                        function (initiator, entry) {
+                            // Test that the delay between 'responseStart' and
+                            // 'responseEnd' includes the delay, which implies
+                            // that 'responseStart' was measured at the time of
+                            // status line receipt.
+                            assert_greater_than_equal(
+                                entry.responseEnd,
+                                entry.responseStart + serverStepDelay,
+                                "Delay after HTTP/1.1 status should not affect 'responseStart'.");
+
+                            test.done();
+                        });
+                    }
+                });
+            });
+
+        // Test that responseStart uses the timing of 1XX responses by
+        // synthesizing a delay between a 100 and 200 status, and verifying that
+        // this delay is included before responseEnd. If the delay is not
+        // included, this implies that the 200 status line was (incorrectly) used
+        // for responseStart timing, despite the 100 response arriving earlier.
+        //
+        // Source: "In the case where more than one response is available for a
+        // request, due to an Informational 1xx response, the reported
+        // responseStart value is that of the first response to the last
+        // request."
+        [
+            { initiator: "iframe",         response: "(done)",    mime: mimeHtml },
+            { initiator: "xmlhttprequest", response: "(done)",    mime: mimeText },
+            { initiator: "script",         response: '"";',       mime: mimeScript },
+            { initiator: "link",           response: ".unused{}", mime: mimeCss },
+        ]
+        .forEach(function (template) {
+            testCases.push({
+                description: "'" + template.initiator + " responseStart uses 1XX (first) response timings'",
+                test: function (test) {
+                    initiateFetch(
+                        test,
+                        template.initiator,
+                        getSyntheticUrl("status:100"
+                                        + "&flush"
+                                        + "&" + serverStepDelay + "ms"
+                                        + "&status:200"
+                                        + "&mime:" + template.mime
+                                        + "&send:" + encodeURIComponent(template.response)),
+                        function (initiator, entry) {
+                            assert_greater_than_equal(
+                                entry.responseEnd,
+                                entry.responseStart + serverStepDelay,
+                                "HTTP/1.1 1XX (first) response should determine 'responseStart' timing.");
+
+                            test.done();
+                        });
+                    }
+                });
+            });
+
         // Function to run the next case in the queue.
         var currentTestIndex = -1;
         function runNextCase() {
@@ -244,7 +296,7 @@ window.onload =
             // Multiple browsers seem to cheat a bit and race img.onLoad and setting responseEnd.  Microsoft https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/2379187
             // Yield for 100ms to workaround a suspected race where window.onload fires before
             //     script visible side-effects from the wininet/urlmon thread have finished.
-            window.setTimeout(
+            test.step_timeout(
                 test.step_func(
                     function () {
                         performance
@@ -388,7 +440,7 @@ window.onload =
             when invoked. */
         function createOnloadCallbackFn(test, initiator, url, onloadCallback) {
             // Remember the number of entries on the timeline prior to initiating the fetch:
-            var beforeEntryCount = performance.getEntries().length;
+            var beforeEntryCount = performance.getEntriesByType("resource").length;
 
             return test.step_func(
                 function() {
@@ -400,7 +452,7 @@ window.onload =
                         }
                     }
 
-                    var entries = performance.getEntries();
+                    var entries = performance.getEntriesByType("resource");
                     var candidateEntry = entries[entries.length - 1];
 
                     switch (entries.length - beforeEntryCount)
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource-timing-level1.sub-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource-timing-level1.sub-expected.txt
new file mode 100644 (file)
index 0000000..5ce703a
--- /dev/null
@@ -0,0 +1,11 @@
+
+Harness Error (TIMEOUT), message = null
+
+PASS No timeline entry for about:blank 
+PASS 'iframe (Populate cache): The initial request populates the cache (if appropriate). 
+PASS 'iframe (Potentially Cached): Immediately fetch the same URL, exercising the cache hit path (if any). 
+PASS 'xmlhttprequest (Populate cache): The initial request populates the cache (if appropriate). 
+PASS 'xmlhttprequest (Potentially Cached): Immediately fetch the same URL, exercising the cache hit path (if any). 
+TIMEOUT 'script (Populate cache): The initial request populates the cache (if appropriate). Test timed out
+TIMEOUT 'script (Potentially Cached): Immediately fetch the same URL, exercising the cache hit path (if any). Test timed out
+Show details
@@ -2,6 +2,7 @@
 <html>
 <head>
   <title>Resource-Timing Level 1</title>
+  <meta name="timeout" content="long">
   <!-- To aid debugability, explicitly link the testharness's CSS to avoid demand
        loading it while the test executes. -->
   <script src="/resources/testharness.js"></script>
@@ -13,6 +14,6 @@
 <body>
   <div id="log"></div>
   <pre id="output"></pre>
-  <script src="resource-timing.js"></script>
+  <script src="resource-timing-level1.js"></script>
 </body>
 </html>
index d2bcab9..7a31a7e 100644 (file)
@@ -21,7 +21,6 @@ test_namespace('getEntriesByType');
 function setup_iframe() {
     iframe = document.getElementById('frameContext');
     d = iframe.contentWindow.document;
-    iframeBody = d.body;
     iframe.addEventListener('load', onload_test, false);
 }
 
@@ -41,6 +40,11 @@ function onload_test() {
         const entry = entries[1];
         test_equals(entry.fetchStart, entry.connectStart, 'connectStart and fetchStart should be the same');
         test_equals(entry.fetchStart, entry.connectEnd, 'connectEnd and fetchStart should be the same');
+        if(!window.isSecureConnection) {
+            test_equals(entry.secureConnectionStart, 0, 'secureConnectStart should be zero');
+        }
+        test_equals(entry.fetchStart, entry.domainLookupStart, 'domainLookupStart and fetchStart should be the same')
+        test_equals(entry.fetchStart, entry.domainLookupEnd, 'domainLookupEnd and fetchStart should be the same')
     }
 
     done();
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_connection_reuse.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_connection_reuse.https-expected.txt
new file mode 100644 (file)
index 0000000..1f9ac1a
--- /dev/null
@@ -0,0 +1,14 @@
+Description
+
+This test validates that connectStart and connectEnd are the same when a connection is reused (e.g. when a persistent connection is used).
+
+
+PASS window.performance is defined 
+PASS window.performance.getEntriesByType is defined 
+PASS There should be 2 PerformanceEntries 
+PASS connectStart and fetchStart should be the same 
+PASS connectEnd and fetchStart should be the same 
+FAIL secureConnectStart and fetchStart should be the same assert_equals: secureConnectStart and fetchStart should be the same expected 0 but got 51.00000000000001
+PASS domainLookupStart and fetchStart should be the same 
+PASS domainLookupEnd and fetchStart should be the same 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_connection_reuse.https.html b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_connection_reuse.https.html
new file mode 100644 (file)
index 0000000..bc79a85
--- /dev/null
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8" />
+<title>Resource Timing connection reuse</title>
+<link rel="author" title="Google" href="http://www.google.com/" />
+<link rel="help" href="https://www.w3.org/TR/resource-timing/#dom-performanceresourcetiming-initiatortype"/>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/webperftestharness.js"></script>
+<script src="resources/webperftestharnessextension.js"></script>
+<script>
+setup({explicit_done: true});
+let iframe;
+let d;
+let body;
+
+// Explicitly test the namespace before we start testing.
+test_namespace('getEntriesByType');
+
+function setup_iframe() {
+    iframe = document.getElementById('frameContext');
+    d = iframe.contentWindow.document;
+    iframe.addEventListener('load', onload_test, false);
+}
+
+function onload_test() {
+    if (window.performance.getEntriesByType === undefined) {
+      done();
+      return;
+    }
+    const context = new PerformanceContext(iframe.contentWindow.performance);
+    const entries = context.getEntriesByType('resource');
+
+    // When a persistent connection is used, follow-on resources should be included as PerformanceResourceTiming objects.
+    test_equals(entries.length, 2, 'There should be 2 PerformanceEntries');
+
+    if (entries.length >= 2) {
+        // When a persistent connection is used, for the resource that reuses the socket, connectStart and connectEnd should have the same value as fetchStart.
+        const entry = entries[1];
+        test_equals(entry.fetchStart, entry.connectStart, 'connectStart and fetchStart should be the same');
+        test_equals(entry.fetchStart, entry.connectEnd, 'connectEnd and fetchStart should be the same');
+        test_equals(entry.fetchStart, entry.secureConnectionStart, 'secureConnectStart and fetchStart should be the same');
+        test_equals(entry.fetchStart, entry.domainLookupStart, 'domainLookupStart and fetchStart should be the same')
+        test_equals(entry.fetchStart, entry.domainLookupEnd, 'domainLookupEnd and fetchStart should be the same')
+    }
+
+    done();
+}
+
+window.setup_iframe = setup_iframe;
+</script>
+</head>
+<body>
+<h1>Description</h1>
+<p>This test validates that connectStart and connectEnd are the same when a connection is reused (e.g. when a persistent connection is used).</p>
+<div id="log"></div>
+<iframe id="frameContext" src="resources/fake_responses.html"></iframe>
+</body>
+</html>
index d610c66..61938b9 100644 (file)
@@ -5,7 +5,5 @@ This test validates that initiator types are represented even when dynamically i
 
 PASS window.performance is defined 
 PASS window.performance.getEntriesByType is defined 
-PASS http://localhost:8800/resource-timing/resources/inject_resource_test.html is expected to have initiatorType iframe 
-PASS http://localhost:8800/resource-timing/resources/resource_timing_test0.css is expected to have initiatorType link 
-PASS http://localhost:8800/resource-timing/resources/resource_timing_test0.png is expected to have initiatorType img 
+PASS Testing resource entries 
 
index 624e24e..d3a0e0f 100644 (file)
@@ -1,16 +1,15 @@
-Blocked access to external URL http://www1.localhost:8801/resource-timing/resources/blue.png?id=cached
-Blocked access to external URL http://www1.localhost:8801/resource-timing/resources/blue.png?id=cached
-Blocked access to external URL http://www1.localhost:8801/resource-timing/resources/blue.png?id=cached
 Description
 
 This test validates that a memory cached resource appears in the buffer once.
 
 
-Harness Error (TIMEOUT), message = null
-
 PASS There should be only one entry 
-PASS http://localhost:8800/resource-timing/resources/blue.png?id=cached is expected to have initiatorType img 
+PASS Testing resource entries 
 PASS requestStart should be non-zero on the same-origin request 
 PASS responseEnd should not be before startTime 
 PASS duration should not be negative 
+PASS There should be one entry in second test 
+PASS Entry name should start with cross-origin domain 
+PASS Entry name should end with file name 
+PASS requestStart should be 0 on the cross-origin request 
   
index 236f69f..89b5874 100644 (file)
@@ -9,24 +9,26 @@
 <script src="/resources/testharnessreport.js"></script>
 <script src="resources/webperftestharness.js"></script>
 <script src="resources/webperftestharnessextension.js"></script>
+<script src="/common/get-host-info.sub.js"></script>
 <script>
 setup({explicit_done: true});
 let d;
 let iframe;
 let iframeBody;
 let count = 0;
+const host = get_host_info();
 function onload_prep() {
     iframe = document.getElementById('frameContext');
     d = iframe.contentWindow.document;
     iframeBody = d.body;
 
-    const image = d.createElement('img');
+    const image = d.createElement('IMG');
     image.addEventListener('load', function() {
         step_timeout(onload_test, 0); });
     image.src = 'blue.png?id=cached';
     iframeBody.appendChild(image);
 
-    const image2 = d.createElement('img');
+    const image2 = d.createElement('IMG');
     image2.addEventListener('load', function() {
         step_timeout(onload_test, 0); });
     image2.src = 'blue.png?id=cached';
@@ -55,16 +57,16 @@ function onload_test() {
     start_crossorigin_test();
 }
 function start_crossorigin_test() {
-    const image3 = d.createElement('img');
+    const image3 = d.createElement('IMG');
     image3.addEventListener("load", function() { step_timeout(finish_crossorigin_test, 0); });
-    image3.src = 'http://{{domains[www1]}}:{{ports[http][1]}}{{location[path]}}/../resources/blue.png?id=cached';
+    image3.src = 'http://' + host.REMOTE_HOST + ':{{ports[http][1]}}{{location[path]}}/../resources/blue.png?id=cached';
     iframeBody.appendChild(image3);
 }
 function finish_crossorigin_test() {
     const context = new PerformanceContext(iframe.contentWindow.performance);
     const entries = context.getEntriesByType('resource');
     test_equals(entries.length, 1, 'There should be one entry in second test');
-    test_true(entries[0].name.startsWith('http://{{domains[www1]}}:{{ports[http][1]}}'), 'Entry name should start with cross-origin domain');
+    test_true(entries[0].name.startsWith('http://' + host.REMOTE_HOST + ':{{ports[http][1]}}'), 'Entry name should start with cross-origin domain');
     test_true(entries[0].name.endsWith('/resources/blue.png?id=cached'), 'Entry name should end with file name');
     test_equals(entries[0].requestStart, 0, 'requestStart should be 0 on the cross-origin request');
     done();
@@ -79,6 +81,10 @@ window.addEventListener('load', onload_prep);
 <div id="log"></div>
 <iframe id="frameContext" src="resources/inject_resource_test.html"></iframe>
 <img src="resources/blue.png?id=cached"></img>
-<img src="http://{{domains[www1]}}:{{ports[http][1]}}{{location[path]}}/../resources/blue.png?id=cached"></img>
+<script>
+    const img = document.createElement('IMG');
+    img.src = "http://" + host.REMOTE_HOST + ":{{ports[http][1]}}{{location[path]}}/../resources/blue.png?id=cached";
+    document.currentScript.parentNode.insertBefore(img, document.currentScript);
+</script>
 </body>
 </html>
index 10cff58..77f9308 100644 (file)
@@ -3,9 +3,5 @@ Description
 This test validates that redirects do not alter the URL.
 
 
-PASS http://localhost:8800/common/redirect.py?location=/resource-timing/resources/blank_page_green.htm is expected to have initiatorType iframe 
-PASS http://localhost:8800/common/redirect.py?location=/resource-timing/resources/blank_page_green.htm?id=xhr is expected to have initiatorType xmlhttprequest 
-PASS http://localhost:8800/common/redirect.py?location=/resource-timing/resources/blue.png is expected to have initiatorType img 
-PASS http://localhost:8800/common/redirect.py?location=/resource-timing/resources/empty_script.js is expected to have initiatorType script 
-PASS http://localhost:8800/common/redirect.py?location=/resource-timing/resources/resource_timing_test0.css is expected to have initiatorType link 
+PASS Testing resource entries 
 
index 0c76972..aebf83b 100644 (file)
@@ -3,13 +3,5 @@ Description
 This test validates that all of the different types of script loads are reported with the correct initiator.
 
 
-PASS http://localhost:8800/resource-timing/resources/empty_script.js?id=1 is expected to have initiatorType script 
-PASS http://localhost:8800/resource-timing/resources/empty_script.js?id=2 is expected to have initiatorType script 
-PASS http://localhost:8800/resource-timing/resources/empty_script.js?id=3 is expected to have initiatorType script 
-PASS http://localhost:8800/resource-timing/resources/empty_script.js?id=4 is expected to have initiatorType script 
-PASS http://localhost:8800/resource-timing/resources/empty_script.js?id=5 is expected to have initiatorType script 
-PASS http://localhost:8800/resource-timing/resources/empty_script.js?id=6 is expected to have initiatorType script 
-PASS http://localhost:8800/resource-timing/resources/empty_script.js?id=7 is expected to have initiatorType script 
-PASS http://localhost:8800/resource-timing/resources/empty_script.js?id=8 is expected to have initiatorType script 
-PASS http://localhost:8800/resource-timing/resources/empty_script.js?id=9 is expected to have initiatorType script 
+PASS Testing resource entries 
 
index 92687f0..dafd2e9 100644 (file)
@@ -59,6 +59,6 @@ async_test(t => {
   .then(() => {
     t.done();
   });
-}, "Performance Resouce Entries in workers");
+}, "Performance Resource Entries in workers");
 
 done();
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_timing_buffer_full_when_populate_entries-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_timing_buffer_full_when_populate_entries-expected.txt
deleted file mode 100644 (file)
index 63b25cf..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-
-PASS There should only be |bufferSize| resource entries. 
-PASS onresourcetimingbufferfull should have been invoked once buffer is full. 
-
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_timing_buffer_full_when_populate_entries.html b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_timing_buffer_full_when_populate_entries.html
deleted file mode 100644 (file)
index 3e62b19..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-<meta charset="utf-8" />
-<link rel="author" title="Intel" href="http://www.intel.com/" />
-<link rel="help" href="http://www.w3.org/TR/resource-timing/#performanceresourcetiming"/>
-<title>This test validates the functionality of onresourcetimingbufferfull in resource timing.</title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="resources/webperftestharness.js"></script>
-<script src="resources/webperftestharnessextension.js"></script>
-</head>
-<body onload=onload_test()>
-<script>
-    const context = new PerformanceContext(performance);
-    const bufferSize = 5;
-    context.setResourceTimingBufferSize(bufferSize);
-    let bufferFullCount = 0;
-    function buffer_full_callback() {
-        bufferFullCount++;
-    }
-    context.registerResourceTimingBufferFullCallback(buffer_full_callback);
-    // Scripts appended in JS to ensure setResourceTimingBufferSize is called before.
-    function appendScript(src) {
-        const script = document.createElement('script');
-        script.type = 'text/javascript';
-        script.src = src;
-        document.body.appendChild(script);
-    }
-    appendScript('resources/empty.js');
-    appendScript('resources/empty_script.js');
-    appendScript('resources/resource_timing_test0.js');
-    setup({ explicit_done: true });
-    function onload_test() {
-        test_equals(context.getEntriesByType('resource').length, bufferSize, 'There should only be |bufferSize| resource entries.');
-        test_equals(bufferFullCount, 1, 'onresourcetimingbufferfull should have been invoked once buffer is full.');
-        done();
-    }
-</script>
-</body>
-</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_timing_store_and_clear_during_callback-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_timing_store_and_clear_during_callback-expected.txt
deleted file mode 100644 (file)
index 5d7ca62..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-
-FAIL No entry should be stored in resource timing buffer since its cleared once an item arrived. assert_equals: No entry should be stored in resource timing buffer since its cleared once an item arrived. expected 0 but got 1
-PASS 6 resource timing entries should be moved to global buffer. 
-FAIL http://localhost:8800/resource-timing/resources/empty.js is not expected to be in the Resource Timing buffer assert_unreached: Reached unreachable code
-PASS http://localhost:8800/resource-timing/resources/empty_script.js is expected to have initiatorType script 
-PASS http://localhost:8800/resource-timing/resources/webperftestharness.js is expected to have initiatorType script 
-PASS http://localhost:8800/resource-timing/resources/webperftestharnessextension.js is expected to have initiatorType script 
-PASS http://localhost:8800/resources/testharness.js is expected to have initiatorType script 
-PASS http://localhost:8800/resources/testharnessreport.js is expected to have initiatorType script 
-FAIL http://localhost:8800/resource-timing/resources/resource_timing_test0.js is expected to be in the Resource Timing buffer assert_unreached: Reached unreachable code
-
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_timing_store_and_clear_during_callback.html b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_timing_store_and_clear_during_callback.html
deleted file mode 100644 (file)
index 218fc0c..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head onload>
-<meta charset="utf-8" />
-<title>This test validates the behavior of read and clear operation in onresourcetimingbufferfull callback of resource timing.</title>
-<link rel="author" title="Intel" href="http://www.intel.com/" />
-<link rel="help" href="http://www.w3.org/TR/resource-timing/#performanceresourcetiming"/>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="resources/webperftestharness.js"></script>
-<script src="resources/webperftestharnessextension.js"></script>
-</head>
-<body onload=onload_test()>
-<script>
-    const context = new PerformanceContext(performance);
-    const resource_timing_buffer_size = 1;
-    let global_buffer = [];
-    function store_and_clear() {
-        const entryList = context.getEntriesByType('resource');
-        entryList.forEach(function (entry) {
-            global_buffer.push(entry);
-        });
-        context.clearResourceTimings();
-    }
-    context.registerResourceTimingBufferFullCallback(store_and_clear);
-    context.setResourceTimingBufferSize(resource_timing_buffer_size);
-    // Scripts appended in JS to ensure setResourceTimingBufferSize is called before.
-    function appendScript(src) {
-        const script = document.createElement('script');
-        script.type = 'text/javascript';
-        script.src = src;
-        document.body.appendChild(script);
-    }
-    appendScript('resources/empty.js');
-    appendScript('resources/empty_script.js');
-    appendScript('resources/resource_timing_test0.js');
-    setup({ explicit_done: true });
-    function onload_test() {
-        test_equals(context.getEntriesByType('resource').length, 0, 'No entry should be stored in resource timing buffer since its cleared once an item arrived.');
-        // The entry for empty.js must not be in the global buffer, but all others should be.
-        test_equals(global_buffer.length, 6, '6 resource timing entries should be moved to global buffer.');
-        const index = window.location.pathname.lastIndexOf('resource-timing');
-        const pathname = window.location.pathname.substring(0, index);
-        let expected_entries = {};
-        expected_entries[pathname + 'resources/testharness.js'] = 'script';
-        expected_entries[pathname + 'resources/testharnessreport.js'] = 'script';
-        expected_entries[pathname + 'resource-timing/resources/webperftestharness.js'] = 'script';
-        expected_entries[pathname + 'resource-timing/resources/webperftestharnessextension.js'] = 'script';
-        expected_entries[pathname + 'resource-timing/resources/empty_script.js'] = 'script';
-        expected_entries[pathname + 'resource-timing/resources/resource_timing_test0.js'] = 'script';
-        test_resource_entries(global_buffer, expected_entries);
-        done();
-    }
-</script>
-</body>
-</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/buffer-full-utilities.js b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/buffer-full-utilities.js
new file mode 100644 (file)
index 0000000..b143da7
--- /dev/null
@@ -0,0 +1,58 @@
+let appendScript = (src, resolve) => {
+    const script = document.createElement('script');
+    script.type = 'text/javascript';
+    script.src = src;
+    script.onload = resolve;
+    document.body.appendChild(script);
+}
+
+let xhrScript = src => {
+    var xhr = new XMLHttpRequest();
+    xhr.open("GET", src, false);
+    xhr.send(null);
+}
+
+let waitForNextTask = () => {
+    return new Promise(resolve => {
+        step_timeout(resolve, 0);
+    });
+};
+
+let waitForEventToFire = () => {
+    return new Promise(resolve => {
+        let waitForIt = function() {
+            if (eventFired) {
+                eventFired = false;
+                resolve();
+            } else {
+                step_timeout(waitForIt, 0);
+            }
+        }
+        step_timeout(waitForIt, 0);
+    });
+};
+
+let clearBufferAndSetSize = size => {
+    performance.clearResourceTimings();
+    performance.setResourceTimingBufferSize(size);
+}
+
+let fillUpTheBufferWithSingleResource = src => {
+    return new Promise(resolve => {
+        // This resource gets buffered in the resource timing entry buffer.
+        appendScript(src, resolve);
+    });
+};
+
+let loadResource = src => {
+    return new Promise(resolve => {
+        appendScript(src, resolve);
+    });
+};
+
+let fillUpTheBufferWithTwoResources = async src => {
+    // These resources get buffered in the resource timing entry buffer.
+    await loadResource(src);
+    await loadResource(src + '?second');
+};
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/document-domain-no-impact.sub.html b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/document-domain-no-impact.sub.html
new file mode 100644 (file)
index 0000000..fbd7bc3
--- /dev/null
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<meta charset="utf-8">
+<iframe id="frame" src="//{{domains[www]}}:{{ports[http][1]}}/resource-timing/resources/iframe-setdomain.sub.html"></iframe>
+<script>
+    let opener = window.opener;
+    window.addEventListener("load", () => {
+        try {
+            let frameDoc = document.getElementById("frame").contentWindow.document;
+            opener.postMessage("FAIL - iframe document.domain was not set", "*");
+            return;
+        } catch(error) {
+            if (error.name != "SecurityError") {
+                opener.postMessage("FAIL - error is " + error.name, "*");
+                return;
+            }
+            let entry = performance.getEntriesByName(window.location.protocol + "//{{domains[www]}}:{{ports[http][1]}}/resource-timing/resources/iframe-setdomain.sub.html");
+            // To verify that setting 'document.domain' did not change the results of the timing allow check,
+            // verify that the following non-zero properties return their value.
+            ["domainLookupStart", "domainLookupEnd", "connectStart", "connectEnd"].forEach(property => {
+                if (entry[property] == 0) {
+                    opener.postMessage("FAIL - " + property + " is 0 but timing allow check should ignore document.domain", "*");
+                }
+            });
+            opener.postMessage("PASS", "*");
+        }
+        opener.postMessage("FAIL - unknown", "*");
+    });
+</script>
+
+
+
@@ -1,14 +1,14 @@
 <!DOCTYPE html>
 <html>
 <head>
-  <title>domain: {{domains[www]}}</title>
+  <title>domain: {{domains[]}}</title>
 </head>
 <body>
   <script>
     // The purpose of this IFrame is to change the 'document.domain'
-    document.domain = "{{domains[www]}}";
+    document.domain = "{{domains[]}}";
   </script>
-  The resource-timings.html test loads this document into an IFrame to vet that setting
+  The resource-timings-level1.sub.html test loads this document into an IFrame to vet that setting
   'document.domain' does not effect the timing allowed.
 </body>
 </html>
index ff0de30..4d67ebb 100644 (file)
@@ -18,6 +18,8 @@ List of files:
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/all_resource_types.htm
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/blank_page_green.htm
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/blue.png
+/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/buffer-full-utilities.js
+/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/document-domain-no-impact.sub.html
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/empty.js
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/empty.py
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/empty_script.js
@@ -26,6 +28,7 @@ List of files:
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/fake_responses.py
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/green_frame.htm
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/gzip_xml.py
+/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/iframe-setdomain.sub.html
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/iframe_TAO_match_origin.html
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/iframe_TAO_match_wildcard.html
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/resources/iframe_TAO_multi.html
index 98b2954..203eb0d 100644 (file)
@@ -1,4 +1,8 @@
-//
+/*
+author: W3C http://www.w3.org/
+help: http://www.w3.org/TR/navigation-timing/#sec-window.performance-attribute
+*/
+//
 // Helper Functions for NavigationTiming W3C tests
 //
 
@@ -45,7 +49,8 @@ function wp_test(func, msg, properties)
         if (performanceNamespace === undefined || performanceNamespace == null)
         {
             // show a single error that window.performance is undefined
-            test(function() { assert_true(performanceNamespace !== undefined && performanceNamespace != null, "window.performance is defined and not null"); }, "window.performance is defined and not null.", {author:"W3C http://www.w3.org/",help:"http://www.w3.org/TR/navigation-timing/#sec-window.performance-attribute",assert:"The window.performance attribute provides a hosting area for performance related attributes. "});
+            // The window.performance attribute provides a hosting area for performance related attributes.
+            test(function() { assert_true(performanceNamespace !== undefined && performanceNamespace != null, "window.performance is defined and not null"); }, "window.performance is defined and not null.");
         }
     }
 
@@ -56,12 +61,14 @@ function test_namespace(child_name, skip_root)
 {
     if (skip_root === undefined) {
         var msg = 'window.performance is defined';
-        wp_test(function () { assert_true(performanceNamespace !== undefined, msg); }, msg,{author:"W3C http://www.w3.org/",help:"http://www.w3.org/TR/navigation-timing/#sec-window.performance-attribute",assert:"The window.performance attribute provides a hosting area for performance related attributes. "});
+        // The window.performance attribute provides a hosting area for performance related attributes.
+        wp_test(function () { assert_true(performanceNamespace !== undefined, msg); }, msg);
     }
 
     if (child_name !== undefined) {
         var msg2 = 'window.performance.' + child_name + ' is defined';
-        wp_test(function() { assert_true(performanceNamespace[child_name] !== undefined, msg2); }, msg2,{author:"W3C http://www.w3.org/",help:"http://www.w3.org/TR/navigation-timing/#sec-window.performance-attribute",assert:"The window.performance attribute provides a hosting area for performance related attributes. "});
+        // The window.performance attribute provides a hosting area for performance related attributes.
+        wp_test(function() { assert_true(performanceNamespace[child_name] !== undefined, msg2); }, msg2);
     }
 }
 
index 230f2ac..901cb1d 100644 (file)
@@ -49,45 +49,48 @@ function test_fail(msg, properties)
 
 function test_resource_entries(entries, expected_entries)
 {
-    // This is slightly convoluted so that we can sort the output.
-    var actual_entries = {};
-    var origin = window.location.protocol + "//" + window.location.host;
-
-    for (var i = 0; i < entries.length; ++i) {
-        var entry = entries[i];
-        var found = false;
-        for (var expected_entry in expected_entries) {
-            if (entry.name == origin + expected_entry) {
-                found = true;
-                if (expected_entry in actual_entries) {
-                    test_fail(expected_entry + ' is not expected to have duplicate entries');
+    test(function() {
+        // This is slightly convoluted so that we can sort the output.
+        var actual_entries = {};
+        var origin = window.location.protocol + "//" + window.location.host;
+
+        for (var i = 0; i < entries.length; ++i) {
+            var entry = entries[i];
+            var found = false;
+            for (var expected_entry in expected_entries) {
+                if (entry.name == origin + expected_entry) {
+                    found = true;
+                    if (expected_entry in actual_entries) {
+                        assert_unreached(expected_entry + ' is not expected to have duplicate entries');
+                    }
+                    actual_entries[expected_entry] = entry;
+                    break;
                 }
-                actual_entries[expected_entry] = entry;
-                break;
+            }
+            if (!found) {
+                assert_unreached(entries[i].name + ' is not expected to be in the Resource Timing buffer');
             }
         }
-        if (!found) {
-            test_fail(entries[i].name + ' is not expected to be in the Resource Timing buffer');
-        }
-    }
 
-    sorted_urls = [];
-    for (var i in actual_entries) {
-        sorted_urls.push(i);
-    }
-    sorted_urls.sort();
-    for (var i in sorted_urls) {
-        var url = sorted_urls[i];
-        test_equals(actual_entries[url].initiatorType,
-                    expected_entries[url],
-                    origin + url + ' is expected to have initiatorType ' + expected_entries[url]);
-    }
-    for (var j in expected_entries) {
-        if (!(j in actual_entries)) {
-            test_fail(origin + j + ' is expected to be in the Resource Timing buffer');
+        sorted_urls = [];
+        for (var i in actual_entries) {
+            sorted_urls.push(i);
         }
-    }
+        sorted_urls.sort();
+        for (var i in sorted_urls) {
+            var url = sorted_urls[i];
+            assert_equals(actual_entries[url].initiatorType,
+                        expected_entries[url],
+                        origin + url + ' is expected to have initiatorType ' + expected_entries[url]);
+        }
+        for (var j in expected_entries) {
+            if (!(j in actual_entries)) {
+                assert_unreached(origin + j + ' is expected to be in the Resource Timing buffer');
+            }
+        }
+    }, "Testing resource entries");
 }
+
 function performance_entrylist_checker(type)
 {
     var entryType = type;
index 39d7d5b..1f8f400 100644 (file)
     function (entryList, obs) {
       var entries = entryList.getEntriesByType("resource");
       for (var i = 0; i < entries.length; ++i) {
+        // Ignore any entries for the test harness files if present.
+        if (/testharness(report)?\.js/.test(entries[i].name)) {
+          continue;
+        }
+
         ++observed;
         if (entries[i].name.indexOf(img_url) != -1)
             ++img_entries;
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/supported_resource_type.any-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/supported_resource_type.any-expected.txt
new file mode 100644 (file)
index 0000000..df46af5
--- /dev/null
@@ -0,0 +1,3 @@
+
+FAIL supportedEntryTypes contains 'resource'. assert_unreached: supportedEntryTypes is not supported. Reached unreachable code
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/supported_resource_type.any.html b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/supported_resource_type.any.html
new file mode 100644 (file)
index 0000000..2382913
--- /dev/null
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/supported_resource_type.any.js b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/supported_resource_type.any.js
new file mode 100644 (file)
index 0000000..6096ad7
--- /dev/null
@@ -0,0 +1,6 @@
+test(() => {
+  if (typeof PerformanceObserver.supportedEntryTypes === "undefined")
+    assert_unreached("supportedEntryTypes is not supported.");
+  assert_true(PerformanceObserver.supportedEntryTypes.includes("resource"),
+    "There should be an entry 'resource' in PerformanceObserver.supportedEntryTypes");
+}, "supportedEntryTypes contains 'resource'.");
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/supported_resource_type.any.worker-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/supported_resource_type.any.worker-expected.txt
new file mode 100644 (file)
index 0000000..df46af5
--- /dev/null
@@ -0,0 +1,3 @@
+
+FAIL supportedEntryTypes contains 'resource'. assert_unreached: supportedEntryTypes is not supported. Reached unreachable code
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/supported_resource_type.any.worker.html b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/supported_resource_type.any.worker.html
new file mode 100644 (file)
index 0000000..2382913
--- /dev/null
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/test_resource_timing.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/test_resource_timing.https-expected.txt
new file mode 100644 (file)
index 0000000..a0e5d7a
--- /dev/null
@@ -0,0 +1,34 @@
+Description
+
+NOTE: Due to caching behavior in the browser, it is possible that when revisiting this page, some resources may not have to be fetched from the network. As a result, the performance timeline will not contain entries for these resources. This test will fail if any entries are missing to ensure that all resources are fetched from the network and entries for these resources exist in the Performance Timeline. If revisiting this page, please either perform a full reload of the page or clear the cache between visits.
+
+
+PASS window.performance.getEntriesByName() and window.performance.getEntriesByNameType() return same data (iframe) 
+PASS PerformanceEntry has correct name, initiatorType, startTime, and duration (iframe) 
+PASS PerformanceEntry has correct order of timing attributes (iframe) 
+FAIL PerformanceEntry has correct network transfer attributes (iframe) assert_equals: encodedBodySize size expected (number) 215 but got (undefined) undefined
+PASS PerformanceEntry has correct protocol attribute (iframe) 
+PASS window.performance.getEntriesByName() and window.performance.getEntriesByNameType() return same data (img) 
+PASS PerformanceEntry has correct name, initiatorType, startTime, and duration (img) 
+PASS PerformanceEntry has correct order of timing attributes (img) 
+FAIL PerformanceEntry has correct network transfer attributes (img) assert_equals: encodedBodySize size expected (number) 249 but got (undefined) undefined
+PASS PerformanceEntry has correct protocol attribute (img) 
+PASS window.performance.getEntriesByName() and window.performance.getEntriesByNameType() return same data (link) 
+PASS PerformanceEntry has correct name, initiatorType, startTime, and duration (link) 
+PASS PerformanceEntry has correct order of timing attributes (link) 
+FAIL PerformanceEntry has correct network transfer attributes (link) assert_equals: encodedBodySize size expected (number) 44 but got (undefined) undefined
+PASS PerformanceEntry has correct protocol attribute (link) 
+PASS window.performance.getEntriesByName() and window.performance.getEntriesByNameType() return same data (script) 
+PASS PerformanceEntry has correct name, initiatorType, startTime, and duration (script) 
+PASS PerformanceEntry has correct order of timing attributes (script) 
+FAIL PerformanceEntry has correct network transfer attributes (script) assert_equals: encodedBodySize size expected (number) 133 but got (undefined) undefined
+PASS PerformanceEntry has correct protocol attribute (script) 
+PASS window.performance.getEntriesByName() and window.performance.getEntriesByNameType() return same data (xmlhttprequest) 
+PASS PerformanceEntry has correct name, initiatorType, startTime, and duration (xmlhttprequest) 
+PASS PerformanceEntry has correct order of timing attributes (xmlhttprequest) 
+FAIL PerformanceEntry has correct network transfer attributes (xmlhttprequest) assert_equals: encodedBodySize size expected (number) 112 but got (undefined) undefined
+PASS PerformanceEntry has correct protocol attribute (xmlhttprequest) 
+PASS window.performance Resource Timing Entries exist 
+PASS window.performance Resource Timing Entries exist 1 
+PASS window.performance Resource Timing Entries exist 2 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/resource-timing/test_resource_timing.https.html b/LayoutTests/imported/w3c/web-platform-tests/resource-timing/test_resource_timing.https.html
new file mode 100644 (file)
index 0000000..f4e851a
--- /dev/null
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <meta charset="UTF-8" />
+        <title>window.performance Resource Timing Entries exist</title>
+        <link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
+        <link rel="help" href="https://w3c.github.io/web-performance/specs/ResourceTiming/Overview.html"/>
+        <script src="/resources/testharness.js"></script>
+        <script src="/resources/testharnessreport.js"></script>
+        <script src="test_resource_timing.js"></script>
+    </head>
+    <body>
+        <h1>Description</h1>
+        <p>
+           NOTE: Due to caching behavior in the browser, it is possible that when revisiting this page, some resources
+           may not have to be fetched from the network.  As a result, the performance timeline will not contain entries
+           for these resources. This test will fail if any entries are missing to ensure that all resources are fetched
+           from the network and entries for these resources exist in the Performance Timeline.  If revisiting this page,
+           please either perform a full reload of the page or clear the cache between visits.
+        </p>
+
+        <div id="log"></div>
+    </body>
+</html>
index 8e729e0..598a727 100644 (file)
@@ -186,22 +186,21 @@ function resource_load(expected)
         const entries = window.performance.getEntriesByName(expected.name);
         assert_equals(entries.length, 1, 'There should be a single matching entry');
         const actual = entries[0];
-
-        // Debugging bug 1263428
-        // Feel free to remove/overwrite this piece of code
-        if (actual.connectStart < actual.domainLookupEnd) {
-            assert_true(false, "actual: "+JSON.stringify(actual));
+        if (window.location.protocol == "http:") {
+            assert_equals(actual.secureConnectionStart, 0, 'secureConnectionStart should be 0 in http');
+        } else {
+            assert_greater_than(actual.secureConnectionStart, 0, 'secureConnectionStart should not be 0 in https');
         }
 
         assert_equals(actual.redirectStart, 0, 'redirectStart should be 0');
         assert_equals(actual.redirectEnd, 0, 'redirectEnd should be 0');
-        assert_true(actual.secureConnectionStart == undefined ||
-                    actual.secureConnectionStart == 0, 'secureConnectionStart should be 0 or undefined');
         assert_equals(actual.fetchStart, actual.startTime, 'fetchStart is equal to startTime');
         assert_greater_than_equal(actual.domainLookupStart, actual.fetchStart, 'domainLookupStart after fetchStart');
         assert_greater_than_equal(actual.domainLookupEnd, actual.domainLookupStart, 'domainLookupEnd after domainLookupStart');
         assert_greater_than_equal(actual.connectStart, actual.domainLookupEnd, 'connectStart after domainLookupEnd');
         assert_greater_than_equal(actual.connectEnd, actual.connectStart, 'connectEnd after connectStart');
+        assert_true(actual.secureConnectionStart == 0 || actual.secureConnectionStart <= actual.requestStart,
+            "secureConnectionStart should be either 0 or smaller than/equals to requestStart")
         assert_greater_than_equal(actual.requestStart, actual.connectEnd, 'requestStart after connectEnd');
         assert_greater_than_equal(actual.responseStart, actual.requestStart, 'responseStart after requestStart');
         assert_greater_than_equal(actual.responseEnd, actual.responseStart, 'responseEnd after responseStart');
index 749aa83..26b68fb 100644 (file)
@@ -16,12 +16,24 @@ None
 List of files:
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/META.yml
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/SyntheticResponse.py
+/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-add-after-full-event.html
+/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-add-entries-during-callback-that-drop.html
+/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-add-entries-during-callback.html
+/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-add-then-clear.html
+/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-decrease-buffer-during-callback.html
+/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-increase-buffer-during-callback.html
+/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-inspect-buffer-during-callback.html
+/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-set-to-current-buffer.html
+/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-store-and-clear-during-callback.html
+/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-then-increased.html
+/LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer-full-when-populate-entries.html
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/clear_resource_timing_functionality.html
+/LayoutTests/imported/w3c/web-platform-tests/resource-timing/document-domain-no-impact-loader.sub.html
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/idlharness.any.js
-/LayoutTests/imported/w3c/web-platform-tests/resource-timing/iframe-setdomain.sub.html
+/LayoutTests/imported/w3c/web-platform-tests/resource-timing/no-entries-for-cross-origin-css-fetched.sub.html
+/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource-timing-level1.js
+/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource-timing-level1.sub.html
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource-timing-tojson.html
-/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource-timing.html
-/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource-timing.js
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_TAO_cross_origin_redirect_chain.html
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_TAO_match_origin.htm
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_TAO_match_wildcard.htm
@@ -35,6 +47,7 @@ List of files:
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_TAO_zero.htm
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_cached.htm
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_connection_reuse.html
+/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_connection_reuse.https.html
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_dedicated_worker.html
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_dynamic_insertion.html
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_ignore_data_url.html
@@ -48,12 +61,12 @@ List of files:
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_timing.worker.js
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_timing_TAO_cross_origin_redirect.html
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_timing_buffer_full_eventually.html
-/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_timing_buffer_full_when_populate_entries.html
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_timing_buffer_full_when_shrink_buffer_size.html
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_timing_cross_origin_redirect.html
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_timing_cross_origin_redirect_chain.html
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_timing_same_origin_redirect.html
-/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_timing_store_and_clear_during_callback.html
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/single-entry-per-resource.html
+/LayoutTests/imported/w3c/web-platform-tests/resource-timing/supported_resource_type.any.js
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/test_resource_timing.html
+/LayoutTests/imported/w3c/web-platform-tests/resource-timing/test_resource_timing.https.html
 /LayoutTests/imported/w3c/web-platform-tests/resource-timing/test_resource_timing.js
index df029b0..42bfbae 100644 (file)
     "imported/w3c/web-platform-tests/quirks/hashless-hex-color.html": [
         "slow"
     ],
+    "imported/w3c/web-platform-tests/resource-timing/resource-timing-level1.sub.html": [
+        "slow"
+    ],
     "imported/w3c/web-platform-tests/resource-timing/single-entry-per-resource.html": [
         "slow"
     ],