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.

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

mercurial