inline-script.html (1222B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 7 <script src="resources/profile-utils.js"></script> 8 </head> 9 <body> 10 <script> 11 // Note: moving these function definitions will change the expected 12 // outcomes below. 13 function nestedInlineScriptFunction(sample) { 14 sample(); 15 } 16 17 function inlineScriptFunction(sample) { 18 nestedInlineScriptFunction(sample); 19 } 20 </script> 21 22 <script> 23 promise_test(async t => { 24 const trace = await ProfileUtils.profileFunction(inlineScriptFunction); 25 26 assert_true(ProfileUtils.containsResource(trace, location.href), 27 'inline script resource is included'); 28 29 assert_true(ProfileUtils.containsSubstack(trace, [ 30 { 31 name: 'nestedInlineScriptFunction', 32 resourceId: trace.resources.indexOf(location.href), 33 line: 13, 34 column: 40, 35 }, 36 { 37 name: 'inlineScriptFunction', 38 resourceId: trace.resources.indexOf(location.href), 39 line: 17, 40 column: 34, 41 }, 42 ])); 43 }, 'inline script function details'); 44 </script> 45 </body> 46 </html>