editor/libeditor/html/tests/test_bug487524.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><head>
michael@0 3 <title>Test for bug 487524</title>
michael@0 4 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
michael@0 5 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 6 <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
michael@0 7
michael@0 8 <script class="testbody" type="application/javascript">
michael@0 9 function runTest() {
michael@0 10
michael@0 11 function setupIframe(e,html,focus_id) {
michael@0 12 var doc = e.contentDocument;
michael@0 13 doc.body.innerHTML = html;
michael@0 14 doc.designMode = "on";
michael@0 15 e = doc.getElementById(focus_id);
michael@0 16 doc.defaultView.focus();
michael@0 17 if (e) e.focus();
michael@0 18 return e;
michael@0 19 }
michael@0 20
michael@0 21 var i1 = document.getElementById('i1')
michael@0 22 var li1 = setupIframe(i1,'<ul><li id="li1">one</li><li>two</li><ul><li>a</li></ul></ul>','li1')
michael@0 23 var doc = li1.ownerDocument;
michael@0 24
michael@0 25 var selection = doc.defaultView.getSelection();
michael@0 26 selection.removeAllRanges();
michael@0 27
michael@0 28 var range = doc.createRange();
michael@0 29 range.setStart(li1,0);
michael@0 30 range.setEnd(li1.nextSibling,0);
michael@0 31 selection.addRange(range);
michael@0 32
michael@0 33 sendKey('delete');
michael@0 34 is(doc.body.innerHTML,'<ul><li>two</li><ul><li>a</li></ul></ul>','delete 1st LI');
michael@0 35
michael@0 36 var li2 = setupIframe(i1,'<ul><li id="li2">two</li><ul><li>a</li></ul></ul>','li2')
michael@0 37 selection = doc.defaultView.getSelection();
michael@0 38 selection.removeAllRanges();
michael@0 39
michael@0 40 range = doc.createRange();
michael@0 41 range.setStart(li2,0);
michael@0 42 range.setEnd(li2.nextSibling.firstChild,0);
michael@0 43 selection.addRange(range);
michael@0 44
michael@0 45 sendKey('delete');
michael@0 46 is(doc.body.innerHTML,'<ul><ul><li>a</li></ul></ul>','delete 2nd LI');
michael@0 47
michael@0 48 SimpleTest.finish();
michael@0 49 }
michael@0 50
michael@0 51 SimpleTest.waitForExplicitFinish();
michael@0 52 addLoadEvent(runTest);
michael@0 53 </script>
michael@0 54 </head>
michael@0 55 <body>
michael@0 56 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=487524">Mozilla Bug 487524</a>
michael@0 57 <p id="display"></p>
michael@0 58
michael@0 59 <pre id="test">
michael@0 60 </pre>
michael@0 61
michael@0 62 <iframe id="i1" width="200" height="100" src="about:blank"></iframe><br>
michael@0 63
michael@0 64 </body>
michael@0 65 </html>

mercurial