editor/reftests/388980-1.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 <head>
     3 <title>Reftest for bug 388980</title></html>
     4 <script type="text/javascript">
     6 var text = '<html><head></head><body style="font-size:16px;">'
     7 	+ '<p id="redpar">This paragraph should be red</p>'
     8 	+ '<p id="bluepar">This paragraph should be blue</p>'
     9 	+ '<p>This paragraph should not be colored</p>'
    10 	+'</body></html>';
    13 function colorPar(par, color) {
    14 	var doc = document.getElementById('theIFrame').contentDocument;
    15 	var win = document.getElementById('theIFrame').contentWindow;
    16 	win.getSelection().selectAllChildren(doc.getElementById(par));
    17 	doc.execCommand("hilitecolor", false, color);
    18 	win.getSelection().removeAllRanges();
    19 }	
    21 function initIFrame() {
    22 	var doc = document.getElementById('theIFrame').contentDocument;
    23 	doc.designMode = 'on';
    24 	doc.open('text/html');
    25 	doc.write(text);
    26 	doc.close();
    28 	// Test hilighting with styleWithCSS, should hilight the text...
    29 	doc.execCommand("styleWithCSS", false, true);
    30 	colorPar("redpar", "red");
    32 	// Test highlighting without styleWithCSS, should also work.
    33 	doc.execCommand("styleWithCSS", false, false);
    34 	colorPar("bluepar", "blue");
    36 }
    37 </script>
    38 </head>
    39 <body>
    40 <iframe id="theIFrame" onload="initIFrame()">
    41 </iframe>
    42 </body>
    43 </html>

mercurial