Title: [242374] trunk/Source/WebInspectorUI
Revision
242374
Author
[email protected]
Date
2019-03-04 12:35:54 -0800 (Mon, 04 Mar 2019)

Log Message

Web Inspector: Canvas: protocol error on first open
https://bugs.webkit.org/show_bug.cgi?id=195059
<rdar://problem/48407871>

Reviewed by Joseph Pecoraro.

* UserInterface/Controllers/CanvasManager.js:
(WI.CanvasManager.prototype.initializeTarget):
(WI.CanvasManager.prototype.static supportsRecordingAutoCapture):
(WI.CanvasManager.prototype.setRecordingAutoCaptureFrameCount):
If targets aren't available, wait until they are and then set the auto-capture frame count.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (242373 => 242374)


--- trunk/Source/WebInspectorUI/ChangeLog	2019-03-04 20:33:57 UTC (rev 242373)
+++ trunk/Source/WebInspectorUI/ChangeLog	2019-03-04 20:35:54 UTC (rev 242374)
@@ -1,5 +1,19 @@
 2019-03-04  Devin Rousso  <[email protected]>
 
+        Web Inspector: Canvas: protocol error on first open
+        https://bugs.webkit.org/show_bug.cgi?id=195059
+        <rdar://problem/48407871>
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Controllers/CanvasManager.js:
+        (WI.CanvasManager.prototype.initializeTarget):
+        (WI.CanvasManager.prototype.static supportsRecordingAutoCapture):
+        (WI.CanvasManager.prototype.setRecordingAutoCaptureFrameCount):
+        If targets aren't available, wait until they are and then set the auto-capture frame count.
+
+2019-03-04  Devin Rousso  <[email protected]>
+
         Web Inspector: Toggling Timeline "Stop when page loads" to on should stop (immediately or soon) any active recording if already past the load event
         https://bugs.webkit.org/show_bug.cgi?id=195239
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/CanvasManager.js (242373 => 242374)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/CanvasManager.js	2019-03-04 20:33:57 UTC (rev 242373)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/CanvasManager.js	2019-03-04 20:35:54 UTC (rev 242374)
@@ -42,8 +42,12 @@
 
     initializeTarget(target)
     {
-        if (target.CanvasAgent)
+        if (target.CanvasAgent) {
             target.CanvasAgent.enable();
+
+            if (target.CanvasAgent.setRecordingAutoCaptureFrameCount && WI.settings.canvasRecordingAutoCaptureEnabled.value && WI.settings.canvasRecordingAutoCaptureFrameCount.value)
+                target.CanvasAgent.setRecordingAutoCaptureFrameCount(WI.settings.canvasRecordingAutoCaptureFrameCount.value);
+        }
     }
 
     // Static
@@ -50,7 +54,7 @@
 
     static supportsRecordingAutoCapture()
     {
-        return window.CanvasAgent && CanvasAgent.setRecordingAutoCaptureFrameCount;
+        return InspectorBackend.domains.CanvasAgent && InspectorBackend.domains.CanvasAgent.setRecordingAutoCaptureFrameCount;
     }
 
     // Public
@@ -97,14 +101,13 @@
     {
         console.assert(!isNaN(count) && count >= 0);
 
-        return CanvasAgent.setRecordingAutoCaptureFrameCount(enabled ? count : 0)
-        .then(() => {
-            WI.settings.canvasRecordingAutoCaptureEnabled.value = enabled && count;
-            WI.settings.canvasRecordingAutoCaptureFrameCount.value = count;
-        })
-        .catch((error) => {
-            console.error(error);
-        });
+        for (let target of WI.targets) {
+            if (target.CanvasAgent)
+                target.CanvasAgent.setRecordingAutoCaptureFrameCount(enabled ? count : 0);
+        }
+
+        WI.settings.canvasRecordingAutoCaptureEnabled.value = enabled && count;
+        WI.settings.canvasRecordingAutoCaptureFrameCount.value = count;
     }
 
     canvasAdded(canvasPayload)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to