@@ -25,10 +25,12 @@ Coverage.CoverageView = class extends UI.VBox {
25
25
this . _toggleRecordButton = UI . Toolbar . createActionButton ( this . _toggleRecordAction ) ;
26
26
toolbar . appendToolbarItem ( this . _toggleRecordButton ) ;
27
27
28
- var startWithReloadAction =
29
- /** @type {!UI.Action }*/ ( UI . actionRegistry . action ( 'coverage.start-with-reload' ) ) ;
30
- this . _startWithReloadButton = UI . Toolbar . createActionButton ( startWithReloadAction ) ;
31
- toolbar . appendToolbarItem ( this . _startWithReloadButton ) ;
28
+ if ( ! Runtime . queryParam ( 'nodeFrontend' ) ) {
29
+ var startWithReloadAction =
30
+ /** @type {!UI.Action }*/ ( UI . actionRegistry . action ( 'coverage.start-with-reload' ) ) ;
31
+ this . _startWithReloadButton = UI . Toolbar . createActionButton ( startWithReloadAction ) ;
32
+ toolbar . appendToolbarItem ( this . _startWithReloadButton ) ;
33
+ }
32
34
this . _clearButton = new UI . ToolbarButton ( Common . UIString ( 'Clear all' ) , 'largeicon-clear' ) ;
33
35
this . _clearButton . addEventListener ( UI . ToolbarButton . Events . Click , this . _clear . bind ( this ) ) ;
34
36
toolbar . appendToolbarItem ( this . _clearButton ) ;
@@ -64,12 +66,17 @@ Coverage.CoverageView = class extends UI.VBox {
64
66
*/
65
67
_buildLandingPage ( ) {
66
68
var recordButton = UI . createInlineButton ( UI . Toolbar . createActionButton ( this . _toggleRecordAction ) ) ;
67
- var reloadButton = UI . createInlineButton ( UI . Toolbar . createActionButtonForId ( 'coverage.start-with-reload' ) ) ;
68
69
var widget = new UI . VBox ( ) ;
69
- var message = UI . formatLocalized (
70
- 'Click the record button %s to start capturing coverage.\n' +
71
- 'Click the reload button %s to reload and start capturing coverage.' ,
72
- [ recordButton , reloadButton ] ) ;
70
+ var message ;
71
+ if ( this . _startWithReloadButton ) {
72
+ var reloadButton = UI . createInlineButton ( UI . Toolbar . createActionButtonForId ( 'coverage.start-with-reload' ) ) ;
73
+ message = UI . formatLocalized (
74
+ 'Click the record button %s to start capturing coverage.\n' +
75
+ 'Click the reload button %s to reload and start capturing coverage.' ,
76
+ [ recordButton , reloadButton ] ) ;
77
+ } else {
78
+ message = UI . formatLocalized ( 'Click the record button %s to start capturing coverage.' , [ recordButton ] ) ;
79
+ }
73
80
message . classList . add ( 'message' ) ;
74
81
widget . contentElement . appendChild ( message ) ;
75
82
widget . element . classList . add ( 'landing-page' ) ;
@@ -110,25 +117,26 @@ Coverage.CoverageView = class extends UI.VBox {
110
117
var mainTarget = SDK . targetManager . mainTarget ( ) ;
111
118
if ( ! mainTarget )
112
119
return ;
113
- this . _resourceTreeModel = /** @type {?SDK.ResourceTreeModel } */ ( mainTarget . model ( SDK . ResourceTreeModel ) ) ;
114
- if ( ! this . _resourceTreeModel )
115
- return ;
116
120
if ( ! this . _model || reload )
117
121
this . _model = new Coverage . CoverageModel ( mainTarget ) ;
118
122
Host . userMetrics . actionTaken ( Host . UserMetrics . Action . CoverageStarted ) ;
119
123
if ( ! this . _model . start ( ) )
120
124
return ;
121
- this . _resourceTreeModel . addEventListener (
122
- SDK . ResourceTreeModel . Events . MainFrameNavigated , this . _onMainFrameNavigated , this ) ;
125
+ this . _resourceTreeModel = /** @type {?SDK.ResourceTreeModel } */ ( mainTarget . model ( SDK . ResourceTreeModel ) ) ;
126
+ if ( this . _resourceTreeModel ) {
127
+ this . _resourceTreeModel . addEventListener (
128
+ SDK . ResourceTreeModel . Events . MainFrameNavigated , this . _onMainFrameNavigated , this ) ;
129
+ }
123
130
this . _decorationManager = new Coverage . CoverageDecorationManager ( this . _model ) ;
124
131
this . _toggleRecordAction . setToggled ( true ) ;
125
132
this . _clearButton . setEnabled ( false ) ;
126
- this . _startWithReloadButton . setEnabled ( false ) ;
133
+ if ( this . _startWithReloadButton )
134
+ this . _startWithReloadButton . setEnabled ( false ) ;
127
135
this . _filterInput . setEnabled ( true ) ;
128
136
if ( this . _landingPage . isShowing ( ) )
129
137
this . _landingPage . detach ( ) ;
130
138
this . _listView . show ( this . _coverageResultsElement ) ;
131
- if ( reload )
139
+ if ( reload && this . _resourceTreeModel )
132
140
this . _resourceTreeModel . reloadPage ( ) ;
133
141
else
134
142
this . _poll ( ) ;
@@ -146,13 +154,16 @@ Coverage.CoverageView = class extends UI.VBox {
146
154
clearTimeout ( this . _pollTimer ) ;
147
155
delete this . _pollTimer ;
148
156
}
149
- this . _resourceTreeModel . removeEventListener (
150
- SDK . ResourceTreeModel . Events . MainFrameNavigated , this . _onMainFrameNavigated , this ) ;
151
- this . _resourceTreeModel = null ;
157
+ if ( this . _resourceTreeModel ) {
158
+ this . _resourceTreeModel . removeEventListener (
159
+ SDK . ResourceTreeModel . Events . MainFrameNavigated , this . _onMainFrameNavigated , this ) ;
160
+ this . _resourceTreeModel = null ;
161
+ }
152
162
var updatedEntries = await this . _model . stop ( ) ;
153
163
this . _updateViews ( updatedEntries ) ;
154
164
this . _toggleRecordAction . setToggled ( false ) ;
155
- this . _startWithReloadButton . setEnabled ( true ) ;
165
+ if ( this . _startWithReloadButton )
166
+ this . _startWithReloadButton . setEnabled ( true ) ;
156
167
this . _clearButton . setEnabled ( true ) ;
157
168
}
158
169
0 commit comments