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

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

Issue 2727383002: DevTools: sort sourceMap mappings since they might not be ordered. (Closed)
Patch Set: Created 3 years, 10 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/http/tests/inspector/text-source-map-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/sdk/SourceMap.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/SourceMap.js b/third_party/WebKit/Source/devtools/front_end/sdk/SourceMap.js
index 8101ab0fef1540eb16919d787b4440596641d2bf..07c42d63717becd8fee2a615089e9f9b94174b1d 100644
--- a/third_party/WebKit/Source/devtools/front_end/sdk/SourceMap.js
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/SourceMap.js
@@ -83,6 +83,17 @@ SDK.SourceMapEntry = class {
this.sourceColumnNumber = sourceColumnNumber;
this.name = name;
}
+
+ /**
+ * @param {!SDK.SourceMapEntry} entry1
+ * @param {!SDK.SourceMapEntry} entry2
+ * @return {number}
+ */
+ static compare(entry1, entry2) {
+ if (entry1.lineNumber !== entry2.lineNumber)
+ return entry1.lineNumber - entry2.lineNumber;
+ return entry1.columnNumber - entry2.columnNumber;
+ }
};
/**
@@ -481,6 +492,9 @@ SDK.TextSourceMap = class {
this._mappings.push(new SDK.SourceMapEntry(
lineNumber, columnNumber, sourceURL, sourceLineNumber, sourceColumnNumber, names[nameIndex]));
}
+
+ // As per spec, mappings are not necessarily sorted.
+ this._mappings.stableSort(SDK.SourceMapEntry.compare);
}
/**
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/inspector/text-source-map-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698