Another token parser bugfix
This commit is contained in:
parent
26805891be
commit
c6fa1d6734
2 changed files with 13 additions and 5 deletions
|
@ -139,11 +139,14 @@ class Js2PyInterpreter(Interpreter):
|
|||
window.Map = function(_i){ };
|
||||
window.setTimeout = function(_f,_t){ };
|
||||
window.setInterval = function(_f,_t){ };
|
||||
window.encodeURIComponent = function(_s){ };
|
||||
window.encodeURIComponent = window.Map;
|
||||
window.document = { };
|
||||
document.doctype = { };
|
||||
document.currentScript = { };
|
||||
document.getElementById = function(_s){ };
|
||||
document.getElementById = window.Map;
|
||||
document.prepend = window.Map;
|
||||
document.append = window.Map;
|
||||
document.appendChild = window.Map;
|
||||
''')
|
||||
|
||||
self.ctx = ctx
|
||||
|
|
|
@ -7,15 +7,20 @@ const args = process.argv.slice(2)
|
|||
const port = args[0] || 8000
|
||||
const host = args[1] || 'localhost'
|
||||
|
||||
const stubFunc = (_i) => {}
|
||||
|
||||
const vm = new VM({
|
||||
timeout: 2000,
|
||||
allowAsync: false,
|
||||
sandbox: {
|
||||
atob: atob,
|
||||
setTimeout: (_a, _b) => {},
|
||||
setInterval: (_a, _b) => {},
|
||||
setTimeout: stubFunc,
|
||||
setInterval: stubFunc,
|
||||
document: {
|
||||
getElementById: (_i) => {},
|
||||
getElementById: stubFunc,
|
||||
prepend: stubFunc,
|
||||
append: stubFunc,
|
||||
appendChild: stubFunc,
|
||||
doctype: {},
|
||||
currentScript: {},
|
||||
},
|
||||
|
|
Reference in a new issue