Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(692)

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/DebuggerScript.js

Issue 2215153002: [DevTools] Eliminate frameId and isContentScript from js protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: navigation tracker Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } 134 }
135 135
136 /** 136 /**
137 * @param {string|undefined} contextData 137 * @param {string|undefined} contextData
138 * @return {number} 138 * @return {number}
139 */ 139 */
140 DebuggerScript._executionContextId = function(contextData) 140 DebuggerScript._executionContextId = function(contextData)
141 { 141 {
142 if (!contextData) 142 if (!contextData)
143 return 0; 143 return 0;
144 var firstComma = contextData.indexOf(","); 144 var match = contextData.match(/^[^,]*,([^,]*),.*$/);
145 if (firstComma === -1) 145 if (!match)
146 return 0; 146 return 0;
147 var secondComma = contextData.indexOf(",", firstComma + 1); 147 return parseInt(match[1], 10) || 0;
148 if (secondComma === -1)
149 return 0;
150
151 return parseInt(contextData.substring(firstComma + 1, secondComma), 10) || 0 ;
152 } 148 }
153 149
154 /** 150 /**
151 * @param {string|undefined} contextData
152 * @return {string}
153 */
154 DebuggerScript._executionContextAuxData = function(contextData)
155 {
156 if (!contextData)
157 return "";
158 var match = contextData.match(/^[^,]*,[^,]*,(.*)$/);
159 return match ? match[1] : "";
160 }
161
162 /**
155 * @param {string} contextGroupId 163 * @param {string} contextGroupId
156 * @return {!Array<!FormattedScript>} 164 * @return {!Array<!FormattedScript>}
157 */ 165 */
158 DebuggerScript.getScripts = function(contextGroupId) 166 DebuggerScript.getScripts = function(contextGroupId)
159 { 167 {
160 var result = []; 168 var result = [];
161 var scripts = Debug.scripts(); 169 var scripts = Debug.scripts();
162 var contextDataPrefix = null; 170 var contextDataPrefix = null;
163 if (contextGroupId) 171 if (contextGroupId)
164 contextDataPrefix = contextGroupId + ","; 172 contextDataPrefix = contextGroupId + ",";
165 for (var i = 0; i < scripts.length; ++i) { 173 for (var i = 0; i < scripts.length; ++i) {
166 var script = scripts[i]; 174 var script = scripts[i];
167 if (contextDataPrefix) { 175 if (contextDataPrefix) {
168 if (!script.context_data) 176 if (!script.context_data)
169 continue; 177 continue;
170 // Context data is a string in the following format: 178 // Context data is a string in the following format:
171 // <contextGroupId>,<contextId>,("default"|"nondefault") 179 // <contextGroupId>,<contextId>,<auxData>
172 if (script.context_data.indexOf(contextDataPrefix) !== 0) 180 if (script.context_data.indexOf(contextDataPrefix) !== 0)
173 continue; 181 continue;
174 } 182 }
175 result.push(DebuggerScript._formatScript(script)); 183 result.push(DebuggerScript._formatScript(script));
176 } 184 }
177 return result; 185 return result;
178 } 186 }
179 187
180 /** 188 /**
181 * @param {!Script} script 189 * @param {!Script} script
(...skipping 19 matching lines...) Expand all
201 id: script.id, 209 id: script.id,
202 name: script.nameOrSourceURL(), 210 name: script.nameOrSourceURL(),
203 sourceURL: script.source_url, 211 sourceURL: script.source_url,
204 sourceMappingURL: script.source_mapping_url, 212 sourceMappingURL: script.source_mapping_url,
205 source: script.source, 213 source: script.source,
206 startLine: script.line_offset, 214 startLine: script.line_offset,
207 startColumn: script.column_offset, 215 startColumn: script.column_offset,
208 endLine: endLine, 216 endLine: endLine,
209 endColumn: endColumn, 217 endColumn: endColumn,
210 executionContextId: DebuggerScript._executionContextId(script.context_da ta), 218 executionContextId: DebuggerScript._executionContextId(script.context_da ta),
211 isContentScript: !!script.context_data && script.context_data.endsWith(" ,nondefault"), 219 // Note that we cannot derive aux data from context id because of compil ation cache.
220 executionContextAuxData: DebuggerScript._executionContextAuxData(script. context_data),
212 isInternalScript: script.is_debugger_script 221 isInternalScript: script.is_debugger_script
213 }; 222 };
214 } 223 }
215 224
216 /** 225 /**
217 * @param {!ExecutionState} execState 226 * @param {!ExecutionState} execState
218 * @param {!BreakpointInfo} info 227 * @param {!BreakpointInfo} info
219 * @return {string|undefined} 228 * @return {string|undefined}
220 */ 229 */
221 DebuggerScript.setBreakpoint = function(execState, info) 230 DebuggerScript.setBreakpoint = function(execState, info)
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 break; 700 break;
692 } 701 }
693 return result; 702 return result;
694 } 703 }
695 704
696 // We never resolve Mirror by its handle so to avoid memory leaks caused by Mirr ors in the cache we disable it. 705 // We never resolve Mirror by its handle so to avoid memory leaks caused by Mirr ors in the cache we disable it.
697 ToggleMirrorCache(false); 706 ToggleMirrorCache(false);
698 707
699 return DebuggerScript; 708 return DebuggerScript;
700 })(); 709 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698