This repository was archived by the owner on Apr 22, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +12
-9
lines changed Expand file tree Collapse file tree 4 files changed +12
-9
lines changed Original file line number Diff line number Diff line change 2020// USE OR OTHER DEALINGS IN THE SOFTWARE.
2121
2222var NativeModule = require ( 'native_module' ) ;
23- var Script = process . binding ( 'evals' ) . Script ;
23+ var Script = process . binding ( 'evals' ) . NodeScript ;
2424var runInThisContext = Script . runInThisContext ;
2525var runInNewContext = Script . runInNewContext ;
2626var assert = require ( 'assert' ) . ok ;
Original file line number Diff line number Diff line change 2121
2222var binding = process . binding ( 'evals' ) ;
2323
24- exports . Script = binding . Script ;
24+ exports . Script = binding . NodeScript ;
2525exports . createScript = function ( code , ctx , name ) {
2626 return new exports . Script ( code , ctx , name ) ;
2727} ;
2828
29- exports . createContext = binding . Script . createContext ;
30- exports . runInContext = binding . Script . runInContext ;
31- exports . runInThisContext = binding . Script . runInThisContext ;
32- exports . runInNewContext = binding . Script . runInNewContext ;
29+ exports . createContext = binding . NodeScript . createContext ;
30+ exports . runInContext = binding . NodeScript . runInContext ;
31+ exports . runInThisContext = binding . NodeScript . runInThisContext ;
32+ exports . runInNewContext = binding . NodeScript . runInNewContext ;
Original file line number Diff line number Diff line change 349349 // core modules found in lib/*.js. All core modules are compiled into the
350350 // node binary, so they can be loaded faster.
351351
352- var Script = process . binding ( 'evals' ) . Script ;
352+ var Script = process . binding ( 'evals' ) . NodeScript ;
353353 var runInThisContext = Script . runInThisContext ;
354354
355355 function NativeModule ( id ) {
Original file line number Diff line number Diff line change @@ -150,7 +150,10 @@ void WrappedScript::Initialize(Handle<Object> target) {
150150 Local<FunctionTemplate> t = FunctionTemplate::New (WrappedScript::New);
151151 constructor_template = Persistent<FunctionTemplate>::New (t);
152152 constructor_template->InstanceTemplate ()->SetInternalFieldCount (1 );
153- constructor_template->SetClassName (String::NewSymbol (" Script" ));
153+ // Note: We use 'NodeScript' instead of 'Script' so that we do not
154+ // conflict with V8's Script class defined in v8/src/messages.js
155+ // See GH-203 https://github.com/joyent/node/issues/203
156+ constructor_template->SetClassName (String::NewSymbol (" NodeScript" ));
154157
155158 NODE_SET_PROTOTYPE_METHOD (constructor_template,
156159 " createContext" ,
@@ -184,7 +187,7 @@ void WrappedScript::Initialize(Handle<Object> target) {
184187 " runInNewContext" ,
185188 WrappedScript::CompileRunInNewContext);
186189
187- target->Set (String::NewSymbol (" Script " ),
190+ target->Set (String::NewSymbol (" NodeScript " ),
188191 constructor_template->GetFunction ());
189192}
190193
You can’t perform that action at this time.
0 commit comments