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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
},
/**
« 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