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.Map = function(_i){ };
|
||||||
window.setTimeout = function(_f,_t){ };
|
window.setTimeout = function(_f,_t){ };
|
||||||
window.setInterval = function(_f,_t){ };
|
window.setInterval = function(_f,_t){ };
|
||||||
window.encodeURIComponent = function(_s){ };
|
window.encodeURIComponent = window.Map;
|
||||||
window.document = { };
|
window.document = { };
|
||||||
document.doctype = { };
|
document.doctype = { };
|
||||||
document.currentScript = { };
|
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
|
self.ctx = ctx
|
||||||
|
|
|
@ -7,15 +7,20 @@ const args = process.argv.slice(2)
|
||||||
const port = args[0] || 8000
|
const port = args[0] || 8000
|
||||||
const host = args[1] || 'localhost'
|
const host = args[1] || 'localhost'
|
||||||
|
|
||||||
|
const stubFunc = (_i) => {}
|
||||||
|
|
||||||
const vm = new VM({
|
const vm = new VM({
|
||||||
timeout: 2000,
|
timeout: 2000,
|
||||||
allowAsync: false,
|
allowAsync: false,
|
||||||
sandbox: {
|
sandbox: {
|
||||||
atob: atob,
|
atob: atob,
|
||||||
setTimeout: (_a, _b) => {},
|
setTimeout: stubFunc,
|
||||||
setInterval: (_a, _b) => {},
|
setInterval: stubFunc,
|
||||||
document: {
|
document: {
|
||||||
getElementById: (_i) => {},
|
getElementById: stubFunc,
|
||||||
|
prepend: stubFunc,
|
||||||
|
append: stubFunc,
|
||||||
|
appendChild: stubFunc,
|
||||||
doctype: {},
|
doctype: {},
|
||||||
currentScript: {},
|
currentScript: {},
|
||||||
},
|
},
|
||||||
|
|
Reference in a new issue