Skip to content

Remove workarounds for upstream bugs fixed in 1.0.0-M6. #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 20, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,30 +36,15 @@ class JSDOMNodeJSEnv(config: JSDOMNodeJSEnv.Config) extends JSEnv {
} catch {
case NonFatal(t) =>
JSRun.failed(t)

case t: NotImplementedError =>
/* In Scala 2.10.x, NotImplementedError was considered fatal.
* We need this case for the conformance tests to pass on 2.10.
*/
JSRun.failed(t)
}
}

def startWithCom(input: Input, runConfig: RunConfig,
onMessage: String => Unit): JSComRun = {
JSDOMNodeJSEnv.validator.validate(runConfig)
try {
ComRun.start(runConfig, onMessage) { comLoader =>
val files = initFiles ::: (comLoader :: codeWithJSDOMContext(input))
internalStart(files, runConfig)
}
} catch {
case t: NotImplementedError =>
/* In Scala 2.10.x, NotImplementedError was considered fatal.
* We need this case for the conformance tests to pass on 2.10.
* Non-fatal exceptions are already handled by ComRun.start().
*/
JSComRun.failed(t)
ComRun.start(runConfig, onMessage) { comLoader =>
val files = initFiles ::: (comLoader :: codeWithJSDOMContext(input))
internalStart(files, runConfig)
}
}

Expand Down Expand Up @@ -111,31 +96,14 @@ class JSDOMNodeJSEnv(config: JSDOMNodeJSEnv.Config) extends JSEnv {
| throw error;
| });
|
| /* Work around the fast that scalajsCom.init() should delay already
| * received messages to the next tick. Here we cannot tell whether
| * the receive callback is called for already received messages or
| * not, so we dealy *all* messages to the next tick.
| */
| var scalajsCom = global.scalajsCom;
| var scalajsComWrapper = scalajsCom === (void 0) ? scalajsCom : ({
| init: function(recvCB) {
| scalajsCom.init(function(msg) {
| process.nextTick(recvCB, msg);
| });
| },
| send: function(msg) {
| scalajsCom.send(msg);
| }
| });
|
| jsdom.env({
| html: "",
| url: "http://localhost/",
| virtualConsole: virtualConsole,
| created: function (error, window) {
| if (error == null) {
| window["__ScalaJSEnv"] = __ScalaJSEnv;
| window["scalajsCom"] = scalajsComWrapper;
| window["scalajsCom"] = global.scalajsCom;
| } else {
| throw error;
| }
Expand Down