kkoopa/contextify — pull request #1 by stash (2013-10-28 04:52:35+00:00)
Title: SIGSEGV deleting un-configurable global

First off, thanks for porting `contextify` to `nan` :+1:

The following code would segfault on node v0.10.21 (line references below refer to this version and the bundled V8).

```js
var sandbox = Contextify({});
Object.defineProperty(sandbox, 'global', {
enumerable: false,
configurable: false, // "cannot delete"
writable: false,
value: sandbox.getGlobal()
});
sandbox.run('delete global.global;');
```

Examining the fall-out with `gdb`, it appears V8 goes into infinite recursion, looping again and again through `GlobalPropertyDeleter` and `JSObject::DeleteProperty` (line 3950 of `deps/v8/src/objects.cc`).

The problem, as far as I could tell by reading through the V8 `JSObject::DeleteProperty` source, is that the initial `->Delete(property)` only ever returns false in the case where (1) an Isolate access-check failed or (2) it's a non-configurable property. Since these are both legitimate reasons to *not* delete a property, it doesn't make sense to do the `(ctx->proxyGlobal)->Delete(property)`, and so I removed it.

After removing, all of the existing tests pass, so I think this should be safe.