File tree 3 files changed +10
-3
lines changed
test/fixtures/wpt/performance-timeline
3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -1272,7 +1272,7 @@ changes:
1272
1272
* ` buffered ` {boolean} If true, the observer callback is called with a
1273
1273
list global ` PerformanceEntry ` buffered entries. If false, only
1274
1274
` PerformanceEntry ` s created after the time point are sent to the
1275
- observer callback. ** Default: ** ` false ` .
1275
+ observer callback. Must be used only with ` options.type ` .
1276
1276
1277
1277
Subscribes the {PerformanceObserver} instance to notifications of new
1278
1278
{PerformanceEntry} instances identified either by ` options.entryTypes `
Original file line number Diff line number Diff line change @@ -260,11 +260,11 @@ class PerformanceObserver {
260
260
} = { ...options } ;
261
261
if ( entryTypes === undefined && type === undefined )
262
262
throw new ERR_MISSING_ARGS ( 'options.entryTypes' , 'options.type' ) ;
263
- if ( entryTypes != null && type != null )
263
+ if ( entryTypes != null && ( type != null || buffered ) )
264
264
throw new ERR_INVALID_ARG_VALUE ( 'options.entryTypes' ,
265
265
entryTypes ,
266
266
'options.entryTypes can not set with ' +
267
- 'options.type together' ) ;
267
+ 'options.type or options.buffered together' ) ;
268
268
269
269
switch ( this . #type) {
270
270
case undefined :
Original file line number Diff line number Diff line change @@ -33,6 +33,13 @@ test(() => {
33
33
} ) ;
34
34
} , "Calling observe() with type and entryTypes should throw a TypeError" ) ;
35
35
36
+ test ( ( ) => {
37
+ const obs = new PerformanceObserver ( ( ) => { } ) ;
38
+ assert_throws_js ( TypeError , function ( ) {
39
+ obs . observe ( { buffered : true , entryTypes : [ "measure" ] } ) ;
40
+ } ) ;
41
+ } , "Calling observe() with buffered and entryTypes should throw a TypeError" ) ;
42
+
36
43
test ( function ( ) {
37
44
const obs = new PerformanceObserver ( ( ) => { } ) ;
38
45
// Definitely not an entry type.
You can’t perform that action at this time.
0 commit comments