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

Unified Diff: Source/devtools/front_end/timeline/TracingTimelineModel.js

Issue 454893003: Show error message on attempt to load old Timeline data into tracing based Timeline (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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
« no previous file with comments | « Source/devtools/front_end/timeline/TracingModel.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/timeline/TracingTimelineModel.js
diff --git a/Source/devtools/front_end/timeline/TracingTimelineModel.js b/Source/devtools/front_end/timeline/TracingTimelineModel.js
index 19ca542d0134dd87ee9be0affed3e307628711ea..b00d8565959c0ecb932f02e9f243bca31f087bea 100644
--- a/Source/devtools/front_end/timeline/TracingTimelineModel.js
+++ b/Source/devtools/front_end/timeline/TracingTimelineModel.js
@@ -823,7 +823,6 @@ WebInspector.TracingModelLoader.prototype = {
return;
if (this._firstChunk) {
- this._firstChunk = false;
this._model.reset();
} else {
var commaIndex = json.indexOf(",");
@@ -836,14 +835,37 @@ WebInspector.TracingModelLoader.prototype = {
try {
items = /** @type {!Array.<!WebInspector.TracingModel.EventPayload>} */ (JSON.parse(json));
} catch (e) {
- WebInspector.console.error("Malformed timeline data.");
- this._model.reset();
- this._reader.cancel();
- this._progress.done();
+ this._reportErrorAndCancelLoading("Malformed timeline data: " + e);
+ return;
+ }
+
+ if (this._firstChunk) {
+ this._firstChunk = false;
+ if (this._looksLikeAppVersion(items[0])) {
+ this._reportErrorAndCancelLoading("Old Timeline format is not supported.");
+ return;
+ }
+ }
+
+ try {
+ this._loader.loadNextChunk(items);
+ } catch(e) {
+ this._reportErrorAndCancelLoading("Malformed timeline data: " + e);
return;
}
+ },
- this._loader.loadNextChunk(items);
+ _reportErrorAndCancelLoading: function(messsage)
+ {
+ WebInspector.console.error(messsage);
+ this._model.reset();
+ this._reader.cancel();
+ this._progress.done();
+ },
+
+ _looksLikeAppVersion: function(item)
+ {
+ return typeof item === "string" && item.indexOf("Chrome") !== -1;
},
close: function()
« no previous file with comments | « Source/devtools/front_end/timeline/TracingModel.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698