js/jsd/test/test_bug617870-callhooks.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 <head>
michael@0 4 <!-- The bug number is pulled from the test URL -->
michael@0 5 <title>JSD Test for Bug AUTOFILLED</title>
michael@0 6 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
michael@0 8 <script type="application/javascript" src="jsd-test.js"></script>
michael@0 9 <script type="application/javascript">
michael@0 10 var BUG = 617870;
michael@0 11 var TEST_SCRIPT = "test-bug617870-callhooks.js";
michael@0 12 document.getElementsByTagName("title")[0].innerHTML = "JSD Test for Bug " + BUG;
michael@0 13
michael@0 14 SimpleTest.waitForExplicitFinish();
michael@0 15
michael@0 16 var hits = { gn: [], ge: [], fn: [], fe: [] };
michael@0 17 var numGlobalNonevals = 0;
michael@0 18 var numFunctionNonevals = 0;
michael@0 19 var numGlobalEvals = 0;
michael@0 20 var numFunctionEvals = 0;
michael@0 21 function runTest() {
michael@0 22 jsd.topLevelHook = {
michael@0 23 onCall: function(frame,type) {
michael@0 24 if (frame.script.fileName.indexOf(TEST_SCRIPT) != -1) {
michael@0 25 var desc = frame.script.fileName + ":" + frame.line + " (" + frame.functionName + ")";
michael@0 26 if (type == Ci.jsdICallHook.TYPE_TOPLEVEL_START) {
michael@0 27 if (frame.callingFrame === null) {
michael@0 28 numGlobalNonevals++;
michael@0 29 hits.gn.push(desc);
michael@0 30 } else if (frame.callee === null) {
michael@0 31 numGlobalEvals++;
michael@0 32 hits.ge.push(desc);
michael@0 33 } else {
michael@0 34 numFunctionEvals++;
michael@0 35 hits.fe.push(desc);
michael@0 36 }
michael@0 37 }
michael@0 38 dumpStack(frame, "TOPLEVEL(" + type + ")");
michael@0 39 }
michael@0 40 }
michael@0 41 };
michael@0 42 jsd.functionHook = {
michael@0 43 onCall: function(frame,type) {
michael@0 44 if (frame.script.fileName.indexOf(TEST_SCRIPT) != -1) {
michael@0 45 if (type == Ci.jsdICallHook.TYPE_FUNCTION_CALL) {
michael@0 46 var desc = frame.script.fileName + ":" + frame.line + " (" + frame.functionName + ")";
michael@0 47 numFunctionNonevals++;
michael@0 48 hits.fn.push(desc);
michael@0 49 }
michael@0 50 dumpStack(frame, "FUNCTION(" + type + ")");
michael@0 51 }
michael@0 52 }
michael@0 53 };
michael@0 54 loadScript(TEST_SCRIPT, document.getElementById("test"));
michael@0 55 }
michael@0 56
michael@0 57 function setupTest() {
michael@0 58 var buglink = document.getElementById("buglink");
michael@0 59 buglink.href = "https://bugzilla.mozilla.org/show_bug.cgi?id=" + BUG;
michael@0 60 buglink.innerHTML = "Mozilla Bug " + BUG;
michael@0 61 }
michael@0 62 </script>
michael@0 63 </head>
michael@0 64 <body onLoad='setupTest(); setupJSD();'>
michael@0 65
michael@0 66 <a id="buglink" target="_blank"></a>
michael@0 67 <p id="display"></p>
michael@0 68
michael@0 69 <div id="content" style="display: none">
michael@0 70 <pre id='test'>
michael@0 71 </pre>
michael@0 72 </div>
michael@0 73
michael@0 74 <div id='test-output'>
michael@0 75 </div>
michael@0 76
michael@0 77 </body>
michael@0 78 </html>

mercurial