catvm/CatVm2/browser/History.js
Big1moster d843fcb236 dsf
2023-02-06 11:36:48 +08:00

29 lines
814 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.

// 从浏览器中知道History是全局的且原型链只是一层因此比较好伪造window有多层所以要伪造多层
// 浏览器中new会报错因此我们此处也需要报错
var History = function History() { // 构造函数
throw new TypeError("Illegal constructor");
};
catvm.safefunction(History);
// 浏览器
Object.defineProperties(History.prototype, {
[Symbol.toStringTag]: {
value: "History",
configurable: true
}
});
history = {
length: 1,
};
history.__proto__ = History.prototype;
////////// 浏览器代码自动生成部分
History.prototype.back = function back() {
debugger;
};
catvm.proxy(History.prototype.back);
////////
// 浏览器中history是全局的因此我们也需要定义一个history
history = catvm.proxy(history);