content/html/content/test/test_bug417760.html

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 <!DOCTYPE html>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=417760
     5 -->
     6 <head>
     7   <title>cannot focus() img with tabindex="-1"</title>
     8   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     9   <style type="text/css">
    10     img {
    11       border: 5px solid white;
    12     }
    13     img:focus {
    14       border: 5px solid black;
    15     }
    16   </style>
    19   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    21   <script type="text/javascript">
    22     function checkFocus(aExpected, aTabIndex)
    23     {
    24       elemCurr = document.activeElement.getAttribute("id");
    25       is(elemCurr, aExpected, "Element with tabIndex " + aTabIndex 
    26          + " did not receive focus!");
    27     }
    29     function doTest()
    30     {
    31       // First, test img with tabindex = 0
    32       document.getElementById("img-tabindex-0").focus();
    33       checkFocus("img-tabindex-0", 0);
    35       // now test the img with tabindex = -1
    36       document.getElementById("img-tabindex-minus-1").focus();
    37       checkFocus("img-tabindex-minus-1", -1);
    39       // now test the img without tabindex, should NOT receive focus!
    40       document.getElementById("img-no-tabindex").focus();
    41       checkFocus("img-tabindex-minus-1", null);
    43       SimpleTest.finish();
    44     }
    46     SimpleTest.waitForExplicitFinish();
    47     addLoadEvent(doTest);
    48   </script>
    49 </head>
    51 <body>
    53   <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=417760">Mozilla Bug 417760</a>
    54   <p id="display"></p>
    55   <div id="content" style="display: none"></div>
    56   <pre id="test">
    57   </pre>
    58   <br>img tabindex="0":
    59   <img id="img-tabindex-0"
    60     src="file_bug417760.png"
    61     alt="MoCo logo" tabindex="0"/>
    62   <br>img tabindex="-1":
    63   <img id="img-tabindex-minus-1"
    64     src="file_bug417760.png"
    65     alt="MoCo logo" tabindex="-1"/>
    66   <br>img without tabindex:
    67   <img id="img-no-tabindex"
    68     src="file_bug417760.png"
    69     alt="MoCo logo"/>
    70 </body>
    71 </html>

mercurial