brianmcd/contextify — pull request #11 by assaf (2011-12-13 07:01:18+00:00)
Title: Declared global variables treated as undefined

In JavaScript, this results in an `ReferenceError: y is not defined`:

```
x = y
```

OTOH a variable declared with no value is set to `undefined`, and so this sets x to `undefined`:

```
var y
x = y
```

This pull requests provides two tests, one with a sandbox property (`x`) set to `undefined` and one with a global variable (`z`) declared as `undefined`.

This seems to fix the first test, by returning the sandbox property if defined, regardless of value:

```
Local rv = sandbox->Get(property);
if (sandbox->GetRealNamedProperty(property))
return scope.Close(rv);

// Next, check the global object (things like Object, Array, etc).
// This needs to call GetRealNamedProperty or else we'll get stuck in
// an infinite loop here.
rv = info->global->GetRealNamedProperty(property);
```

I am not sure if this is correct, or how to go about fixing the second test.