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 {
6363 }
6464
6565 runScript ( methodName , session ) {
66- const sandbox = session ? session . sandbox : this . sandbox ;
66+ const { sandbox } = ( session || this ) ;
6767 const script = this . api . get ( methodName ) ;
6868 if ( ! script ) return null ;
6969 return script . runInContext ( sandbox , SCRIPT_OPTIONS ) ;
Original file line number Diff line number Diff line change @@ -57,8 +57,7 @@ module.exports = application => {
5757 const fillPool = ( ) => {
5858 const need = SANDBOX_POOL - pool . length ;
5959 for ( let i = 0 ; i < need ; i ++ ) {
60- const sandbox = application . createSandbox ( ) ;
61- pool . push ( sandbox ) ;
60+ pool . push ( application . createSandbox ( ) ) ;
6261 }
6362 } ;
6463
Original file line number Diff line number Diff line change @@ -55,13 +55,13 @@ class Client {
5555 }
5656
5757 static ( ) {
58- const { url } = this . req ;
58+ const { req : { url } , res , application } = this ;
5959 const filePath = url === '/' ? '/index.html' : url ;
6060 const fileExt = path . extname ( filePath ) . substring ( 1 ) ;
6161 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 ) ;
6565 else this . error ( 404 ) ;
6666 }
6767
You can’t perform that action at this time.
0 commit comments