| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview Provides communication interface to remote v8 debugger. See | 6 * @fileoverview Provides communication interface to remote v8 debugger. See |
| 7 * protocol decription at http://code.google.com/p/v8/wiki/DebuggerProtocol | 7 * protocol decription at http://code.google.com/p/v8/wiki/DebuggerProtocol |
| 8 */ | 8 */ |
| 9 goog.provide('devtools.DebuggerAgent'); | 9 goog.provide('devtools.DebuggerAgent'); |
| 10 | 10 |
| (...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 964 return false; | 964 return false; |
| 965 } | 965 } |
| 966 var context = msg.lookup(script.context.ref); | 966 var context = msg.lookup(script.context.ref); |
| 967 var scriptContextId = context.data; | 967 var scriptContextId = context.data; |
| 968 if (!goog.isDef(scriptContextId)) { | 968 if (!goog.isDef(scriptContextId)) { |
| 969 return false; // Always ignore scripts from the utility context. | 969 return false; // Always ignore scripts from the utility context. |
| 970 } | 970 } |
| 971 if (this.contextId_ === null) { | 971 if (this.contextId_ === null) { |
| 972 return true; | 972 return true; |
| 973 } | 973 } |
| 974 return (scriptContextId.value == this.contextId_); | 974 if (goog.isString(context.data)) { |
| 975 // Find the id from context data. The context data has the format "type,id". |
| 976 var comma = context.data.indexOf(','); |
| 977 if (comma < 0) { |
| 978 return false; |
| 979 } |
| 980 return (parseInt(context.data.substring(comma + 1)) == this.contextId_); |
| 981 } else { |
| 982 // TODO(sgjesse) remove this when patch for |
| 983 // https://bugs.webkit.org/show_bug.cgi?id=31873 has landed in Chromium. |
| 984 return (scriptContextId.value == this.contextId_); |
| 985 } |
| 975 }; | 986 }; |
| 976 | 987 |
| 977 | 988 |
| 978 /** | 989 /** |
| 979 * @param {devtools.DebuggerMessage} msg | 990 * @param {devtools.DebuggerMessage} msg |
| 980 */ | 991 */ |
| 981 devtools.DebuggerAgent.prototype.handleSetBreakpointResponse_ = function(msg) { | 992 devtools.DebuggerAgent.prototype.handleSetBreakpointResponse_ = function(msg) { |
| 982 var requestSeq = msg.getRequestSeq(); | 993 var requestSeq = msg.getRequestSeq(); |
| 983 var breakpointInfo = this.requestNumberToBreakpointInfo_[requestSeq]; | 994 var breakpointInfo = this.requestNumberToBreakpointInfo_[requestSeq]; |
| 984 if (!breakpointInfo) { | 995 if (!breakpointInfo) { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1059 | 1070 |
| 1060 /** | 1071 /** |
| 1061 * Adds the script info to the local cache. This method assumes that the script | 1072 * Adds the script info to the local cache. This method assumes that the script |
| 1062 * is not in the cache yet. | 1073 * is not in the cache yet. |
| 1063 * @param {Object} script Script json object from the debugger message. | 1074 * @param {Object} script Script json object from the debugger message. |
| 1064 * @param {devtools.DebuggerMessage} msg Debugger message containing the script | 1075 * @param {devtools.DebuggerMessage} msg Debugger message containing the script |
| 1065 * data. | 1076 * data. |
| 1066 */ | 1077 */ |
| 1067 devtools.DebuggerAgent.prototype.addScriptInfo_ = function(script, msg) { | 1078 devtools.DebuggerAgent.prototype.addScriptInfo_ = function(script, msg) { |
| 1068 var context = msg.lookup(script.context.ref); | 1079 var context = msg.lookup(script.context.ref); |
| 1069 var contextType = context.data.type; | 1080 var contextType; |
| 1081 if (goog.isString(context.data)) { |
| 1082 // Find the type from context data. The context data has the format |
| 1083 // "type,id". |
| 1084 var comma = context.data.indexOf(','); |
| 1085 if (comma < 0) { |
| 1086 return |
| 1087 } |
| 1088 contextType = context.data.substring(0, comma); |
| 1089 } else { |
| 1090 // TODO(sgjesse) remove this when patch for |
| 1091 // https://bugs.webkit.org/show_bug.cgi?id=31873 has landed in Chromium. |
| 1092 contextType = context.data.type; |
| 1093 } |
| 1070 this.parsedScripts_[script.id] = new devtools.ScriptInfo( | 1094 this.parsedScripts_[script.id] = new devtools.ScriptInfo( |
| 1071 script.id, script.name, script.lineOffset, contextType); | 1095 script.id, script.name, script.lineOffset, contextType); |
| 1072 if (this.scriptsPanelInitialized_) { | 1096 if (this.scriptsPanelInitialized_) { |
| 1073 // Only report script as parsed after scripts panel has been shown. | 1097 // Only report script as parsed after scripts panel has been shown. |
| 1074 WebInspector.parsedScriptSource( | 1098 WebInspector.parsedScriptSource( |
| 1075 script.id, script.name, script.source, script.lineOffset); | 1099 script.id, script.name, script.source, script.lineOffset); |
| 1076 } | 1100 } |
| 1077 }; | 1101 }; |
| 1078 | 1102 |
| 1079 | 1103 |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1616 | 1640 |
| 1617 | 1641 |
| 1618 /** | 1642 /** |
| 1619 * @param {number} handle Object handle. | 1643 * @param {number} handle Object handle. |
| 1620 * @return {?Object} Returns the object with the handle if it was sent in this | 1644 * @return {?Object} Returns the object with the handle if it was sent in this |
| 1621 * message(some objects referenced by handles may be missing in the message). | 1645 * message(some objects referenced by handles may be missing in the message). |
| 1622 */ | 1646 */ |
| 1623 devtools.DebuggerMessage.prototype.lookup = function(handle) { | 1647 devtools.DebuggerMessage.prototype.lookup = function(handle) { |
| 1624 return this.refs_[handle]; | 1648 return this.refs_[handle]; |
| 1625 }; | 1649 }; |
| OLD | NEW |