resource_timing_iframe.html (1892B)
1 <!-- 2 Any copyright is dedicated to the Public Domain. 3 http://creativecommons.org/publicdomain/zero/1.0/ 4 --> 5 6 <!-- 7 This file is a sub-test file for the Resource Timing and Performance Timeline 8 APIs. 9 These tests are focused on the iframe corner case. 10 The first step is to check that the image from this document was added as 11 an entry to this window.performance object. 12 The second step is to check that this iframe was not added as an entry to its 13 own window.performance object. 14 As a final step, we do a double checking: no ifrmes were added as entries 15 to this window.performance object. 16 --> 17 18 <!DOCTYPE HTML> 19 <html> 20 <head> 21 <meta charset="utf-8"> 22 <title>Test for Bug 822480 - Add in the Resource Timing API</title> 23 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 24 </head> 25 <script> 26 function doTest() { 27 window.parent.ok(!!window.performance.getEntriesByName( 28 "http://mochi.test:8888/tests/image/test/mochitest/damon.jpg").length, 29 "http://mochi.test:8888/tests/image/test/mochitest/damon.jpg should be a valid entry name"); 30 let entries = window.performance.getEntriesByName( 31 "http://mochi.test:8888/tests/dom/tests/mochitest/general/resource_timing_iframe.html"); 32 window.parent.is(entries.length, 1, "This iframe should have only 1 entry with its URL"); 33 window.parent.is(entries[0].type, "navigate", "This iframe should have its navigation entry"); 34 35 // Check that there are no iframes added as entries 36 var resources = window.performance.getEntriesByType("resource"); 37 for (var i = 0 ; i < resources.length; i++) { 38 var entry = resources[i]; 39 if (entry.initiatorType === "iframe") { 40 ok(false, "unexpected iframe " + entry.name); 41 } 42 } 43 44 window.parent.iframeTestsCompleted(); 45 } 46 </script> 47 <body onLoad="doTest()"> 48 <img src="http://mochi.test:8888/tests/image/test/mochitest/damon.jpg"/> 49 </body> 50 </html>