I know a->x is a wrong syntax, but v8 should be able to handle
execution errors, right?
Am I missing something here? It's not throwing an exception or
returning an error code, but accessing null pointer in internal::Invoke
()
Handle<String> source = String::New("function A(){} var a = new A();
a->x = 0;");
Handle<Script> script = Script::Compile(source);
Handle<Value> result = script->Run();
The problem is that this is a syntax error so Compile fails and gives
you back an empty handle. You have to check that compilation
succeeded (using Script::IsEmpty) before you run it.
On Thu, Jul 23, 2009 at 12:22 PM, Kenji<kenjichan...@gmail.com> wrote:
> Hi,
> The following code would crash.
> I know a->x is a wrong syntax, but v8 should be able to handle
> execution errors, right?
> Am I missing something here? It's not throwing an exception or
> returning an error code, but accessing null pointer in internal::Invoke
> ()
> Handle<String> source = String::New("function A(){} var a = new A();
> a->x = 0;");
> Handle<Script> script = Script::Compile(source);
> Handle<Value> result = script->Run();
<christian.plesner.han...@gmail.com> wrote:
> The problem is that this is a syntax error so Compile fails and gives
> you back an empty handle. You have to check that compilation
> succeeded (using Script::IsEmpty) before you run it.
> On Thu, Jul 23, 2009 at 12:22 PM, Kenji<kenjichan...@gmail.com> wrote:
> > Hi,
> > The following code would crash.
> > I know a->x is a wrong syntax, but v8 should be able to handle
> > execution errors, right?
> > Am I missing something here? It's not throwing an exception or
> > returning an error code, but accessing null pointer in internal::Invoke
> > ()
> > Handle<String> source = String::New("function A(){} var a = new A();
> > a->x = 0;");
> > Handle<Script> script = Script::Compile(source);
> > Handle<Value> result = script->Run();
> But it crashed before Run() returns, and this is the problem.
> On 7月23日, 下午6時30分, Christian Plesner Hansen
> <christian.plesner.han...@gmail.com> wrote:
> > The problem is that this is a syntax error so Compile fails and gives
> > you back an empty handle. You have to check that compilation
> > succeeded (using Script::IsEmpty) before you run it.
> > On Thu, Jul 23, 2009 at 12:22 PM, Kenji<kenjichan...@gmail.com> wrote:
> > > Hi,
> > > The following code would crash.
> > > I know a->x is a wrong syntax, but v8 should be able to handle
> > > execution errors, right?
> > > Am I missing something here? It's not throwing an exception or
> > > returning an error code, but accessing null pointer in internal::Invoke
> > > ()
> > > Handle<String> source = String::New("function A(){} var a = new A();
> > > a->x = 0;");
> > > Handle<Script> script = Script::Compile(source);
> > > Handle<Value> result = script->Run();