1<!DOCTYPE HTML> 2<meta charset=utf-8> 3<title>User Timing: L2 vs L3 feature detection</title> 4<script src="/resources/testharness.js"></script> 5<script src="/resources/testharnessreport.js"></script> 6<script> 7 test(() => { 8 // Feature detection for PerformanceMark. 9 assert_equals(typeof(PerformanceMark.prototype), "object"); 10 // Test for UserTiming L3. 11 if (PerformanceMark.prototype.hasOwnProperty('detail')) { 12 assert_equals(typeof(performance.mark("mark")), "object", 13 "performance.mark should return an object in UserTiming L3."); 14 } 15 // Test for UserTiming L2. 16 else { 17 assert_equals(typeof(performance.mark("mark")), "undefined", 18 "performance.mark should be void in UserTiming L2."); 19 } 20 }, "Test PerformanceMark existence and feature detection"); 21 22 test(() => { 23 // Feature detection for PerformanceMeasure. 24 assert_equals(typeof(PerformanceMeasure.prototype), "object"); 25 // Test for UserTiming L3. 26 if (PerformanceMeasure.prototype.hasOwnProperty('detail')) { 27 assert_equals(typeof(performance.measure("measure")), "object", 28 "performance.measure should return an object in UserTiming L3."); 29 } 30 // Test for UserTiming L2. 31 else { 32 assert_equals(typeof(performance.measure("measure")), "undefined", 33 "performance.measure should be void in UserTiming L2."); 34 } 35 }, "Test PerformanceMeasure existence and feature detection"); 36</script> 37