Web Inspector: Timelines - Export fails for MediaTimelineRecords with originator...
authorpecoraro@apple.com <pecoraro@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Mar 2019 21:22:08 +0000 (21:22 +0000)
committerpecoraro@apple.com <pecoraro@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Mar 2019 21:22:08 +0000 (21:22 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196027

Reviewed by Timothy Hatcher.

* UserInterface/Models/MediaTimelineRecord.js:
(WI.MediaTimelineRecord.prototype.toJSON):
Remove the originator since that is a WI.DOMNode and cannot
be JSON serialized.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243238 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Models/MediaTimelineRecord.js

index e4cfd1e..9ecbe62 100644 (file)
@@ -1,3 +1,15 @@
+2019-03-20  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Timelines - Export fails for MediaTimelineRecords with originator DOM Node - Cannot serialize cyclic structure
+        https://bugs.webkit.org/show_bug.cgi?id=196027
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Models/MediaTimelineRecord.js:
+        (WI.MediaTimelineRecord.prototype.toJSON):
+        Remove the originator since that is a WI.DOMNode and cannot
+        be JSON serialized.
+
 2019-03-20  Devin Rousso  <drousso@apple.com>
 
         Web Inspector: Debugger: move breakpoint storage to use `WI.ObjectStore`
index c1b9953..ed37070 100644 (file)
@@ -49,11 +49,18 @@ WI.MediaTimelineRecord = class MediaTimelineRecord extends WI.TimelineRecord
     {
         // FIXME: DOMNode
 
+        // Don't include the DOMEvent's originator.
+        let domEvent = this._domEvent;
+        if (domEvent && domEvent.originator) {
+            domEvent = Object.shallowCopy(domEvent);
+            domEvent.originator = undefined;
+        }
+
         return {
             type: this.type,
             eventType: this._eventType,
             timestamp: this.startTime,
-            domEvent: this._domEvent,
+            domEvent,
             isLowPower: this._isLowPower,
         };
     }