3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/debugger-test.js"></script>
8 InspectorTest.runDebuggerTestSuite([
9 function testSuccessfulCompileAndRun(next)
11 var expression = "var a = 1; var b = 2; a + b; ";
12 InspectorTest.addResult("Compiling script");
13 DebuggerAgent.compileScript(expression, "test.js", compileCallback.bind(this));
15 function compileCallback(error, scriptId, syntaxErrorMessage)
17 InspectorTest.assertTrue(!error);
18 InspectorTest.assertTrue(!syntaxErrorMessage);
19 InspectorTest.assertTrue(!!scriptId);
20 var contextId = undefined;
21 InspectorTest.addResult("Running script");
22 DebuggerAgent.runScript(scriptId, contextId, "console", false, runCallback.bind(this));
25 function runCallback(error, result, wasThrown)
27 InspectorTest.assertTrue(!error);
28 InspectorTest.assertTrue(!wasThrown);
29 InspectorTest.addResult("Script result: " + result.value);
34 function testRunError(next)
36 var expression = "var a = 1; a + c; ";
37 InspectorTest.addResult("Compiling script");
38 DebuggerAgent.compileScript(expression, "test.js", compileCallback.bind(this));
40 function compileCallback(error, scriptId, syntaxErrorMessage)
42 InspectorTest.assertTrue(!error);
43 InspectorTest.assertTrue(!syntaxErrorMessage);
44 InspectorTest.assertTrue(!!scriptId);
45 var contextId = undefined;
46 InspectorTest.addResult("Running script");
47 DebuggerAgent.runScript(scriptId, contextId, "console", false, runCallback.bind(this));
50 function runCallback(error, result, wasThrown)
52 InspectorTest.assertTrue(!error);
53 InspectorTest.assertTrue(wasThrown);
54 InspectorTest.addResult("Script run error: " + result.description);
59 function testCompileError(next)
62 InspectorTest.addResult("Compiling script");
63 DebuggerAgent.compileScript(expression, "test.js", compileCallback.bind(this));
65 function compileCallback(error, scriptId, syntaxErrorMessage)
67 InspectorTest.assertTrue(!error);
68 InspectorTest.assertTrue(!scriptId);
69 InspectorTest.addResult("Script compile error: " + syntaxErrorMessage);
77 <body onload="runTest()">
78 <p>Tests separate compilation and run.</p>
79 <a href="https://bugs.webkit.org/show_bug.cgi?id=89646">Bug 89646.</a>