| OLD | NEW | 
|   1 <html> |   1 <html> | 
|   2 <head> |   2 <head> | 
|   3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto
    r-protocol-test.js"></script> |   3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto
    r-protocol-test.js"></script> | 
|   4 <script> |   4 <script> | 
|   5 function testFunction() |   5 function testFunction() | 
|   6 { |   6 { | 
|   7     function foo() |   7     function foo() | 
|   8     { |   8     { | 
|   9         try { |   9         try { | 
|  10             throw new Error(); |  10             throw new Error(); | 
|  11         } catch (e) { |  11         } catch (e) { | 
|  12         } |  12         } | 
|  13     } |  13     } | 
|  14     debugger; |  14     debugger; | 
|  15     foo(); |  15     foo(); | 
|  16     console.log("completed"); |  16     console.log("completed"); | 
|  17 } |  17 } | 
|  18 </script> |  18 </script> | 
|  19 <script> |  19 <script> | 
|  20 function test() |  20 function test() | 
|  21 { |  21 { | 
|  22     InspectorTest.sendCommandOrDie("Debugger.enable", {} ); |  22     InspectorTest.sendCommandOrDie("Debugger.enable", {} ); | 
|  23     InspectorTest.sendCommandOrDie("Console.enable", {} ); |  23     InspectorTest.sendCommandOrDie("Runtime.enable", {} ); | 
|  24     step1(); |  24     step1(); | 
|  25  |  25  | 
|  26     function step1() |  26     function step1() | 
|  27     { |  27     { | 
|  28         InspectorTest.sendCommandOrDie("Runtime.evaluate", { "expression": "setT
    imeout(testFunction, 0);"} ); |  28         InspectorTest.sendCommandOrDie("Runtime.evaluate", { "expression": "setT
    imeout(testFunction, 0);"} ); | 
|  29         var commands = [ "Print", "stepOver", "stepOver", "Print", "resume" ]; |  29         var commands = [ "Print", "stepOver", "stepOver", "Print", "resume" ]; | 
|  30         InspectorTest.eventHandler["Debugger.paused"] = function(messageObject) |  30         InspectorTest.eventHandler["Debugger.paused"] = function(messageObject) | 
|  31         { |  31         { | 
|  32             var command = commands.shift(); |  32             var command = commands.shift(); | 
|  33             if (command === "Print") { |  33             if (command === "Print") { | 
|  34                 var callFrames = messageObject.params.callFrames; |  34                 var callFrames = messageObject.params.callFrames; | 
|  35                 for (var callFrame of callFrames) |  35                 for (var callFrame of callFrames) | 
|  36                     InspectorTest.log(callFrame.functionName + ":" + callFrame.l
    ocation.lineNumber); |  36                     InspectorTest.log(callFrame.functionName + ":" + callFrame.l
    ocation.lineNumber); | 
|  37                 command = commands.shift(); |  37                 command = commands.shift(); | 
|  38             } |  38             } | 
|  39             if (command) |  39             if (command) | 
|  40                 InspectorTest.sendCommandOrDie("Debugger." + command, {}); |  40                 InspectorTest.sendCommandOrDie("Debugger." + command, {}); | 
|  41         } |  41         } | 
|  42  |  42  | 
|  43         InspectorTest.eventHandler["Console.messageAdded"] = function(messageObj
    ect) |  43         InspectorTest.eventHandler["Runtime.consoleAPICalled"] = function(messag
    eObject) | 
|  44         { |  44         { | 
|  45             if (messageObject.params.message.text === "completed") { |  45             if (messageObject.params.args[0].value === "completed") { | 
|  46                 if (commands.length) |  46                 if (commands.length) | 
|  47                     InspectorTest.log("[FAIL]: execution was resumed too earlier
    .") |  47                     InspectorTest.log("[FAIL]: execution was resumed too earlier
    .") | 
|  48                 step2(); |  48                 step2(); | 
|  49             } |  49             } | 
|  50         } |  50         } | 
|  51     } |  51     } | 
|  52  |  52  | 
|  53     function step2() |  53     function step2() | 
|  54     { |  54     { | 
|  55         InspectorTest.sendCommandOrDie("Runtime.evaluate", { "expression": "setT
    imeout(testFunction, 0);"} ); |  55         InspectorTest.sendCommandOrDie("Runtime.evaluate", { "expression": "setT
    imeout(testFunction, 0);"} ); | 
|  56         var commands = [ "Print", "stepOver", "stepInto", "stepOver", "stepOver"
    , "Print", "resume" ]; |  56         var commands = [ "Print", "stepOver", "stepInto", "stepOver", "stepOver"
    , "Print", "resume" ]; | 
|  57         InspectorTest.eventHandler["Debugger.paused"] = function(messageObject) |  57         InspectorTest.eventHandler["Debugger.paused"] = function(messageObject) | 
|  58         { |  58         { | 
|  59             var command = commands.shift(); |  59             var command = commands.shift(); | 
|  60             if (command === "Print") { |  60             if (command === "Print") { | 
|  61                 var callFrames = messageObject.params.callFrames; |  61                 var callFrames = messageObject.params.callFrames; | 
|  62                 for (var callFrame of callFrames) |  62                 for (var callFrame of callFrames) | 
|  63                     InspectorTest.log(callFrame.functionName + ":" + callFrame.l
    ocation.lineNumber); |  63                     InspectorTest.log(callFrame.functionName + ":" + callFrame.l
    ocation.lineNumber); | 
|  64                 command = commands.shift(); |  64                 command = commands.shift(); | 
|  65             } |  65             } | 
|  66             if (command) |  66             if (command) | 
|  67                 InspectorTest.sendCommandOrDie("Debugger." + command, {}); |  67                 InspectorTest.sendCommandOrDie("Debugger." + command, {}); | 
|  68         } |  68         } | 
|  69  |  69  | 
|  70         InspectorTest.eventHandler["Console.messageAdded"] = function(messageObj
    ect) |  70         InspectorTest.eventHandler["Runtime.consoleAPICalled"] = function(messag
    eObject) | 
|  71         { |  71         { | 
|  72             if (messageObject.params.message.text === "completed") { |  72             if (messageObject.params.args[0].value === "completed") { | 
|  73                 if (commands.length) |  73                 if (commands.length) | 
|  74                     InspectorTest.log("[FAIL]: execution was resumed too earlier
    .") |  74                     InspectorTest.log("[FAIL]: execution was resumed too earlier
    .") | 
|  75                 InspectorTest.completeTest(); |  75                 InspectorTest.completeTest(); | 
|  76             } |  76             } | 
|  77         } |  77         } | 
|  78     } |  78     } | 
|  79 } |  79 } | 
|  80 </script> |  80 </script> | 
|  81 </head> |  81 </head> | 
|  82 <body onLoad="runTest();"></body> |  82 <body onLoad="runTest();"></body> | 
|  83 </html> |  83 </html> | 
| OLD | NEW |