3 <script src=
"../../../http/tests/inspector/inspector-test.js"></script>
4 <script src=
"../../../http/tests/inspector/debugger-test.js"></script>
8 function printExceptionDetails(exceptionDetails
)
10 InspectorTest
.addResult("exceptionDetails:")
11 InspectorTest
.addResult(" " + exceptionDetails
.text
);
12 InspectorTest
.addResult(" line: " + exceptionDetails
.line
+ ", column: " + exceptionDetails
.column
);
14 var stack
= exceptionDetails
.stackTrace
;
16 InspectorTest
.addResult(" no stack trace attached to exceptionDetails");
18 InspectorTest
.addResult(" exceptionDetails stack trace:");
19 for (var i
= 0; i
< stack
.length
&& i
< 100; ++i
) {
20 InspectorTest
.addResult(" url: " + stack
[i
].url
);
21 InspectorTest
.addResult(" function: " + stack
[i
].functionName
);
22 InspectorTest
.addResult(" line: " + stack
[i
].lineNumber
);
27 InspectorTest
.runDebuggerTestSuite([
28 function testSuccessfulCompileAndRun(next
)
30 var expression
= "var a = 1; var b = 2; a + b; ";
31 InspectorTest
.addResult("Compiling script");
32 InspectorTest
.DebuggerAgent
.compileScript(expression
, "test.js", true, compileCallback
.bind(this));
34 function compileCallback(error
, scriptId
, exceptionDetails
)
36 InspectorTest
.assertTrue(!error
);
37 InspectorTest
.assertTrue(!exceptionDetails
);
38 InspectorTest
.assertTrue(!!scriptId
);
39 InspectorTest
.addResult("Running script");
40 InspectorTest
.DebuggerAgent
.runScript(scriptId
, undefined, "console", false, runCallback
.bind(this));
43 function runCallback(error
, result
, exceptionDetails
)
45 var wasThrown
= !!exceptionDetails
;
46 InspectorTest
.assertTrue(!error
);
47 InspectorTest
.assertTrue(!wasThrown
);
48 InspectorTest
.addResult("Script result: " + result
.value
);
53 function testRunError(next
)
55 var expression
= "var a = 1; a + c; ";
56 InspectorTest
.addResult("Compiling script");
57 InspectorTest
.DebuggerAgent
.compileScript(expression
, "test.js", true, compileCallback
.bind(this));
59 function compileCallback(error
, scriptId
, exceptionDetails
)
61 InspectorTest
.assertTrue(!error
);
62 InspectorTest
.assertTrue(!exceptionDetails
);
63 InspectorTest
.assertTrue(!!scriptId
);
64 InspectorTest
.addResult("Running script");
65 InspectorTest
.DebuggerAgent
.runScript(scriptId
, undefined, "console", false, runCallback
.bind(this));
68 function runCallback(error
, result
, exceptionDetails
)
70 var wasThrown
= !!exceptionDetails
;
71 InspectorTest
.assertTrue(!error
);
72 InspectorTest
.assertTrue(wasThrown
);
73 printExceptionDetails(exceptionDetails
);
78 function testCompileError(next
)
81 InspectorTest
.addResult("Compiling script");
82 var contextId
= undefined;
83 InspectorTest
.DebuggerAgent
.compileScript(expression
, "test.js", true, contextId
, compileCallback
.bind(this));
85 function compileCallback(error
, scriptId
, exceptionDetails
)
87 InspectorTest
.assertTrue(!error
);
88 InspectorTest
.assertTrue(!!exceptionDetails
);
89 InspectorTest
.assertTrue(!scriptId
);
90 printExceptionDetails(exceptionDetails
);
98 <body onload=
"runTest()">
99 <p>Tests separate compilation and run.
</p>
100 <a href=
"https://bugs.webkit.org/show_bug.cgi?id=89646">Bug
89646.
</a>