Closed kripken closed 12 years ago
I would very much like to put it in a worker. But that way we will be loosing raw_input
(we're using window.prompt).
That said weighing against how smooth language loading for the UI would be and not to mention this bug and the safety features that coud be added (e.g. prompt terminating a worker when taking too long to respond). I would be ok in loading emscripted langs in workers (if @max99x is) and maintaining input using the DB hack in Chrome and when generators land (or SyncIndexedDB), we would use it to implement input for FF.
@kripken ETA on generators (or SyncIndexedDB) for FF?
repl.it should load Python in a worker for chrome ( unless webdb api is removed in chrome nightly on windows?!).
Generators already work in Firefox on the web, you need to use the mime-type for JS 1.7 or 1.8 though, not sure which. Here is an example project using generators on the web, perhaps it is easy to look in their code or examples: http://taskjs.org/ Edit: And Chrome has some ES6 features, perhaps generators, behind a flag now.
Not sure what the status of sync IndexedDB is. I don't think any browser implemented it yet.
WebSQL is not a web standard, so I would not be surprised if Google removes it from Chrome at some point.
Thats great!
How to make Worker use JS 1.8 though? I tried setting Content-Type -> 'application/javascript;version=1.8'
I'm testing using:
missing ; before statement
(function () {yield 1;})
sandbox.js (line 2, col 22)
[EDIT]
Also tried creating the worker in a context where it is already JS 1.8 with no luck.
I asked in #jsapi on the mozilla IRC, and was told that this is currently impossible, sadly. So generators exist, but not in workers... perhaps if we file a bug this will get attention.
OK do you want me to file it? if thats the case does it go to Firefox?
Yeah, best would be to file it on JavaScript Engine in https://bugzilla.mozilla.org/enter_bug.cgi?product=Core . Mentioning the concrete use case you have for it would be helpful.
There is an open bug since April 2009. https://bugzilla.mozilla.org/show_bug.cgi?id=487070 Seems no activity so I've left a comment.
Fixed in jsrepl, see README (https://github.com/replit/jsrepl/blob/master/README.md)
Firefox and Chrome have disabled ArrayBuffer responses in sync XHRs in their nightly builds, example error:
[10:02:13.078] Use of XMLHttpRequest's responseType attribute is no longer supported in the synchronous mode in window context. @ http://repl.it/jsrepl/sandbox.html [10:02:13.095] uncaught exception: [Exception... "A parameter or an operation is not supported by the underlying object" code: "15" nsresult: "0x8053000f (NS_ERROR_DOM_INVALID_ACCESS_ERR)" location: "http://repl.it/jsrepl/sandbox.js Line: 322"]
Sync XHRs work without ArrayBuffers, but the better solution is probably to put the compiled code in a worker, where ArrayBuffer still works.