Skip to content

Instantly share code, notes, and snippets.

@cms
Created August 19, 2011 07:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cms/1156251 to your computer and use it in GitHub Desktop.
Save cms/1156251 to your computer and use it in GitHub Desktop.
V8 Engine internals using built-ins
/* V8 Engine internals using built-ins
*
* Bug report:
* http://code.google.com/p/v8/issues/detail?id=1625
* Bug on code:
* http://code.google.com/p/v8/source/browse/trunk/src/v8natives.js?r=8733#1026
* http://www.google.com/codesearch#W9JxUuHYyMg/trunk/src/v8natives.js&l=1026,1029
*/
var _push = Array.prototype.push;
Array.prototype.push = function f(arg) {
if (typeof arg == 'string') {
// Property name
arg = 'evil';
} else {
// Leaked PropertyDescriptor spec. internal type exposed
arg.value_ = true;
console.log(arg);
}
console.log(f.caller); // Leaked "defineProperties" internal implementation
_push.apply(this, arguments);
};
var o = Object.defineProperties({}, { 'foo': { value: 'bar' } });
console.log(o.evil); // true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment