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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/bindings/ResourceScriptMapping.js

Issue 2077363003: DevTools: similarly to the way we match scripts ignoring sourceurl comments, ignore framework-speci… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test added Created 4 years, 6 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
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/sources/debugger/file-system-project-mapping-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 * @return {boolean} 313 * @return {boolean}
314 */ 314 */
315 _isDiverged: function() 315 _isDiverged: function()
316 { 316 {
317 if (this._uiSourceCode.isDirty()) 317 if (this._uiSourceCode.isDirty())
318 return true; 318 return true;
319 if (!this._script) 319 if (!this._script)
320 return false; 320 return false;
321 if (typeof this._scriptSource === "undefined") 321 if (typeof this._scriptSource === "undefined")
322 return false; 322 return false;
323 if (!this._uiSourceCode.workingCopy().startsWith(this._scriptSource.trim Right())) 323 var workingCopy = this._uiSourceCode.workingCopy();
324 return true; 324
325 var suffix = this._uiSourceCode.workingCopy().substr(this._scriptSource. length); 325 // Match ignoring sourceURL.
326 return !!suffix.length && !suffix.match(WebInspector.Script.sourceURLReg ex); 326 if (workingCopy.startsWith(this._scriptSource.trimRight())) {
327 var suffix = this._uiSourceCode.workingCopy().substr(this._scriptSou rce.length);
328 return !!suffix.length && !suffix.match(WebInspector.Script.sourceUR LRegex);
329 }
330
331 // Match ignoring Node wrapper.
332 var nodePrefix = "(function (exports, require, module, __filename, __dir name) { \n";
paulirish 2016/09/21 02:47:58 fwiw: this matches against the node string here:
333 var nodeSuffix = "\n});";
334 if (workingCopy.startsWith("#!/usr/bin/env node\n"))
335 workingCopy = workingCopy.substring("#!/usr/bin/env node\n".length);
336 if (this._scriptSource === nodePrefix + workingCopy + nodeSuffix)
337 return false;
338 return true;
327 }, 339 },
328 340
329 /** 341 /**
330 * @param {!WebInspector.Event} event 342 * @param {!WebInspector.Event} event
331 */ 343 */
332 _workingCopyChanged: function(event) 344 _workingCopyChanged: function(event)
333 { 345 {
334 this._update(); 346 this._update();
335 }, 347 },
336 348
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 /** 484 /**
473 * @return {boolean} 485 * @return {boolean}
474 */ 486 */
475 hasSourceMapURL: function() 487 hasSourceMapURL: function()
476 { 488 {
477 return this._script && !!this._script.sourceMapURL; 489 return this._script && !!this._script.sourceMapURL;
478 }, 490 },
479 491
480 __proto__: WebInspector.Object.prototype 492 __proto__: WebInspector.Object.prototype
481 } 493 }
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/sources/debugger/file-system-project-mapping-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698