tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_frames.html (3500B)


      1 <html>
      2 
      3 <head>
      4  <title>frame based document testing</title>
      5 
      6  <link rel="stylesheet" type="text/css"
      7        href="chrome://mochikit/content/tests/SimpleTest/test.css" />
      8 
      9  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
     10 
     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>
     17 
     18  <script type="application/javascript">
     19    if (navigator.platform.startsWith("Win")) {
     20      SimpleTest.expectAssertions(0, 2);
     21    }
     22 
     23    function doTest() {
     24      const frameDoc = document.getElementById("frame_doc").contentDocument;
     25      const frameDocArticle = document.getElementById("frame_doc_article").contentDocument;
     26      const frameDocCheckbox = document.getElementById("frame_doc_checkbox").contentDocument;
     27      const frameDocTextbox = document.getElementById("frame_doc_textbox").contentDocument;
     28 
     29      testStates(frameDoc, STATE_READONLY, 0, 0, 0,
     30                 "test1: frameDoc");
     31      testStates(frameDocArticle, STATE_READONLY, 0, 0, 0,
     32                 "test1: frameDocArticle");
     33      testStates(frameDocCheckbox, STATE_READONLY, 0, 0, 0,
     34                 "test1: frameDocCheckbox");
     35      testStates(frameDocTextbox, STATE_READONLY, 0, 0, 0,
     36                 "test1: frameDocTextbox");
     37      frameDoc.designMode = "on";
     38      testStates(frameDoc, 0, EXT_STATE_EDITABLE, STATE_READONLY, 0,
     39                 "test2: frameDoc");
     40      testStates(frameDocArticle, STATE_READONLY, 0, 0, 0,
     41                 "test2: frameDocArticle");
     42      testStates(frameDocCheckbox, STATE_READONLY, 0, 0, 0,
     43                 "test2: frameDocCheckbox");
     44      testStates(frameDocTextbox, STATE_READONLY, 0, 0, 0,
     45                 "test2: frameDocTextbox");
     46 
     47      frameDocArticle.designMode = "on";
     48      testStates(frameDocArticle, 0, EXT_STATE_EDITABLE, STATE_READONLY, 0,
     49                 "test3: frameDocArticle");
     50 
     51      frameDocCheckbox.designMode = "on";
     52      testStates(frameDocCheckbox, 0, EXT_STATE_EDITABLE, STATE_READONLY, 0,
     53                 "test4: frameDocCheckbox");
     54 
     55      // Replace iframe document body before the document accessible tree is
     56      // created. Check the states are updated for new body.
     57      var frameUpdateDoc =
     58        document.getElementById("frame_updatedoc").contentDocument;
     59      testStates(frameUpdateDoc, 0, EXT_STATE_EDITABLE,
     60                 STATE_READONLY, EXT_STATE_STALE, "test5: frameUpdateDoc");
     61 
     62      SimpleTest.finish();
     63    }
     64 
     65    SimpleTest.waitForExplicitFinish();
     66    addA11yLoadEvent(doTest);
     67  </script>
     68 </head>
     69 
     70 <body>
     71 
     72  <a target="_blank"
     73     href="https://bugzilla.mozilla.org/show_bug.cgi?id=467387"
     74     title="Expose non-editable documents as readonly, regardless of role">
     75    Mozilla Bug 467387
     76  </a>
     77  <a target="_blank"
     78     href="https://bugzilla.mozilla.org/show_bug.cgi?id=638106"
     79     title="CKEditor document should be editable">
     80    Mozilla Bug 638106
     81  </a>
     82  <p id="display"></p>
     83  <div id="content" style="display: none"></div>
     84  <pre id="test">
     85  </pre>
     86 
     87  <iframe id="frame_doc" src="z_frames.html"></iframe>
     88  <iframe id="frame_doc_article" src="z_frames_article.html"></iframe>
     89  <iframe id="frame_doc_checkbox" src="z_frames_checkbox.html"></iframe>
     90  <iframe id="frame_doc_textbox" src="z_frames_textbox.html"></iframe>
     91  <iframe id="frame_updatedoc" src="z_frames_update.html"></iframe>
     92 </body>
     93 </html>