tor-browser

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

variable-reference-refresh.html (2228B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4    <title>Variable reference across document refresh</title>
      5 
      6    <meta rel="author" title="Kevin Babbitt">
      7    <meta rel="author" title="Greg Whitworth">
      8    <link rel="author" title="Microsoft Corporation" href="http://microsoft.com" />
      9    <!-- This is not directly specified in the spec but should work -->
     10    <link rel="help" href="http://www.w3.org/TR/css-variables-1/#defining-variables">
     11 
     12    <script src="/resources/testharness.js"></script>
     13    <script src="/resources/testharnessreport.js"></script>
     14 </head>
     15 <body>
     16 
     17    <iframe id="iframe" src="resources/variable-reference-refresh-iframe.html"></iframe>
     18 
     19 <script type="text/javascript">
     20    "use strict";
     21 
     22    setup({explicit_done: true});
     23 
     24    // Set up event handler to drive tests
     25    var loadCount = 0;
     26    document.getElementById("iframe").addEventListener("load", function() {
     27        loadCount++;
     28        if (loadCount == 1)
     29        {
     30            test(function() {
     31                var iframe = document.getElementById("iframe");
     32                var iframeWindow = iframe.contentWindow;
     33                var iframeDocument = iframe.contentDocument;
     34                var testElement = iframeDocument.getElementById("testElement");
     35                var computedValue = iframeWindow.getComputedStyle(testElement).getPropertyValue("color").trim();
     36                assert_equals(computedValue, "rgb(0, 128, 0)", "color is green before page refresh");
     37                iframe.src = iframe.src;
     38            }, "Verify substituted color value before refresh");
     39        }
     40        else if (loadCount == 2)
     41        {
     42            test(function() {
     43                var iframeWindow = document.getElementById("iframe").contentWindow;
     44                var iframeDocument = document.getElementById("iframe").contentDocument;
     45                var testElement = iframeDocument.getElementById("testElement");
     46                var computedValue = iframeWindow.getComputedStyle(testElement).getPropertyValue("color").trim();
     47                assert_equals(computedValue, "rgb(0, 128, 0)", "color is green after page refresh");
     48            }, "Verify substituted color value after refresh");
     49 
     50            done();
     51        }
     52    });
     53 </script>
     54 
     55 </body>
     56 </html>