1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/tests/mochitest/general/resource_timing_iframe.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,48 @@ 1.4 +<!-- 1.5 + Any copyright is dedicated to the Public Domain. 1.6 + http://creativecommons.org/publicdomain/zero/1.0/ 1.7 +--> 1.8 + 1.9 +<!-- 1.10 + This file is a sub-test file for the Resource Timing and Performance Timeline 1.11 + APIs. 1.12 + These tests are focused on the iframe corner case. 1.13 + The first step is to check that the image from this document was added as 1.14 + an entry to this window.performance object. 1.15 + The second step is to check that this iframe was not added as an entry to its 1.16 + own window.performance object. 1.17 + As a final step, we do a double checking: no ifrmes were added as entries 1.18 + to this window.performance object. 1.19 +--> 1.20 + 1.21 +<!DOCTYPE HTML> 1.22 +<html> 1.23 +<head> 1.24 + <meta charset="utf-8"> 1.25 + <title>Test for Bug 822480 - Add in the Resource Timing API</title> 1.26 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.27 +</head> 1.28 +<script> 1.29 +function doTest() { 1.30 + window.parent.ok(!!window.performance.getEntriesByName( 1.31 + "http://example.com/tests/image/test/mochitest/damon.jpg").length, 1.32 + "http://example.com/tests/image/test/mochitest/damon.jpg should be a valid entry name"); 1.33 + window.parent.ok(!window.performance.getEntriesByName( 1.34 + "http://mochi.test:8888/tests/dom/tests/mochitest/general/resource_timing_iframe.html").length, 1.35 + "This iframe should NOT contain itself as an entry"); 1.36 + 1.37 + // Check that there are no iframes added as entries 1.38 + for (var i = 0 ; i < window.performance.getEntries().length ; i++) { 1.39 + var entry = window.performance.getEntries()[i]; 1.40 + if (entry.initiatorType === "subdocument") { 1.41 + ok(false, "unexpected iframe " + entry.name); 1.42 + } 1.43 + } 1.44 + 1.45 + window.parent.iframeTestsCompleted(); 1.46 +} 1.47 +</script> 1.48 +<body onLoad="doTest()"> 1.49 + <img src="http://example.com/tests/image/test/mochitest/damon.jpg"/> 1.50 +</body> 1.51 +</html>