Title: [123198] trunk
Revision
123198
Author
commit-qu...@webkit.org
Date
2012-07-20 02:41:35 -0700 (Fri, 20 Jul 2012)

Log Message

Web Inspector: Timeline: forward compatibility for load.
https://bugs.webkit.org/show_bug.cgi?id=91714

Patch by Eugene Klyuchnikov <eustas....@gmail.com> on 2012-07-20
Reviewed by Pavel Feldman.

Accept records of unrecognized types and render them as "unknown".

Source/WebCore:

Test: inspector/timeline/timeline-load-incompatible.html

* English.lproj/localizedStrings.js: Added UI string.
* inspector/front-end/TimelinePresentationModel.js:
(WebInspector.TimelinePresentationModel.recordStyle): Add missing record
styles at runtime.
(WebInspector.TimelinePresentationModel.Record.prototype._getRecordDetails):
Add some common information for default case.

LayoutTests:

* inspector/timeline/timeline-load-incompatible-expected.txt: Added.
* inspector/timeline/timeline-load-incompatible.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (123197 => 123198)


--- trunk/LayoutTests/ChangeLog	2012-07-20 09:30:07 UTC (rev 123197)
+++ trunk/LayoutTests/ChangeLog	2012-07-20 09:41:35 UTC (rev 123198)
@@ -1,3 +1,15 @@
+2012-07-20  Eugene Klyuchnikov  <eustas....@gmail.com>
+
+        Web Inspector: Timeline: forward compatibility for load.
+        https://bugs.webkit.org/show_bug.cgi?id=91714
+
+        Reviewed by Pavel Feldman.
+
+        Accept records of unrecognized types and render them as "unknown".
+
+        * inspector/timeline/timeline-load-incompatible-expected.txt: Added.
+        * inspector/timeline/timeline-load-incompatible.html: Added.
+
 2012-07-20  Mihnea Ovidenie  <mih...@adobe.com>
 
         [CSSRegions]Crash when flowing a region into itself

Added: trunk/LayoutTests/inspector/timeline/timeline-load-incompatible-expected.txt (0 => 123198)


--- trunk/LayoutTests/inspector/timeline/timeline-load-incompatible-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/timeline/timeline-load-incompatible-expected.txt	2012-07-20 09:41:35 UTC (rev 123198)
@@ -0,0 +1,5 @@
+Tests the Timeline save/load of unknown (incompatible) record types.
+
+Bug 91714
+passed
+

Added: trunk/LayoutTests/inspector/timeline/timeline-load-incompatible.html (0 => 123198)


--- trunk/LayoutTests/inspector/timeline/timeline-load-incompatible.html	                        (rev 0)
+++ trunk/LayoutTests/inspector/timeline/timeline-load-incompatible.html	2012-07-20 09:41:35 UTC (rev 123198)
@@ -0,0 +1,46 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+
+function test()
+{
+    WebInspector.showPanel("timeline");
+    InspectorTest.addSniffer(WebInspector.TimelineModel.prototype, "_loadNextChunk", loadNextChunk);
+    InspectorFrontendHost.save = save;
+    var data = ""
+
+    try {
+        WebInspector.panels.timeline._model._loadNextChunk(data, 0);
+    } catch (e) {
+        InspectorTest.addResult("failed");
+        InspectorTest.completeTest();
+    }
+
+    function loadNextChunk()
+    {
+        WebInspector.panels.timeline._model.saveToFile();
+    }
+
+    function save(name, saveData, saveAs)
+    {
+        saveData = JSON.parse(saveData);
+        saveData.shift(); // strip version info
+        if (JSON.stringify(data) == JSON.stringify(saveData))
+            InspectorTest.addResult("passed");
+        else
+            InspectorTest.addResult("saved data is not equal to restored");
+        InspectorTest.completeTest();
+    }
+}
+
+</script>
+</head>
+
+<body _onload_="runTest()">
+<p>Tests the Timeline save/load of unknown (incompatible) record types.</p>
+<a href="" 91714</a>
+
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (123197 => 123198)


--- trunk/Source/WebCore/ChangeLog	2012-07-20 09:30:07 UTC (rev 123197)
+++ trunk/Source/WebCore/ChangeLog	2012-07-20 09:41:35 UTC (rev 123198)
@@ -1,3 +1,21 @@
+2012-07-20  Eugene Klyuchnikov  <eustas....@gmail.com>
+
+        Web Inspector: Timeline: forward compatibility for load.
+        https://bugs.webkit.org/show_bug.cgi?id=91714
+
+        Reviewed by Pavel Feldman.
+
+        Accept records of unrecognized types and render them as "unknown".
+
+        Test: inspector/timeline/timeline-load-incompatible.html
+
+        * English.lproj/localizedStrings.js: Added UI string.
+        * inspector/front-end/TimelinePresentationModel.js:
+        (WebInspector.TimelinePresentationModel.recordStyle): Add missing record
+        styles at runtime.
+        (WebInspector.TimelinePresentationModel.Record.prototype._getRecordDetails):
+        Add some common information for default case.
+
 2012-07-20  MORITA Hajime  <morr...@google.com>
 
         Another unreviewed Mac build fix against r123184.

Modified: trunk/Source/WebCore/English.lproj/localizedStrings.js (123197 => 123198)


--- trunk/Source/WebCore/English.lproj/localizedStrings.js	2012-07-20 09:30:07 UTC (rev 123197)
+++ trunk/Source/WebCore/English.lproj/localizedStrings.js	2012-07-20 09:41:35 UTC (rev 123198)
@@ -215,6 +215,8 @@
 localizedStrings["Font scale factor:"] = "Font scale factor:";
 localizedStrings["Fonts"] = "Fonts";
 localizedStrings["Form Data"] = "Form Data";
+localizedStrings["Program"] = "Program";
+localizedStrings["Unknown: "] = "Unknown: %s";
 localizedStrings["Function Call"] = "Function Call";
 localizedStrings["Function"] = "Function";
 localizedStrings["GC Event"] = "GC Event";

Modified: trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js (123197 => 123198)


--- trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js	2012-07-20 09:30:07 UTC (rev 123197)
+++ trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js	2012-07-20 09:41:35 UTC (rev 123198)
@@ -57,12 +57,12 @@
 };
 
 /**
- * @param {Object} record
+ * @return {!Object.<string, {title: string, category}>}
  */
-WebInspector.TimelinePresentationModel.recordStyle = function(record)
+WebInspector.TimelinePresentationModel.initRecordStyles_ = function()
 {
     if (WebInspector.TimelinePresentationModel._recordStylesMap)
-        return WebInspector.TimelinePresentationModel._recordStylesMap[record.type];
+        return WebInspector.TimelinePresentationModel._recordStylesMap;
 
     var recordTypes = WebInspector.TimelineModel.RecordType;
     var categories = WebInspector.TimelinePresentationModel.categories();
@@ -100,9 +100,26 @@
     recordStyles[recordTypes.FireAnimationFrame] = { title: WebInspector.UIString("Animation Frame Fired"), category: categories["scripting"] };
 
     WebInspector.TimelinePresentationModel._recordStylesMap = recordStyles;
-    return recordStyles[record.type];
+    return recordStyles;
 }
 
+/**
+ * @param {Object} record
+ */
+WebInspector.TimelinePresentationModel.recordStyle = function(record)
+{
+    var recordStyles = WebInspector.TimelinePresentationModel.initRecordStyles_();
+    var result = recordStyles[record.type];
+    if (!result) {
+        result = {
+            title: WebInspector.UIString("Unknown: %s", record.type),
+            category: WebInspector.TimelinePresentationModel.categories()["program"]
+        };
+        recordStyles[record.type] = result;
+    }
+    return result;
+}
+
 WebInspector.TimelinePresentationModel.categoryForRecord = function(record)
 {
     return WebInspector.TimelinePresentationModel.recordStyle(record).category;
@@ -754,7 +771,7 @@
             case WebInspector.TimelineModel.RecordType.TimeStamp:
                 return this.data["message"];
             default:
-                return null;
+                return this._linkifyScriptLocation() || this._linkifyTopCallFrame() || null;
         }
     },
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to