Created
October 27, 2012 18:46
-
-
Save AndreasMadsen/3965647 to your computer and use it in GitHub Desktop.
Hack javascript - delete
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var log = typeof print === 'undefined' ? console.log : print; | |
// get v8 internal DELETE | |
var DELETE; | |
delete ({}[{ toString: function x(){ DELETE = x.caller; } }]); | |
// try it out | |
var obj = {hi: true}; | |
DELETE.call(obj, 'hi', 0); // BUG: hack.js:5: RangeError: Maximum call stack size exceeded | |
// print obj | |
log(obj.hasOwnProperty('hi') === false); // should print true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Benvie wounded if you could explain this.
I have executed the
hack.js
with bothd8
andnode
and I get the same result:Expected result that
true
is printed.The source is primally copied from your blog.
In any case, Thanks.