@@ -120,41 +120,46 @@ Instrumenter.prototype.configure = function(options) {
120
120
}
121
121
} ;
122
122
123
- // eslint-disable-next-line complexity
124
123
Instrumenter . prototype . instrument = function ( oldSettings ) {
125
- if ( this . autoInstrument . network && ! ( oldSettings && oldSettings . network ) ) {
124
+ var network = oldSettings && oldSettings . network ;
125
+ if ( this . autoInstrument . network && ! network ) {
126
126
this . instrumentNetwork ( ) ;
127
- } else if ( ! this . autoInstrument . network && oldSettings && oldSettings . network ) {
127
+ } else if ( ! this . autoInstrument . network && network ) {
128
128
this . deinstrumentNetwork ( ) ;
129
129
}
130
130
131
- if ( this . autoInstrument . log && ! ( oldSettings && oldSettings . log ) ) {
131
+ var log = oldSettings && oldSettings . log ;
132
+ if ( this . autoInstrument . log && ! log ) {
132
133
this . instrumentConsole ( ) ;
133
- } else if ( ! this . autoInstrument . log && oldSettings && oldSettings . log ) {
134
+ } else if ( ! this . autoInstrument . log && log ) {
134
135
this . deinstrumentConsole ( ) ;
135
136
}
136
137
137
- if ( this . autoInstrument . dom && ! ( oldSettings && oldSettings . dom ) ) {
138
+ var dom = oldSettings && oldSettings . dom ;
139
+ if ( this . autoInstrument . dom && ! dom ) {
138
140
this . instrumentDom ( ) ;
139
- } else if ( ! this . autoInstrument . dom && oldSettings && oldSettings . dom ) {
141
+ } else if ( ! this . autoInstrument . dom && dom ) {
140
142
this . deinstrumentDom ( ) ;
141
143
}
142
144
143
- if ( this . autoInstrument . navigation && ! ( oldSettings && oldSettings . navigation ) ) {
145
+ var navigation = oldSettings && oldSettings . navigation ;
146
+ if ( this . autoInstrument . navigation && ! navigation ) {
144
147
this . instrumentNavigation ( ) ;
145
- } else if ( ! this . autoInstrument . navigation && oldSettings && oldSettings . navigation ) {
148
+ } else if ( ! this . autoInstrument . navigation && navigation ) {
146
149
this . deinstrumentNavigation ( ) ;
147
150
}
148
151
149
- if ( this . autoInstrument . connectivity && ! ( oldSettings && oldSettings . connectivity ) ) {
152
+ var connectivity = oldSettings && oldSettings . connectivity ;
153
+ if ( this . autoInstrument . connectivity && ! connectivity ) {
150
154
this . instrumentConnectivity ( ) ;
151
- } else if ( ! this . autoInstrument . connectivity && oldSettings && oldSettings . connectivity ) {
155
+ } else if ( ! this . autoInstrument . connectivity && connectivity ) {
152
156
this . deinstrumentConnectivity ( ) ;
153
157
}
154
158
155
- if ( this . autoInstrument . contentSecurityPolicy && ! ( oldSettings && oldSettings . contentSecurityPolicy ) ) {
159
+ var contentSecurityPolicy = oldSettings && oldSettings . contentSecurityPolicy ;
160
+ if ( this . autoInstrument . contentSecurityPolicy && ! contentSecurityPolicy ) {
156
161
this . instrumentContentSecurityPolicy ( ) ;
157
- } else if ( ! this . autoInstrument . contentSecurityPolicy && oldSettings && oldSettings . contentSecurityPolicy ) {
162
+ } else if ( ! this . autoInstrument . contentSecurityPolicy && contentSecurityPolicy ) {
158
163
this . deinstrumentContentSecurityPolicy ( ) ;
159
164
}
160
165
} ;
@@ -222,9 +227,7 @@ Instrumenter.prototype.instrumentNetwork = function() {
222
227
} , this . replacements , 'network' ) ;
223
228
224
229
replace ( xhrp , 'send' , function ( orig ) {
225
- /* eslint-disable no-unused-vars */
226
230
return function ( data ) {
227
- /* eslint-enable no-unused-vars */
228
231
var xhr = this ;
229
232
230
233
function onreadystatechangeHandler ( ) {
@@ -331,9 +334,8 @@ Instrumenter.prototype.instrumentNetwork = function() {
331
334
332
335
if ( 'fetch' in this . _window ) {
333
336
replace ( this . _window , 'fetch' , function ( orig ) {
334
- /* eslint-disable no-unused-vars */
337
+ /* eslint-disable-next-line no-unused-vars */
335
338
return function ( fn , t ) {
336
- /* eslint-enable no-unused-vars */
337
339
var args = new Array ( arguments . length ) ;
338
340
for ( var i = 0 , len = args . length ; i < len ; i ++ ) {
339
341
args [ i ] = arguments [ i ] ;
0 commit comments