@@ -213,10 +213,6 @@ public void disconnect() throws Exception {
213213 @ Alerts (DEFAULT = {"true" , "true" , "true" , "true" },
214214 FF = {"true" , "false" , "true" , "true" },
215215 FF_ESR = {"true" , "false" , "true" , "true" })
216- @ HtmlUnitNYI (CHROME = {"true" , "false" , "true" , "true" },
217- EDGE = {"true" , "false" , "true" , "true" },
218- FF = {"true" , "false" , "true" , "true" },
219- FF_ESR = {"true" , "false" , "true" , "true" })
220216 public void supportedEntryTypes () throws Exception {
221217 runTest ("var types = PerformanceObserver.supportedEntryTypes;\n "
222218 + "log(Array.isArray(types));\n "
@@ -233,19 +229,63 @@ public void supportedEntryTypes() throws Exception {
233229 + "long-animation-frame,longtask,mark,measure,navigation,paint,resource,soft-navigation,visibility-state" ,
234230 FF = "event,first-input,largest-contentful-paint,mark,measure,navigation,paint,resource" ,
235231 FF_ESR = "event,first-input,largest-contentful-paint,mark,measure,navigation,paint,resource" )
236- @ HtmlUnitNYI (
237- CHROME = "element,event,first-input,largest-contentful-paint,layout-shift,"
238- + "long-animation-frame,longtask,mark,measure,navigation,paint,resource,visibility-state" ,
239- EDGE = "element,event,first-input,largest-contentful-paint,layout-shift,"
240- + "long-animation-frame,longtask,mark,measure,navigation,paint,resource,visibility-state" ,
241- FF = "element,event,first-input,largest-contentful-paint,layout-shift,"
242- + "long-animation-frame,longtask,mark,measure,navigation,paint,resource,visibility-state" ,
243- FF_ESR = "element,event,first-input,largest-contentful-paint,layout-shift,"
244- + "long-animation-frame,longtask,mark,measure,navigation,paint,resource,visibility-state" )
245232 public void supportedEntryTypesList () throws Exception {
246233 runTest ("log(PerformanceObserver.supportedEntryTypes.join());" );
247234 }
248235
236+ /**
237+ * The entryTypes member has to be a sequence (e.g. an array).
238+ * @throws Exception if the test fails
239+ */
240+ @ Test
241+ @ Alerts ({"TypeError" , "TypeError" , "TypeError" , "TypeError" , "done" })
242+ public void observeEntryTypesNotASequence () throws Exception {
243+ runTest ("var observer = new PerformanceObserver(function() {});\n "
244+ + "try { observer.observe({ entryTypes: 'mark' }); log('done'); } catch(e) { logEx(e); }\n "
245+ + "try { observer.observe({ entryTypes: 7 }); log('done'); } catch(e) { logEx(e); }\n "
246+ + "try { observer.observe({ entryTypes: null }); log('done'); } catch(e) { logEx(e); }\n "
247+ + "try { observer.observe({ entryTypes: {} }); log('done'); } catch(e) { logEx(e); }\n "
248+ + "try { observer.observe({ entryTypes: new Set(['mark']) }); log('done'); } catch(e) { logEx(e); }" );
249+ }
250+
251+ /**
252+ * @throws Exception if the test fails
253+ */
254+ @ Test
255+ @ Alerts ("done" )
256+ public void observeEntryTypesWithBuffered () throws Exception {
257+ runTest ("var observer = new PerformanceObserver(function() {});\n "
258+ + "try { observer.observe({ entryTypes: ['mark'], buffered: true }); log('done'); }"
259+ + " catch(e) { logEx(e); }" );
260+ }
261+
262+ /**
263+ * @throws Exception if the test fails
264+ */
265+ @ Test
266+ @ Alerts ({"TypeError" , "TypeError" })
267+ public void observeOptionsNotAnObject () throws Exception {
268+ runTest ("var observer = new PerformanceObserver(function() {});\n "
269+ + "try { observer.observe('mark'); log('done'); } catch(e) { logEx(e); }\n "
270+ + "try { observer.observe(null); log('done'); } catch(e) { logEx(e); }" );
271+ }
272+
273+ /**
274+ * @throws Exception if the test fails
275+ */
276+ @ Test
277+ @ Alerts (DEFAULT = {"true" , "TypeError" , "-1" },
278+ FF = {"false" , "9" , "-1" },
279+ FF_ESR = {"false" , "9" , "-1" })
280+ @ HtmlUnitNYI (CHROME = {"true" , "15" , "-1" },
281+ EDGE = {"true" , "15" , "-1" })
282+ public void supportedEntryTypesSameObject () throws Exception {
283+ runTest ("var types = PerformanceObserver.supportedEntryTypes;\n "
284+ + "log(types === PerformanceObserver.supportedEntryTypes);\n "
285+ + "try { types.push('htmlunit'); log(types.length); } catch(e) { logEx(e); }\n "
286+ + "log(PerformanceObserver.supportedEntryTypes.indexOf('htmlunit'));" );
287+ }
288+
249289 private void runTest (final String js ) throws Exception {
250290 final String html = DOCTYPE_HTML
251291 + "<html><head>\n "
0 commit comments