toolkit/devtools/server/tests/mochitest/test_memory.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>
     3 <!--
     4 Bug 923275 - Add a memory monitor widget to the developer toolbar
     5 -->
     6 <head>
     7   <meta charset="utf-8">
     8   <title>Memory monitoring actor test</title>
     9   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    10   <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
    11 </head>
    12 <body>
    13 <pre id="test">
    14 <script>
    16 window.onload = function() {
    17   var Cu = Components.utils;
    18   var Cc = Components.classes;
    19   var Ci = Components.interfaces;
    21   Cu.import("resource://gre/modules/Services.jsm");
    23   // Always log packets when running tests.
    24   Services.prefs.setBoolPref("devtools.debugger.log", true);
    25   SimpleTest.registerCleanupFunction(function() {
    26     Services.prefs.clearUserPref("devtools.debugger.log");
    27   });
    29   Cu.import("resource://gre/modules/devtools/Loader.jsm");
    30   Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
    31   Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
    33   SimpleTest.waitForExplicitFinish();
    35   var {MemoryFront} = devtools.require("devtools/server/actors/memory");
    37   DebuggerServer.init(function () { return true; });
    38   DebuggerServer.addBrowserActors();
    40   var client = new DebuggerClient(DebuggerServer.connectPipe());
    41   client.connect(function onConnect() {
    42     client.listTabs(function onListTabs(aResponse) {
    43       var form = aResponse.tabs[aResponse.selected];
    44       var front = MemoryFront(client, form);
    46       front.measure().then(measurement => {
    47         ok(measurement.total > 0, "total memory is valid");
    48         ok(measurement.domSize > 0, "domSize is valid");
    49         ok(measurement.styleSize > 0, "styleSize is valid");
    50         ok(measurement.jsObjectsSize > 0, "jsObjectsSize is valid");
    51         ok(measurement.jsStringsSize > 0, "jsStringsSize is valid");
    52         ok(measurement.jsOtherSize > 0, "jsOtherSize is valid");
    53         ok(measurement.otherSize > 0, "otherSize is valid");
    54         ok(measurement.jsMilliseconds, "jsMilliseconds is valid");
    55         ok(measurement.nonJSMilliseconds, "nonJSMilliseconds is valid");
    57         client.close(() => {
    58           DebuggerServer.destroy();
    59           SimpleTest.finish()
    60         });
    61       });
    63     });
    64   });
    66 }
    67 </script>
    68 </pre>
    69 </body>
    70 </html>

mercurial