do not throw if require.toUrl is missing

This commit is contained in:
Harutyun Amirjanyan 2013-05-27 12:08:45 -04:00
commit 9a170dcd03

View file

@ -41,14 +41,15 @@ var WorkerClient = function(topLevelNamespaces, mod, classname) {
this.onMessage = this.onMessage.bind(this);
this.onError = this.onError.bind(this);
// nameToUrl is renamed to toUrl in requirejs 2
if (require.nameToUrl && !require.toUrl)
require.toUrl = require.nameToUrl;
var workerUrl;
if (config.get("packaged")) {
if (config.get("packaged") || !require.toUrl) {
workerUrl = config.moduleUrl(mod, "worker");
} else {
var normalizePath = this.$normalizePath;
// nameToUrl is renamed to toUrl in requirejs 2
if (require.nameToUrl && !require.toUrl)
require.toUrl = require.nameToUrl;
workerUrl = normalizePath(require.toUrl("ace/worker/worker.js", null, "_"));
var tlns = {};
@ -184,7 +185,7 @@ var UIWorkerClient = function(topLevelNamespaces, mod, classname) {
var sender = Object.create(EventEmitter);
var _self = this;
this.$worker = {}
this.$worker = {};
this.$worker.terminate = function() {};
this.$worker.postMessage = function(e) {
_self.messageBuffer.push(e);