toolkit/devtools/webconsole/test/test_bug819670_getter_throws.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html lang="en">
michael@0 3 <head>
michael@0 4 <meta charset="utf8">
michael@0 5 <title>Test for Bug 819670 - Web console object inspection does not handle native getters throwing very well</title>
michael@0 6 <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
michael@0 7 <script type="text/javascript;version=1.8" src="common.js"></script>
michael@0 8 <!-- Any copyright is dedicated to the Public Domain.
michael@0 9 - http://creativecommons.org/publicdomain/zero/1.0/ -->
michael@0 10 </head>
michael@0 11 <body>
michael@0 12 <p>Test for Bug 819670 - Web console object inspection does not handle native getters throwing very well</p>
michael@0 13
michael@0 14 <script class="testbody" type="text/javascript;version=1.8">
michael@0 15 SimpleTest.waitForExplicitFinish();
michael@0 16
michael@0 17 function startTest()
michael@0 18 {
michael@0 19 removeEventListener("load", startTest);
michael@0 20 attachConsole([], onAttach, true);
michael@0 21 }
michael@0 22
michael@0 23 function onAttach(aState, aResponse)
michael@0 24 {
michael@0 25 onEvaluate = onEvaluate.bind(null, aState);
michael@0 26 aState.client.evaluateJS("document.__proto__", onEvaluate);
michael@0 27 }
michael@0 28
michael@0 29 function onEvaluate(aState, aResponse)
michael@0 30 {
michael@0 31 checkObject(aResponse, {
michael@0 32 from: aState.actor,
michael@0 33 input: "document.__proto__",
michael@0 34 result: {
michael@0 35 type: "object",
michael@0 36 actor: /[a-z]/,
michael@0 37 },
michael@0 38 });
michael@0 39
michael@0 40 ok(!aResponse.exception, "no eval exception");
michael@0 41 ok(!aResponse.helperResult, "no helper result");
michael@0 42
michael@0 43 onInspect = onInspect.bind(null, aState);
michael@0 44 let client = new ObjectClient(aState.dbgClient, aResponse.result);
michael@0 45 client.getPrototypeAndProperties(onInspect);
michael@0 46 }
michael@0 47
michael@0 48 function onInspect(aState, aResponse)
michael@0 49 {
michael@0 50 ok(!aResponse.error, "no response error");
michael@0 51
michael@0 52 let expectedProps = {
michael@0 53 "addBroadcastListenerFor": { value: { type: "object" } },
michael@0 54 "commandDispatcher": { get: { type: "object" } },
michael@0 55 "getBoxObjectFor": { value: { type: "object" } },
michael@0 56 "getElementsByAttribute": { value: { type: "object" } },
michael@0 57 };
michael@0 58
michael@0 59 let props = aResponse.ownProperties;
michael@0 60 ok(props, "response properties available");
michael@0 61
michael@0 62 if (props) {
michael@0 63 ok(Object.keys(props).length > Object.keys(expectedProps).length,
michael@0 64 "number of enumerable properties");
michael@0 65 checkObject(props, expectedProps);
michael@0 66 }
michael@0 67
michael@0 68 closeDebugger(aState, function() {
michael@0 69 SimpleTest.finish();
michael@0 70 });
michael@0 71 }
michael@0 72
michael@0 73 addEventListener("load", startTest);
michael@0 74 </script>
michael@0 75 </body>
michael@0 76 </html>

mercurial