Changeset 83151 in webkit
- Timestamp:
- Apr 7, 2011 1:39:45 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r83145 r83151 1 2011-04-07 Pavel Podivilov <podivilov@chromium.org> 2 3 Reviewed by Pavel Feldman. 4 5 Web Inspector: build mapping for formatted scripts based on keywords positions. 6 https://bugs.webkit.org/show_bug.cgi?id=57936 7 8 Mapping based on [\$\.\w]+ was not accurate because string literals representation 9 may be different in original and formatted scripts. 10 11 * inspector/front-end/ScriptFormatterWorker.js: 12 (buildMapping.regexp.b): 13 (buildMapping): 14 1 15 2011-04-07 Kent Tamura <tkent@chromium.org> 2 16 -
trunk/Source/WebCore/inspector/front-end/ScriptFormatterWorker.js
r82666 r83151 51 51 { 52 52 var mapping = { original: [], formatted: [] }; 53 var last CodePosition = 0;54 var regexp = / [\$\.\w]+|{|}/g;53 var lastFormattedPosition = 0; 54 var regexp = /\b(?:function|var|const|try|catch|throw|new|switch|break|continue|if|for|while|do|return|with|null|undefined)\b/g; 55 55 while (true) { 56 var match = regexp.exec( formattedSource);56 var match = regexp.exec(source); 57 57 if (!match) 58 58 break; 59 var position = source.indexOf(match[0], lastCodePosition); 60 if (position === -1) 61 continue; 62 mapping.original.push(position); 63 mapping.formatted.push(match.index); 64 lastCodePosition = position + match[0].length; 59 var formattedPosition = formattedSource.indexOf(match[0], lastFormattedPosition); 60 mapping.original.push(match.index); 61 mapping.formatted.push(formattedPosition); 62 lastFormattedPosition = formattedPosition + match[0].length; 65 63 } 66 64 return mapping;
Note: See TracChangeset
for help on using the changeset viewer.