Skip to content

Commit c7c3cb1

Browse files
authored
Merge pull request #16 from sjrd/remove-workarounds
Remove workarounds for upstream bugs fixed in 1.0.0-M6.
2 parents a9e9056 + 3f4ecbc commit c7c3cb1

File tree

1 file changed

+4
-36
lines changed

1 file changed

+4
-36
lines changed

jsdom-nodejs-env/src/main/scala/org/scalajs/jsenv/jsdomnodejs/JSDOMNodeJSEnv.scala

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -36,30 +36,15 @@ class JSDOMNodeJSEnv(config: JSDOMNodeJSEnv.Config) extends JSEnv {
3636
} catch {
3737
case NonFatal(t) =>
3838
JSRun.failed(t)
39-
40-
case t: NotImplementedError =>
41-
/* In Scala 2.10.x, NotImplementedError was considered fatal.
42-
* We need this case for the conformance tests to pass on 2.10.
43-
*/
44-
JSRun.failed(t)
4539
}
4640
}
4741

4842
def startWithCom(input: Input, runConfig: RunConfig,
4943
onMessage: String => Unit): JSComRun = {
5044
JSDOMNodeJSEnv.validator.validate(runConfig)
51-
try {
52-
ComRun.start(runConfig, onMessage) { comLoader =>
53-
val files = initFiles ::: (comLoader :: codeWithJSDOMContext(input))
54-
internalStart(files, runConfig)
55-
}
56-
} catch {
57-
case t: NotImplementedError =>
58-
/* In Scala 2.10.x, NotImplementedError was considered fatal.
59-
* We need this case for the conformance tests to pass on 2.10.
60-
* Non-fatal exceptions are already handled by ComRun.start().
61-
*/
62-
JSComRun.failed(t)
45+
ComRun.start(runConfig, onMessage) { comLoader =>
46+
val files = initFiles ::: (comLoader :: codeWithJSDOMContext(input))
47+
internalStart(files, runConfig)
6348
}
6449
}
6550

@@ -111,31 +96,14 @@ class JSDOMNodeJSEnv(config: JSDOMNodeJSEnv.Config) extends JSEnv {
11196
| throw error;
11297
| });
11398
|
114-
| /* Work around the fast that scalajsCom.init() should delay already
115-
| * received messages to the next tick. Here we cannot tell whether
116-
| * the receive callback is called for already received messages or
117-
| * not, so we dealy *all* messages to the next tick.
118-
| */
119-
| var scalajsCom = global.scalajsCom;
120-
| var scalajsComWrapper = scalajsCom === (void 0) ? scalajsCom : ({
121-
| init: function(recvCB) {
122-
| scalajsCom.init(function(msg) {
123-
| process.nextTick(recvCB, msg);
124-
| });
125-
| },
126-
| send: function(msg) {
127-
| scalajsCom.send(msg);
128-
| }
129-
| });
130-
|
13199
| jsdom.env({
132100
| html: "",
133101
| url: "http://localhost/",
134102
| virtualConsole: virtualConsole,
135103
| created: function (error, window) {
136104
| if (error == null) {
137105
| window["__ScalaJSEnv"] = __ScalaJSEnv;
138-
| window["scalajsCom"] = scalajsComWrapper;
106+
| window["scalajsCom"] = global.scalajsCom;
139107
| } else {
140108
| throw error;
141109
| }

0 commit comments

Comments
 (0)