diff --git a/lib/ace/mode/xquery_worker.js b/lib/ace/mode/xquery_worker.js index cf01e423..863a06e3 100644 --- a/lib/ace/mode/xquery_worker.js +++ b/lib/ace/mode/xquery_worker.js @@ -36,8 +36,6 @@ var Mirror = require("../worker/mirror").Mirror; var JSONParseTreeHandler = require("./xquery/JSONParseTreeHandler").JSONParseTreeHandler; var XQueryParser = require("./xquery/XQueryParser").XQueryParser; var SyntaxHighlighter = require("../mode/xquery/visitors/SyntaxHighlighter").SyntaxHighlighter; -window.addEventListener = function() {}; - var XQueryWorker = exports.XQueryWorker = function(sender) { Mirror.call(this, sender); diff --git a/lib/ace/worker/worker_client.js b/lib/ace/worker/worker_client.js index d3b9c3c8..8f11ff4b 100644 --- a/lib/ace/worker/worker_client.js +++ b/lib/ace/worker/worker_client.js @@ -3,7 +3,7 @@ * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright @@ -14,7 +14,7 @@ * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -36,14 +36,15 @@ var EventEmitter = require("../lib/event_emitter").EventEmitter; var config = require("../config"); var WorkerClient = function(topLevelNamespaces, mod, classname) { - this.changeListener = this.changeListener.bind(this); + this.onMessage = this.onMessage.bind(this); + this.onError = this.onError.bind(this); + var workerUrl; if (config.get("packaged")) { - this.$worker = new Worker(config.moduleUrl(mod, "worker")); - } - else { - var workerUrl; + workerUrl = config.moduleUrl(mod, "worker"); + } else { + var normalizePath = this.$normalizePath; if (typeof require.supports !== "undefined" && require.supports.indexOf("ucjs2-pinf-0") >= 0) { // We are running in the sourcemint loader. workerUrl = require.nameToUrl("ace/worker/worker_sourcemint"); @@ -52,19 +53,16 @@ var WorkerClient = function(topLevelNamespaces, mod, classname) { // nameToUrl is renamed to toUrl in requirejs 2 if (require.nameToUrl && !require.toUrl) require.toUrl = require.nameToUrl; - workerUrl = this.$normalizePath(require.toUrl("ace/worker/worker", null, "_")); + workerUrl = normalizePath(require.toUrl("ace/worker/worker", null, "_")); } - this.$worker = new Worker(workerUrl); var tlns = {}; - for (var i=0; i