editor/libeditor/html/tests/test_bug857487.html

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=857487
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <title>Test for Bug 857487</title>
michael@0 8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
michael@0 10 <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
michael@0 11 </head>
michael@0 12 <body>
michael@0 13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=857487">Mozilla Bug 857487</a>
michael@0 14 <div id="edit" contenteditable="true">
michael@0 15 <table id="table" border="1" width="100%">
michael@0 16 <tbody>
michael@0 17 <tr>
michael@0 18 <td>a</td>
michael@0 19 <td>b</td>
michael@0 20 <td>c</td>
michael@0 21 </tr>
michael@0 22 <tr>
michael@0 23 <td>d</td>
michael@0 24 <td id="cell">e</td>
michael@0 25 <td>f</td>
michael@0 26 </tr>
michael@0 27 <tr>
michael@0 28 <td>g</td>
michael@0 29 <td>h</td>
michael@0 30 <td>i</td>
michael@0 31 </tr>
michael@0 32 </tbody>
michael@0 33 </table>
michael@0 34 </div>
michael@0 35 <script type="application/javascript">
michael@0 36
michael@0 37 /**
michael@0 38 * Test for Bug 857487
michael@0 39 *
michael@0 40 * Tests that removing a table row through nsIHTMLEditor works
michael@0 41 */
michael@0 42
michael@0 43 function getEditor() {
michael@0 44 const Ci = SpecialPowers.Ci;
michael@0 45 var editingSession = SpecialPowers.wrap(window)
michael@0 46 .QueryInterface(Ci.nsIInterfaceRequestor)
michael@0 47 .getInterface(Ci.nsIWebNavigation)
michael@0 48 .QueryInterface(Ci.nsIInterfaceRequestor)
michael@0 49 .getInterface(Ci.nsIEditingSession);
michael@0 50 return editingSession.getEditorForWindow(window).QueryInterface(Ci.nsITableEditor);
michael@0 51 }
michael@0 52
michael@0 53 var cell = document.getElementById("cell");
michael@0 54 cell.focus();
michael@0 55
michael@0 56 // place caret at end of center cell
michael@0 57 var sel = getSelection();
michael@0 58 sel.collapse(cell, cell.childNodes.length);
michael@0 59
michael@0 60 var editor = getEditor();
michael@0 61 editor.deleteTableRow(1);
michael@0 62
michael@0 63 var table = document.getElementById("table");
michael@0 64
michael@0 65 is(table.innerHTML == "\n <tbody>\n <tr>\n <td>a</td>\n <td>b</td>\n <td>c</td>\n </tr>\n \n <tr>\n <td>g</td>\n <td>h</td>\n <td>i</td>\n </tr>\n </tbody>\n ",
michael@0 66 true, "editor.deleteTableRow(1) should delete the row containing the selection");
michael@0 67
michael@0 68 </script>
michael@0 69
michael@0 70
michael@0 71 </body>
michael@0 72 </html>

mercurial