@@ -120,41 +120,46 @@ Instrumenter.prototype.configure = function(options) {
120120 }
121121} ;
122122
123- // eslint-disable-next-line complexity
124123Instrumenter . prototype . instrument = function ( oldSettings ) {
125- if ( this . autoInstrument . network && ! ( oldSettings && oldSettings . network ) ) {
124+ var network = oldSettings && oldSettings . network ;
125+ if ( this . autoInstrument . network && ! network ) {
126126 this . instrumentNetwork ( ) ;
127- } else if ( ! this . autoInstrument . network && oldSettings && oldSettings . network ) {
127+ } else if ( ! this . autoInstrument . network && network ) {
128128 this . deinstrumentNetwork ( ) ;
129129 }
130130
131- if ( this . autoInstrument . log && ! ( oldSettings && oldSettings . log ) ) {
131+ var log = oldSettings && oldSettings . log ;
132+ if ( this . autoInstrument . log && ! log ) {
132133 this . instrumentConsole ( ) ;
133- } else if ( ! this . autoInstrument . log && oldSettings && oldSettings . log ) {
134+ } else if ( ! this . autoInstrument . log && log ) {
134135 this . deinstrumentConsole ( ) ;
135136 }
136137
137- if ( this . autoInstrument . dom && ! ( oldSettings && oldSettings . dom ) ) {
138+ var dom = oldSettings && oldSettings . dom ;
139+ if ( this . autoInstrument . dom && ! dom ) {
138140 this . instrumentDom ( ) ;
139- } else if ( ! this . autoInstrument . dom && oldSettings && oldSettings . dom ) {
141+ } else if ( ! this . autoInstrument . dom && dom ) {
140142 this . deinstrumentDom ( ) ;
141143 }
142144
143- if ( this . autoInstrument . navigation && ! ( oldSettings && oldSettings . navigation ) ) {
145+ var navigation = oldSettings && oldSettings . navigation ;
146+ if ( this . autoInstrument . navigation && ! navigation ) {
144147 this . instrumentNavigation ( ) ;
145- } else if ( ! this . autoInstrument . navigation && oldSettings && oldSettings . navigation ) {
148+ } else if ( ! this . autoInstrument . navigation && navigation ) {
146149 this . deinstrumentNavigation ( ) ;
147150 }
148151
149- if ( this . autoInstrument . connectivity && ! ( oldSettings && oldSettings . connectivity ) ) {
152+ var connectivity = oldSettings && oldSettings . connectivity ;
153+ if ( this . autoInstrument . connectivity && ! connectivity ) {
150154 this . instrumentConnectivity ( ) ;
151- } else if ( ! this . autoInstrument . connectivity && oldSettings && oldSettings . connectivity ) {
155+ } else if ( ! this . autoInstrument . connectivity && connectivity ) {
152156 this . deinstrumentConnectivity ( ) ;
153157 }
154158
155- if ( this . autoInstrument . contentSecurityPolicy && ! ( oldSettings && oldSettings . contentSecurityPolicy ) ) {
159+ var contentSecurityPolicy = oldSettings && oldSettings . contentSecurityPolicy ;
160+ if ( this . autoInstrument . contentSecurityPolicy && ! contentSecurityPolicy ) {
156161 this . instrumentContentSecurityPolicy ( ) ;
157- } else if ( ! this . autoInstrument . contentSecurityPolicy && oldSettings && oldSettings . contentSecurityPolicy ) {
162+ } else if ( ! this . autoInstrument . contentSecurityPolicy && contentSecurityPolicy ) {
158163 this . deinstrumentContentSecurityPolicy ( ) ;
159164 }
160165} ;
@@ -222,9 +227,7 @@ Instrumenter.prototype.instrumentNetwork = function() {
222227 } , this . replacements , 'network' ) ;
223228
224229 replace ( xhrp , 'send' , function ( orig ) {
225- /* eslint-disable no-unused-vars */
226230 return function ( data ) {
227- /* eslint-enable no-unused-vars */
228231 var xhr = this ;
229232
230233 function onreadystatechangeHandler ( ) {
@@ -331,9 +334,8 @@ Instrumenter.prototype.instrumentNetwork = function() {
331334
332335 if ( 'fetch' in this . _window ) {
333336 replace ( this . _window , 'fetch' , function ( orig ) {
334- /* eslint-disable no-unused-vars */
337+ /* eslint-disable-next-line no-unused-vars */
335338 return function ( fn , t ) {
336- /* eslint-enable no-unused-vars */
337339 var args = new Array ( arguments . length ) ;
338340 for ( var i = 0 , len = args . length ; i < len ; i ++ ) {
339341 args [ i ] = arguments [ i ] ;
0 commit comments