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

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: include 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 if (firstComma === -1) 145 if (firstComma === -1)
146 return 0; 146 return 0;
147 var secondComma = contextData.indexOf(",", firstComma + 1); 147 var secondComma = contextData.indexOf(",", firstComma + 1);
148 if (secondComma === -1) 148 if (secondComma === -1)
149 return 0; 149 return 0;
150 150
151 return parseInt(contextData.substring(firstComma + 1, secondComma), 10) || 0 ; 151 return parseInt(contextData.substring(firstComma + 1, secondComma), 10) || 0 ;
152 } 152 }
153 153
154 /** 154 /**
155 * @param {string|undefined} contextData
156 * @return {string}
157 */
158 DebuggerScript._executionContextAuxData = function(contextData)
159 {
160 if (!contextData)
161 return "";
162 var firstComma = contextData.indexOf(",");
kozy 2016/08/05 02:35:41 Can we use regexp here? var matches = contextData.
dgozman 2016/08/05 18:00:38 Done.
163 if (firstComma === -1)
164 return "";
165 var secondComma = contextData.indexOf(",", firstComma + 1);
166 if (secondComma === -1)
167 return "";
168
169 return contextData.substring(secondComma + 1);
170 }
171
172 /**
155 * @param {string} contextGroupId 173 * @param {string} contextGroupId
156 * @return {!Array<!FormattedScript>} 174 * @return {!Array<!FormattedScript>}
157 */ 175 */
158 DebuggerScript.getScripts = function(contextGroupId) 176 DebuggerScript.getScripts = function(contextGroupId)
159 { 177 {
160 var result = []; 178 var result = [];
161 var scripts = Debug.scripts(); 179 var scripts = Debug.scripts();
162 var contextDataPrefix = null; 180 var contextDataPrefix = null;
163 if (contextGroupId) 181 if (contextGroupId)
164 contextDataPrefix = contextGroupId + ","; 182 contextDataPrefix = contextGroupId + ",";
165 for (var i = 0; i < scripts.length; ++i) { 183 for (var i = 0; i < scripts.length; ++i) {
166 var script = scripts[i]; 184 var script = scripts[i];
167 if (contextDataPrefix) { 185 if (contextDataPrefix) {
168 if (!script.context_data) 186 if (!script.context_data)
169 continue; 187 continue;
170 // Context data is a string in the following format: 188 // Context data is a string in the following format:
171 // <contextGroupId>,<contextId>,("default"|"nondefault") 189 // <contextGroupId>,<contextId>,<auxData>
172 if (script.context_data.indexOf(contextDataPrefix) !== 0) 190 if (script.context_data.indexOf(contextDataPrefix) !== 0)
173 continue; 191 continue;
174 } 192 }
175 result.push(DebuggerScript._formatScript(script)); 193 result.push(DebuggerScript._formatScript(script));
176 } 194 }
177 return result; 195 return result;
178 } 196 }
179 197
180 /** 198 /**
181 * @param {!Script} script 199 * @param {!Script} script
(...skipping 19 matching lines...) Expand all
201 id: script.id, 219 id: script.id,
202 name: script.nameOrSourceURL(), 220 name: script.nameOrSourceURL(),
203 sourceURL: script.source_url, 221 sourceURL: script.source_url,
204 sourceMappingURL: script.source_mapping_url, 222 sourceMappingURL: script.source_mapping_url,
205 source: script.source, 223 source: script.source,
206 startLine: script.line_offset, 224 startLine: script.line_offset,
207 startColumn: script.column_offset, 225 startColumn: script.column_offset,
208 endLine: endLine, 226 endLine: endLine,
209 endColumn: endColumn, 227 endColumn: endColumn,
210 executionContextId: DebuggerScript._executionContextId(script.context_da ta), 228 executionContextId: DebuggerScript._executionContextId(script.context_da ta),
211 isContentScript: !!script.context_data && script.context_data.endsWith(" ,nondefault"), 229 // Note that we cannot derive aux data from context id because of compil ation cache.
230 executionContextAuxData: DebuggerScript._executionContextAuxData(script. context_data),
212 isInternalScript: script.is_debugger_script 231 isInternalScript: script.is_debugger_script
213 }; 232 };
214 } 233 }
215 234
216 /** 235 /**
217 * @param {!ExecutionState} execState 236 * @param {!ExecutionState} execState
218 * @param {!BreakpointInfo} info 237 * @param {!BreakpointInfo} info
219 * @return {string|undefined} 238 * @return {string|undefined}
220 */ 239 */
221 DebuggerScript.setBreakpoint = function(execState, info) 240 DebuggerScript.setBreakpoint = function(execState, info)
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 break; 710 break;
692 } 711 }
693 return result; 712 return result;
694 } 713 }
695 714
696 // We never resolve Mirror by its handle so to avoid memory leaks caused by Mirr ors in the cache we disable it. 715 // 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); 716 ToggleMirrorCache(false);
698 717
699 return DebuggerScript; 718 return DebuggerScript;
700 })(); 719 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698