Changeset 247356 in webkit


Ignore:
Timestamp:
Jul 11, 2019 11:36:57 AM (5 years ago)
Author:
Devin Rousso
Message:

Web Inspector: Layers: Uncaught Exception: Request with id = 2 failed. {"code":-32601,"message":"'Page' domain was not found","data":[{"code":-32601,"message":"'Page' domain was not found"}]}
https://bugs.webkit.org/show_bug.cgi?id=199555

Reviewed by Joseph Pecoraro.

Use modern inspected target support checking, and defer agent commands until a target is
available.

  • UserInterface/Views/Layers3DContentView.js:

(WI.Layers3DContentView):
(WI.Layers3DContentView.prototype._showPaintRectsSettingChanged):
(WI.Layers3DContentView.prototype._updateCompositingBordersButtonState):
(WI.Layers3DContentView.prototype._toggleCompositingBorders):

  • UserInterface/Views/DOMTreeContentView.js:

(WI.DOMTreeContentView):
(WI.DOMTreeContentView.prototype._toggleCompositingBorders):
(WI.DOMTreeContentView.prototype._updateCompositingBordersButtonToMatchPageSettings):
(WI.DOMTreeContentView.prototype._showPaintRectsSettingChanged):
(WI.DOMTreeContentView.prototype._showPrintStylesChanged):
(WI.DOMTreeContentView.prototype._showRulersChanged):
Drive-by: apply the same changes to the Elements tab for when the Layers tab isn't enabled.

Location:
trunk/Source/WebInspectorUI
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r247278 r247356  
     12019-07-11  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Layers: Uncaught Exception: Request with id = 2 failed. {"code":-32601,"message":"'Page' domain was not found","data":[{"code":-32601,"message":"'Page' domain was not found"}]}
     4        https://bugs.webkit.org/show_bug.cgi?id=199555
     5
     6        Reviewed by Joseph Pecoraro.
     7
     8        Use modern inspected target support checking, and defer agent commands until a target is
     9        available.
     10
     11        * UserInterface/Views/Layers3DContentView.js:
     12        (WI.Layers3DContentView):
     13        (WI.Layers3DContentView.prototype._showPaintRectsSettingChanged):
     14        (WI.Layers3DContentView.prototype._updateCompositingBordersButtonState):
     15        (WI.Layers3DContentView.prototype._toggleCompositingBorders):
     16
     17        * UserInterface/Views/DOMTreeContentView.js:
     18        (WI.DOMTreeContentView):
     19        (WI.DOMTreeContentView.prototype._toggleCompositingBorders):
     20        (WI.DOMTreeContentView.prototype._updateCompositingBordersButtonToMatchPageSettings):
     21        (WI.DOMTreeContentView.prototype._showPaintRectsSettingChanged):
     22        (WI.DOMTreeContentView.prototype._showPrintStylesChanged):
     23        (WI.DOMTreeContentView.prototype._showRulersChanged):
     24        Drive-by: apply the same changes to the Elements tab for when the Layers tab isn't enabled.
     25
    1262019-07-09  Devin Rousso  <drousso@apple.com>
    227
  • trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js

    r247248 r247356  
    3535            this._compositingBordersButtonNavigationItem = new WI.ActivateButtonNavigationItem("layer-borders", WI.UIString("Show compositing borders"), WI.UIString("Hide compositing borders"), "Images/LayerBorders.svg", 13, 13);
    3636            this._compositingBordersButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._toggleCompositingBorders, this);
    37             this._compositingBordersButtonNavigationItem.enabled = !!PageAgent.getCompositingBordersVisible;
     37            this._compositingBordersButtonNavigationItem.enabled = !!InspectorBackend.domains.Page.getCompositingBordersVisible;
    3838            this._compositingBordersButtonNavigationItem.visibilityPriority = WI.NavigationItem.VisibilityPriority.Low;
    3939        }
     
    4343            this._paintFlashingButtonNavigationItem = new WI.ActivateButtonNavigationItem("paint-flashing", WI.UIString("Enable paint flashing"), WI.UIString("Disable paint flashing"), "Images/Paint.svg", 16, 16);
    4444            this._paintFlashingButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._togglePaintFlashing, this);
    45             this._paintFlashingButtonNavigationItem.enabled = !!PageAgent.setShowPaintRects;
    46             this._paintFlashingButtonNavigationItem.activated = PageAgent.setShowPaintRects && WI.settings.showPaintRects.value;
     45            this._paintFlashingButtonNavigationItem.enabled = !!InspectorBackend.domains.Page.setShowPaintRects;
     46            this._paintFlashingButtonNavigationItem.activated = InspectorBackend.domains.Page.setShowPaintRects && WI.settings.showPaintRects.value;
    4747            this._paintFlashingButtonNavigationItem.visibilityPriority = WI.NavigationItem.VisibilityPriority.Low;
    4848        }
     
    591591    _toggleCompositingBorders(event)
    592592    {
    593         console.assert(PageAgent.setCompositingBordersVisible);
    594 
    595593        var activated = !this._compositingBordersButtonNavigationItem.activated;
    596594        this._compositingBordersButtonNavigationItem.activated = activated;
    597         PageAgent.setCompositingBordersVisible(activated);
     595
     596        for (let target of WI.targets) {
     597            if (target.PageAgent)
     598                target.PageAgent.setCompositingBordersVisible(activated);
     599        }
    598600    }
    599601
     
    605607    _updateCompositingBordersButtonToMatchPageSettings()
    606608    {
     609        if (!WI.targetsAvailable()) {
     610            WI.whenTargetsAvailable().then(() => {
     611                this._updateCompositingBordersButtonToMatchPageSettings();
     612            });
     613            return;
     614        }
     615
     616        if (!window.PageAgent)
     617            return;
     618
    607619        var button = this._compositingBordersButtonNavigationItem;
    608620
     
    617629    _showPaintRectsSettingChanged(event)
    618630    {
    619         console.assert(PageAgent.setShowPaintRects);
    620 
    621         this._paintFlashingButtonNavigationItem.activated = WI.settings.showPaintRects.value;
    622 
    623         PageAgent.setShowPaintRects(this._paintFlashingButtonNavigationItem.activated);
     631        let activated = WI.settings.showPaintRects.value;
     632        this._paintFlashingButtonNavigationItem.activated = activated;
     633
     634        for (let target of WI.targets) {
     635            if (target.PageAgent && target.PageAgent.setShowPaintRects)
     636                target.PageAgent.setShowPaintRects(activated);
     637        }
    624638    }
    625639
     
    639653
    640654        let mediaType = WI.printStylesEnabled ? "print" : "";
    641         PageAgent.setEmulatedMedia(mediaType);
     655        for (let target of WI.targets) {
     656            if (target.PageAgent)
     657                target.PageAgent.setEmulatedMedia(mediaType);
     658        }
    642659
    643660        WI.cssManager.mediaTypeChanged();
     
    717734    _showRulersChanged()
    718735    {
    719         console.assert(PageAgent.setShowRulers);
    720 
    721         this._showRulersButtonNavigationItem.activated = WI.settings.showRulers.value;
    722 
    723         PageAgent.setShowRulers(this._showRulersButtonNavigationItem.activated);
     736        let activated = WI.settings.showRulers.value;
     737        this._showRulersButtonNavigationItem.activated = activated;
     738
     739        for (let target of WI.targets) {
     740            if (target.PageAgent && target.PageAgent.setShowRulers)
     741                target.PageAgent.setShowRulers(activated);
     742        }
    724743    }
    725744
  • trunk/Source/WebInspectorUI/UserInterface/Views/Layers3DContentView.js

    r238743 r247356  
    3434        this._compositingBordersButtonNavigationItem = new WI.ActivateButtonNavigationItem("layer-borders", WI.UIString("Show compositing borders"), WI.UIString("Hide compositing borders"), "Images/LayerBorders.svg", 13, 13);
    3535        this._compositingBordersButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._toggleCompositingBorders, this);
     36        this._compositingBordersButtonNavigationItem.enabled = !!InspectorBackend.domains.Page;
    3637        this._compositingBordersButtonNavigationItem.visibilityPriority = WI.NavigationItem.VisibilityPriority.Low;
    3738
     
    3940        this._paintFlashingButtonNavigationItem = new WI.ActivateButtonNavigationItem("paint-flashing", WI.UIString("Enable paint flashing"), WI.UIString("Disable paint flashing"), "Images/Paint.svg", 16, 16);
    4041        this._paintFlashingButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._togglePaintFlashing, this);
    41         this._paintFlashingButtonNavigationItem.enabled = !!PageAgent.setShowPaintRects;
    42         this._paintFlashingButtonNavigationItem.activated = PageAgent.setShowPaintRects && WI.settings.showPaintRects.value;
     42        this._paintFlashingButtonNavigationItem.enabled = InspectorBackend.domains.Page && !!InspectorBackend.domains.Page.setShowPaintRects;
     43        this._paintFlashingButtonNavigationItem.activated = InspectorBackend.domains.Page.setShowPaintRects && WI.settings.showPaintRects.value;
    4344        this._paintFlashingButtonNavigationItem.visibilityPriority = WI.NavigationItem.VisibilityPriority.Low;
    4445
     
    393394    _showPaintRectsSettingChanged(event)
    394395    {
    395         console.assert(PageAgent.setShowPaintRects);
    396 
    397         this._paintFlashingButtonNavigationItem.activated = WI.settings.showPaintRects.value;
    398         PageAgent.setShowPaintRects(this._paintFlashingButtonNavigationItem.activated);
     396        let activated = WI.settings.showPaintRects.value;
     397        this._paintFlashingButtonNavigationItem.activated = activated;
     398
     399        for (let target of WI.targets) {
     400            if (target.PageAgent && target.PageAgent.setShowPaintRects)
     401                target.PageAgent.setShowPaintRects(activated);
     402        }
    399403    }
    400404
     
    406410    _updateCompositingBordersButtonState()
    407411    {
     412        if (!WI.targetsAvailable()) {
     413            WI.whenTargetsAvailable().then(() => {
     414                this._updateCompositingBordersButtonState();
     415            });
     416            return;
     417        }
     418
     419        if (!window.PageAgent)
     420            return;
     421
    408422        // This value can be changed outside of Web Inspector.
    409423        // FIXME: Have PageAgent dispatch a change event instead?
     
    416430    _toggleCompositingBorders(event)
    417431    {
    418         this._compositingBordersButtonNavigationItem.activated = !this._compositingBordersButtonNavigationItem.activated;
    419         PageAgent.setCompositingBordersVisible(this._compositingBordersButtonNavigationItem.activated);
     432        let activated = !this._compositingBordersButtonNavigationItem.activated;
     433        this._compositingBordersButtonNavigationItem.activated = activated;
     434
     435        for (let target of WI.targets) {
     436            if (target.PageAgent)
     437                target.PageAgent.setCompositingBordersVisible(activated);
     438        }
    420439    }
    421440
Note: See TracChangeset for help on using the changeset viewer.