layout/reftests/cssom/computed-style-cross-window-ref.html

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 <!DOCTYPE HTML>
     2 <title>getComputedStyle across windows</title>
     3 <style>
     4 p { color: blue }
     6 div { margin: 1em 0 }
     7 </style>
     9 <script>
    11 var gRunCount = 2;
    13 function run() {
    14   if (--gRunCount != 0)
    15     return;
    17   var i = document.getElementById("i");
    19   var pout = document.getElementById("out");
    20   var poutnone = document.getElementById("outnone");
    21   var poutdet = document.createElement("p");
    22   var pin = i.contentDocument.getElementsByTagName("p")[0];
    23   var pinnone = i.contentDocument.getElementsByTagName("p")[1];
    24   var pindet = i.contentDocument.createElement("p");
    26   document.getElementById("res1").style.color =
    27     window.getComputedStyle(pin, "").color;
    29   document.getElementById("res2").style.color =
    30     i.contentWindow.getComputedStyle(pout, "").color;
    32   document.getElementById("res3").style.color =
    33     window.getComputedStyle(pinnone, "").color;
    35   document.getElementById("res4").style.color =
    36     i.contentWindow.getComputedStyle(poutnone, "").color;
    38   document.getElementById("res5").style.color =
    39     window.getComputedStyle(pindet, "").color;
    41   document.getElementById("res6").style.color =
    42     i.contentWindow.getComputedStyle(poutdet, "").color;
    43 }
    45 </script>
    46 <body onload="run()">
    48 <p id="out">This is a paragraph outside the iframe.</p>
    49 <div style="display:none"><p id="outnone">This is a paragraph outside the iframe.</p></div>
    51 <iframe id="i" src="computed-style-cross-window-inner.html" onload="run()"></iframe>
    53 <div style="color:fuchsia">This paragraph is the color that
    54 outerWindow.getComputedStyle says the paragraph inside the iframe
    55 is.</div>
    57 <div style="color:blue">This paragraph is the color that
    58 iframeWindow.getComputedStyle says the paragraph outside the iframe
    59 is.</div>
    61 <div style="color:fuchsia">This paragraph is the color that
    62 outerWindow.getComputedStyle says the display:none paragraph inside the
    63 iframe is.</div>
    65 <div style="color:blue">This paragraph is the color that
    66 iframeWindow.getComputedStyle says the display:none paragraph outside
    67 the iframe is.</div>
    69 <div style="color:blue">This paragraph is the color that
    70 outerWindow.getComputedStyle says the detached paragraph inside the
    71 iframe is.</div>
    73 <div style="color:fuchsia">This paragraph is the color that
    74 iframeWindow.getComputedStyle says the detached paragraph outside
    75 the iframe is.</div>

mercurial