Bugfix for document.doctype
(#85)
This commit is contained in:
parent
5132b5ea3a
commit
cfee59d119
2 changed files with 14 additions and 7 deletions
|
@ -135,12 +135,15 @@ class Js2PyInterpreter(Interpreter):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
ctx = js2py.EvalJs({'atob': atob})
|
ctx = js2py.EvalJs({'atob': atob})
|
||||||
ctx.execute('window.document = { };')
|
ctx.execute('''
|
||||||
ctx.execute('window.Map = function(_i){ };')
|
window.Map = function(_i){ };
|
||||||
ctx.execute('window.setTimeout = function(_f,_t){ };')
|
window.setTimeout = function(_f,_t){ };
|
||||||
ctx.execute('window.setInterval = function(_f,_t){ };')
|
window.setInterval = function(_f,_t){ };
|
||||||
ctx.execute('document.getElementById = function(_a) { };')
|
window.encodeURIComponent = function(_s){ };
|
||||||
ctx.execute('window.encodeURIComponent = function(_s){ };')
|
window.document = { };
|
||||||
|
document.doctype = { };
|
||||||
|
document.getElementById = function(_s){ };
|
||||||
|
''')
|
||||||
|
|
||||||
self.ctx = ctx
|
self.ctx = ctx
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,13 @@ const vm = new VM({
|
||||||
atob: atob,
|
atob: atob,
|
||||||
setTimeout: (_a, _b) => {},
|
setTimeout: (_a, _b) => {},
|
||||||
setInterval: (_a, _b) => {},
|
setInterval: (_a, _b) => {},
|
||||||
|
document: {
|
||||||
|
getElementById: (_i) => {},
|
||||||
|
doctype: {},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
vm.run('var window = global; var document = {}')
|
vm.run('var window = global')
|
||||||
|
|
||||||
const listener = (req, res) => {
|
const listener = (req, res) => {
|
||||||
|
|
||||||
|
|
Reference in a new issue