dom/tests/mochitest/general/resource_timing_iframe.html

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

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

mercurial