File tree Expand file tree Collapse file tree 3 files changed +6
-7
lines changed Expand file tree Collapse file tree 3 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ class Application extends events.EventEmitter {
63
63
}
64
64
65
65
runScript ( methodName , session ) {
66
- const sandbox = session ? session . sandbox : this . sandbox ;
66
+ const { sandbox } = ( session || this ) ;
67
67
const script = this . api . get ( methodName ) ;
68
68
if ( ! script ) return null ;
69
69
return script . runInContext ( sandbox , SCRIPT_OPTIONS ) ;
Original file line number Diff line number Diff line change @@ -57,8 +57,7 @@ module.exports = application => {
57
57
const fillPool = ( ) => {
58
58
const need = SANDBOX_POOL - pool . length ;
59
59
for ( let i = 0 ; i < need ; i ++ ) {
60
- const sandbox = application . createSandbox ( ) ;
61
- pool . push ( sandbox ) ;
60
+ pool . push ( application . createSandbox ( ) ) ;
62
61
}
63
62
} ;
64
63
Original file line number Diff line number Diff line change @@ -55,13 +55,13 @@ class Client {
55
55
}
56
56
57
57
static ( ) {
58
- const { url } = this . req ;
58
+ const { req : { url } , res , application } = this ;
59
59
const filePath = url === '/' ? '/index.html' : url ;
60
60
const fileExt = path . extname ( filePath ) . substring ( 1 ) ;
61
61
const mimeType = MIME_TYPES [ fileExt ] || MIME_TYPES . html ;
62
- this . res . writeHead ( 200 , { 'Content-Type' : mimeType } ) ;
63
- const data = this . application . cache . get ( filePath ) ;
64
- if ( data ) this . res . end ( data ) ;
62
+ res . writeHead ( 200 , { 'Content-Type' : mimeType } ) ;
63
+ const data = application . cache . get ( filePath ) ;
64
+ if ( data ) res . end ( data ) ;
65
65
else this . error ( 404 ) ;
66
66
}
67
67
You can’t perform that action at this time.
0 commit comments