javascript - How to get the original native browser objects, if they have changed? -


actually whole issue. kind of anti-monkey patching. how original objects (object, array, function, string, etc) , prototypes, if have changed \ expanded \ deleted?

the option see - dynamic creation of frame - pulling out of native objects - remove frame on fly. perhaps same can done web workers. ie> 9, in there no classes dom, , same way dynamic frame.

example frame

delete object.prototype.constructor; delete object;  console.log(window.__proto__.__proto__.__proto__.constructor); // undefined // console.log(object); // undefined  var frame = document.createelement('frame'); document.all[0].appendchild(frame);  var object = frames[0].object; document.all[0].removechild(frame); console.log(object); 

this theoretical question. example, developing embedded library, , can not know when called, time invoked native browser objects can changed. need original objects, initial environment.

maybe there other ways solve?

thanks in advance.

before posting answer, have tell not speak english excuse me orthography, , not have solution problem but maybe helps you.

i searching weeks how tostring built-in function if redefined , not found (except creating new frame, solution not work me because using node js/node webkit).

i start search inside window object, objects not configurable nobody can redefine them , found this:

object.getownpropertydescriptor(window, "top"); //object {value: window, writable: true, enumerable: true, configurable: false} object.getownpropertydescriptor(top.__proto__, "tostring"); //object {value: function, writable: true, enumerable: false, configurable: false} 

so if access top.__proto__.tostring real built-in function because not configurable (and far found no way replace it). work me on webkit client, have keep searching solution nodejs.

by way, delete object constructor same did , can not find object inside top, think must stored somewhere. keep searching, if find solution edit post.

i hope have helped.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -