toolkit/devtools/webconsole/test/test_reflow.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.

     1 <!DOCTYPE HTML>
     2 <html lang="en">
     3 <head>
     4   <meta charset="utf8">
     5   <title>Test for the Reflow Activity</title>
     6   <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
     7   <script type="text/javascript;version=1.8" src="common.js"></script>
     8   <!-- Any copyright is dedicated to the Public Domain.
     9      - http://creativecommons.org/publicdomain/zero/1.0/ -->
    10 </head>
    11 <body>
    12 <p>Test for reflow events</p>
    14 <script class="testbody" type="text/javascript;version=1.8">
    15 SimpleTest.waitForExplicitFinish();
    17 let client;
    19 function generateReflow()
    20 {
    21   top.document.documentElement.style.display = "none";
    22   top.document.documentElement.getBoundingClientRect();
    23   top.document.documentElement.style.display = "block";
    24 }
    26 function startTest()
    27 {
    28   removeEventListener("load", startTest);
    29   attachConsole(["ReflowActivity"], onAttach, true);
    30 }
    32 function onAttach(aState, aResponse)
    33 {
    34   client = aState.dbgClient;
    36   onReflowActivity = onReflowActivity.bind(null, aState);
    37   client.addListener("reflowActivity", onReflowActivity);
    38   generateReflow();
    39 }
    41 // We are expecting 3 reflow events.
    42 let expectedEvents = [
    43   {
    44     interruptible: false,
    45     sourceURL: "chrome://mochitests/content/chrome/toolkit/devtools/webconsole/test/test_reflow.html",
    46     functionName: "generateReflow"
    47   },
    48   {
    49     interruptible: true,
    50     sourceURL: null,
    51     functionName: null
    52   },
    53   {
    54     interruptible: true,
    55     sourceURL: null,
    56     functionName: null
    57   },
    58 ];
    60 let receivedEvents = [];
    63 function onReflowActivity(aState, aType, aPacket)
    64 {
    65   info("packet: " + aPacket.message);
    66   receivedEvents.push(aPacket);
    67   if (receivedEvents.length == expectedEvents.length) {
    68     checkEvents();
    69     finish(aState);
    70   }
    71 }
    73 function checkEvents() {
    74   for (let i = 0; i < expectedEvents.length; i++) {
    75     let a = expectedEvents[i];
    76     let b = receivedEvents[i];
    77     for (let key in a) {
    78       is(a[key], b[key], "field " + key + " is valid");
    79     }
    80   }
    81 }
    83 function finish(aState) {
    84   client.removeListener("reflowActivity", onReflowActivity);
    85   closeDebugger(aState, function() {
    86     SimpleTest.finish();
    87   });
    88 }
    90 addEventListener("load", startTest);
    92 </script>
    93 </body>
    94 </html>

mercurial