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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/script_formatter_worker/ScriptFormatterWorker.js

Issue 1770263002: Devtools: resolve expressions in minified scripts with sourcemaps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 4 years, 9 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 { 92 {
93 var chunkSize = 100000; // characters per data chunk 93 var chunkSize = 100000; // characters per data chunk
94 var outlineChunk = []; 94 var outlineChunk = [];
95 var previousIdentifier = null; 95 var previousIdentifier = null;
96 var previousToken = null; 96 var previousToken = null;
97 var processedChunkCharacters = 0; 97 var processedChunkCharacters = 0;
98 var addedFunction = false; 98 var addedFunction = false;
99 var isReadingArguments = false; 99 var isReadingArguments = false;
100 var argumentsText = ""; 100 var argumentsText = "";
101 var currentFunction = null; 101 var currentFunction = null;
102 var tokenizer = new FormatterWorker.AcornTokenizer(params.content); 102 var tokenizer = new WebInspector.AcornTokenizer(params.content);
103 var AT = FormatterWorker.AcornTokenizer; 103 var AT = WebInspector.AcornTokenizer;
104 104
105 while (tokenizer.peekToken()) { 105 while (tokenizer.peekToken()) {
106 var token = /** @type {!Acorn.TokenOrComment} */(tokenizer.nextToken()); 106 var token = /** @type {!Acorn.TokenOrComment} */(tokenizer.nextToken());
107 if (AT.lineComment(token) || AT.blockComment(token)) 107 if (AT.lineComment(token) || AT.blockComment(token))
108 continue; 108 continue;
109 109
110 var tokenValue = params.content.substring(token.start, token.end); 110 var tokenValue = params.content.substring(token.start, token.end);
111 111
112 if (AT.identifier(token) && previousToken && (AT.identifier(previousToke n, "get") || AT.identifier(previousToken, "set"))) { 112 if (AT.identifier(token) && previousToken && (AT.identifier(previousToke n, "get") || AT.identifier(previousToken, "set"))) {
113 currentFunction = { 113 currentFunction = {
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 515
516 var scriptContent = this._content.substring(this._position, cursor); 516 var scriptContent = this._content.substring(this._position, cursor);
517 this._mapping.original.push(this._position); 517 this._mapping.original.push(this._position);
518 this._mapping.formatted.push(this._formattedContent.length); 518 this._mapping.formatted.push(this._formattedContent.length);
519 var formattedScriptContent = formatFunction(scriptContent, this._mapping , this._position, this._formattedContent.length, this._indentString); 519 var formattedScriptContent = formatFunction(scriptContent, this._mapping , this._position, this._formattedContent.length, this._indentString);
520 520
521 this._formattedContent += formattedScriptContent; 521 this._formattedContent += formattedScriptContent;
522 this._position = cursor; 522 this._position = cursor;
523 } 523 }
524 } 524 }
525
526 // A dummy javascript mode which is used only by htmlmixed mode to advance
527 // stream until a </script> is found.
528 CodeMirror.defineMode("javascript", function(config, parserConfig) {
529 return {
530 token: function(stream, state)
531 {
532 return stream.next();
533 }
534 }
535 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698