accessible/tests/mochitest/test_nsIAccessibleDocument.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 <html>
     2 <!--
     3 https://bugzilla.mozilla.org/show_bug.cgi?id=441737
     4 -->
     5 <head>
     6   <title>nsIAccessibleDocument chrome tests</title>
     7   <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
     9   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    11   <script type="application/javascript"
    12           src="common.js"></script>
    13   <script type="application/javascript"
    14           src="role.js"></script>
    15   <script type="application/javascript"
    16           src="states.js"></script>
    18   <script type="application/javascript"
    19           src="chrome://mochikit/content/chrome-harness.js"></script>
    21   <script type="application/javascript">
    22     function doTest()
    23     {
    24       var docAcc = getAccessible(document, [nsIAccessibleDocument]);
    25       if (docAcc) {
    26         // nsIAccessible
    27         is(docAcc.name, "nsIAccessibleDocument chrome tests",
    28            "Name for document accessible not correct!");
    30         testRole(docAcc, ROLE_DOCUMENT);
    32         // check if it is focusable, read-only.
    33         testStates(docAcc, (STATE_READONLY | STATE_FOCUSABLE));
    35         // No actions wanted on doc
    36         is(docAcc.actionCount, 0, "Wrong number of actions for document!");
    38         // attributes should contain tag:body
    39         attributes = docAcc.attributes;
    40         is(attributes.getStringProperty("tag"), "body",
    41            "Wrong attribute on document!");
    43         // Document URL.
    44         var rootDir = getRootDirectory(window.location.href);
    45         is(docAcc.URL, rootDir + "test_nsIAccessibleDocument.html",
    46            "Wrong URL for document!");
    48         // Document title and mime type.
    49         is(docAcc.title, "nsIAccessibleDocument chrome tests",
    50            "Wrong title for document!");
    51         is(docAcc.mimeType, "text/html",
    52            "Wrong mime type for document!");
    54         // DocAccessible::getDocType currently returns NS_ERROR_FAILURE.
    55         // See bug 442005. After fixing, please remove this comment and
    56         // uncomment the below two lines to enable the test.
    57 //        is(docAcc.docType, "HTML",
    58 //           "Wrong type of document!");
    60         // Test for correct nsIDOMDocument retrieval.
    61         var domDoc = null;
    62         try {
    63           domDoc = docAcc.DOMDocument.QueryInterface(nsIDOMDocument);
    64         } catch(e) {}
    65         ok(domDoc, "no nsIDOMDocument for this doc accessible!");
    66         is(domDoc, document, "Document nodes do not match!");
    68         // Test for correct nsIDOMWindow retrieval.
    69         var domWindow = null;
    70         try {
    71           domWindow = docAcc.window.QueryInterface(nsIDOMWindow);
    72         } catch(e) {}
    73         ok(domWindow, "no nsIDOMWindow for this doc accessible!");
    74         is(domWindow, window, "Window nodes do not match!");
    75       }
    77       SimpleTest.finish();
    78     }
    80     SimpleTest.waitForExplicitFinish();
    81     addA11yLoadEvent(doTest);
    82   </script>
    83 </head>
    84 <body>
    86   <a target="_blank"
    87      href="https://bugzilla.mozilla.org/show_bug.cgi?id=441737"
    88      title="nsAccessibleDocument chrome tests">
    89     Mozilla Bug 441737
    90   </a>
    91   <p id="display"></p>
    92   <div id="content" style="display: none"></div>
    93   <pre id="test">
    94   </pre>
    95 </body>
    96 </html>

mercurial