Title: [240454] trunk
Revision
240454
Author
[email protected]
Date
2019-01-24 16:04:52 -0800 (Thu, 24 Jan 2019)

Log Message

Implement PerformanceObserver.supportedEntryTypes
https://bugs.webkit.org/show_bug.cgi?id=193428

LayoutTests/imported/w3c:

Patch by Charles Vazac <[email protected]> on 2019-01-24
Reviewed by Joseph Pecoraro.

* web-platform-tests/resource-timing/supported_resource_type.any-expected.txt:
* web-platform-tests/resource-timing/supported_resource_type.any.worker-expected.txt:

Source/WebCore:

PerformanceObserver.supportedEntryTypes should return an array of
entryTypes that can be observed per specification
https://w3c.github.io/performance-timeline/#supportedentrytypes-attribute

Patch by Charles Vazac <[email protected]> on 2019-01-24
Reviewed by Joseph Pecoraro.

This is covered by web-platform-tests
LayoutTests/imported/w3c/web-platform-tests/resource-timing/supported_resource_type.*.html.

* page/PerformanceObserver.cpp:
(WebCore::PerformanceObserver::supportedEntryTypes):
* page/PerformanceObserver.h:
* page/PerformanceObserver.idl:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (240453 => 240454)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2019-01-24 23:41:30 UTC (rev 240453)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2019-01-25 00:04:52 UTC (rev 240454)
@@ -1,3 +1,13 @@
+2019-01-24  Charles Vazac  <[email protected]>
+
+        Implement PerformanceObserver.supportedEntryTypes
+        https://bugs.webkit.org/show_bug.cgi?id=193428
+
+        Reviewed by Joseph Pecoraro.
+
+        * web-platform-tests/resource-timing/supported_resource_type.any-expected.txt:
+        * web-platform-tests/resource-timing/supported_resource_type.any.worker-expected.txt:
+
 2019-01-23  Oriol Brufau  <[email protected]>
 
         [css-logical] Implement flow-relative inset properties

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/navigation-timing/supported_navigation_type.any-expected.txt (0 => 240454)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/navigation-timing/supported_navigation_type.any-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/navigation-timing/supported_navigation_type.any-expected.txt	2019-01-25 00:04:52 UTC (rev 240454)
@@ -0,0 +1,3 @@
+
+FAIL supportedEntryTypes contains 'navigation'. assert_true: There should be an entry 'navigation' in PerformanceObserver.supportedEntryTypes expected true got false
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/navigation-timing/supported_navigation_type.any.html (0 => 240454)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/navigation-timing/supported_navigation_type.any.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/navigation-timing/supported_navigation_type.any.html	2019-01-25 00:04:52 UTC (rev 240454)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/navigation-timing/supported_navigation_type.any.js (0 => 240454)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/navigation-timing/supported_navigation_type.any.js	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/navigation-timing/supported_navigation_type.any.js	2019-01-25 00:04:52 UTC (rev 240454)
@@ -0,0 +1,20 @@
+test(() => {
+  if (typeof PerformanceObserver.supportedEntryTypes === "undefined")
+    assert_unreached("supportedEntryTypes is not supported.");
+  assert_true(PerformanceObserver.supportedEntryTypes.includes("navigation"),
+    "There should be an entry 'navigation' in PerformanceObserver.supportedEntryTypes");
+}, "supportedEntryTypes contains 'navigation'.");
+
+if (typeof PerformanceObserver.supportedEntryTypes !== "undefined") {
+  const entryType = "navigation";
+  if (PerformanceObserver.supportedEntryTypes.includes(entryType)) {
+    promise_test(async() => {
+      await new Promise((resolve) => {
+        new PerformanceObserver(function (list, observer) {
+          observer.disconnect();
+          resolve();
+        }).observe({entryTypes: [entryType]});
+      })
+    }, `'${entryType}' entries should be observable.`)
+  }
+}

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/navigation-timing/supported_navigation_type.any.worker-expected.txt (0 => 240454)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/navigation-timing/supported_navigation_type.any.worker-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/navigation-timing/supported_navigation_type.any.worker-expected.txt	2019-01-25 00:04:52 UTC (rev 240454)
@@ -0,0 +1,3 @@
+
+FAIL supportedEntryTypes contains 'navigation'. assert_true: There should be an entry 'navigation' in PerformanceObserver.supportedEntryTypes expected true got false
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/navigation-timing/supported_navigation_type.any.worker.html (0 => 240454)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/navigation-timing/supported_navigation_type.any.worker.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/navigation-timing/supported_navigation_type.any.worker.html	2019-01-25 00:04:52 UTC (rev 240454)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/performance-timeline/resources/square.png


(Binary files differ)
Index: trunk/LayoutTests/imported/w3c/web-platform-tests/performance-timeline/resources/square.png =================================================================== --- trunk/LayoutTests/imported/w3c/web-platform-tests/performance-timeline/resources/square.png 2019-01-24 23:41:30 UTC (rev 240453) +++ trunk/LayoutTests/imported/w3c/web-platform-tests/performance-timeline/resources/square.png 2019-01-25 00:04:52 UTC (rev 240454) Property changes on: trunk/LayoutTests/imported/w3c/web-platform-tests/performance-timeline/resources/square.png ___________________________________________________________________

Added: svn:mime-type

+image/png \ No newline at end of property

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/performance-timeline/supportedEntryTypes.any-expected.txt (0 => 240454)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/performance-timeline/supportedEntryTypes.any-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/performance-timeline/supportedEntryTypes.any-expected.txt	2019-01-25 00:04:52 UTC (rev 240454)
@@ -0,0 +1,3 @@
+
+PASS supportedEntryTypes exists and returns entries in alphabetical order 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/performance-timeline/supportedEntryTypes.any.html (0 => 240454)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/performance-timeline/supportedEntryTypes.any.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/performance-timeline/supportedEntryTypes.any.html	2019-01-25 00:04:52 UTC (rev 240454)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/performance-timeline/supportedEntryTypes.any.js (0 => 240454)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/performance-timeline/supportedEntryTypes.any.js	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/performance-timeline/supportedEntryTypes.any.js	2019-01-25 00:04:52 UTC (rev 240454)
@@ -0,0 +1,12 @@
+test(() => {
+  if (typeof PerformanceObserver.supportedEntryTypes === "undefined")
+    assert_unreached("supportedEntryTypes is not supported.");
+  const types = PerformanceObserver.supportedEntryTypes;
+  assert_greater_than(types.length, 0,
+    "There should be at least one entry in supportedEntryTypes.");
+  for (let i = 1; i < types.length; i++) {
+    assert_true(types[i-1] < types[i],
+      "The strings '" + types[i-1] + "' and '" + types[i] +
+      "' are repeated or they are not in alphabetical order.")
+  }
+}, "supportedEntryTypes exists and returns entries in alphabetical order");

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/performance-timeline/supportedEntryTypes.any.worker-expected.txt (0 => 240454)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/performance-timeline/supportedEntryTypes.any.worker-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/performance-timeline/supportedEntryTypes.any.worker-expected.txt	2019-01-25 00:04:52 UTC (rev 240454)
@@ -0,0 +1,3 @@
+
+PASS supportedEntryTypes exists and returns entries in alphabetical order 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/performance-timeline/supportedEntryTypes.any.worker.html (0 => 240454)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/performance-timeline/supportedEntryTypes.any.worker.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/performance-timeline/supportedEntryTypes.any.worker.html	2019-01-25 00:04:52 UTC (rev 240454)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/supported_resource_type.any-expected.txt (240453 => 240454)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/supported_resource_type.any-expected.txt	2019-01-24 23:41:30 UTC (rev 240453)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/supported_resource_type.any-expected.txt	2019-01-25 00:04:52 UTC (rev 240454)
@@ -1,3 +1,4 @@
 
-FAIL supportedEntryTypes contains 'resource'. assert_unreached: supportedEntryTypes is not supported. Reached unreachable code
+PASS supportedEntryTypes contains 'resource'. 
+PASS 'resource' entries should be observable. 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/supported_resource_type.any.js (240453 => 240454)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/supported_resource_type.any.js	2019-01-24 23:41:30 UTC (rev 240453)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/supported_resource_type.any.js	2019-01-25 00:04:52 UTC (rev 240454)
@@ -4,3 +4,21 @@
   assert_true(PerformanceObserver.supportedEntryTypes.includes("resource"),
     "There should be an entry 'resource' in PerformanceObserver.supportedEntryTypes");
 }, "supportedEntryTypes contains 'resource'.");
+
+if (typeof PerformanceObserver.supportedEntryTypes !== "undefined") {
+  const entryType = "resource";
+  if (PerformanceObserver.supportedEntryTypes.includes(entryType)) {
+    promise_test(async() => {
+      await new Promise((resolve) => {
+        new PerformanceObserver(function (list, observer) {
+          observer.disconnect();
+          resolve();
+        }).observe({entryTypes: [entryType]});
+
+        // Force the PerformanceEntry.
+        // Use `self` for Workers.
+        fetch(self.location.href + "?" + Math.random());
+      })
+    }, `'${entryType}' entries should be observable.`)
+  }
+}

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/supported_resource_type.any.worker-expected.txt (240453 => 240454)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/supported_resource_type.any.worker-expected.txt	2019-01-24 23:41:30 UTC (rev 240453)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/supported_resource_type.any.worker-expected.txt	2019-01-25 00:04:52 UTC (rev 240454)
@@ -1,3 +1,4 @@
 
-FAIL supportedEntryTypes contains 'resource'. assert_unreached: supportedEntryTypes is not supported. Reached unreachable code
+PASS supportedEntryTypes contains 'resource'. 
+PASS 'resource' entries should be observable. 
 

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/user-timing/supported-usertiming-types.any-expected.txt (0 => 240454)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/user-timing/supported-usertiming-types.any-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/user-timing/supported-usertiming-types.any-expected.txt	2019-01-25 00:04:52 UTC (rev 240454)
@@ -0,0 +1,5 @@
+
+PASS supportedEntryTypes contains 'mark' and 'measure'. 
+PASS 'mark' entries should be observable. 
+PASS 'measure' entries should be observable. 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/user-timing/supported-usertiming-types.any.html (0 => 240454)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/user-timing/supported-usertiming-types.any.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/user-timing/supported-usertiming-types.any.html	2019-01-25 00:04:52 UTC (rev 240454)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/user-timing/supported-usertiming-types.any.js (0 => 240454)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/user-timing/supported-usertiming-types.any.js	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/user-timing/supported-usertiming-types.any.js	2019-01-25 00:04:52 UTC (rev 240454)
@@ -0,0 +1,37 @@
+test(() => {
+  if (typeof PerformanceObserver.supportedEntryTypes === "undefined")
+    assert_unreached("supportedEntryTypes is not supported.");
+  const types = PerformanceObserver.supportedEntryTypes;
+  assert_true(types.includes("mark"),
+    "There should be 'mark' in PerformanceObserver.supportedEntryTypes");
+  assert_true(types.includes("measure"),
+    "There should be 'measure' in PerformanceObserver.supportedEntryTypes");
+  assert_greater_than(types.indexOf("measure"), types.indexOf('mark'),
+    "The 'measure' entry should appear after the 'mark' entry");
+}, "supportedEntryTypes contains 'mark' and 'measure'.");
+
+if (typeof PerformanceObserver.supportedEntryTypes !== "undefined") {
+  const entryTypes = {
+    "mark": () => {
+      performance.mark('foo');
+    },
+    "measure": () => {
+      performance.measure('bar');
+    }
+  }
+  for (let entryType in entryTypes) {
+    if (PerformanceObserver.supportedEntryTypes.includes(entryType)) {
+      promise_test(async() => {
+        await new Promise((resolve) => {
+          new PerformanceObserver(function (list, observer) {
+            observer.disconnect();
+            resolve();
+          }).observe({entryTypes: [entryType]});
+
+          // Force the PerformanceEntry.
+          entryTypes[entryType]();
+        })
+      }, `'${entryType}' entries should be observable.`)
+    }
+  }
+}

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/user-timing/supported-usertiming-types.any.worker-expected.txt (0 => 240454)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/user-timing/supported-usertiming-types.any.worker-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/user-timing/supported-usertiming-types.any.worker-expected.txt	2019-01-25 00:04:52 UTC (rev 240454)
@@ -0,0 +1,5 @@
+
+PASS supportedEntryTypes contains 'mark' and 'measure'. 
+PASS 'mark' entries should be observable. 
+PASS 'measure' entries should be observable. 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/user-timing/supported-usertiming-types.any.worker.html (0 => 240454)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/user-timing/supported-usertiming-types.any.worker.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/user-timing/supported-usertiming-types.any.worker.html	2019-01-25 00:04:52 UTC (rev 240454)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/user-timing/w3c-import.log (240453 => 240454)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/user-timing/w3c-import.log	2019-01-24 23:41:30 UTC (rev 240453)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/user-timing/w3c-import.log	2019-01-25 00:04:52 UTC (rev 240454)
@@ -1,7 +1,7 @@
 The tests in this directory were imported from the W3C repository.
 Do NOT modify these tests directly in WebKit.
 Instead, create a pull request on the WPT github:
-	https://github.com/w3c/web-platform-tests
+	https://github.com/web-platform-tests/wpt
 
 Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
 
@@ -32,4 +32,5 @@
 /LayoutTests/imported/w3c/web-platform-tests/user-timing/measure_exceptions_navigation_timing.html
 /LayoutTests/imported/w3c/web-platform-tests/user-timing/measure_navigation_timing.html
 /LayoutTests/imported/w3c/web-platform-tests/user-timing/measure_syntax_err.any.js
+/LayoutTests/imported/w3c/web-platform-tests/user-timing/supported-usertiming-types.any.js
 /LayoutTests/imported/w3c/web-platform-tests/user-timing/user_timing_exists.any.js

Modified: trunk/Source/WebCore/ChangeLog (240453 => 240454)


--- trunk/Source/WebCore/ChangeLog	2019-01-24 23:41:30 UTC (rev 240453)
+++ trunk/Source/WebCore/ChangeLog	2019-01-25 00:04:52 UTC (rev 240454)
@@ -1,3 +1,22 @@
+2019-01-24  Charles Vazac  <[email protected]>
+
+        Implement PerformanceObserver.supportedEntryTypes
+        https://bugs.webkit.org/show_bug.cgi?id=193428
+
+        PerformanceObserver.supportedEntryTypes should return an array of
+        entryTypes that can be observed per specification
+        https://w3c.github.io/performance-timeline/#supportedentrytypes-attribute
+
+        Reviewed by Joseph Pecoraro.
+
+        This is covered by web-platform-tests
+        LayoutTests/imported/w3c/web-platform-tests/resource-timing/supported_resource_type.*.html.
+
+        * page/PerformanceObserver.cpp:
+        (WebCore::PerformanceObserver::supportedEntryTypes):
+        * page/PerformanceObserver.h:
+        * page/PerformanceObserver.idl:
+
 2019-01-24  Truitt Savell  <[email protected]>
 
         Unreviewed, rolling out r240446.

Modified: trunk/Source/WebCore/page/PerformanceObserver.cpp (240453 => 240454)


--- trunk/Source/WebCore/page/PerformanceObserver.cpp	2019-01-24 23:41:30 UTC (rev 240453)
+++ trunk/Source/WebCore/page/PerformanceObserver.cpp	2019-01-25 00:04:52 UTC (rev 240454)
@@ -113,4 +113,15 @@
     InspectorInstrumentation::didFireObserverCallback(cookie);
 }
 
+Vector<String> PerformanceObserver::supportedEntryTypes()
+{
+    return {
+        // FIXME: <https://webkit.org/b/184363> Add support for Navigation Timing Level 2
+        // "navigation"_s,
+        "mark"_s,
+        "measure"_s,
+        "resource"_s
+    };
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/page/PerformanceObserver.h (240453 => 240454)


--- trunk/Source/WebCore/page/PerformanceObserver.h	2019-01-24 23:41:30 UTC (rev 240453)
+++ trunk/Source/WebCore/page/PerformanceObserver.h	2019-01-25 00:04:52 UTC (rev 240454)
@@ -49,6 +49,8 @@
         return adoptRef(*new PerformanceObserver(context, WTFMove(callback)));
     }
 
+    static Vector<String> supportedEntryTypes();
+
     void disassociate();
 
     ExceptionOr<void> observe(Init&&);

Modified: trunk/Source/WebCore/page/PerformanceObserver.idl (240453 => 240454)


--- trunk/Source/WebCore/page/PerformanceObserver.idl	2019-01-24 23:41:30 UTC (rev 240453)
+++ trunk/Source/WebCore/page/PerformanceObserver.idl	2019-01-25 00:04:52 UTC (rev 240454)
@@ -36,6 +36,7 @@
 ] interface PerformanceObserver {
     [MayThrowException] void observe(PerformanceObserverInit options);
     void disconnect();
+    static readonly attribute FrozenArray<DOMString> supportedEntryTypes;
 };
 
 dictionary PerformanceObserverInit {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to