File tree Expand file tree Collapse file tree 1 file changed +20
-13
lines changed
Expand file tree Collapse file tree 1 file changed +20
-13
lines changed Original file line number Diff line number Diff line change 433433 }
434434 return true ;
435435 } ;
436+ const pruner = function ( o ) {
437+ if ( log !== undefined ) {
438+ const json = JSON . stringify ( o , null , 2 ) ;
439+ if ( reLogNeedle . test ( json ) ) {
440+ log ( 'uBO:' , location . hostname , json ) ;
441+ }
442+ return o ;
443+ }
444+ if ( mustProcess ( o ) === false ) { return o ; }
445+ for ( const path of prunePaths ) {
446+ findOwner ( o , path , true ) ;
447+ }
448+ return o ;
449+ } ;
436450 JSON . parse = new Proxy ( JSON . parse , {
437451 apply : function ( ) {
438- const r = Reflect . apply ( ...arguments ) ;
439- if ( log !== undefined ) {
440- const json = JSON . stringify ( r , null , 2 ) ;
441- if ( reLogNeedle . test ( json ) ) {
442- log ( 'uBO:' , location . hostname , json ) ;
443- }
444- return r ;
445- }
446- if ( mustProcess ( r ) === false ) { return r ; }
447- for ( const path of prunePaths ) {
448- findOwner ( r , path , true ) ;
449- }
450- return r ;
452+ return pruner ( Reflect . apply ( ...arguments ) ) ;
453+ } ,
454+ } ) ;
455+ Response . prototype . json = new Proxy ( Response . prototype . json , {
456+ apply : function ( ) {
457+ return Reflect . apply ( ...arguments ) . then ( o => pruner ( o ) ) ;
451458 } ,
452459 } ) ;
453460} ) ( ) ;
You can’t perform that action at this time.
0 commit comments