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

Unified Diff: third_party/WebKit/Source/devtools/front_end/sdk/Script.js

Issue 2235743004: [DevTools] Removed deprecatedCommentWasUsed flag from protocol scriptParsed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments Created 4 years, 4 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
Index: third_party/WebKit/Source/devtools/front_end/sdk/Script.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/Script.js b/third_party/WebKit/Source/devtools/front_end/sdk/Script.js
index 2e91baca71521197080ab9a35f26e38a67655e46..976eceb128a980c2a03ac0a64a1db42d986bec74 100644
--- a/third_party/WebKit/Source/devtools/front_end/sdk/Script.js
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/Script.js
@@ -89,6 +89,27 @@ WebInspector.Script._trimSourceURLComment = function(source)
return source.substr(0, sourceURLLineIndex) + source.substr(sourceURLLineIndex + sourceURLLine.length + 1);
}
+/**
+ * @param {!WebInspector.Script} script
+ * @param {string} source
+ */
+WebInspector.Script._reportDeprecatedCommentIfNeeded = function(script, source)
+{
+ var consoleModel = script.target().consoleModel;
+ if (!consoleModel)
+ return;
+ var linesToCheck = 5;
+ var offset = source.lastIndexOf("\n");
+ while (linesToCheck && offset !== -1)
+ offset = source.lastIndexOf("\n", offset - 1);
dgozman 2016/08/12 19:06:04 linesToCheck--
kozy 2016/08/12 19:24:36 Done.
+ offset = offset !== -1 ? offset : 0;
+ var sourceTail = source.substr(offset);
+ if (sourceTail.search(/^[\040\t]*\/\/@ source(mapping)?url=/mi) === -1)
dgozman 2016/08/12 19:06:04 Let's not do anything if sourceTail is longer than
kozy 2016/08/12 19:24:36 Done.
+ return;
+ var text = WebInspector.UIString("'//@ sourceURL' and '//@ sourceMappingURL' are deprecated, please use '//# sourceURL=' and '//# sourceMappingURL=' instead.");
+ var msg = new WebInspector.ConsoleMessage(script.target(), WebInspector.ConsoleMessage.MessageSource.JS, WebInspector.ConsoleMessage.MessageLevel.Warning, text, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, script.scriptId);
dgozman 2016/08/12 19:06:04 nit: can we have lineNumber and columnNumber so th
kozy 2016/08/12 19:24:36 I'd like to avoid full scan of documents for new l
+ consoleModel.addMessage(msg);
+}
WebInspector.Script.prototype = {
/**
@@ -164,6 +185,7 @@ WebInspector.Script.prototype = {
*/
function didGetScriptSource(error, source)
{
+ WebInspector.Script._reportDeprecatedCommentIfNeeded(this, source);
this._source = WebInspector.Script._trimSourceURLComment(error ? "" : source);
callback(this._source);
}

Powered by Google App Engine
This is Rietveld 408576698