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 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 return false; | 976 return false; |
977 } | 977 } |
978 var context = msg.lookup(script.context.ref); | 978 var context = msg.lookup(script.context.ref); |
979 var scriptContextId = context.data; | 979 var scriptContextId = context.data; |
980 if (!goog.isDef(scriptContextId)) { | 980 if (!goog.isDef(scriptContextId)) { |
981 return false; // Always ignore scripts from the utility context. | 981 return false; // Always ignore scripts from the utility context. |
982 } | 982 } |
983 if (this.contextId_ === null) { | 983 if (this.contextId_ === null) { |
984 return true; | 984 return true; |
985 } | 985 } |
986 return (scriptContextId.value == this.contextId_); | 986 if (goog.isString(context.data)) { |
| 987 // Find the id from context data. The context data has the format "type,id". |
| 988 var comma = context.data.indexOf(','); |
| 989 if (comma < 0) { |
| 990 return false; |
| 991 } |
| 992 return (parseInt(context.data.substring(comma + 1)) == this.contextId_); |
| 993 } else { |
| 994 // TODO(sgjesse) remove this when patch for |
| 995 // https://bugs.webkit.org/show_bug.cgi?id=31873 has landed in Chromium. |
| 996 return (scriptContextId.value == this.contextId_); |
| 997 } |
987 }; | 998 }; |
988 | 999 |
989 | 1000 |
990 /** | 1001 /** |
991 * @param {devtools.DebuggerMessage} msg | 1002 * @param {devtools.DebuggerMessage} msg |
992 */ | 1003 */ |
993 devtools.DebuggerAgent.prototype.handleSetBreakpointResponse_ = function(msg) { | 1004 devtools.DebuggerAgent.prototype.handleSetBreakpointResponse_ = function(msg) { |
994 var requestSeq = msg.getRequestSeq(); | 1005 var requestSeq = msg.getRequestSeq(); |
995 var breakpointInfo = this.requestNumberToBreakpointInfo_[requestSeq]; | 1006 var breakpointInfo = this.requestNumberToBreakpointInfo_[requestSeq]; |
996 if (!breakpointInfo) { | 1007 if (!breakpointInfo) { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 | 1079 |
1069 /** | 1080 /** |
1070 * Adds the script info to the local cache. This method assumes that the script | 1081 * Adds the script info to the local cache. This method assumes that the script |
1071 * is not in the cache yet. | 1082 * is not in the cache yet. |
1072 * @param {Object} script Script json object from the debugger message. | 1083 * @param {Object} script Script json object from the debugger message. |
1073 * @param {devtools.DebuggerMessage} msg Debugger message containing the script | 1084 * @param {devtools.DebuggerMessage} msg Debugger message containing the script |
1074 * data. | 1085 * data. |
1075 */ | 1086 */ |
1076 devtools.DebuggerAgent.prototype.addScriptInfo_ = function(script, msg) { | 1087 devtools.DebuggerAgent.prototype.addScriptInfo_ = function(script, msg) { |
1077 var context = msg.lookup(script.context.ref); | 1088 var context = msg.lookup(script.context.ref); |
1078 var contextType = context.data.type; | 1089 var contextType; |
| 1090 if (goog.isString(context.data)) { |
| 1091 // Find the type from context data. The context data has the format |
| 1092 // "type,id". |
| 1093 var comma = context.data.indexOf(','); |
| 1094 if (comma < 0) { |
| 1095 return |
| 1096 } |
| 1097 contextType = context.data.substring(0, comma); |
| 1098 } else { |
| 1099 // TODO(sgjesse) remove this when patch for |
| 1100 // https://bugs.webkit.org/show_bug.cgi?id=31873 has landed in Chromium. |
| 1101 contextType = context.data.type; |
| 1102 } |
1079 this.parsedScripts_[script.id] = new devtools.ScriptInfo( | 1103 this.parsedScripts_[script.id] = new devtools.ScriptInfo( |
1080 script.id, script.name, script.lineOffset, contextType); | 1104 script.id, script.name, script.lineOffset, contextType); |
1081 if (this.scriptsPanelInitialized_) { | 1105 if (this.scriptsPanelInitialized_) { |
1082 // Only report script as parsed after scripts panel has been shown. | 1106 // Only report script as parsed after scripts panel has been shown. |
1083 WebInspector.parsedScriptSource( | 1107 WebInspector.parsedScriptSource( |
1084 script.id, script.name, script.source, script.lineOffset); | 1108 script.id, script.name, script.source, script.lineOffset); |
1085 } | 1109 } |
1086 }; | 1110 }; |
1087 | 1111 |
1088 | 1112 |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1625 | 1649 |
1626 | 1650 |
1627 /** | 1651 /** |
1628 * @param {number} handle Object handle. | 1652 * @param {number} handle Object handle. |
1629 * @return {?Object} Returns the object with the handle if it was sent in this | 1653 * @return {?Object} Returns the object with the handle if it was sent in this |
1630 * message(some objects referenced by handles may be missing in the message). | 1654 * message(some objects referenced by handles may be missing in the message). |
1631 */ | 1655 */ |
1632 devtools.DebuggerMessage.prototype.lookup = function(handle) { | 1656 devtools.DebuggerMessage.prototype.lookup = function(handle) { |
1633 return this.refs_[handle]; | 1657 return this.refs_[handle]; |
1634 }; | 1658 }; |
OLD | NEW |