1// META: script=performanceobservers.js 2 3 async_test(function (t) { 4 var observer = new PerformanceObserver( 5 t.step_func(function (entryList, obs) { 6 assert_unreached("This callback must not be invoked"); 7 }) 8 ); 9 observer.observe({entryTypes: ["mark", "measure", "navigation"]}); 10 observer.disconnect(); 11 self.performance.mark("mark1"); 12 self.performance.measure("measure1"); 13 t.step_timeout(function () { 14 t.done(); 15 }, 2000); 16 }, "disconnected callbacks must not be invoked"); 17 18 test(function () { 19 var obs = new PerformanceObserver(function () { return true; }); 20 obs.disconnect(); 21 obs.disconnect(); 22 }, "disconnecting an unconnected observer is a no-op"); 23 24 async_test(function (t) { 25 var observer = new PerformanceObserver( 26 t.step_func(function (entryList, obs) { 27 assert_unreached("This callback must not be invoked"); 28 }) 29 ); 30 observer.observe({entryTypes: ["mark"]}); 31 self.performance.mark("mark1"); 32 observer.disconnect(); 33 self.performance.mark("mark2"); 34 t.step_timeout(function () { 35 t.done(); 36 }, 2000); 37 }, "An observer disconnected after a mark must not have its callback invoked"); 38