| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 }; | 519 }; |
| 520 } | 520 } |
| 521 | 521 |
| 522 DebuggerScript._buildScopeObject = function(scopeType, scopeObject) | 522 DebuggerScript._buildScopeObject = function(scopeType, scopeObject) |
| 523 { | 523 { |
| 524 var result; | 524 var result; |
| 525 switch (scopeType) { | 525 switch (scopeType) { |
| 526 case ScopeType.Local: | 526 case ScopeType.Local: |
| 527 case ScopeType.Closure: | 527 case ScopeType.Closure: |
| 528 case ScopeType.Catch: | 528 case ScopeType.Catch: |
| 529 case ScopeType.Block: |
| 530 case ScopeType.Script: |
| 529 // For transient objects we create a "persistent" copy that contains | 531 // For transient objects we create a "persistent" copy that contains |
| 530 // the same properties. | 532 // the same properties. |
| 531 // Reset scope object prototype to null so that the proto properties | 533 // Reset scope object prototype to null so that the proto properties |
| 532 // don't appear in the local scope section. | 534 // don't appear in the local scope section. |
| 535 var properties = MakeMirror(scopeObject, true /* transient */).propertie
s(); |
| 536 // Almost always Script scope will be empty, so just filter out that noi
se. |
| 537 // Also drop empty Block scopes, should we get any. |
| 538 if (!properties.length && (scopeType === ScopeType.Script || scopeType =
== ScopeType.Block)) |
| 539 break; |
| 533 result = { __proto__: null }; | 540 result = { __proto__: null }; |
| 534 var properties = MakeMirror(scopeObject, true /* transient */).propertie
s(); | |
| 535 for (var j = 0; j < properties.length; j++) { | 541 for (var j = 0; j < properties.length; j++) { |
| 536 var name = properties[j].name(); | 542 var name = properties[j].name(); |
| 537 if (name.charAt(0) === ".") | 543 if (name.charAt(0) === ".") |
| 538 continue; // Skip internal variables like ".arguments" | 544 continue; // Skip internal variables like ".arguments" |
| 539 result[name] = properties[j].value_; | 545 result[name] = properties[j].value_; |
| 540 } | 546 } |
| 541 break; | 547 break; |
| 542 case ScopeType.Global: | 548 case ScopeType.Global: |
| 543 case ScopeType.With: | 549 case ScopeType.With: |
| 544 result = scopeObject; | 550 result = scopeObject; |
| 545 break; | 551 break; |
| 546 case ScopeType.Block: | |
| 547 // Unsupported yet. Mustn't be reachable. | |
| 548 break; | |
| 549 } | 552 } |
| 550 return result; | 553 return result; |
| 551 } | 554 } |
| 552 | 555 |
| 553 DebuggerScript.getPromiseDetails = function(eventData) | 556 DebuggerScript.getPromiseDetails = function(eventData) |
| 554 { | 557 { |
| 555 return { | 558 return { |
| 556 "promise": eventData.promise().value(), | 559 "promise": eventData.promise().value(), |
| 557 "parentPromise": eventData.parentPromise().value(), | 560 "parentPromise": eventData.parentPromise().value(), |
| 558 "status": eventData.status() | 561 "status": eventData.status() |
| 559 }; | 562 }; |
| 560 } | 563 } |
| 561 | 564 |
| 562 // We never resolve Mirror by its handle so to avoid memory leaks caused by Mirr
ors in the cache we disable it. | 565 // We never resolve Mirror by its handle so to avoid memory leaks caused by Mirr
ors in the cache we disable it. |
| 563 ToggleMirrorCache(false); | 566 ToggleMirrorCache(false); |
| 564 | 567 |
| 565 return DebuggerScript; | 568 return DebuggerScript; |
| 566 })(); | 569 })(); |
| OLD | NEW |