File tree 2 files changed +1
-26
lines changed
packages/datadog-plugin-dd-trace-api
2 files changed +1
-26
lines changed Original file line number Diff line number Diff line change @@ -48,14 +48,6 @@ module.exports = class DdTraceApiPlugin extends Plugin {
48
48
self = objectMap . get ( self )
49
49
}
50
50
51
- // `trace` returns the value that's returned from the original callback
52
- // passed to it, so we need to detect that happening and bypass the check
53
- // for a proxy, since a proxy isn't needed, since the object originates
54
- // from the caller. In callbacks, we'll assign return values to this
55
- // value, and bypass the proxy check if `ret.value` is exactly this
56
- // value.
57
- let passthroughRetVal
58
-
59
51
for ( let i = 0 ; i < args . length ; i ++ ) {
60
52
if ( objectMap . has ( args [ i ] ) ) {
61
53
args [ i ] = objectMap . get ( args [ i ] )
@@ -71,8 +63,7 @@ module.exports = class DdTraceApiPlugin extends Plugin {
71
63
}
72
64
}
73
65
// TODO do we need to apply(this, ...) here?
74
- passthroughRetVal = orig ( ...fnArgs )
75
- return passthroughRetVal
66
+ return orig ( ...fnArgs )
76
67
}
77
68
}
78
69
}
@@ -83,8 +74,6 @@ module.exports = class DdTraceApiPlugin extends Plugin {
83
74
const proxyVal = proxy ( )
84
75
objectMap . set ( proxyVal , ret . value )
85
76
ret . value = proxyVal
86
- } else if ( ret . value && typeof ret . value === 'object' && passthroughRetVal !== ret . value ) {
87
- throw new TypeError ( `Objects need proxies when returned via API (${ name } )` )
88
77
}
89
78
} catch ( e ) {
90
79
ret . error = e
Original file line number Diff line number Diff line change @@ -220,20 +220,6 @@ describe('Plugin', () => {
220
220
describeMethod ( 'extract' , null )
221
221
describeMethod ( 'getRumData' , '' )
222
222
describeMethod ( 'trace' )
223
-
224
- describe ( 'trace with return value' , ( ) => {
225
- it ( 'should return the exact same value' , ( ) => {
226
- const obj = { mustBeThis : 'value' }
227
- tracer . trace . resetHistory ( ) // clear previous call to `trace`
228
- testChannel ( {
229
- name : 'trace' ,
230
- fn : tracer . trace ,
231
- ret : obj ,
232
- proxy : false ,
233
- args : [ 'foo' , { } , ( ) => obj ]
234
- } )
235
- } )
236
- } )
237
223
describeMethod ( 'wrap' )
238
224
describeMethod ( 'use' , SELF )
239
225
describeMethod ( 'profilerStarted' , Promise . resolve ( false ) )
You can’t perform that action at this time.
0 commit comments