Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / sources / debugger-ui / debugger-save-to-temp-var.html
blob01de9dfb2e578b23b6a16077cdda3d4ed2d10207
1 <html>
2 <head>
3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/console-test.js"></script>
5 <script src="../../../http/tests/inspector/debugger-test.js"></script>
6 <script>
8 var thisObj;
10 function testFunction()
12 function inner()
14 debugger;
17 thisObj = { foo: 42, __proto__: null };
18 for (var i = 1; i < 6; ++i)
19 thisObj["temp" + i] = "FAIL";
21 inner.call(thisObj);
24 function checkThisObject()
26 for (var key in thisObj) {
27 if (key === "foo")
28 console.assert(thisObj[key] === 42);
29 else if (key.substr(0, 4) === "temp")
30 console.assert(thisObj[key] === "FAIL");
31 else
32 console.error("FAIL: Unexpected property " + key);
36 function onload()
38 for (var i = 3; i < 8; ++i)
39 window["temp" + i] = "Reserved";
41 runTest();
44 function test()
46 var expressions = [
47 "42",
48 "'foo string'",
49 "NaN",
50 "Infinity",
51 "-Infinity",
52 "-0",
53 "[1, 2, NaN, -0, null, undefined]",
54 "({ foo: 'bar' })",
55 "(function(){ return arguments; })(1,2,3,4)",
56 "(function func() {})",
57 "new Error('errr')"
60 InspectorTest.setQuiet(true);
61 InspectorTest.startDebuggerTest(step1);
63 InspectorTest.addResult("Number of expressions: " + expressions.length);
64 InspectorTest.addResult("Names [temp3..temp7] are reserved\n");
66 function step1()
68 InspectorTest.runTestFunctionAndWaitUntilPaused(didPause);
71 function didPause()
73 evaluateNext();
76 function evaluateNext()
78 var expression = expressions.shift();
79 if (!expression) {
80 InspectorTest.waitForRemoteObjectsConsoleMessages(tearDown);
81 return;
84 function didEvaluate(result, wasThrown)
86 InspectorTest.assertTrue(!wasThrown, "FAIL: was thrown. Expression: " + expression);
87 WebInspector.panels.sources._saveToTempVariable(result);
88 InspectorTest.waitUntilNthMessageReceived(2, evaluateNext);
91 WebInspector.context.flavor(WebInspector.ExecutionContext).evaluate(expression, "console", true, undefined, undefined, undefined, didEvaluate);
94 function tearDown()
96 InspectorTest.evaluateInPage("checkThisObject()", dumpConsoleMessages);
99 function dumpConsoleMessages()
101 InspectorTest.dumpConsoleMessagesIgnoreErrorStackFrames();
102 InspectorTest.completeDebuggerTest();
106 </script>
107 </head>
109 <body onload="onload()">
111 Tests saving objects to temporary variables while paused.
112 </p>
114 </body>
115 </html>