Fix some errors in debugger tests
authorRyan Dahl <ry@tinyclouds.org>
Fri, 31 Dec 2010 01:52:14 +0000 (17:52 -0800)
committerRyan Dahl <ry@tinyclouds.org>
Fri, 31 Dec 2010 01:53:53 +0000 (17:53 -0800)
lib/_debugger.js
test/simple/test-debugger-client.js

index 98e19be..275d33e 100644 (file)
@@ -108,7 +108,7 @@ function Client() {
   this._reqCallbacks = [];
   var socket = this;
 
-  this.currentFrame = 0;
+  this.currentFrame = NO_FRAME;
   this.currentSourceLine = -1;
   this.currentSource = null;
   this.handles = {};
index 9708e70..a517f56 100644 (file)
@@ -85,11 +85,13 @@ addTest(function (client, done) {
 
 addTest(function (client, done) {
   console.error("requesting scripts");
-  client.reqScripts(function (s) {
-    console.error("got %d scripts", s.length);
+  client.reqScripts(function () {
+    console.error("got %d scripts", Object.keys(client.scripts).length);
+
     var foundMainScript = false;
-    for (var i = 0; i < s.length; i++) {
-      if (s[i].name === 'node.js') {
+    for (var k in client.scripts) {
+      var script = client.scripts[k];
+      if (script && script.name === 'node.js') {
         foundMainScript = true;
         break;
       }