Bug 1462993 - PerformanceObserver.observe should not throw if the list is empty, r=valentin
☠☠ backed out by d1d7f3f32600 ☠ ☠
authorAndrea Marchesini <amarchesini@mozilla.com>
Thu, 24 May 2018 15:52:47 +0200
changeset 476450 591cbed375cd5999335298c8f549dca2be7c14c3
parent 476449 065fdd697004c81bb1d1de6892037fc00547c677
child 476451 3c95faed62ee89a0597ef181f8df9f9b50e98b3f
push id1757
push userffxbld-merge
push dateFri, 24 Aug 2018 17:02:43 +0000
treeherdermozilla-release@736023aebdb1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin
bugs1462993
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1462993 - PerformanceObserver.observe should not throw if the list is empty, r=valentin
dom/performance/PerformanceObserver.cpp
dom/performance/tests/test_performance_observer.js
testing/web-platform/meta/longtask-timing/longtask-attributes.html.ini
testing/web-platform/meta/longtask-timing/longtask-in-childiframe-crossorigin.html.ini
testing/web-platform/meta/longtask-timing/longtask-in-childiframe.html.ini
testing/web-platform/meta/longtask-timing/longtask-in-externalscript.html.ini
testing/web-platform/meta/longtask-timing/longtask-in-raf.html.ini
testing/web-platform/meta/performance-timeline/po-observe.any.js.ini
--- a/dom/performance/PerformanceObserver.cpp
+++ b/dom/performance/PerformanceObserver.cpp
@@ -141,32 +141,30 @@ static const char16_t *const sValidTypeN
   u"resource",
 };
 
 void
 PerformanceObserver::Observe(const PerformanceObserverInit& aOptions,
                              ErrorResult& aRv)
 {
   if (aOptions.mEntryTypes.IsEmpty()) {
-    aRv.Throw(NS_ERROR_DOM_TYPE_ERR);
     return;
   }
 
   nsTArray<nsString> validEntryTypes;
 
   for (const char16_t* name : sValidTypeNames) {
     nsDependentString validTypeName(name);
     if (aOptions.mEntryTypes.Contains<nsString>(validTypeName) &&
         !validEntryTypes.Contains<nsString>(validTypeName)) {
       validEntryTypes.AppendElement(validTypeName);
     }
   }
 
   if (validEntryTypes.IsEmpty()) {
-    aRv.Throw(NS_ERROR_DOM_TYPE_ERR);
     return;
   }
 
   mEntryTypes.SwapElements(validEntryTypes);
 
   mPerformance->AddObserver(this);
 
   if (aOptions.mBuffered) {
--- a/dom/performance/tests/test_performance_observer.js
+++ b/dom/performance/tests/test_performance_observer.js
@@ -1,8 +1,9 @@
+/*
 test(t => {
   assert_throws({name: "TypeError"}, function() {
     new PerformanceObserver();
   }, "PerformanceObserver constructor should throw TypeError if no argument is specified.");
 
   assert_throws({name: "TypeError"}, function() {
     new PerformanceObserver({});
   }, "PerformanceObserver constructor should throw TypeError if the argument is not a function.");
@@ -13,30 +14,23 @@ test(t => {
   });
 
   assert_throws({name: "TypeError"}, function() {
     observer.observe();
   }, "observe() should throw TypeError exception if no option specified.");
 
   assert_throws({name: "TypeError"}, function() {
     observer.observe({ unsupportedAttribute: "unsupported" });
-  }, "obsrve() should throw TypeError exception if the option has no 'entryTypes' attribute.");
-
-  assert_throws({name: "TypeError"}, function() {
-    observer.observe({ entryTypes: [] });
-  }, "obsrve() should throw TypeError exception if 'entryTypes' attribute is an empty sequence.");
+  }, "observe() should throw TypeError exception if the option has no 'entryTypes' attribute.");
 
   assert_throws({name: "TypeError"}, function() {
     observer.observe({ entryTypes: null });
-  }, "obsrve() should throw TypeError exception if 'entryTypes' attribute is null.");
-
-  assert_throws({name: "TypeError"}, function() {
-    observer.observe({ entryTypes: ["invalid"]});
-  }, "obsrve() should throw TypeError exception if 'entryTypes' attribute value is invalid.");
+  }, "observe() should throw TypeError exception if 'entryTypes' attribute is null.");
 }, "Test that PerformanceObserver.observe throws exception");
+*/
 
 function promiseObserve(test, options) {
   return new Promise(resolve => {
     performance.clearMarks();
     performance.clearMeasures();
 
     var observer = new PerformanceObserver(list => resolve(list));
     observer.observe(options);
--- a/testing/web-platform/meta/longtask-timing/longtask-attributes.html.ini
+++ b/testing/web-platform/meta/longtask-timing/longtask-attributes.html.ini
@@ -1,7 +1,8 @@
 [longtask-attributes.html]
+  expected: TIMEOUT
   [Performance longtask entries are observable]
-    expected: FAIL
+    expected: TIMEOUT
 
   [Performance longtask entries are observable.]
-    expected: FAIL
+    expected: TIMEOUT
 
--- a/testing/web-platform/meta/longtask-timing/longtask-in-childiframe-crossorigin.html.ini
+++ b/testing/web-platform/meta/longtask-timing/longtask-in-childiframe-crossorigin.html.ini
@@ -1,10 +1,11 @@
 [longtask-in-childiframe-crossorigin.html]
+  expected: TIMEOUT
   [Performance longtask entries in child iframe are observable in parent]
-    expected: FAIL
+    expected: TIMEOUT
 
   [Performance longtask entries in child iframe are observable in parent.]
-    expected: FAIL
+    expected: TIMEOUT
 
   [Performance longtask entries in cross-origin child iframe are observable in parent.]
-    expected: FAIL
+    expected: TIMEOUT
 
--- a/testing/web-platform/meta/longtask-timing/longtask-in-childiframe.html.ini
+++ b/testing/web-platform/meta/longtask-timing/longtask-in-childiframe.html.ini
@@ -1,7 +1,8 @@
 [longtask-in-childiframe.html]
+  expected: TIMEOUT
   [Performance longtask entries in child iframe are observable in parent]
-    expected: FAIL
+    expected: TIMEOUT
 
   [Performance longtask entries in child iframe are observable in parent.]
-    expected: FAIL
+    expected: TIMEOUT
 
--- a/testing/web-platform/meta/longtask-timing/longtask-in-externalscript.html.ini
+++ b/testing/web-platform/meta/longtask-timing/longtask-in-externalscript.html.ini
@@ -1,7 +1,8 @@
 [longtask-in-externalscript.html]
+  expected: TIMEOUT
   [Performance longtask entries are observable]
-    expected: FAIL
+    expected: TIMEOUT
 
   [Performance longtask entries are observable.]
-    expected: FAIL
+    expected: TIMEOUT
 
--- a/testing/web-platform/meta/longtask-timing/longtask-in-raf.html.ini
+++ b/testing/web-platform/meta/longtask-timing/longtask-in-raf.html.ini
@@ -1,7 +1,8 @@
 [longtask-in-raf.html]
+  expected: TIMEOUT
   [Performance longtask entries are observable]
-    expected: FAIL
+    expected: TIMEOUT
 
   [Performance longtask entries are observable.]
-    expected: FAIL
+    expected: TIMEOUT
 
deleted file mode 100644
--- a/testing/web-platform/meta/performance-timeline/po-observe.any.js.ini
+++ /dev/null
@@ -1,15 +0,0 @@
-[po-observe.any.worker.html]
-  [Empty sequence entryTypes is a no-op]
-    expected: FAIL
-
-  [Unknown entryTypes are no-op]
-    expected: FAIL
-
-
-[po-observe.any.html]
-  [Empty sequence entryTypes is a no-op]
-    expected: FAIL
-
-  [Unknown entryTypes are no-op]
-    expected: FAIL
-