dom/tests/mochitest/general/test_consoleAPI.html

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <head>
michael@0 4 <title>window.console test</title>
michael@0 5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
michael@0 7 </head>
michael@0 8
michael@0 9 <body id="body">
michael@0 10
michael@0 11 <script type="application/javascript;version=1.8">
michael@0 12
michael@0 13 function doTest() {
michael@0 14 ok(window.console, "console exists");
michael@0 15
michael@0 16 try {
michael@0 17 ok(!console.foo, "random property doesn't throw");
michael@0 18 } catch (ex) {
michael@0 19 ok(false, "random property threw: " + ex);
michael@0 20 }
michael@0 21
michael@0 22 var expectedProps = {
michael@0 23 "log": "function",
michael@0 24 "info": "function",
michael@0 25 "warn": "function",
michael@0 26 "error": "function",
michael@0 27 "exception": "function",
michael@0 28 "debug": "function",
michael@0 29 "trace": "function",
michael@0 30 "dir": "function",
michael@0 31 "group": "function",
michael@0 32 "groupCollapsed": "function",
michael@0 33 "groupEnd": "function",
michael@0 34 "time": "function",
michael@0 35 "timeEnd": "function",
michael@0 36 "profile": "function",
michael@0 37 "profileEnd": "function",
michael@0 38 "assert": "function",
michael@0 39 "count": "function",
michael@0 40 "__noSuchMethod__": "function"
michael@0 41 };
michael@0 42
michael@0 43 var foundProps = 0;
michael@0 44 for (var prop in console) {
michael@0 45 foundProps++;
michael@0 46 is(typeof(console[prop]), expectedProps[prop], "expect console prop " + prop + " exists");
michael@0 47 }
michael@0 48 is(foundProps, Object.keys(expectedProps).length, "found correct number of properties");
michael@0 49
michael@0 50 SimpleTest.finish();
michael@0 51 }
michael@0 52
michael@0 53 SimpleTest.waitForExplicitFinish();
michael@0 54 addLoadEvent(doTest);
michael@0 55
michael@0 56 </script>
michael@0 57
michael@0 58 <p id="display"></p>
michael@0 59
michael@0 60 </body>
michael@0 61 </html>

mercurial