Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/bindings/ResourceScriptMapping.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/bindings/ResourceScriptMapping.js b/third_party/WebKit/Source/devtools/front_end/bindings/ResourceScriptMapping.js |
| index 11174402c239b4f7b9623571a0007949b1f21807..9d1e09b4ebcb1f840c92b97c92067a01a13d4604 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/bindings/ResourceScriptMapping.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/bindings/ResourceScriptMapping.js |
| @@ -320,10 +320,22 @@ WebInspector.ResourceScriptFile.prototype = { |
| return false; |
| if (typeof this._scriptSource === "undefined") |
| return false; |
| - if (!this._uiSourceCode.workingCopy().startsWith(this._scriptSource.trimRight())) |
| - return true; |
| - var suffix = this._uiSourceCode.workingCopy().substr(this._scriptSource.length); |
| - return !!suffix.length && !suffix.match(WebInspector.Script.sourceURLRegex); |
| + var workingCopy = this._uiSourceCode.workingCopy(); |
| + |
| + // Match ignoring sourceURL. |
| + if (workingCopy.startsWith(this._scriptSource.trimRight())) { |
| + var suffix = this._uiSourceCode.workingCopy().substr(this._scriptSource.length); |
| + return !!suffix.length && !suffix.match(WebInspector.Script.sourceURLRegex); |
| + } |
| + |
| + // Match ignoring Node wrapper. |
| + var nodePrefix = "(function (exports, require, module, __filename, __dirname) { \n"; |
|
paulirish
2016/09/21 02:47:58
fwiw: this matches against the node string here:
|
| + var nodeSuffix = "\n});"; |
| + if (workingCopy.startsWith("#!/usr/bin/env node\n")) |
| + workingCopy = workingCopy.substring("#!/usr/bin/env node\n".length); |
| + if (this._scriptSource === nodePrefix + workingCopy + nodeSuffix) |
| + return false; |
| + return true; |
| }, |
| /** |