Title: [242511] trunk/Source/WebInspectorUI
Revision
242511
Author
drou...@apple.com
Date
2019-03-05 14:05:15 -0800 (Tue, 05 Mar 2019)

Log Message

Web Inspector: Canvas: remove event listeners once a recording is ready
https://bugs.webkit.org/show_bug.cgi?id=195324

Reviewed by Matt Baker.

* UserInterface/Models/Recording.js:
(WI.Recording):
(WI.Recording.prototype.async swizzle):
(WI.Recording.prototype.async _process):

* UserInterface/Views/RecordingActionTreeElement.js:
(WI.RecordingActionTreeElement):
(WI.RecordingActionTreeElement.prototype._handleValidityChanged):

* UserInterface/Views/CanvasSidebarPanel.js:
(WI.CanvasSidebarPanel.prototype.set recording):
(WI.CanvasSidebarPanel.prototype._handleRecordingProcessedAction):

* UserInterface/Views/RecordingContentView.js:
(WI.RecordingContentView.prototype.initialLayout):
(WI.RecordingContentView.prototype._handleRecordingProcessedAction):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (242510 => 242511)


--- trunk/Source/WebInspectorUI/ChangeLog	2019-03-05 22:00:57 UTC (rev 242510)
+++ trunk/Source/WebInspectorUI/ChangeLog	2019-03-05 22:05:15 UTC (rev 242511)
@@ -1,3 +1,27 @@
+2019-03-05  Devin Rousso  <drou...@apple.com>
+
+        Web Inspector: Canvas: remove event listeners once a recording is ready
+        https://bugs.webkit.org/show_bug.cgi?id=195324
+
+        Reviewed by Matt Baker.
+
+        * UserInterface/Models/Recording.js:
+        (WI.Recording):
+        (WI.Recording.prototype.async swizzle):
+        (WI.Recording.prototype.async _process):
+
+        * UserInterface/Views/RecordingActionTreeElement.js:
+        (WI.RecordingActionTreeElement):
+        (WI.RecordingActionTreeElement.prototype._handleValidityChanged):
+
+        * UserInterface/Views/CanvasSidebarPanel.js:
+        (WI.CanvasSidebarPanel.prototype.set recording):
+        (WI.CanvasSidebarPanel.prototype._handleRecordingProcessedAction):
+
+        * UserInterface/Views/RecordingContentView.js:
+        (WI.RecordingContentView.prototype.initialLayout):
+        (WI.RecordingContentView.prototype._handleRecordingProcessedAction):
+
 2019-03-05  Joseph Pecoraro  <pecor...@apple.com>
 
         Web Inspector: Attempting to select records in the bottom 16px of the timeline overview graph fails

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Recording.js (242510 => 242511)


--- trunk/Source/WebInspectorUI/UserInterface/Models/Recording.js	2019-03-05 22:00:57 UTC (rev 242510)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Recording.js	2019-03-05 22:05:15 UTC (rev 242511)
@@ -36,7 +36,7 @@
         this._data = data;
         this._displayName = WI.UIString("Recording");
 
-        this._swizzle = [];
+        this._swizzle = null;
         this._actions = [new WI.RecordingInitialStateAction].concat(...this._frames.map((frame) => frame.actions));
         this._visualActionIndexes = [];
         this._source = null;
@@ -295,6 +295,9 @@
 
     async swizzle(index, type)
     {
+        if (!this._swizzle)
+            this._swizzle = {};
+
         if (typeof this._swizzle[index] !== "object")
             this._swizzle[index] = {};
 
@@ -530,6 +533,7 @@
                 return;
         }
 
+        this._swizzle = null;
         this._processContext = null;
         this._processing = false;
     }

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CanvasSidebarPanel.js (242510 => 242511)


--- trunk/Source/WebInspectorUI/UserInterface/Views/CanvasSidebarPanel.js	2019-03-05 22:00:57 UTC (rev 242510)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CanvasSidebarPanel.js	2019-03-05 22:05:15 UTC (rev 242511)
@@ -114,10 +114,8 @@
         if (recording === this._recording)
             return;
 
-        if (this._recording) {
-            this._recording.removeEventListener(WI.Recording.Event.ProcessedAction, this._handleRecordingProcessedAction, this);
-            this._recording.removeEventListener(WI.Recording.Event.StartProcessingFrame, this._handleRecordingStartProcessingFrame, this);
-        }
+        if (this._recording)
+            this._recording.removeEventListener(null, null, this);
 
         if (recording)
             this.canvas = recording.source;
@@ -124,7 +122,7 @@
 
         this._recording = recording;
 
-        if (this._recording) {
+        if (this._recording && !this._recording.ready) {
             this._recording.addEventListener(WI.Recording.Event.ProcessedAction, this._handleRecordingProcessedAction, this);
             this._recording.addEventListener(WI.Recording.Event.StartProcessingFrame, this._handleRecordingStartProcessingFrame, this);
         }
@@ -579,12 +577,16 @@
         console.assert(isInitialStateAction || this._recordingTreeOutline.children.lastValue instanceof WI.FolderTreeElement, "There should be a WI.FolderTreeElement for the frame for this action.");
         this._createRecordingActionTreeElement(action, index, isInitialStateAction ? this._recordingTreeOutline : this._recordingTreeOutline.children.lastValue);
 
-        if (this._recording.ready && !this._recording[WI.CanvasSidebarPanel.SelectedActionSymbol])
-            this.action = ""
+        if (this._recording.ready) {
+            this._recording.removeEventListener(null, null, this);
 
-        if (action ="" this._recording.actions.lastValue && this._recordingProcessingOptionsContainer) {
-            this._recordingProcessingOptionsContainer.remove();
-            this._recordingProcessingOptionsContainer = null;
+            if (!this._recording[WI.CanvasSidebarPanel.SelectedActionSymbol])
+                this.action = ""
+
+            if (this._recordingProcessingOptionsContainer) {
+                this._recordingProcessingOptionsContainer.remove();
+                this._recordingProcessingOptionsContainer = null;
+            }
         }
     }
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/RecordingActionTreeElement.js (242510 => 242511)


--- trunk/Source/WebInspectorUI/UserInterface/Views/RecordingActionTreeElement.js	2019-03-05 22:00:57 UTC (rev 242510)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/RecordingActionTreeElement.js	2019-03-05 22:05:15 UTC (rev 242511)
@@ -38,7 +38,8 @@
         this._index = index;
         this._copyText = copyText;
 
-        this.representedObject.addEventListener(WI.RecordingAction.Event.ValidityChanged, this._handleValidityChanged, this);
+        if (this.representedObject.valid)
+            this.representedObject.addEventListener(WI.RecordingAction.Event.ValidityChanged, this._handleValidityChanged, this);
     }
 
     // Static
@@ -453,6 +454,8 @@
     _handleValidityChanged(event)
     {
         this.addClassName("invalid");
+
+        this.representedObject.removeEventListener(null, null, this);
     }
 };
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/RecordingContentView.js (242510 => 242511)


--- trunk/Source/WebInspectorUI/UserInterface/Views/RecordingContentView.js	2019-03-05 22:00:57 UTC (rev 242510)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/RecordingContentView.js	2019-03-05 22:05:15 UTC (rev 242511)
@@ -167,7 +167,8 @@
         this._sliderElement.min = 0;
         this._sliderElement.max = 0;
 
-        this.representedObject.addEventListener(WI.Recording.Event.ProcessedAction, this._handleRecordingProcessedAction, this);
+        if (!this.representedObject.ready)
+            this.representedObject.addEventListener(WI.Recording.Event.ProcessedAction, this._handleRecordingProcessedAction, this);
     }
 
     // Private
@@ -486,6 +487,9 @@
     {
         this._sliderElement.max = this.representedObject.visualActionIndexes.length;
         this._updateSliderValue();
+
+        if (this.representedObject.ready)
+            this.representedObject.removeEventListener(null, null, this);
     }
 };
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to