Changeset 20090
- Timestamp:
- 04/21/21 18:48:47 (4 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/InterpreterV8-4.cc
r20085 r20090 479 479 } 480 480 481 void InterpreterV8::GetterCallback(Local< Name > name, const PropertyCallbackInfo< Value > &info) 482 { 483 //const string server = *String::Utf8Value(name); 484 info.GetReturnValue().Set(info.Data()); 485 } 486 487 488 void InterpreterV8::SetProperty(Handle<ObjectTemplate> &obj, const char *name, const Local<Value> &val) 489 { 490 // My answer on: https://bugs.chromium.org/p/v8/issues/detail?id=4997 491 obj->SetNativeDataProperty(String::NewFromUtf8(Isolate::GetCurrent(), name), 492 GetterCallback, 493 nullptr, 494 val, 495 ReadOnly, 496 Local<AccessorSignature>(), 497 ALL_CAN_READ); 498 } 499 500 481 501 void InterpreterV8::FuncState(const Arguments& args) 482 502 { … … 515 535 MaybeLocal<Value> date = Date::New(isolate->GetCurrentContext(), rc.time.JavaDate()); 516 536 if (rc.index>-256 && !date.IsEmpty()) 517 obj->Set(String::NewFromUtf8(isolate, "time"), date.ToLocalChecked());537 SetProperty(obj, "time", date.ToLocalChecked()); 518 538 519 539 args.GetReturnValue().Set(obj->NewInstance()); … … 1977 1997 MaybeLocal<Value> date = Date::New(isolate->GetCurrentContext(), state.time.JavaDate()); 1978 1998 if (!date.IsEmpty()) 1999 SetProperty(obj, "time", date.ToLocalChecked()); 2000 /* 1979 2001 { 1980 2002 obj->Set(String::NewFromUtf8(isolate, "time"), date.ToLocalChecked()->ToString(), ReadOnly); … … 1982 2004 // This crahshes when called a secont time. I don't know why. 1983 2005 // obj->Set(String::NewFromUtf8(isolate, "time"), date.ToLocalChecked(), ReadOnly); 1984 } 2006 }*/ 1985 2007 } 1986 2008 -
trunk/FACT++/src/InterpreterV8-4.h
r20085 r20090 84 84 85 85 static void TerminateExecution(v8::Isolate*); 86 87 88 static void GetterCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value> &info); 89 static void SetProperty(v8::Handle<v8::ObjectTemplate> &obj, const char *name, const v8::Local<v8::Value> &val); 90 86 91 87 92 void FuncWait(const FactArguments& args);
Note:
See TracChangeset
for help on using the changeset viewer.