Title: [238048] trunk/Source/WebInspectorUI
Revision
238048
Author
joep...@webkit.org
Date
2018-11-09 11:23:42 -0800 (Fri, 09 Nov 2018)

Log Message

Web Inspector: Start moving toward better multi-target support
https://bugs.webkit.org/show_bug.cgi?id=191345

Reviewed by Devin Rousso.

This change continues the move toward better multi-target support
by explicitly using explicit target agents in more places, and
converting generalized feature checks into target agnostic versions
that use the new InspectorBackend.domains, which does not vary based
on the connected targets / debuggable type.

I also audited uses of RuntimeAgent, ConsoleAgent, and DebuggerAgent
for better multi-target support since these agents should already
have complete multi-target support.

* UserInterface/Protocol/Target.js:
(WI.Target.prototype.initialize):
Move explicitly to target.Agent feature checks with a known target.

* UserInterface/Controllers/DebuggerManager.js:
(WI.DebuggerManager.prototype.initializeTarget):
(WI.DebuggerManager.prototype._pauseForInternalScriptsDidChange):
Move explicitly to target.DebuggerAgent for feature checks with a known target.

* UserInterface/Controllers/NetworkManager.js:
(WI.NetworkManager.prototype.initializeTarget):
Move explicitly to target.NetworkAgent for feature checks with a known target.

* UserInterface/Controllers/RuntimeManager.js:
(WI.RuntimeManager.prototype.initializeTarget):
(WI.RuntimeManager.prototype.saveResult):
* UserInterface/Protocol/RemoteObject.js:
(WI.RemoteObject.prototype.updatePreview):
(WI.RemoteObject.prototype.getDisplayablePropertyDescriptors):
(WI.RemoteObject.prototype.deprecatedGetDisplayableProperties):
* UserInterface/Views/SourceCodeTextEditor.js:
(WI.SourceCodeTextEditor.prototype._createTypeTokenAnnotator):
(WI.SourceCodeTextEditor.prototype._createBasicBlockAnnotator):
Move explicitly to target.RuntimeAgent for feature checks with a known target.

* UserInterface/Models/CSSCompletions.js:
(WI.CSSCompletions.initializeCSSCompletions):
Move explicitly to target.CSSAgent for feature checks with a known target.

* UserInterface/Views/ContextMenuUtilities.js:
Use the DebuggerAgent from the target associated with the DOMNode's
remote object instead of assuming the main target.

* UserInterface/Views/SettingsTabContentView.js:
(WI.SettingsTabContentView.prototype._createGeneralSettingsView):
Update the ConsoleAgent setting on all targets that support it.

* UserInterface/Views/BreakpointActionView.js:
(WI.BreakpointActionView):
All backends support BreakpointActionType, the assertion can go away.

* UserInterface/Views/LogContentView.js:
(WI.LogContentView.prototype.get navigationItems):
* UserInterface/Views/DOMTreeContentView.js:
(WI.DOMTreeContentView.prototype.get navigationItems):
Include additional `window.FooAgent` checks for these since they will need
to be revisited in the future.

* UserInterface/Protocol/InspectorBackend.js:
(InspectorBackendClass.prototype.get domains):
(InspectorBackendClass.prototype.activateDomain):
Expose InspectorBackend.domains.<Domain> for feature checking.

* UserInterface/Controllers/BreakpointPopoverController.js:
(WI.BreakpointPopoverController.prototype._createPopoverContent):
* UserInterface/Controllers/CSSManager.js:
(WI.CSSManager):
(WI.CSSManager.prototype._mainResourceDidChange):
* UserInterface/Controllers/TimelineManager.js:
(WI.TimelineManager.prototype._attemptAutoCapturingForFrame):
(WI.TimelineManager.prototype._updateAutoCaptureInstruments):
(WI.TimelineManager):
* UserInterface/Models/Canvas.js:
(WI.Canvas.prototype.startRecording):
(WI.Canvas.prototype.recordingFinished):
* UserInterface/Models/ScriptSyntaxTree.js:
(WI.ScriptSyntaxTree.functionReturnDivot):
* UserInterface/Protocol/DebuggerObserver.js:
(WI.DebuggerObserver):
* UserInterface/Protocol/NetworkObserver.js:
(WI.NetworkObserver.prototype.requestWillBeSent):
* UserInterface/Views/DebuggerSidebarPanel.js:
(WI.DebuggerSidebarPanel):
(WI.DebuggerSidebarPanel.prototype._handleCreateBreakpointClicked):
* UserInterface/Views/NetworkTimelineView.js:
(WI.NetworkTimelineView):
* UserInterface/Views/ResourceDetailsSidebarPanel.js:
(WI.ResourceDetailsSidebarPanel.prototype._refreshRequestAndResponse):
* UserInterface/Views/WebSocketContentView.js:
(WI.WebSocketContentView):
(WI.NetworkManager.prototype.webSocketWillSendHandshakeRequest):
(WI.DebuggerManager.prototype.debuggerDidResume):
Feature check in a target agnostic way.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (238047 => 238048)


--- trunk/Source/WebInspectorUI/ChangeLog	2018-11-09 19:10:27 UTC (rev 238047)
+++ trunk/Source/WebInspectorUI/ChangeLog	2018-11-09 19:23:42 UTC (rev 238048)
@@ -1,3 +1,104 @@
+2018-11-08  Joseph Pecoraro  <pecor...@apple.com>
+
+        Web Inspector: Start moving toward better multi-target support
+        https://bugs.webkit.org/show_bug.cgi?id=191345
+
+        Reviewed by Devin Rousso.
+
+        This change continues the move toward better multi-target support
+        by explicitly using explicit target agents in more places, and
+        converting generalized feature checks into target agnostic versions
+        that use the new InspectorBackend.domains, which does not vary based
+        on the connected targets / debuggable type.
+
+        I also audited uses of RuntimeAgent, ConsoleAgent, and DebuggerAgent
+        for better multi-target support since these agents should already
+        have complete multi-target support.
+
+        * UserInterface/Protocol/Target.js:
+        (WI.Target.prototype.initialize):
+        Move explicitly to target.Agent feature checks with a known target.
+
+        * UserInterface/Controllers/DebuggerManager.js:
+        (WI.DebuggerManager.prototype.initializeTarget):
+        (WI.DebuggerManager.prototype._pauseForInternalScriptsDidChange):
+        Move explicitly to target.DebuggerAgent for feature checks with a known target.
+
+        * UserInterface/Controllers/NetworkManager.js:
+        (WI.NetworkManager.prototype.initializeTarget):
+        Move explicitly to target.NetworkAgent for feature checks with a known target.
+
+        * UserInterface/Controllers/RuntimeManager.js:
+        (WI.RuntimeManager.prototype.initializeTarget):
+        (WI.RuntimeManager.prototype.saveResult):
+        * UserInterface/Protocol/RemoteObject.js:
+        (WI.RemoteObject.prototype.updatePreview):
+        (WI.RemoteObject.prototype.getDisplayablePropertyDescriptors):
+        (WI.RemoteObject.prototype.deprecatedGetDisplayableProperties):
+        * UserInterface/Views/SourceCodeTextEditor.js:
+        (WI.SourceCodeTextEditor.prototype._createTypeTokenAnnotator):
+        (WI.SourceCodeTextEditor.prototype._createBasicBlockAnnotator):
+        Move explicitly to target.RuntimeAgent for feature checks with a known target.
+
+        * UserInterface/Models/CSSCompletions.js:
+        (WI.CSSCompletions.initializeCSSCompletions):
+        Move explicitly to target.CSSAgent for feature checks with a known target.
+
+        * UserInterface/Views/ContextMenuUtilities.js:
+        Use the DebuggerAgent from the target associated with the DOMNode's
+        remote object instead of assuming the main target.
+
+        * UserInterface/Views/SettingsTabContentView.js:
+        (WI.SettingsTabContentView.prototype._createGeneralSettingsView):
+        Update the ConsoleAgent setting on all targets that support it.
+
+        * UserInterface/Views/BreakpointActionView.js:
+        (WI.BreakpointActionView):
+        All backends support BreakpointActionType, the assertion can go away.
+
+        * UserInterface/Views/LogContentView.js:
+        (WI.LogContentView.prototype.get navigationItems):
+        * UserInterface/Views/DOMTreeContentView.js:
+        (WI.DOMTreeContentView.prototype.get navigationItems):
+        Include additional `window.FooAgent` checks for these since they will need
+        to be revisited in the future.
+
+        * UserInterface/Protocol/InspectorBackend.js:
+        (InspectorBackendClass.prototype.get domains):
+        (InspectorBackendClass.prototype.activateDomain):
+        Expose InspectorBackend.domains.<Domain> for feature checking.
+
+        * UserInterface/Controllers/BreakpointPopoverController.js:
+        (WI.BreakpointPopoverController.prototype._createPopoverContent):
+        * UserInterface/Controllers/CSSManager.js:
+        (WI.CSSManager):
+        (WI.CSSManager.prototype._mainResourceDidChange):
+        * UserInterface/Controllers/TimelineManager.js:
+        (WI.TimelineManager.prototype._attemptAutoCapturingForFrame):
+        (WI.TimelineManager.prototype._updateAutoCaptureInstruments):
+        (WI.TimelineManager):
+        * UserInterface/Models/Canvas.js:
+        (WI.Canvas.prototype.startRecording):
+        (WI.Canvas.prototype.recordingFinished):
+        * UserInterface/Models/ScriptSyntaxTree.js:
+        (WI.ScriptSyntaxTree.functionReturnDivot):
+        * UserInterface/Protocol/DebuggerObserver.js:
+        (WI.DebuggerObserver):
+        * UserInterface/Protocol/NetworkObserver.js:
+        (WI.NetworkObserver.prototype.requestWillBeSent):
+        * UserInterface/Views/DebuggerSidebarPanel.js:
+        (WI.DebuggerSidebarPanel):
+        (WI.DebuggerSidebarPanel.prototype._handleCreateBreakpointClicked):
+        * UserInterface/Views/NetworkTimelineView.js:
+        (WI.NetworkTimelineView):
+        * UserInterface/Views/ResourceDetailsSidebarPanel.js:
+        (WI.ResourceDetailsSidebarPanel.prototype._refreshRequestAndResponse):
+        * UserInterface/Views/WebSocketContentView.js:
+        (WI.WebSocketContentView):
+        (WI.NetworkManager.prototype.webSocketWillSendHandshakeRequest):
+        (WI.DebuggerManager.prototype.debuggerDidResume):
+        Feature check in a target agnostic way.
+
 2018-11-08  Matt Baker  <mattba...@apple.com>
 
         Web Inspector: ResourceQueryController should early return when query is longer than search string

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/BreakpointPopoverController.js (238047 => 238048)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/BreakpointPopoverController.js	2018-11-09 19:10:27 UTC (rev 238047)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/BreakpointPopoverController.js	2018-11-09 19:23:42 UTC (rev 238048)
@@ -173,7 +173,7 @@
         // COMPATIBILITY (iOS 9): Legacy backends don't support breakpoint ignore count. Since support
         // can't be tested directly, check for CSS.getSupportedSystemFontFamilyNames.
         // FIXME: Use explicit version checking once https://webkit.org/b/148680 is fixed.
-        if (CSSAgent.getSupportedSystemFontFamilyNames) {
+        if (InspectorBackend.domains.CSS.getSupportedSystemFontFamilyNames) {
             let ignoreCountRow = table.appendChild(document.createElement("tr"));
             let ignoreCountHeader = ignoreCountRow.appendChild(document.createElement("th"));
             let ignoreCountLabel = ignoreCountHeader.appendChild(document.createElement("label"));

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/CSSManager.js (238047 => 238048)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/CSSManager.js	2018-11-09 19:10:27 UTC (rev 238047)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/CSSManager.js	2018-11-09 19:23:42 UTC (rev 238048)
@@ -48,7 +48,7 @@
 
         // COMPATIBILITY (iOS 9): Legacy backends did not send stylesheet
         // added/removed events and must be fetched manually.
-        this._fetchedInitialStyleSheets = window.CSSAgent && window.CSSAgent.hasEvent("styleSheetAdded");
+        this._fetchedInitialStyleSheets = InspectorBackend.domains.CSS.hasEvent("styleSheetAdded");
     }
 
     // Target
@@ -363,7 +363,7 @@
 
         // Clear our maps when the main frame navigates.
 
-        this._fetchedInitialStyleSheets = window.CSSAgent && window.CSSAgent.hasEvent("styleSheetAdded");
+        this._fetchedInitialStyleSheets = InspectorBackend.domains.CSS.hasEvent("styleSheetAdded");
         this._styleSheetIdentifierMap.clear();
         this._styleSheetFrameURLMap.clear();
         this._nodeStylesMap = {};

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js (238047 => 238048)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js	2018-11-09 19:10:27 UTC (rev 238047)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js	2018-11-09 19:23:42 UTC (rev 238048)
@@ -118,15 +118,15 @@
         target.DebuggerAgent.setPauseOnExceptions(this._breakOnExceptionsState);
 
         // COMPATIBILITY (iOS 10): DebuggerAgent.setPauseOnAssertions did not exist yet.
-        if (DebuggerAgent.setPauseOnAssertions)
+        if (target.DebuggerAgent.setPauseOnAssertions)
             target.DebuggerAgent.setPauseOnAssertions(this._assertionFailuresBreakpointEnabledSetting.value);
 
         // COMPATIBILITY (iOS 10): Debugger.setAsyncStackTraceDepth did not exist yet.
-        if (DebuggerAgent.setAsyncStackTraceDepth)
+        if (target.DebuggerAgent.setAsyncStackTraceDepth)
             target.DebuggerAgent.setAsyncStackTraceDepth(this._asyncStackTraceDepthSetting.value);
 
         // COMPATIBILITY (iOS 12): DebuggerAgent.setPauseForInternalScripts did not exist yet.
-        if (DebuggerAgent.setPauseForInternalScripts)
+        if (target.DebuggerAgent.setPauseForInternalScripts)
             target.DebuggerAgent.setPauseForInternalScripts(WI.settings.pauseForInternalScripts.value);
 
         if (this.paused)
@@ -689,7 +689,7 @@
         // 50ms, and treat it as a real resume if we haven't paused in that time frame.
         // This delay ensures the user interface does not flash between brief steps
         // or successive breakpoints.
-        if (!DebuggerAgent.setPauseOnAssertions) {
+        if (!target.DebuggerAgent.setPauseOnAssertions) {
             this._delayedResumeTimeout = setTimeout(this._didResumeInternal.bind(this, target), 50);
             return;
         }
@@ -1156,11 +1156,10 @@
 
     _pauseForInternalScriptsDidChange(event)
     {
-        // COMPATIBILITY (iOS 12): DebuggerAgent.setPauseForInternalScripts did not exist yet.
-        console.assert(DebuggerAgent.setPauseForInternalScripts);
-
-        for (let target of WI.targets)
-            target.DebuggerAgent.setPauseForInternalScripts(WI.settings.pauseForInternalScripts.value);
+        for (let target of WI.targets) {
+            if (target.DebuggerAgent.setPauseForInternalScripts)
+                target.DebuggerAgent.setPauseForInternalScripts(WI.settings.pauseForInternalScripts.value);
+        }
     }
 
     _mainResourceDidChange(event)

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js (238047 => 238048)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js	2018-11-09 19:10:27 UTC (rev 238047)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js	2018-11-09 19:23:42 UTC (rev 238048)
@@ -62,10 +62,8 @@
             target.NetworkAgent.enable();
 
             // COMPATIBILITY (iOS 10.3): Network.setDisableResourceCaching did not exist.
-            if (NetworkAgent.setResourceCachingDisabled) {
-                if (WI.settings.resourceCachingDisabled && WI.settings.resourceCachingDisabled.value)
-                    target.NetworkAgent.setResourceCachingDisabled(true);
-            }
+            if (target.NetworkAgent.setResourceCachingDisabled)
+                target.NetworkAgent.setResourceCachingDisabled(WI.settings.resourceCachingDisabled.value);
         }
 
         if (target.type === WI.Target.Type.Worker)
@@ -296,7 +294,7 @@
             return;
 
         // COMPATIBILITY(iOS 10.3): `walltime` did not exist in 10.3 and earlier.
-        if (!NetworkAgent.hasEventParameter("webSocketWillSendHandshakeRequest", "walltime")) {
+        if (!InspectorBackend.domains.Network.hasEventParameter("webSocketWillSendHandshakeRequest", "walltime")) {
             request = arguments[2];
             walltime = NaN;
         }

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/RuntimeManager.js (238047 => 238048)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/RuntimeManager.js	2018-11-09 19:10:27 UTC (rev 238047)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/RuntimeManager.js	2018-11-09 19:23:42 UTC (rev 238048)
@@ -41,11 +41,11 @@
         target.RuntimeAgent.enable();
 
         // COMPATIBILITY (iOS 8): Runtime.enableTypeProfiler did not exist.
-        if (WI.settings.showJavaScriptTypeInformation && WI.settings.showJavaScriptTypeInformation.value && RuntimeAgent.enableTypeProfiler)
+        if (target.RuntimeAgent.enableTypeProfiler && WI.settings.showJavaScriptTypeInformation.value)
             target.RuntimeAgent.enableTypeProfiler();
 
         // COMPATIBILITY (iOS 10): Runtime.enableControlFlowProfiler did not exist
-        if (WI.settings.enableControlFlowProfiler && WI.settings.enableControlFlowProfiler.value && RuntimeAgent.enableControlFlowProfiler)
+        if (target.RuntimeAgent.enableControlFlowProfiler && WI.settings.enableControlFlowProfiler.value)
             target.RuntimeAgent.enableControlFlowProfiler();
     }
 
@@ -131,8 +131,11 @@
     {
         console.assert(remoteObject instanceof WI.RemoteObject);
 
+        let target = this._activeExecutionContext.target;
+        let executionContextId = this._activeExecutionContext.id;
+
         // COMPATIBILITY (iOS 8): Runtime.saveResult did not exist.
-        if (!RuntimeAgent.saveResult) {
+        if (!target.RuntimeAgent.saveResult) {
             callback(undefined);
             return;
         }
@@ -142,9 +145,6 @@
             callback(savedResultIndex);
         }
 
-        let target = this._activeExecutionContext.target;
-        let executionContextId = this._activeExecutionContext.id;
-
         if (remoteObject.objectId)
             target.RuntimeAgent.saveResult(remoteObject.asCallArgument(), mycallback);
         else

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js (238047 => 238048)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js	2018-11-09 19:10:27 UTC (rev 238047)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js	2018-11-09 19:23:42 UTC (rev 238048)
@@ -723,6 +723,8 @@
 
         // COMPATIBILITY (iOS 9): Timeline.setAutoCaptureEnabled did not exist.
         // Perform auto capture in the frontend.
+        if (!window.TimelineAgent)
+            return false;
         if (!TimelineAgent.setAutoCaptureEnabled)
             return this._legacyAttemptStartAutoCapturingForFrame(frame);
 
@@ -1062,34 +1064,35 @@
 
     _updateAutoCaptureInstruments(targets)
     {
-        if (!TimelineAgent.setInstruments)
-            return;
-
-        let instrumentSet = new Set;
         let enabledTimelineTypes = this._enabledTimelineTypesSetting.value;
 
-        for (let timelineType of enabledTimelineTypes) {
-            switch (timelineType) {
-            case WI.TimelineRecord.Type.Script:
-                instrumentSet.add(TimelineAgent.Instrument.ScriptProfiler);
-                break;
-            case WI.TimelineRecord.Type.HeapAllocations:
-                instrumentSet.add(TimelineAgent.Instrument.Heap);
-                break;
-            case WI.TimelineRecord.Type.Network:
-            case WI.TimelineRecord.Type.RenderingFrame:
-            case WI.TimelineRecord.Type.Layout:
-                instrumentSet.add(TimelineAgent.Instrument.Timeline);
-                break;
-            case WI.TimelineRecord.Type.Memory:
-                instrumentSet.add(TimelineAgent.Instrument.Memory);
-                break;
+        for (let target of targets) {
+            if (!target.TimelineAgent)
+                continue;
+            if (!target.TimelineAgent.setInstruments)
+                continue;
+
+            let instrumentSet = new Set;
+            for (let timelineType of enabledTimelineTypes) {
+                switch (timelineType) {
+                case WI.TimelineRecord.Type.Script:
+                    instrumentSet.add(target.TimelineAgent.Instrument.ScriptProfiler);
+                    break;
+                case WI.TimelineRecord.Type.HeapAllocations:
+                    instrumentSet.add(target.TimelineAgent.Instrument.Heap);
+                    break;
+                case WI.TimelineRecord.Type.Network:
+                case WI.TimelineRecord.Type.RenderingFrame:
+                case WI.TimelineRecord.Type.Layout:
+                    instrumentSet.add(target.TimelineAgent.Instrument.Timeline);
+                    break;
+                case WI.TimelineRecord.Type.Memory:
+                    instrumentSet.add(target.TimelineAgent.Instrument.Memory);
+                    break;
+                }
             }
-        }
 
-        for (let target of targets) {
-            if (target.TimelineAgent)
-                target.TimelineAgent.setInstruments([...instrumentSet]);
+            target.TimelineAgent.setInstruments(Array.from(instrumentSet));
         }
     }
 };

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/CSSCompletions.js (238047 => 238048)


--- trunk/Source/WebInspectorUI/UserInterface/Models/CSSCompletions.js	2018-11-09 19:10:27 UTC (rev 238047)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/CSSCompletions.js	2018-11-09 19:23:42 UTC (rev 238048)
@@ -167,7 +167,7 @@
         target.CSSAgent.getSupportedCSSProperties(propertyNamesCallback);
 
         // COMPATIBILITY (iOS 9): CSS.getSupportedSystemFontFamilyNames did not exist.
-        if (CSSAgent.getSupportedSystemFontFamilyNames)
+        if (target.CSSAgent.getSupportedSystemFontFamilyNames)
             target.CSSAgent.getSupportedSystemFontFamilyNames(fontFamilyNamesCallback);
     }
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Canvas.js (238047 => 238048)


--- trunk/Source/WebInspectorUI/UserInterface/Models/Canvas.js	2018-11-09 19:10:27 UTC (rev 238047)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Canvas.js	2018-11-09 19:23:42 UTC (rev 238048)
@@ -279,7 +279,7 @@
             this._recordingState = WI.Canvas.RecordingState.ActiveFrontend;
 
             // COMPATIBILITY (iOS 12.1): Canvas.event.recordingStarted did not exist yet
-            if (CanvasAgent.hasEvent("recordingStarted"))
+            if (InspectorBackend.domains.Canvas.hasEvent("recordingStarted"))
                 return;
 
             this._recordingFrames = [];
@@ -289,7 +289,7 @@
         };
 
         // COMPATIBILITY (iOS 12.1): `frameCount` did not exist yet.
-        if (CanvasAgent.startRecording.supports("singleFrame")) {
+        if (InspectorBackend.domains.Canvas.startRecording.supports("singleFrame")) {
             CanvasAgent.startRecording(this._identifier, singleFrame, handleStartRecording);
             return;
         }
@@ -376,7 +376,7 @@
         let initiatedByUser = this._recordingState === WI.Canvas.RecordingState.ActiveFrontend;
 
         // COMPATIBILITY (iOS 12.1): Canvas.event.recordingStarted did not exist yet
-        if (!initiatedByUser && !CanvasAgent.hasEvent("recordingStarted"))
+        if (!initiatedByUser && !InspectorBackend.domains.Canvas.hasEvent("recordingStarted"))
             initiatedByUser = !!this.recordingActive;
 
         let recording = recordingPayload ? WI.Recording.fromPayload(recordingPayload, this._recordingFrames) : null;

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/ScriptSyntaxTree.js (238047 => 238048)


--- trunk/Source/WebInspectorUI/UserInterface/Models/ScriptSyntaxTree.js	2018-11-09 19:10:27 UTC (rev 238047)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/ScriptSyntaxTree.js	2018-11-09 19:23:42 UTC (rev 238048)
@@ -174,9 +174,8 @@
 
         // COMPATIBILITY (iOS 9): Legacy Backends view the return type as being the opening "{" of the function body.
         // After iOS 9, this is to move to the start of the function statement/_expression_. See below:
-        // FIXME: Need a better way to determine backend versions. Using DOM.pseudoElement because that was added after iOS 9.
-        // FIXME: This wouldn't work for debugging an iOS 9 or earlier JSContext target.
-        if (window.DOMAgent && !DOMAgent.hasEvent("pseudoElementAdded"))
+        // Using DOM.pseudoElement because that was added after iOS 9.
+        if (!InspectorBackend.domains.DOM.hasEvent("pseudoElementAdded"))
             return node.body.range[0];
 
         // "f" in "function". "s" in "set". "g" in "get". First letter in any method name for classes and object literals.
@@ -186,7 +185,7 @@
 
     updateTypes(nodesToUpdate, callback)
     {
-        console.assert(RuntimeAgent.getRuntimeTypesForVariablesAtOffsets);
+        console.assert(this._script.target.RuntimeAgent.getRuntimeTypesForVariablesAtOffsets);
         console.assert(Array.isArray(nodesToUpdate) && this._parsedSuccessfully);
 
         if (!this._parsedSuccessfully)

Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/DebuggerObserver.js (238047 => 238048)


--- trunk/Source/WebInspectorUI/UserInterface/Protocol/DebuggerObserver.js	2018-11-09 19:10:27 UTC (rev 238047)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/DebuggerObserver.js	2018-11-09 19:23:42 UTC (rev 238048)
@@ -27,7 +27,7 @@
 {
     constructor()
     {
-        this._legacyScriptParsed = DebuggerAgent.hasEventParameter("scriptParsed", "hasSourceURL");
+        this._legacyScriptParsed = InspectorBackend.domains.Debugger.hasEventParameter("scriptParsed", "hasSourceURL");
     }
 
     // Events defined by the "Debugger" domain.

Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js (238047 => 238048)


--- trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js	2018-11-09 19:10:27 UTC (rev 238047)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js	2018-11-09 19:23:42 UTC (rev 238048)
@@ -58,6 +58,13 @@
 
     // Public
 
+    // This should be used for feature checking if something exists in the protocol
+    // regardless of whether or not the domain is active for a specific target.
+    get domains()
+    {
+        return this._agents;
+    }
+
     // It's still possible to set this flag on InspectorBackend to just
     // dump protocol traffic as it happens. For more complex uses of
     // protocol data, install a subclass of WI.ProtocolTracer.
@@ -165,6 +172,10 @@
         for (let debuggableType of supportedDebuggableTypes)
             this._supportedDomainsForDebuggableType.get(debuggableType).push(domainName);
 
+        // FIXME: For proper multi-target support we should eliminate all uses of
+        // `window.FooAgent` and `unprefixed FooAgent` in favor of either:
+        //   - Per-target: `target.FooAgent`
+        //   - Global feature check: `InspectorBackend.domains.Foo`
         if (!activationDebuggableTypes || activationDebuggableTypes.includes(InspectorFrontendHost.debuggableType())) {
             let agent = this._agents[domainName];
             agent.activate();

Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/NetworkObserver.js (238047 => 238048)


--- trunk/Source/WebInspectorUI/UserInterface/Protocol/NetworkObserver.js	2018-11-09 19:10:27 UTC (rev 238047)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/NetworkObserver.js	2018-11-09 19:23:42 UTC (rev 238048)
@@ -30,7 +30,7 @@
     requestWillBeSent(requestId, frameId, loaderId, documentURL, request, timestamp, walltime, initiator, redirectResponse, type, targetId)
     {
         // COMPATIBILITY(iOS 11.0): `walltime` did not exist in 11.0 and earlier.
-        if (!NetworkAgent.hasEventParameter("requestWillBeSent", "walltime")) {
+        if (!InspectorBackend.domains.Network.hasEventParameter("requestWillBeSent", "walltime")) {
             walltime = undefined;
             initiator = arguments[6];
             redirectResponse = arguments[7];

Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js (238047 => 238048)


--- trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js	2018-11-09 19:10:27 UTC (rev 238047)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js	2018-11-09 19:23:42 UTC (rev 238048)
@@ -245,7 +245,7 @@
             return;
         }
 
-        if (!RuntimeAgent.getPreview) {
+        if (!this._target.RuntimeAgent.getPreview) {
             this._failedToLoadPreview = true;
             callback(null);
             return;
@@ -282,7 +282,7 @@
 
         // COMPATIBILITY (iOS 8): RuntimeAgent.getDisplayableProperties did not exist.
         // Here we do our best to reimplement it by getting all properties and reducing them down.
-        if (!RuntimeAgent.getDisplayableProperties) {
+        if (!this._target.RuntimeAgent.getDisplayableProperties) {
             this._target.RuntimeAgent.getProperties(this._objectId, function(error, allProperties) {
                 var ownOrGetterPropertiesList = [];
                 if (allProperties) {
@@ -329,7 +329,7 @@
 
         // COMPATIBILITY (iOS 8): RuntimeAgent.getProperties did not support ownerAndGetterProperties.
         // Here we do our best to reimplement it by getting all properties and reducing them down.
-        if (!RuntimeAgent.getDisplayableProperties) {
+        if (!this._target.RuntimeAgent.getDisplayableProperties) {
             this._target.RuntimeAgent.getProperties(this._objectId, function(error, allProperties) {
                 var ownOrGetterPropertiesList = [];
                 if (allProperties) {

Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/Target.js (238047 => 238048)


--- trunk/Source/WebInspectorUI/UserInterface/Protocol/Target.js	2018-11-09 19:10:27 UTC (rev 238047)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/Target.js	2018-11-09 19:23:42 UTC (rev 238048)
@@ -72,7 +72,7 @@
         // Non-manager specific initialization.
         // COMPATIBILITY (iOS 8): Page.setShowPaintRects did not exist.
         if (this.PageAgent) {
-            if (PageAgent.setShowPaintRects && WI.settings.showPaintRects.value)
+            if (this.PageAgent.setShowPaintRects && WI.settings.showPaintRects.value)
                 this.PageAgent.setShowPaintRects(true);
         }
 
@@ -92,7 +92,7 @@
             // This allows an automatically paused backend to resume execution, but we want to ensure
             // our breakpoints were already sent to that backend.
             // COMPATIBILITY (iOS 8): Inspector.initialized did not exist yet.
-            if (this.InspectorAgent && InspectorAgent.initialized)
+            if (this.InspectorAgent && this.InspectorAgent.initialized)
                 this.InspectorAgent.initialized();
         });
     }

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/BreakpointActionView.js (238047 => 238048)


--- trunk/Source/WebInspectorUI/UserInterface/Views/BreakpointActionView.js	2018-11-09 19:10:27 UTC (rev 238047)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/BreakpointActionView.js	2018-11-09 19:23:42 UTC (rev 238048)
@@ -31,7 +31,6 @@
 
         console.assert(action);
         console.assert(delegate);
-        console.assert(DebuggerAgent.BreakpointActionType);
 
         this._action = action;
         this._delegate = delegate;

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ContextMenuUtilities.js (238047 => 238048)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ContextMenuUtilities.js	2018-11-09 19:10:27 UTC (rev 238047)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ContextMenuUtilities.js	2018-11-09 19:23:42 UTC (rev 238048)
@@ -168,16 +168,14 @@
                 });
             }
 
-            function didGetProperty(error, result, wasThrown) {
-                if (error || result.type !== "function")
-                    return;
-
-                DebuggerAgent.getFunctionDetails(result.objectId, didGetFunctionDetails);
-                result.release();
-            }
-
             WI.RemoteObject.resolveNode(domNode).then((remoteObject) => {
-                remoteObject.getProperty("constructor", didGetProperty);
+                remoteObject.getProperty("constructor", (error, result, wasThrown) => {
+                    if (error)
+                        return;
+                    if (result.type === "function")
+                        remoteObject.target.DebuggerAgent.getFunctionDetails(result.objectId, didGetFunctionDetails);
+                    result.release();
+                });
                 remoteObject.release();
             });
         });

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js (238047 => 238048)


--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js	2018-11-09 19:10:27 UTC (rev 238047)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js	2018-11-09 19:23:42 UTC (rev 238048)
@@ -101,7 +101,7 @@
         let items = [this._showPrintStylesButtonNavigationItem, this._showsShadowDOMButtonNavigationItem];
 
         // COMPATIBILITY (iOS 11.3)
-        if (PageAgent.setShowRulers)
+        if (window.PageAgent && PageAgent.setShowRulers)
             items.unshift(this._showRulersButtonNavigationItem);
 
         if (!WI.settings.experimentalEnableLayersTab.value)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js (238047 => 238048)


--- trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js	2018-11-09 19:10:27 UTC (rev 238047)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js	2018-11-09 19:23:42 UTC (rev 238048)
@@ -212,7 +212,7 @@
         WI.debuggerManager.addBreakpoint(WI.debuggerManager.uncaughtExceptionsBreakpoint);
 
         // COMPATIBILITY (iOS 10): DebuggerAgent.setPauseOnAssertions did not exist yet.
-        if (DebuggerAgent.setPauseOnAssertions && WI.settings.showAssertionFailuresBreakpoint.value)
+        if (InspectorBackend.domains.Debugger.setPauseOnAssertions && WI.settings.showAssertionFailuresBreakpoint.value)
             WI.debuggerManager.addBreakpoint(WI.debuggerManager.assertionFailuresBreakpoint);
 
         if (WI.networkManager.mainFrame)
@@ -1377,7 +1377,7 @@
         let contextMenu = WI.ContextMenu.createFromEvent(event.data.nativeEvent);
 
         // COMPATIBILITY (iOS 10): DebuggerAgent.setPauseOnAssertions did not exist yet.
-        if (DebuggerAgent.setPauseOnAssertions) {
+        if (InspectorBackend.domains.Debugger.setPauseOnAssertions) {
             let assertionFailuresBreakpointShown = WI.settings.showAssertionFailuresBreakpoint.value;
 
             contextMenu.appendCheckboxItem(WI.UIString("Assertion Failures"), () => {

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js (238047 => 238048)


--- trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js	2018-11-09 19:10:27 UTC (rev 238047)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js	2018-11-09 19:23:42 UTC (rev 238048)
@@ -128,7 +128,7 @@
         if (this._hasNonDefaultLogChannelMessage && this._messageSourceBar)
             navigationItems.push(this._messageSourceBar, new WI.DividerNavigationItem);
 
-        if (HeapAgent.gc)
+        if (window.HeapAgent && HeapAgent.gc)
             navigationItems.push(this._garbageCollectNavigationItem);
 
         navigationItems.push(this._clearLogNavigationItem);

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineView.js (238047 => 238048)


--- trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineView.js	2018-11-09 19:10:27 UTC (rev 238047)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineView.js	2018-11-09 19:23:42 UTC (rev 238048)
@@ -114,7 +114,7 @@
         columns.graph.sortable = false;
 
         // COMPATIBILITY(iOS 10.3): Network load metrics were not previously available.
-        if (!NetworkAgent.hasEventParameter("loadingFinished", "metrics")) {
+        if (!InspectorBackend.domains.Network.hasEventParameter("loadingFinished", "metrics")) {
             delete columns.protocol;
             delete columns.priority;
             delete columns.remoteAddress;

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceDetailsSidebarPanel.js (238047 => 238048)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ResourceDetailsSidebarPanel.js	2018-11-09 19:10:27 UTC (rev 238047)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ResourceDetailsSidebarPanel.js	2018-11-09 19:23:42 UTC (rev 238048)
@@ -356,7 +356,7 @@
         this._requestMethodRow.value = this._resource.requestMethod || emDash;
 
         // COMPATIBILITY(iOS 10.3): Network load metrics were not previously available.
-        if (window.NetworkAgent && NetworkAgent.hasEventParameter("loadingFinished", "metrics")) {
+        if (InspectorBackend.domains.Network.hasEventParameter("loadingFinished", "metrics")) {
             let protocolDisplayName = WI.Resource.displayNameForProtocol(this._resource.protocol);
             this._protocolRow.value = protocolDisplayName || emDash;
             this._protocolRow.tooltip = protocolDisplayName ? this._resource.protocol : "";

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js (238047 => 238048)


--- trunk/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js	2018-11-09 19:10:27 UTC (rev 238047)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js	2018-11-09 19:23:42 UTC (rev 238048)
@@ -225,7 +225,10 @@
             for (let channel of channels) {
                 let logEditor = generalSettingsView.addGroupWithCustomSetting(editorLabels[channel.source], WI.SettingEditor.Type.Select, {values: logLevels});
                 logEditor.value = channel.level;
-                logEditor.addEventListener(WI.SettingEditor.Event.ValueDidChange, () => { ConsoleAgent.setLoggingChannelLevel(channel.source, logEditor.value); });
+                logEditor.addEventListener(WI.SettingEditor.Event.ValueDidChange, () => {
+                    for (let target of WI.targets)
+                        target.ConsoleAgent.setLoggingChannelLevel(channel.source, logEditor.value);
+                });
             }
         }
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js (238047 => 238048)


--- trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js	2018-11-09 19:10:27 UTC (rev 238047)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js	2018-11-09 19:23:42 UTC (rev 238048)
@@ -2154,7 +2154,7 @@
     _createTypeTokenAnnotator()
     {
         // COMPATIBILITY (iOS 8): Runtime.getRuntimeTypesForVariablesAtOffsets did not exist yet.
-        if (!RuntimeAgent.getRuntimeTypesForVariablesAtOffsets)
+        if (!this.target.RuntimeAgent.getRuntimeTypesForVariablesAtOffsets)
             return;
 
         var script = this._getAssociatedScript();
@@ -2167,7 +2167,7 @@
     _createBasicBlockAnnotator()
     {
         // COMPATIBILITY (iOS 8): Runtime.getBasicBlocks did not exist yet.
-        if (!RuntimeAgent.getBasicBlocks)
+        if (!this.target.RuntimeAgent.getBasicBlocks)
             return;
 
         var script = this._getAssociatedScript();

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/WebSocketContentView.js (238047 => 238048)


--- trunk/Source/WebInspectorUI/UserInterface/Views/WebSocketContentView.js	2018-11-09 19:10:27 UTC (rev 238047)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/WebSocketContentView.js	2018-11-09 19:23:42 UTC (rev 238048)
@@ -36,7 +36,7 @@
         this._lastRenderedReadyState = null;
 
         // COMPATIBILITY (iOS 10.3): `walltime` did not exist in 10.3 and earlier.
-        this._showTimeColumn = NetworkAgent.hasEventParameter("webSocketWillSendHandshakeRequest", "walltime");
+        this._showTimeColumn = InspectorBackend.domains.Network.hasEventParameter("webSocketWillSendHandshakeRequest", "walltime");
 
         this.element.classList.add("web-socket", "resource");
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to