js_reverse/zy-补环境框架/vmProxy_test.js
2022-03-22 18:01:37 +08:00

48 lines
1009 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

window = this;
// 定义名字
Object.defineProperties(window, {
[Symbol.toStringTag]:{
value: "window",
configurable: true
}
});
function vmProxy(o){
return new Proxy(window, {
set(obj, prop, value) {
// obj 那个对象, prop哪个属性value设置的值
console.log(obj, prop, value);
return Reflect.set(...arguments);
},
get: function (target, property, receiver) {
// obj 那个对象, prop哪个属性value设置的值
console.log(target, property, receiver);
return target[property];
}
});
}
// 创建对象的方法
// object.create({});
// class window{};
// function window(){};new window;
window = vmProxy(window);
// navigator = {};
// navigator = vmProxy(navigator);
//
// document = {};
// document = vmProxy(document);
location = {};
location.reload = function reload(){
};
location = vmProxy(location);
console.log(location.reload+'');