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.

     1 <!--
     2   Any copyright is dedicated to the Public Domain.
     3   http://creativecommons.org/publicdomain/zero/1.0/
     4 -->
     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 -->
    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://example.com/tests/image/test/mochitest/damon.jpg").length,
    29     "http://example.com/tests/image/test/mochitest/damon.jpg should be a valid entry name");
    30   window.parent.ok(!window.performance.getEntriesByName(
    31     "http://mochi.test:8888/tests/dom/tests/mochitest/general/resource_timing_iframe.html").length,
    32     "This iframe should NOT contain itself as an entry");
    34   // Check that there are no iframes added as entries
    35   for (var i = 0 ; i < window.performance.getEntries().length ; i++) {
    36     var entry = window.performance.getEntries()[i];
    37     if (entry.initiatorType === "subdocument") {
    38       ok(false, "unexpected iframe " + entry.name);
    39     }
    40   }
    42   window.parent.iframeTestsCompleted();
    43 }
    44 </script>
    45 <body onLoad="doTest()">
    46   <img src="http://example.com/tests/image/test/mochitest/damon.jpg"/>
    47 </body>
    48 </html>

mercurial