diff options
Diffstat (limited to 'js')
54 files changed, 1028 insertions, 1047 deletions
diff --git a/js/assets/icejs.css b/js/assets/icejs.css index 72fbd4c1fdc..5ed4dc729a5 100644 --- a/js/assets/icejs.css +++ b/js/assets/icejs.css @@ -8,7 +8,7 @@ // *********************************************************************/ .noUiSlider{ margin-top:7px; } -#wss, #loop{ margin-top:10px;} +#wss, #loop, #worker{ margin-top:10px;} #progress .icon { margin-left:10px; margin-top: 5px; } #progress .text { margin-left:25px; } diff --git a/js/bin/HttpServer.js b/js/bin/HttpServer.js index 7dd5a2241ce..39a5e8c7e05 100644 --- a/js/bin/HttpServer.js +++ b/js/bin/HttpServer.js @@ -13,18 +13,7 @@ var http = require("http"); var https = require("https"); var path = require("path"); var url = require("url"); - -function isdir(p) -{ - try - { - return fs.statSync(path.join(p)).isDirectory(); - } - catch(e) - { - } - return false; -} +var hogan = require("hogan.js"); function Init() { @@ -37,11 +26,24 @@ function Init() json: "application/json", }; + var TestData = + { + languages: [{value: "cpp", name: "C++"}, {value: "java", name: "Java"}] + }; + if(process.platform == "win32") + { + serverLanguages.languages.push({value: "csharp", name: "C#"}); + } + var libraries = ["/lib/Ice.js", "/lib/Ice.min.js", "/lib/Glacier2.js", "/lib/Glacier2.min.js", "/lib/IceStorm.js", "/lib/IceStorm.min.js", "/lib/IceGrid.js", "/lib/IceGrid.min.js",]; + TestData.TestCases = fs.readFileSync(path.join(__dirname, "..", "test", "Common", "TestCases.json"), "utf8"); + var TestCases = JSON.parse(TestData.TestCases); + TestData.tests = Object.keys(TestCases); + var template = hogan.compile(fs.readFileSync(path.join(__dirname, "..", "test", "Common", "index.html"), "utf8")); var libraryMaps = libraries.map( function(f) { @@ -50,168 +52,250 @@ function Init() var HttpServer = function(host, ports) { - this._host = host; - this._ports = ports; this._basePath = path.resolve(path.join(__dirname, "..")); }; HttpServer.prototype.processRequest = function(req, res) { - var iceLib = libraries.indexOf(req.url.pathname) !== -1; - var iceLibMap = libraryMaps.indexOf(req.url.pathname) !== -1; - - var basePath = (process.env.USE_BIN_DIST == "yes" && (iceLib || iceLibMap)) ? - path.resolve(path.join(require.resolve("ice"), "..", "..")) : this._basePath; - - var filePath = path.resolve(path.join(basePath, req.url.pathname)); - - // - // If OPTIMIZE is set resolve Ice libraries to the corresponding minified - // versions. - // - if(process.env.OPTIMIZE == "yes") + var match = req.url.pathname.match("^\/test/(.*)/index\.html"); + if(match) { - if(iceLib && filePath.substr(-7) !== ".min.js") + // That is a test case + var testCase = TestCases[match[1]]; + if(testCase === undefined) { - filePath = filePath.replace(".js", ".min.js"); + res.writeHead(404); + res.end("404 Page Not Found"); + console.log("HTTP/404 (Page Not Found)" + req.method + " " + req.url.pathname); } - else if(iceLibMap && filePath.substr(-11) !== ".min.js.map") + else { - filePath = filePath.replace(".js.map", ".min.js.map"); - } - } - - var ext = path.extname(filePath).slice(1); + TestData.current = match[1]; + if(req.url.query.next == "true") + { + var testCase = TestData.tests[0]; + var language = req.url.query.language !== undefined ? req.url.query.language : "cpp"; + var protocol = req.url.protocol; + var i = TestData.tests.indexOf(TestData.current); + var worker = req.url.query.worker == "true"; - // - // When the browser ask for a .js or .css file and it has support for gzip content - // check if a gzip version (.js.gz or .css.gz) of the file exists and use that instead. - // - if((ext == "js" || ext == "css" || ext == "map") && req.headers["accept-encoding"].indexOf("gzip") !== -1) - { - fs.stat(filePath + ".gz", - function(err, stats) + if(i < TestData.tests.length - 1) { - if(err || !stats.isFile()) - { - fs.stat(filePath, - function(err, stats) - { - doRequest(err, stats, filePath); - }); - } - else - { - doRequest(err, stats, filePath + ".gz"); - } - }); - } - else - { - fs.stat(filePath, - function(err, stats) + testCase = TestData.tests[i + 1]; + } + else if(!worker) + { + worker = true; + } + else if(protocol == "http") + { + protocol = "https"; + } + else + { + var languages = TestData.languages.map(function(o) { return o.value; }); + var j = languages.indexOf(language); + language = languages[j == languages.length - 1 ? 0 : j + 1]; + worker = false; + protocol = "http"; + } + + var location = url.format( { - doRequest(err, stats, filePath); + protocol: protocol, + hostname: req.headers.host.split(":")[0], + port: (protocol == "http" ? 8080 : 9090), + pathname: ("/test/" + testCase + "/index.html"), + query:{loop: "true", language: language, worker: worker} }); - } - var doRequest = function(err, stats, filePath) - { - if(err) - { - if(err.code === "ENOENT") - { - res.writeHead(404); - res.end("404 Page Not Found"); - console.log("HTTP/404 (Page Not Found)" + req.method + " " + req.url.pathname + " -> " + filePath); + res.writeHead(302, {"Location": location}); + res.end(); + console.log("HTTP/302 (Redierct) -> " + location); } else { - res.writeHead(500); - res.end("500 Internal Server Error"); - console.log("HTTP/500 (Internal Server Error) " + req.method + " " + req.url.pathname + " -> " + - filePath); + if(req.url.query.worker != "true") + { + TestData.scripts = + [ + "/lib/Ice.js", + "/test/Common/TestRunner.js", + "/test/Common/TestSuite.js", + "/test/Common/Controller.js" + ].concat(testCase.files); + } + else + { + TestData.scripts = + [ + "/test/Common/TestSuite.js" + ]; + } + res.writeHead(200, {"Content-Type": "text/html"}); + res.end(template.render(TestData)); + console.log("HTTP/200 (Ok)" + req.method + " " + req.url.pathname); } } - else + } + else + { + var iceLib = libraries.indexOf(req.url.pathname) !== -1; + var iceLibMap = libraryMaps.indexOf(req.url.pathname) !== -1; + + var basePath = (process.env.USE_BIN_DIST == "yes" && (iceLib || iceLibMap)) ? + path.resolve(path.join(require.resolve("ice"), "..", "..")) : this._basePath; + + var filePath = path.resolve(path.join(basePath, req.url.pathname)); + + // + // If OPTIMIZE is set resolve Ice libraries to the corresponding minified + // versions. + // + if(process.env.OPTIMIZE == "yes") { - if(req.url.pathname === '/') + if(iceLib && filePath.substr(-7) !== ".min.js") { - res.writeHead(302, - { - "Location": "test/Ice/acm/index.html" - }); - res.end(); - console.log("HTTP/302 (Found) " + req.method + " " + req.url.pathname + " -> " + - "test/Ice/acm/index.html"); + filePath = filePath.replace(".js", ".min.js"); } - else if(!stats.isFile()) + else if(iceLibMap && filePath.substr(-11) !== ".min.js.map") { - res.writeHead(403); - res.end("403 Forbiden"); - console.log("HTTP/403 (Forbiden) " + req.method + " " + req.url.pathname + " -> " + filePath); + filePath = filePath.replace(".js.map", ".min.js.map"); } - else - { - // - // Create a md5 using the stats attributes - // to be used as Etag header. - // - var hash = crypto.createHash("md5"); - hash.update(stats.ino.toString()); - hash.update(stats.mtime.toString()); - hash.update(stats.size.toString()); + } - var headers = - { - "Content-Type": MimeTypes[ext] || "text/plain", - "Content-Length": stats.size, - "Etag": hash.digest("hex") - }; + var ext = path.extname(filePath).slice(1); - if(path.extname(filePath).slice(1) == "gz") + // + // When the browser ask for a .js or .css file and it has support for gzip content + // check if a gzip version (.js.gz or .css.gz) of the file exists and use that instead. + // + if((ext == "js" || ext == "css" || ext == "map") && req.headers["accept-encoding"].indexOf("gzip") !== -1) + { + fs.stat(filePath + ".gz", + function(err, stats) + { + if(err || !stats.isFile()) + { + fs.stat(filePath, + function(err, stats) + { + doRequest(err, stats, filePath); + }); + } + else + { + doRequest(err, stats, filePath + ".gz"); + } + }); + } + else + { + fs.stat(filePath, + function(err, stats) + { + doRequest(err, stats, filePath); + }); + } + + var doRequest = function(err, stats, filePath) + { + if(err) + { + if(err.code === "ENOENT") { - headers["Content-Encoding"] = "gzip"; + res.writeHead(404); + res.end("404 Page Not Found"); + console.log("HTTP/404 (Page Not Found)" + req.method + " " + req.url.pathname + " -> " + filePath); } - - // - // Check for conditional request header if-none-match. - // - var modified = true; - if(req.headers["if-none-match"] !== undefined) + else { - modified = req.headers["if-none-match"].split(" ").every( - function(element, index, array) - { - return element !== headers.Etag; - }); + res.writeHead(500); + res.end("500 Internal Server Error"); + console.log("HTTP/500 (Internal Server Error) " + req.method + " " + req.url.pathname + " -> " + + filePath); } - - // - // Not Modified - // - if(!modified) + } + else + { + if(req.url.pathname === '/') { - res.writeHead(304, headers); + res.writeHead(302, + { + "Location": "/test/Ice/acm/index.html" + }); res.end(); - console.log("HTTP/304 (Not Modified) " + req.method + " " + req.url.pathname + " -> " + filePath); + console.log("HTTP/302 (Found) " + req.method + " " + req.url.pathname + " -> " + + "/test/Ice/acm/index.html"); + } + else if(!stats.isFile()) + { + res.writeHead(403); + res.end("403 Forbiden"); + console.log("HTTP/403 (Forbiden) " + req.method + " " + req.url.pathname + " -> " + filePath); } else { - res.writeHead(200, headers); - if(req.method === "HEAD") + // + // Create a md5 using the stats attributes + // to be used as Etag header. + // + var hash = crypto.createHash("md5"); + hash.update(stats.ino.toString()); + hash.update(stats.mtime.toString()); + hash.update(stats.size.toString()); + + var headers = + { + "Content-Type": MimeTypes[ext] || "text/plain", + "Content-Length": stats.size, + "Etag": hash.digest("hex") + }; + + if(path.extname(filePath).slice(1) == "gz") + { + headers["Content-Encoding"] = "gzip"; + } + + // + // Check for conditional request header if-none-match. + // + var modified = true; + if(req.headers["if-none-match"] !== undefined) { + modified = req.headers["if-none-match"].split(" ").every( + function(element, index, array) + { + return element !== headers.Etag; + }); + } + + // + // Not Modified + // + if(!modified) + { + res.writeHead(304, headers); res.end(); + console.log("HTTP/304 (Not Modified) " + req.method + " " + req.url.pathname + " -> " + filePath); } else { - fs.createReadStream(filePath, { "bufferSize": 4 * 1024 }).pipe(res); + res.writeHead(200, headers); + if(req.method === "HEAD") + { + res.end(); + } + else + { + fs.createReadStream(filePath, { "bufferSize": 4 * 1024 }).pipe(res); + } + console.log("HTTP/200 (Ok) " + req.method + " " + req.url.pathname + " -> " + filePath); } - console.log("HTTP/200 (Ok) " + req.method + " " + req.url.pathname + " -> " + filePath); } } - } - }; + }; + } }; HttpServer.prototype.start = function() @@ -223,34 +307,36 @@ function Init() }); var self = this; - [httpServer, httpsServer].forEach(function(server) - { - server.on("request", function(req, res) - { - // - // Dummy data callback required so request end event is emitted. - // - var dataCB = function(data) - { - }; - - var endCB = function() - { - req.url = url.parse(req.url); - self.processRequest(req, res); - }; - req.on("data", dataCB); - req.on("end", endCB); - }); - }); + function createServerHandler(server, port, host) + { + server.on("request", + function(req, res) + { + // + // Dummy data callback required so request end event is emitted. + // + var dataCB = function(data) + { + }; + var endCB = function() + { + req.url = url.parse(req.url, true); + req.url.protocol = port == 8080 ? "http" : "https"; + self.processRequest(req, res); + }; + req.on("data", dataCB); + req.on("end", endCB); + }); + server.listen(port, host); + } - httpServer.listen(8080, this._host); - httpsServer.listen(9090, this._host); + createServerHandler(httpServer, 8080, "0.0.0.0"); + createServerHandler(httpsServer, 9090, "0.0.0.0"); console.log("listening on ports 8080 (http) and 9090 (https)..."); }; - new HttpServer("0.0.0.0", [8080, 9090]).start(); + new HttpServer().start(); } module.exports = Init; diff --git a/js/bower.json b/js/bower.json index b8ef141ebb1..111e8c15b0b 100644 --- a/js/bower.json +++ b/js/bower.json @@ -2,11 +2,12 @@ "name": "ice", "private": true, "dependencies": { + "animo.js": "~1.0.2", "foundation": "~5.5.0", + "highlightjs": "~8.4.0", "jquery": "~2.1.3", - "animo.js": "~1.0.2", - "spin.js": "~2.0.2", "nouislider": "~7.0.10", - "highlightjs": "~8.4.0" + "spin.js": "~2.0.2", + "URIjs": "uri.js#~1.16.0" } } diff --git a/js/gulp/bundle.js b/js/gulp/bundle.js index 83db50b0a6c..2e92e426165 100644 --- a/js/gulp/bundle.js +++ b/js/gulp/bundle.js @@ -322,11 +322,11 @@ function bundle(args) var sb = new StringBuffer(); sb.write(preamble); - lineOffset += 2; - + sb.write(" var __root = typeof(window) !== \"undefined\" ? window : self;\n"); + lineOffset += 3; args.modules.forEach( function(m){ - sb.write(" window." + m + " = window." + m + " || {};\n"); + sb.write(" __root." + m + " = __root." + m + " || {};\n"); lineOffset++; if(m == "Ice") @@ -455,11 +455,11 @@ function bundle(args) lineOffset++; // - // Now exports the modules to the global Window object. + // Now exports the modules to the global object. // args.modules.forEach( function(m){ - sb.write(" window." + m + " = " + m + ";\n"); + sb.write(" __root." + m + " = " + m + ";\n"); lineOffset++; }); diff --git a/js/gulpfile.js b/js/gulpfile.js index 049c4afa22a..714efec8747 100644 --- a/js/gulpfile.js +++ b/js/gulpfile.js @@ -85,6 +85,7 @@ var common = { "bower_components/animo.js/animo.js", "bower_components/spin.js/spin.js", "bower_components/spin.js/jquery.spin.js", + "bower_components/URIjs/src/URI.js", "bower_components/highlightjs/highlight.pack.js", "assets/icejs.js" ], @@ -164,32 +165,6 @@ function testTask(name) { return name.replace("/", "_"); } function testWatchTask(name) { return testTask(name) + ":watch"; } function testCleanDependTask(name) { return testTask(name) + "-depend:clean"; } function testCleanTask(name) { return testTask(name) + ":clean"; } -function testHtmlTask(name) { return testTask(name) + ":html"; } -function testHtmlCleanTask(name) { return testTask(name) + ":html:clean"; } - -tests.forEach( - function(name){ - gulp.task(testHtmlTask(name), [], - function(){ - return gulp.src("test/Common/index.html") - .pipe(newer(path.join(name, "index.html"))) - .pipe(gulp.dest(path.join(name))); - }); - - gulp.task(testHtmlCleanTask(name), [], - function(){ - del(path.join(name, "index.html")); - }); - }); - -gulp.task("html", tests.map(testHtmlTask)); - -gulp.task("html:watch", ["html"], - function(){ - gulp.watch(["test/Common/index.html"], ["html"]); - }); - -gulp.task("html:clean", tests.map(testHtmlCleanTask)); tests.forEach( function(name){ @@ -204,13 +179,12 @@ tests.forEach( .pipe(gulp.dest(name)); }); - gulp.task(testWatchTask(name), [testTask(name), "html"], + gulp.task(testWatchTask(name), [testTask(name)], function(){ gulp.watch([path.join(name, "*.ice")], [testTask(name)]); gulp.watch( - [path.join(name, "*.js"), path.join(name, "browser", "*.js"), - path.join(name, "*.html")]); + [path.join(name, "*.js"), path.join(name, "browser", "*.js")]); }); gulp.task(testCleanDependTask(name), [], @@ -227,14 +201,12 @@ tests.forEach( }); }); -gulp.task("test", tests.map(testTask).concat( - ["common:slice", "common:js", "common:css"].concat(tests.map(testHtmlTask)))); +gulp.task("test", tests.map(testTask).concat(["common:slice", "common:js", "common:css"])); gulp.task("test:watch", tests.map(testWatchTask).concat( - ["common:slice:watch", "common:css:watch", "common:js:watch", "html:watch"])); + ["common:slice:watch", "common:css:watch", "common:js:watch"])); -gulp.task("test:clean", tests.map(testCleanTask).concat( - tests.map(testHtmlCleanTask).concat(["common:slice:clean"]))); +gulp.task("test:clean", tests.map(testCleanTask).concat(["common:slice:clean"])); // // Tasks to build IceJS Distribution @@ -373,17 +345,7 @@ gulp.task("watch", ["test:watch"].concat(useBinDist ? [] : ["dist:watch"])); gulp.task("test:run-with-browser", ["watch"].concat(useBinDist ? ["test"] : ["build"]), function(){ - var serverLanguages = - { - languages: [{value: "cpp", name: "C++"}, {value: "java", name: "Java"}] - }; - if(process.platform == "win32") - { - serverLanguages.languages.push({value: "csharp", name: "C#"}); - } - fs.writeFileSync("server-languages.json", JSON.stringify(serverLanguages, null, 4)); require("./bin/HttpServer")(); - var cmd = ["../scripts/TestController.py"] cmd = cmd.concat(process.argv.slice(3)) var p = require("child_process").spawn("python", cmd, {stdio: "inherit"}); @@ -408,7 +370,7 @@ gulp.task("test:run-with-browser", ["watch"].concat(useBinDist ? ["test"] : ["bu { p.kill(); }); - return gulp.src("./test/Ice/acm/index.html") + return gulp.src("./test/Common/index.html") .pipe(open("", {url: "http://127.0.0.1:8080/test/Ice/acm/index.html"})); }); diff --git a/js/package.json b/js/package.json index 3795974d300..83f0f87fe8c 100644 --- a/js/package.json +++ b/js/package.json @@ -31,6 +31,7 @@ "gulp-uglify": "^1.2.0", "gulp-util": "^3.0.5", "gulp-watch": "^4.2.4", + "hogan.js": "^3.0.2", "http-proxy": "^1.11.1", "source-map": "^0.4.2", "through2": "^0.6.5", diff --git a/js/src/Ice/browser/ModuleRegistry.js b/js/src/Ice/browser/ModuleRegistry.js index 2f64dd42c4d..18945d27d91 100644 --- a/js/src/Ice/browser/ModuleRegistry.js +++ b/js/src/Ice/browser/ModuleRegistry.js @@ -7,21 +7,25 @@ // // ********************************************************************** +/* globals self */ +var __root = typeof(window) !== "undefined" ? window : self; +/* globals -self */ + var __M = { module: function(name) { - var m = window[name]; + var m = __root[name]; if(m === undefined) { m = {}; - window[name] = m; + __root[name] = m; } return m; }, require: function(name) { - return window; + return __root; }, type: function(scoped) { @@ -30,7 +34,7 @@ var __M = return undefined; } var components = scoped.split("."); - var T = window; + var T = __root; for(var i = 0, length = components.length; i < length; ++i) { @@ -48,7 +52,7 @@ var Ice = __M.module("Ice"); Ice.__require = function() { - return window; + return __root; }; Ice.Slice = Ice.Slice || {}; diff --git a/js/src/Ice/browser/TimerUtil.js b/js/src/Ice/browser/TimerUtil.js index 5d9d498cd3d..698350d9dc5 100644 --- a/js/src/Ice/browser/TimerUtil.js +++ b/js/src/Ice/browser/TimerUtil.js @@ -17,9 +17,9 @@ var Ice = require("../Ice/ModuleRegistry").Ice; // -// Create a timer object that uses the default browser methods. Note that we also -// have to use apply with null as the first argument to workaround an issue where -// IE doesn't like these functions to be called with an unknown object (it reports +// Create a timer object that uses the default browser methods. Note that we also +// have to use apply with null as the first argument to workaround an issue where +// IE doesn't like these functions to be called with an unknown object (it reports // an "Invalid calling object" error). // function createTimerObject() @@ -29,11 +29,12 @@ function createTimerObject() Timer.clearTimeout = function () { clearTimeout.apply(null, arguments); }; Timer.setInterval = function () { setInterval.apply(null, arguments); }; Timer.clearInterval = function () { clearInterval.apply(null, arguments); }; - Timer.setImmediate = function () { setImmediate.apply(null, arguments); }; + Timer.setImmediate = typeof(setImmediate) == "function" ? + function () { setImmediate.apply(null, arguments); } : function() { setTimeout.apply(null, arguments); }; return Timer; } -if(typeof WorkerGlobalScope !== 'undefined' && this instanceof WorkerGlobalScope) +if(typeof(WorkerGlobalScope) !== 'undefined' && this instanceof WorkerGlobalScope) { // // If running in a worker we don't need to create a separate worker for the timers diff --git a/js/test/Common/Common.js b/js/test/Common/Common.js index d2bb087dd4f..c6887ab975a 100644 --- a/js/test/Common/Common.js +++ b/js/test/Common/Common.js @@ -7,44 +7,38 @@ // // ********************************************************************** -(function(module, require, exports){ - var Ice = require("ice").Ice; +/* globals -Ice*/ +var Ice = require("ice").Ice; - var write = function(msg) - { - process.stdout.write(msg); - }; +var write = function(msg) +{ + process.stdout.write(msg); +}; - var writeLine = function(msg) - { - this.write(msg + "\n"); - }; +var writeLine = function(msg) +{ + this.write(msg + "\n"); +}; - var run = function(m) - { - var id = new Ice.InitializationData(); - id.properties = Ice.createProperties(process.argv); - - var test = m.require("./Client").__test__; - - test({write: write, writeLine: writeLine}, id).exception( - function(ex, r) +var run = function(m) +{ + var id = new Ice.InitializationData(); + id.properties = Ice.createProperties(process.argv); + var test = m.require("./Client").__test__; + test({write: write, writeLine: writeLine}, id).exception( + function(ex, r) + { + console.log(ex.toString()); + if(r instanceof Ice.AsyncResult) + { + console.log("\nexception occurred in call to " + r.operation); + } + if(ex.stack) { - console.log(ex.toString()); - if(r instanceof Ice.AsyncResult) - { - console.log("\nexception occurred in call to " + r.operation); - } - if(ex.stack) - { - console.log(ex.stack); - } - process.exit(1); - }); - }; + console.log(ex.stack); + } + process.exit(1); + }); +}; - exports.run = run; -} -(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); +exports.run = run; diff --git a/js/test/Common/TestCases.json b/js/test/Common/TestCases.json new file mode 100644 index 00000000000..63aad046a21 --- /dev/null +++ b/js/test/Common/TestCases.json @@ -0,0 +1,231 @@ +{ + "Ice/acm": + { + "files": ["Test.js", "Client.js"] + }, + "Ice/ami": + { + "files": ["Test.js", "Client.js"] + }, + "Ice/binding": + { + "files": ["Test.js", "Client.js"] + }, + "Ice/defaultValue": + { + "files": ["Test.js", "Client.js"] + }, + "Ice/enums": + { + "files": ["Test.js", "Client.js"], + "configurations": + [ + { + "name": "1.0 encoding", + "args": ["--Ice.Default.EncodingVersion=1.0"] + }, + { + "name": "1.1 encoding" + } + ] + }, + "Ice/exceptions": + { + "files": ["Test.js", "Client.js"], + "configurations": + [ + { + "name": "compact (default) format" + }, + { + "name": "sliced format", + "args": ["--Ice.Default.SlicedFormat"] + }, + { + "name": "1.0 encoding", + "args": ["--Ice.Default.EncodingVersion=1.0"] + }, + { + "name": "compact (default) format and AMD server" + }, + { + "name": "sliced format and AMD server.", + "args": ["--Ice.Default.SlicedFormat"] + }, + { + "name": "1.0 encoding and AMD server", + "args": ["--Ice.Default.EncodingVersion=1.0"] + } + ] + }, + "Ice/exceptionsBidir": + { + "files": ["Test.js", "TestAMD.js", "ThrowerI.js", "AMDThrowerI.js", + "../exceptions/Client.js", "Client.js"] + }, + "Ice/facets": + { + "files": ["Test.js", "Client.js"] + }, + "Ice/facetsBidir": + { + "files": ["Test.js", "TestI.js", "../facets/Client.js", "Client.js"] + }, + "Ice/hold": + { + "files": ["Test.js", "Client.js"] + }, + "Ice/info": + { + "files": ["Test.js", "Client.js"] + }, + "Ice/inheritance": + { + "files": ["Test.js", "Client.js"] + }, + "Ice/inheritanceBidir": + { + "files": ["Test.js", "InitialI.js", "../inheritance/Client.js", "Client.js"] + }, + "Ice/operations": + { + "files": ["Test.js", "Twoways.js", "Oneways.js", "BatchOneways.js", "Client.js"], + "configurations": + [ + { + "name": "regular server" + }, + { + "name": "AMD server" + }, + { + "name": "TIE server", + "langs": ["java", "csharp"] + }, + { + "name": "AMD TIE server", + "langs": ["java", "csharp"] + } + ] + }, + "Ice/operationsBidir": + { + "files": ["Test.js", "TestAMD.js", "../operations/Twoways.js", "../operations/Oneways.js", + "../operations/BatchOneways.js", "MyDerivedClassI.js", "AMDMyDerivedClassI.js", + "../operations/Client.js", "Client.js"] + }, + "Ice/objects": + { + "files": ["Test.js", "Client.js"], + "configurations": + [ + { + "name": "compact (default) format" + }, + { + "name": "sliced format", + "args": ["--Ice.Default.SlicedFormat"] + }, + { + "name": "1.0 encoding", + "args": ["--Ice.Default.EncodingVersion=1.0"] + } + ] + }, + "Ice/optional": + { + "files": ["Test.js", "Client.js"], + "configurations": + [ + { + "name": "compact (default) format" + }, + { + "name": "sliced format", + "args": ["--Ice.Default.SlicedFormat"] + }, + { + "name": "AMD server" + } + ] + }, + "Ice/optionalBidir": + { + "files": ["Test.js", "TestAMD.js", "InitialI.js", "AMDInitialI.js", "../optional/Client.js", "Client.js"] + }, + "Ice/promise": + { + "files": ["Client.js"] + }, + "Ice/properties": + { + "files": ["Client.js"] + }, + "Ice/proxy": + { + "files": ["Test.js", "Client.js"], + "configurations": + [ + { + "name": "regular server" + }, + { + "name": "AMD server" + } + ] + }, + "Ice/retry": + { + "files": ["Test.js", "Client.js"] + }, + "Ice/slicing/exceptions": + { + "files": ["Test.js", "Client.js"], + "configurations": + [ + { + "name": "sliced format" + }, + { + "name": "1.0 encoding", + "args": ["--Ice.Default.EncodingVersion=1.0"] + }, + { + "name": "sliced format and AMD server" + }, + { + "name": "1.0 encoding and AMD server", + "args": ["--Ice.Default.EncodingVersion=1.0"] + } + ] + }, + "Ice/slicing/objects": + { + "files": ["Test.js", "Client.js"], + "configurations": + [ + { + "name": "sliced format" + }, + { + "name": "1.0 encoding", + "args": ["--Ice.Default.EncodingVersion=1.0"] + }, + { + "name": "sliced format and AMD server" + }, + { + "name": "1.0 encoding and AMD server", + "args": ["--Ice.Default.EncodingVersion=1.0"] + } + ] + }, + "Ice/timeout": + { + "files": ["Test.js", "Client.js"] + }, + "Ice/number": + { + "files": ["Client.js"] + } +}
\ No newline at end of file diff --git a/js/test/Common/TestRunner.js b/js/test/Common/TestRunner.js new file mode 100644 index 00000000000..37d3684dc4a --- /dev/null +++ b/js/test/Common/TestRunner.js @@ -0,0 +1,154 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + + + /* global + __runEchoServerOptions__ : false, + __test__ : false, + Test : false, +*/ + +function runTest(name, language, defaultHost, protocol, configurations, out) +{ + var server, communicator; + var id = new Ice.InitializationData(); + id.properties = Ice.createProperties(); + id.properties.setProperty("Ice.Default.Host", defaultHost); + id.properties.setProperty("Ice.Default.Protocol", protocol); + + return Ice.Promise.try( + function() + { + if(typeof(__runServer__) !== "undefined" || typeof(__runEchoServer__) !== "undefined") + { + communicator = Ice.initialize(); + var str = protocol == "ws" ? "controller:ws -h " + defaultHost + " -p 15002" : + "controller:wss -h " + defaultHost + " -p 15003"; + + var controller = Test.Common.ControllerPrx.uncheckedCast(communicator.stringToProxy(str)); + + var options = []; + var srv = typeof(__runEchoServer__) !== "undefined" ? "Ice/echo" : name; + if(typeof(__runEchoServerOptions__) !== "undefined") + { + options = options.concat(__runEchoServerOptions__); + } + out.write("starting " + srv + " server... "); + return controller.runServer(language, srv, protocol, defaultHost, false, options).then( + function(proxy) + { + var ref = proxy.ice_getIdentity().name + ":" + protocol + " -h " + defaultHost + " -p " + + (protocol == "ws" ? "15002" : "15003"); + out.writeLine("ok"); + server = Test.Common.ServerPrx.uncheckedCast(communicator.stringToProxy(ref)); + + if(configurations === undefined) + { + return server.waitForServer().then( + function() + { + return __test__(out, id); + }); + } + else + { + var prev = new Ice.Promise().succeed(); + configurations.forEach( + function(configuration) + { + if(configuration.langs && configuration.langs.indexOf(language) == -1) + { + return prev; + } + prev = prev.then( + function() + { + out.writeLine("Running test with " + configuration.name + "."); + return server.waitForServer().then( + function() + { + var initData = id.clone(); + if(configuration.args !== undefined) + { + initData.properties = Ice.createProperties(configuration.args, id.properties); + } + return __test__(out, initData); + }); + }); + }); + return prev; + } + }, + function(ex) + { + out.writeLine("failed! (" + ex + ")"); + throw ex; + } + ).then( + function() + { + if(server) + { + return server.waitTestSuccess(); + } + } + ).exception( + function(ex) + { + if(server) + { + return server.terminate().then( + function() + { + throw ex; + }, + function() + { + throw ex; + }); + } + else + { + throw ex; + } + }); + } + else + { + return __test__(out, id); + } + } + ).finally( + function() + { + if(communicator) + { + return communicator.destroy(); + } + } + ).then( + function() + { + return true; + }, + function(ex, r) + { + out.writeLine(""); + if(r instanceof Ice.AsyncResult) + { + out.writeLine("exception occurred in call to " + r.operation); + } + out.writeLine(ex.toString()); + if(ex.stack) + { + out.writeLine(ex.stack); + } + return false; + }); +} diff --git a/js/test/Common/TestSuite.js b/js/test/Common/TestSuite.js index 7d1d38576c4..5add8b9cffd 100644 --- a/js/test/Common/TestSuite.js +++ b/js/test/Common/TestSuite.js @@ -11,286 +11,16 @@ __runEchoServerOptions__ : false, __test__ : false, Test : false, + URI : false, + current : false, + TestCases : false, + runTest: false */ -var communicator = Ice.initialize(); - - $(document).foundation(); $(document).ready( function(){ - - /* jshint browser:true, jquery:true */ - var TestCases = { - "Ice/acm": - { - files: ["Test.js", "Client.js"] - }, - "Ice/ami": - { - files: ["Test.js", "Client.js"] - }, - "Ice/binding": - { - files: ["Test.js", "Client.js"] - }, - "Ice/defaultValue": - { - files: ["Test.js", "Client.js"] - }, - "Ice/enums": - { - files: ["Test.js", "Client.js"], - configurations: - [ - { - name: "1.0 encoding", args: ["--Ice.Default.EncodingVersion=1.0"] - }, - { - name: "1.1 encoding" - }, - ] - }, - "Ice/exceptions": - { - files: ["Test.js", "Client.js"], - configurations: - [ - { - name: "compact (default) format" - }, - { - name: "sliced format", args: ["--Ice.Default.SlicedFormat"] - }, - { - name: "1.0 encoding", args: ["--Ice.Default.EncodingVersion=1.0"] - }, - { - name: "compact (default) format and AMD server" - }, - { - name: "sliced format and AMD server.", args: ["--Ice.Default.SlicedFormat"] - }, - { - name: "1.0 encoding and AMD server", args: ["--Ice.Default.EncodingVersion=1.0"] - } - ] - }, - "Ice/exceptionsBidir": - { - files: ["Test.js", "TestAMD.js", "ThrowerI.js", "AMDThrowerI.js", - "../exceptions/Client.js", "Client.js"], - }, - "Ice/facets": - { - files: ["Test.js", "Client.js"] - }, - "Ice/facetsBidir": - { - files: ["Test.js", "TestI.js", "../facets/Client.js", "Client.js"] - }, - "Ice/hold": - { - files: ["Test.js", "Client.js"] - }, - "Ice/info": - { - files: ["Test.js", "Client.js"] - }, - "Ice/inheritance": - { - files: ["Test.js", "Client.js"] - }, - "Ice/inheritanceBidir": - { - files: ["Test.js", "InitialI.js", "../inheritance/Client.js", "Client.js"], - }, - "Ice/operations": - { - files: ["Test.js", "Twoways.js", "Oneways.js", "BatchOneways.js", "Client.js"], - configurations: - [ - { - name: "regular server" - }, - { - name: "AMD server" - }, - { - name: "TIE server", langs: ["java", "csharp"] - }, - { - name: "AMD TIE server", langs: ["java", "csharp"] - } - ] - }, - "Ice/operationsBidir": - { - files: ["Test.js", "TestAMD.js", "../operations/Twoways.js", "../operations/Oneways.js", - "../operations/BatchOneways.js", "MyDerivedClassI.js", "AMDMyDerivedClassI.js", - "../operations/Client.js", "Client.js"] - }, - "Ice/objects": - { - files: ["Test.js", "Client.js"], - configurations: - [ - { - name: "compact (default) format" - }, - { - name: "sliced format", args: ["--Ice.Default.SlicedFormat"] - }, - { - name: "1.0 encoding", args: ["--Ice.Default.EncodingVersion=1.0"] - } - ] - }, - "Ice/optional": - { - files: ["Test.js", "Client.js"], - configurations: - [ - { - name: "compact (default) format" - }, - { - name: "sliced format", args: ["--Ice.Default.SlicedFormat"] - }, - { - name: "AMD server" - } - ] - }, - "Ice/optionalBidir": - { - files: ["Test.js", "TestAMD.js", "InitialI.js", "AMDInitialI.js", "../optional/Client.js", - "Client.js"] - }, - "Ice/promise": - { - files: ["Client.js"] - }, - "Ice/properties": - { - files: ["Client.js"] - }, - "Ice/proxy": - { - files: ["Test.js", "Client.js"], - configurations: - [ - { - name: "regular server" - }, - { - name: "AMD server" - } - ] - }, - "Ice/retry": - { - files: ["Test.js", "Client.js"] - }, - "Ice/slicing/exceptions": - { - files: ["Test.js", "Client.js"], - configurations: - [ - { - name: "sliced format" - }, - { - name: "1.0 encoding", args: ["--Ice.Default.EncodingVersion=1.0"] - }, - { - name: "sliced format and AMD server" - }, - { - name: "1.0 encoding and AMD server", args: ["--Ice.Default.EncodingVersion=1.0"] - } - ] - }, - "Ice/slicing/objects": - { - files: ["Test.js", "Client.js"], - configurations: - [ - { - name: "sliced format" - }, - { - name: "1.0 encoding", args: ["--Ice.Default.EncodingVersion=1.0"] - }, - { - name: "sliced format and AMD server" - }, - { - name: "1.0 encoding and AMD server", args: ["--Ice.Default.EncodingVersion=1.0"] - } - ] - }, - "Ice/timeout": - { - files: ["Test.js", "Client.js"] - }, - "Ice/number": - { - files: ["Client.js"] - }, - }; - - var current, next; - for(var testName in TestCases) - { - if(current) - { - next = testName; - break; - } - - if(document.location.pathname.indexOf(testName + "/index.html") !== -1) - { - current = testName; - } - } - $("#console").height(120); - $("#protocol").val(document.location.protocol == "https:" ? "wss" : "ws"); - for(var name in TestCases) - { - $("#test").append("<option value=\"/test/" + name + "/index.html\">" + name + "</option>"); - } - $("#test").val("/test/" + current + "/index.html"); - - var nextLanguage; - $.ajax( - { - url: "/server-languages.json", - dataType: "json" - } - ).done( - function(data) - { - data.languages.forEach( - function(lang) - { - $("#language").append("<option value=\"" + lang.value + "\">" + lang.name + "</option>"); - }); - - nextLanguage = function(language) - { - var i = 0; - for(; i < data.languages.length; ++i) - { - if(data.languages[i].value == language) - { - break; - } - } - return data.languages[i < data.languages.length - 1 ? i + 1 : 0].value; - }; - }); var out = { @@ -306,297 +36,178 @@ $(document).ready( } }; - var protocol; + var query = new URI(document.location.href).search(true); - $("#run").click(function(){ - if(!$(this).hasClass("disabled")) + $("#language").val(query.language !== undefined ? query.language : "cpp"); + $("#protocol").val(document.location.protocol == "http:" ? "ws" : "wss"); + $("#test").val("/test/" + current + "/index.html"); + $("#worker").prop("checked", query.worker == "true"); + $("#loop").prop("checked", query.loop == "true"); + + function nextTest() + { + document.location.assign(new URI() + .host(document.location.host) + .pathname($("#test").val()) + .search( + { + language: $("#language").val(), + worker: $("#worker").is(":checked"), + loop: $("#loop").is(":checked"), + next:"true" + }).toString()); + } + + function setRunning(running) + { + if(running) { $("#console").val(""); - $(this).addClass("disabled"); + $("#run").addClass("disabled"); $("#test").prop("disabled", "disabled"); $("#protocol").prop("disabled", "disabled"); $("#language").prop("disabled", "disabled"); - var defaultHost = document.location.hostname || "127.0.0.1"; - - protocol = $("#protocol").val(); - var id = new Ice.InitializationData(); - id.properties = Ice.createProperties(); - id.properties.setProperty("Ice.Default.Host", defaultHost); - id.properties.setProperty("Ice.Default.Protocol", protocol); - - var language = $("#language").val(); - - var str; - if(protocol == "ws") - { - str = "controller:ws -h " + defaultHost + " -p 15002"; - } - else - { - str = "controller:wss -h " + defaultHost + " -p 15003"; - } - var controller = Test.Common.ControllerPrx.uncheckedCast(communicator.stringToProxy(str)); + $("#worker").prop("disabled", "disabled"); + } + else + { + $("#test").prop("disabled", false); + $("#protocol").prop("disabled", false); + $("#language").prop("disabled", false); + $("#worker").prop("disabled", false); + $("#run").removeClass("disabled"); + } + } + + function updateLocation() + { + document.location.assign(new URI() + .host(document.location.host) + .pathname($("#test").val()) + .search( + { + language: $("#language").val(), + worker: $("#worker").is(":checked"), + loop: $("#loop").is(":checked") + }).toString()); + } - var p; - var server; - var options = []; - if(typeof(__runServer__) !== "undefined" || typeof(__runEchoServer__) !== "undefined") + $("#run").click(function(){ + if(!$(this).hasClass("disabled")) + { + setRunning(true); + if($("#worker").is(":checked")) { - var srv; - if(typeof(__runEchoServer__) !== "undefined") + var worker = new Worker("/test/Common/Worker.js"); + worker.onmessage = function(e) { - srv = "Ice/echo"; - if(typeof(__runEchoServerOptions__) !== "undefined") + if(e.data.type == "Write") { - options = options.concat(__runEchoServerOptions__); + out.write(e.data.message); } - - } - else - { - srv = current; - } - out.write("starting " + srv + " server... "); - p = controller.runServer(language, srv, protocol, defaultHost, false, options).then( - function(proxy) + else if(e.data.type == "WriteLine") { - var ref = proxy.ice_getIdentity().name + ":" + protocol + " -h " + defaultHost + " -p " + - (protocol == "ws" ? "15002" : "15003"); - out.writeLine("ok"); - server = Test.Common.ServerPrx.uncheckedCast(communicator.stringToProxy(ref)); - - var testCase = TestCases[current]; - if(testCase.configurations === undefined) + out.writeLine(e.data.message); + } + else if(e.data.type == "TestFinished") + { + setRunning(false); + if(e.data.success && $("#loop").is(":checked")) { - return server.waitForServer().then( - function() - { - return __test__(out, id); - }); + nextTest(); } - else + else if(query.loop == "true") { - var prev = new Ice.Promise().succeed(); - testCase.configurations.forEach( - function(configuration) - { - if(configuration.langs && configuration.langs.indexOf(language) == -1) - { - return prev; - } - prev = prev.then( - function() - { - out.writeLine("Running test with " + configuration.name + "."); - return server.waitForServer().then( - function() - { - var initData = id.clone(); - if(configuration.args !== undefined) - { - initData.properties = Ice.createProperties(configuration.args, id.properties); - } - return __test__(out, initData); - }); - }); - }); - return prev; + updateLocation(); } - }, - function(ex) - { - out.writeLine("failed! (" + ex + ")"); - throw ex; } - ).then( - function() + }; + worker.postMessage( { - if(server) + type: "RunTest", + test: { - return server.waitTestSuccess(); + name: current, + language: $("#language").val(), + defaultHost: document.location.hostname || "127.0.0.1", + protocol: $("#protocol").val(), + configurations: TestCases[current].configurations, + files: TestCases[current].files } + }); + } + else + { + runTest(current, + $("#language").val(), + document.location.hostname || "127.0.0.1", + $("#protocol").val(), + TestCases[current].configurations, out).finally( + function() + { + setRunning(false); } - ).exception( - function(ex) + ).then( + function() { - if(server) + if($("#loop").is(":checked")) { - return server.terminate().then( - function() - { - throw ex; - }, - function() - { - throw ex; - }); + nextTest(); } - else + else if(query.loop == "true") { - throw ex; + updateLocation(); } }); } - else - { - p = __test__(out, id); - } - - p.finally( - function() - { - $("#test").prop("disabled", false); - $("#protocol").prop("disabled", false); - $("#language").prop("disabled", false); - $("#run").removeClass("disabled"); - } - ).then( - function() - { - if($("#loop").is(":checked")) - { - var href = document.location.protocol + "//" + document.location.host; - if(!next) - { - next = "Ice/acm"; - if(protocol == "ws") - { - protocol = "wss"; - href = href.replace("http", "https"); - href = href.replace("8080", "9090"); - } - else - { - protocol = "ws"; - href = href.replace("https", "http"); - href = href.replace("9090", "8080"); - language = nextLanguage(language); - } - } - - href += document.location.pathname.replace(current, next); - href += "?loop=true&language=" + language; - document.location.assign(href); - } - } - ).exception( - function(ex, r) - { - out.writeLine(""); - if(r instanceof Ice.AsyncResult) - { - out.writeLine("exception occurred in call to " + r.operation); - } - out.writeLine(ex.toString()); - if(ex.stack) - { - out.writeLine(ex.stack); - } - }); } return false; }); - // - // Test case - // $("#test").on("change", - function(e) - { - document.location.assign($(this).val() + "?language=" + $("#language").val()); - return false; - }); + function(e) + { + updateLocation(); + return false; + }); $("#language").on("change", - function(e) - { - document.location.assign(document.location.pathname + "?language=" + $("#language").val()); - return false; - }); + function(e) + { + updateLocation(); + return false; + }); + + $("#worker").on("change", + function(e) + { + updateLocation(); + return false; + }); - // - // Protocol - // $("#protocol").on("change", - function(e) - { - var newProtocol = $(this).val(); - if(protocol !== newProtocol) - { - var href = document.location.protocol + "//" + document.location.host + - document.location.pathname; - if(newProtocol == "ws") - { - href = href.replace("https", "http"); - href = href.replace("9090", "8080"); - } - else - { - href = href.replace("http", "https"); - href = href.replace("8080", "9090"); - } - href += "?language=" + $("#language").val(); - document.location.assign(href); - } - }); - - - $(this).addClass("disabled"); - $("#test").prop("disabled", "disabled"); - $("#protocol").prop("disabled", "disabled"); - $("#language").prop("disabled", "disabled"); - - var scripts = TestCases[current].files.slice(0); - var head = document.getElementsByTagName("head")[0]; - function loadScript() + function(e) + { + if((document.location.protocol == "http:" && $(this).val() == "wss") || + (document.location.protocol == "https:" && $(this).val() == "ws")) + { + document.location.assign( + new URI() + .protocol($(this).val() == "ws" ? "http" : "https") + .hostname(document.location.hostname) + .port($(this).val() == "ws" ? 8080 : 9090) + .search( + { + language: $("#language").val(), + worker: $("#worker").is(":checked") + })); + return false; + } + }); + + if($("#loop").is(":checked")) { - if(scripts.length === 0) - { - $("#test").prop("disabled", false); - $("#protocol").prop("disabled", false); - $("#language").prop("disabled", false); - $("#run").removeClass("disabled"); - - // - // Check if we should start the test loop=true - // - var href = document.location.href; - var i = href.indexOf("?"); - - var languageIdx = i !== -1 ? href.substr(i).indexOf("language=") : -1; - if(languageIdx !== -1) - { - $("#language").val(href.substr(i + languageIdx + 9)); - } - else - { - $("#language").val("cpp"); - } - - var autoStart = i !== -1 && href.substr(i).indexOf("loop=true") !== -1; - if(autoStart) - { - $("#loop").prop("checked", true); - $("#run").click(); - } - return; - } - - var script = document.createElement("script"); - script.type = "text/javascript"; - script.src = "/test/" + current + "/" + scripts.shift(); - - var loaded = false; - script.onload = script.onreadystatechange = function() - { - if(!loaded && (!this.readyState || this.readyState == "complete" || this.readyState == "loaded")) - { - loaded = true; - loadScript(); - } - }; - - head.appendChild(script); + $("#loop").prop("checked", true); + $("#run").click(); } - loadScript(); }); diff --git a/js/test/Common/Worker.js b/js/test/Common/Worker.js new file mode 100644 index 00000000000..861bd608c41 --- /dev/null +++ b/js/test/Common/Worker.js @@ -0,0 +1,45 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +/* global + self : false, + runTest : false +*/ + +var Output = +{ + write: function(msg) + { + self.postMessage({type:"Write", message:msg}); + }, + writeLine: function(msg) + { + self.postMessage({type:"WriteLine", message:msg}); + } +}; + +self.onmessage = function(e) +{ + if(e.data.type == "RunTest") + { + var test = e.data.test; + self.importScripts("/lib/Ice.js"); + self.importScripts("/test/Common/Controller.js"); + self.importScripts("/test/Common/TestRunner.js"); + for(var i = 0; i < test.files.length; ++i) + { + self.importScripts("/test/" + test.name + "/" + test.files[i]); + } + runTest(test.name, test.language, test.defaultHost, test.protocol, test.configurations, Output).then( + function(r) + { + self.postMessage({type:"TestFinished", success:r}); + }); + } +}; diff --git a/js/test/Common/index.html b/js/test/Common/index.html index fb26feb2447..8d0e21f4e47 100644 --- a/js/test/Common/index.html +++ b/js/test/Common/index.html @@ -8,9 +8,13 @@ <link rel="stylesheet" type="text/css" href="/assets/common.css"/> <script src="/assets/common.min.js"></script> - <script src="/lib/Ice.js"></script> - <script src="/test/Common/Controller.js"></script> - <script src="/test/Common/TestSuite.js"></script> + {{#scripts}} + <script src="{{.}}"></script> + {{/scripts}} + <script type="text/javascript"> + var current = "{{current}}"; + var TestCases = {{{TestCases}}}; + </script> </head> <body> <div id="header"> @@ -44,6 +48,9 @@ </div> <div class="small-9 columns"> <select id="test"> + {{#tests}} + <option value="/test/{{.}}/index.html">{{.}}</option> + {{/tests}} </select> </div> </div> @@ -53,6 +60,9 @@ </div> <div class="small-9 columns"> <select id="language"> + {{#languages}} + <option value="{{value}}">{{name}}</option> + {{/languages}} </select> </div> </div> @@ -69,6 +79,14 @@ </div> <div class="row"> <div class="small-3 columns"> + <label class="right inline" for="worker">Worker:</label> + </div> + <div class="small-9 columns"> + <input id="worker" type="checkbox"/> + </div> + </div> + <div class="row"> + <div class="small-3 columns"> <label class="right inline" for="loop">Loop:</label> </div> <div class="small-9 columns"> diff --git a/js/test/Glacier2/router/Client.js b/js/test/Glacier2/router/Client.js index 1f981582267..d3ce7c6220b 100644 --- a/js/test/Glacier2/router/Client.js +++ b/js/test/Glacier2/router/Client.js @@ -400,5 +400,5 @@ exports.__test__ = run; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/acm/Client.js b/js/test/Ice/acm/Client.js index 65628559651..81379ad2507 100644 --- a/js/test/Ice/acm/Client.js +++ b/js/test/Ice/acm/Client.js @@ -534,5 +534,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/ami/Client.js b/js/test/Ice/ami/Client.js index 69b443a3832..3f8e50b3399 100644 --- a/js/test/Ice/ami/Client.js +++ b/js/test/Ice/ami/Client.js @@ -518,5 +518,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/binding/Client.js b/js/test/Ice/binding/Client.js index ae19b4dd875..8d90abba6bb 100644 --- a/js/test/Ice/binding/Client.js +++ b/js/test/Ice/binding/Client.js @@ -29,6 +29,8 @@ return p; }; + var isBrowser = (typeof window !== 'undefined' || typeof WorkerGlobalScope !== 'undefined'); + var communicator; var com; var allTests = function(out, initData) @@ -191,8 +193,8 @@ }, function(ex) { - if(!(typeof(window) == 'undefined' && ex instanceof Ice.ConnectionRefusedException) && - !(typeof(window) != 'undefined' && ex instanceof Ice.ConnectFailedException)) + if(!(!isBrowser && ex instanceof Ice.ConnectionRefusedException) && + !(isBrowser && ex instanceof Ice.ConnectFailedException)) { throw ex; } @@ -806,8 +808,8 @@ }, function(ex) { - test((typeof(window) == 'undefined' && ex instanceof Ice.ConnectionRefusedException) || - (typeof(window) != 'undefined' && ex instanceof Ice.ConnectFailedException)); + test((!isBrowser && ex instanceof Ice.ConnectionRefusedException) || + (isBrowser && ex instanceof Ice.ConnectFailedException)); return prx.ice_getEndpoints(); } ).then( @@ -909,8 +911,8 @@ }, function(ex) { - test((typeof(window) == 'undefined' && ex instanceof Ice.ConnectionRefusedException) || - (typeof(window) != 'undefined' && ex instanceof Ice.ConnectFailedException)); + test((!isBrowser && ex instanceof Ice.ConnectionRefusedException) || + (isBrowser && ex instanceof Ice.ConnectFailedException)); }); }; return f1(); @@ -1077,8 +1079,8 @@ }, function(ex) { - test((typeof(window) == 'undefined' && ex instanceof Ice.ConnectionRefusedException) || - (typeof(window) != 'undefined' && ex instanceof Ice.ConnectFailedException)); + test((!isBrowser && ex instanceof Ice.ConnectionRefusedException) || + (isBrowser && ex instanceof Ice.ConnectFailedException)); return prx.ice_getEndpoints(); } ).then( @@ -1167,5 +1169,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/defaultValue/Client.js b/js/test/Ice/defaultValue/Client.js index 460f2f030eb..4ae6e74b83a 100644 --- a/js/test/Ice/defaultValue/Client.js +++ b/js/test/Ice/defaultValue/Client.js @@ -211,5 +211,5 @@ exports.__test__ = run; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/enums/Client.js b/js/test/Ice/enums/Client.js index 7c20393af18..28f1d5fd45d 100644 --- a/js/test/Ice/enums/Client.js +++ b/js/test/Ice/enums/Client.js @@ -233,5 +233,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/exceptions/Client.js b/js/test/Ice/exceptions/Client.js index 5defef53b5d..eeded84d58b 100644 --- a/js/test/Ice/exceptions/Client.js +++ b/js/test/Ice/exceptions/Client.js @@ -503,5 +503,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/exceptionsBidir/AMDThrowerI.js b/js/test/Ice/exceptionsBidir/AMDThrowerI.js index 4e11da59999..6cdda5c4ab6 100644 --- a/js/test/Ice/exceptionsBidir/AMDThrowerI.js +++ b/js/test/Ice/exceptionsBidir/AMDThrowerI.js @@ -161,6 +161,6 @@ exports.AMDThrowerI = AMDThrowerI; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/exceptionsBidir/Client.js b/js/test/Ice/exceptionsBidir/Client.js index 4e856a71a02..b19cd36fac0 100644 --- a/js/test/Ice/exceptionsBidir/Client.js +++ b/js/test/Ice/exceptionsBidir/Client.js @@ -101,5 +101,5 @@ exports.__runEchoServerOptions__ = ["Ice.Warn.Dispatch=0", "Ice.Warn.Connections=0"]; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/exceptionsBidir/ThrowerI.js b/js/test/Ice/exceptionsBidir/ThrowerI.js index e193d24580b..6dada1df355 100644 --- a/js/test/Ice/exceptionsBidir/ThrowerI.js +++ b/js/test/Ice/exceptionsBidir/ThrowerI.js @@ -162,5 +162,5 @@ exports.ThrowerI = ThrowerI; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/facets/Client.js b/js/test/Ice/facets/Client.js index 4ef4e0b07fd..aa8e6cc876f 100644 --- a/js/test/Ice/facets/Client.js +++ b/js/test/Ice/facets/Client.js @@ -11,7 +11,6 @@ { var Ice = require("ice").Ice; var Test = require("Test").Test; - var Promise = Ice.Promise; var allTests = function(out, communicator) @@ -257,5 +256,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/facetsBidir/Client.js b/js/test/Ice/facetsBidir/Client.js index 6ed035de473..f0dc8cb737a 100644 --- a/js/test/Ice/facetsBidir/Client.js +++ b/js/test/Ice/facetsBidir/Client.js @@ -177,5 +177,5 @@ exports.__runEchoServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/facetsBidir/TestI.js b/js/test/Ice/facetsBidir/TestI.js index 1027487ed18..9fde2134fd5 100644 --- a/js/test/Ice/facetsBidir/TestI.js +++ b/js/test/Ice/facetsBidir/TestI.js @@ -70,6 +70,6 @@ exports.HI = HI; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/hashmap/Client.js b/js/test/Ice/hashmap/Client.js index f72f2013bd0..2ef78be166d 100644 --- a/js/test/Ice/hashmap/Client.js +++ b/js/test/Ice/hashmap/Client.js @@ -249,5 +249,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/hold/Client.js b/js/test/Ice/hold/Client.js index cb8a7b7f085..2691b96f9ec 100644 --- a/js/test/Ice/hold/Client.js +++ b/js/test/Ice/hold/Client.js @@ -354,5 +354,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/info/Client.js b/js/test/Ice/info/Client.js index 940b59048c9..aa797edf52f 100644 --- a/js/test/Ice/info/Client.js +++ b/js/test/Ice/info/Client.js @@ -186,5 +186,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/inheritance/Client.js b/js/test/Ice/inheritance/Client.js index bec3a503df4..457ceff0707 100644 --- a/js/test/Ice/inheritance/Client.js +++ b/js/test/Ice/inheritance/Client.js @@ -297,5 +297,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/inheritanceBidir/Client.js b/js/test/Ice/inheritanceBidir/Client.js index 0271ba676a7..b778133cd4c 100644 --- a/js/test/Ice/inheritanceBidir/Client.js +++ b/js/test/Ice/inheritanceBidir/Client.js @@ -72,5 +72,5 @@ exports.__runEchoServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/inheritanceBidir/InitialI.js b/js/test/Ice/inheritanceBidir/InitialI.js index 93cd05ea0b4..d861ad95e5d 100644 --- a/js/test/Ice/inheritanceBidir/InitialI.js +++ b/js/test/Ice/inheritanceBidir/InitialI.js @@ -180,5 +180,5 @@ exports.InitialI = InitialI; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/location/Client.js b/js/test/Ice/location/Client.js index 9a417545545..ea6588ea12b 100644 --- a/js/test/Ice/location/Client.js +++ b/js/test/Ice/location/Client.js @@ -1332,5 +1332,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/number/Client.js b/js/test/Ice/number/Client.js index dcfe099937b..e927bece426 100644 --- a/js/test/Ice/number/Client.js +++ b/js/test/Ice/number/Client.js @@ -37,7 +37,7 @@ test(new Ice.Long(0x00000001, 0xFFFFFFFF).toNumber() === Math.pow(2, 33) - 1); // 2^33 - 1 test(new Ice.Long(0x001FFFFF, 0xFFFFFFFF).toNumber() === Math.pow(2, 53) - 1); // 2^53 - 1 test(new Ice.Long(0x00200000, 0x00000000).toNumber() === Number.POSITIVE_INFINITY); // 2^53 - + // // Test negative numbers // @@ -57,5 +57,5 @@ exports.__test__ = run; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/objects/Client.js b/js/test/Ice/objects/Client.js index 83388124444..9357c8e8c03 100644 --- a/js/test/Ice/objects/Client.js +++ b/js/test/Ice/objects/Client.js @@ -511,5 +511,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/operations/BatchOneways.js b/js/test/Ice/operations/BatchOneways.js index d1eeae89378..2632345e6da 100644 --- a/js/test/Ice/operations/BatchOneways.js +++ b/js/test/Ice/operations/BatchOneways.js @@ -164,5 +164,5 @@ exports.BatchOneways = { run: run }; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/operations/Client.js b/js/test/Ice/operations/Client.js index ed467143831..f2b11dfbd5f 100644 --- a/js/test/Ice/operations/Client.js +++ b/js/test/Ice/operations/Client.js @@ -99,5 +99,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/operations/Oneways.js b/js/test/Ice/operations/Oneways.js index c08689e1505..f0dd0830f27 100644 --- a/js/test/Ice/operations/Oneways.js +++ b/js/test/Ice/operations/Oneways.js @@ -108,6 +108,6 @@ exports.Oneways = { run: run }; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/operations/Twoways.js b/js/test/Ice/operations/Twoways.js index f49c13ab79f..a5c78738fe9 100644 --- a/js/test/Ice/operations/Twoways.js +++ b/js/test/Ice/operations/Twoways.js @@ -1075,7 +1075,6 @@ test(retval.get(0xf1)[0] === 0xf2); test(retval.get(0xf1)[1] === 0xf3); - var si1 = [true, false]; var si2 = [false, true, true]; @@ -1493,7 +1492,7 @@ s.tesT = "Test.MyStruct1.s"; s.myClass = null; s.myStruct1 = "Test.MyStruct1.myStruct1"; - + var c = new Test.MyClass1(); c.tesT = "Test.MyClass1.testT"; c.myClass = null; @@ -1530,12 +1529,12 @@ test(arguments[8][0].size === 0); test(arguments[9][0].length === 0); test(arguments[10][0].size === 0); - + s = arguments[11][0]; test(s.tesT == "Test.MyStruct1.s"); test(s.myClass === null); test(s.myStruct1 == "Test.MyStruct1.myStruct1"); - + c = arguments[12][0]; test(c.tesT == "Test.MyClass1.testT"); test(c.myClass === null); @@ -1558,5 +1557,5 @@ exports.Twoways = { run: run }; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/operationsBidir/AMDMyDerivedClassI.js b/js/test/Ice/operationsBidir/AMDMyDerivedClassI.js index a8864118671..578749cc2ee 100644 --- a/js/test/Ice/operationsBidir/AMDMyDerivedClassI.js +++ b/js/test/Ice/operationsBidir/AMDMyDerivedClassI.js @@ -30,37 +30,31 @@ { this._opByteSOnewayCount = 0; }, - ice_isA: function(id, current) { test(current.mode === Ice.OperationMode.Nonmutating); return Ice.Object.prototype.ice_isA.call(this, id, current); }, - ice_ping: function(current) { test(current.mode === Ice.OperationMode.Nonmutating); Ice.Object.prototype.ice_ping.call(this, current); }, - ice_ids: function(current) { test(current.mode === Ice.OperationMode.Nonmutating); return Ice.Object.prototype.ice_ids.call(this, current); }, - ice_id: function(current) { test(current.mode === Ice.OperationMode.Nonmutating); return Ice.Object.prototype.ice_id.call(this, current); }, - shutdown_async: function(cb, current) { current.adapter.getCommunicator().shutdown(); cb.ice_response(); }, - delay_async: function(cb, ms, current) { Ice.Timer.setTimeout( @@ -69,42 +63,35 @@ cb.ice_response(); }, ms); }, - opVoid_async: function(cb, current) { test(current.mode === Ice.OperationMode.Normal); cb.ice_response(); }, - opBool_async: function(cb, p1, p2, current) { cb.ice_response(p2, p1); }, - opBoolS_async: function(cb, p1, p2, current) { var p3 = p1.concat(p2); cb.ice_response(p1.reverse(), p3); }, - opBoolSS_async: function(cb, p1, p2, current) { var p3 = p1.concat(p2); cb.ice_response(p1.reverse(), p3); }, - opByte_async: function(cb, p1, p2, current) { cb.ice_response(p1, (p1 ^ p2) & 0xff); }, - opByteBoolD_async: function(cb, p1, p2, current) { var r = p1.clone(); r.merge(p2); cb.ice_response(r, p1); }, - opByteS_async: function(cb, p1, p2, current) { var i; @@ -125,39 +112,33 @@ } cb.ice_response(r, p3); }, - opByteSS_async: function(cb, p1, p2, current) { var r = p1.concat(p2); cb.ice_response(r, p1.reverse()); }, - opFloatDouble_async: function(cb, p1, p2, current) { cb.ice_response(p2, p1, p2); }, - opFloatDoubleS_async: function(cb, p1, p2, current) { var r = p2.concat(p1); var p4 = p2.reverse(); cb.ice_response(r, p1, p4); }, - opFloatDoubleSS_async: function(cb, p1, p2, current) { var r = p2.concat(p2); var p4 = p2.reverse(); cb.ice_response(r, p1, p4); }, - opLongFloatD_async: function(cb, p1, p2, current) { var r = p1.clone(); r.merge(p2); cb.ice_response(r, p1); }, - opMyClass_async: function(cb, p1, current) { var p2 = p1; @@ -166,67 +147,56 @@ var r = TestAMD.MyClassPrx.uncheckedCast(current.adapter.createProxy(current.id)); cb.ice_response(r, p2, p3); }, - opMyEnum_async: function(cb, p1, current) { cb.ice_response(TestAMD.MyEnum.enum3, p1); }, - opShortIntD_async: function(cb, p1, p2, current) { var r = p1.clone(); r.merge(p2); cb.ice_response(r, p1); }, - opShortIntLong_async: function(cb, p1, p2, p3, current) { cb.ice_response(p3, p1, p2, p3); }, - opShortIntLongS_async: function(cb, p1, p2, p3, current) { cb.ice_response(p3, p1, p2.reverse(), p3.concat(p3)); }, - opShortIntLongSS_async: function(cb, p1, p2, p3, current) { cb.ice_response(p3, p1, p2.reverse(), p3.concat(p3)); }, - opString_async: function(cb, p1, p2, current) { cb.ice_response(p1 + " " + p2, p2 + " " + p1); }, - opStringMyEnumD_async: function(cb, p1, p2, current) { var r = p1.clone(); r.merge(p2); cb.ice_response(r, p1); }, - opMyEnumStringD_async: function(cb, p1, p2, current) { var r = p1.clone(); r.merge(p2); cb.ice_response(r, p1); }, - opMyStructMyEnumD_async: function(cb, p1, p2, current) { var r = p1.clone(); r.merge(p2); cb.ice_response(r, p1); }, - opByteBoolDS_async: function(cb, p1, p2, current) { var p3 = p2.concat(p1); var r = p1.reverse(); cb.ice_response(r, p3); }, - opShortIntDS_async: function(cb, p1, p2, current) { var p3 = p2.concat(p1); @@ -240,35 +210,30 @@ var r = p1.reverse(); cb.ice_response(r, p3); }, - opStringStringDS_async: function(cb, p1, p2, current) { var p3 = p2.concat(p1); var r = p1.reverse(); cb.ice_response(r, p3); }, - opStringMyEnumDS_async: function(cb, p1, p2, current) { var p3 = p2.concat(p1); var r = p1.reverse(); cb.ice_response(r, p3); }, - opMyEnumStringDS_async: function(cb, p1, p2, current) { var p3 = p2.concat(p1); var r = p1.reverse(); cb.ice_response(r, p3); }, - opMyStructMyEnumDS_async: function(cb, p1, p2, current) { var p3 = p2.concat(p1); var r = p1.reverse(); cb.ice_response(r, p3); }, - opByteByteSD_async: function(cb, p1, p2, current) { var r = p1.clone(); @@ -276,7 +241,6 @@ var p3 = p2.clone(); cb.ice_response(r, p3); }, - opBoolBoolSD_async: function(cb, p1, p2, current) { var r = p1.clone(); @@ -284,7 +248,6 @@ var p3 = p2.clone(); cb.ice_response(r, p3); }, - opShortShortSD_async: function(cb, p1, p2, current) { var r = p1.clone(); @@ -292,7 +255,6 @@ var p3 = p2.clone(); cb.ice_response(r, p3); }, - opIntIntSD_async: function(cb, p1, p2, current) { var r = p1.clone(); @@ -300,7 +262,6 @@ var p3 = p2.clone(); cb.ice_response(r, p3); }, - opLongLongSD_async: function(cb, p1, p2, current) { var r = p1.clone(); @@ -308,7 +269,6 @@ var p3 = p2.clone(); cb.ice_response(r, p3); }, - opStringFloatSD_async: function(cb, p1, p2, current) { var r = p1.clone(); @@ -316,7 +276,6 @@ var p3 = p2.clone(); cb.ice_response(r, p3); }, - opStringDoubleSD_async: function(cb, p1, p2, current) { var r = p1.clone(); @@ -324,7 +283,6 @@ var p3 = p2.clone(); cb.ice_response(r, p3); }, - opStringStringSD_async: function(cb, p1, p2, current) { var r = p1.clone(); @@ -332,7 +290,6 @@ var p3 = p2.clone(); cb.ice_response(r, p3); }, - opMyEnumMyEnumSD_async: function(cb, p1, p2, current) { var r = p1.clone(); @@ -340,30 +297,25 @@ var p3 = p2.clone(); cb.ice_response(r, p3); }, - opIntS_async: function(cb, s, current) { cb.ice_response(s.map(function(v, i, arr) { return -v; })); }, - opByteSOneway_async: function(cb, s, current) { this._opByteSOnewayCount += 1; cb.ice_response(); }, - opByteSOnewayCallCount_async: function(cb, current) { var count = this._opByteSOnewayCount; this._opByteSOnewayCount = 0; cb.ice_response(count); }, - opContext_async: function(cb, current) { cb.ice_response(current.ctx); }, - opDoubleMarshaling_async: function(cb, p1, p2, current) { var d = 1278312346.0 / 13.0; @@ -374,118 +326,97 @@ } cb.ice_response(); }, - opStringS_async: function(cb, p1, p2, current) { var p3 = p1.concat(p2); var r = p1.reverse(); cb.ice_response(r, p3); }, - opStringSS_async: function(cb, p1, p2, current) { var p3 = p1.concat(p2); var r = p2.reverse(); cb.ice_response(r, p3); }, - opStringSSS_async: function(cb, p1, p2, current) { var p3 = p1.concat(p2); var r = p2.reverse(); cb.ice_response(r, p3); }, - opStringStringD_async: function(cb, p1, p2, current) { var r = p1.clone(); r.merge(p2); cb.ice_response(r, p1); }, - opStruct_async: function(cb, p1, p2, current) { p1.s.s = "a new string"; cb.ice_response(p2, p1); }, - opIdempotent_async: function(cb, current) { test(current.mode === Ice.OperationMode.Idempotent); cb.ice_response(); }, - opNonmutating_async: function(cb, current) { test(current.mode === Ice.OperationMode.Nonmutating); cb.ice_response(); }, - opDerived_async: function(cb, current) { cb.ice_response(); }, - opByte1_async: function(cb, value, current) { cb.ice_response(value); }, - opShort1_async: function(cb, value, current) { cb.ice_response(value); }, - opInt1_async: function(cb, value, current) { cb.ice_response(value); }, - opLong1_async: function(cb, value, current) { cb.ice_response(value); }, - opFloat1_async: function(cb, value, current) { cb.ice_response(value); }, - opDouble1_async: function(cb, value, current) { cb.ice_response(value); }, - opString1_async: function(cb, value, current) { cb.ice_response(value); }, - opStringS1_async: function(cb, value, current) { cb.ice_response(value); }, - opByteBoolD1_async: function(cb, value, current) { cb.ice_response(value); }, - opStringS2_async: function(cb, value, current) { cb.ice_response(value); }, - opByteBoolD2_async: function(cb, value, current) { cb.ice_response(value); }, - opMyClass1_async: function(cb, value, current) { return cb.ice_response(value); }, - opMyStruct1_async: function(cb, value, current) { return cb.ice_response(value); @@ -495,5 +426,5 @@ exports.AMDMyDerivedClassI = AMDMyDerivedClassI; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/operationsBidir/Client.js b/js/test/Ice/operationsBidir/Client.js index b5f664b35ce..1425a82e1ac 100644 --- a/js/test/Ice/operationsBidir/Client.js +++ b/js/test/Ice/operationsBidir/Client.js @@ -90,5 +90,5 @@ exports.__runEchoServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/operationsBidir/MyDerivedClassI.js b/js/test/Ice/operationsBidir/MyDerivedClassI.js index 840c445a010..c128926d771 100644 --- a/js/test/Ice/operationsBidir/MyDerivedClassI.js +++ b/js/test/Ice/operationsBidir/MyDerivedClassI.js @@ -30,36 +30,30 @@ { this._opByteSOnewayCount = 0; }, - ice_isA: function(id, current) { test(current.mode === Ice.OperationMode.Nonmutating); return Ice.Object.prototype.ice_isA.call(this, id, current); }, - ice_ping: function(current) { test(current.mode === Ice.OperationMode.Nonmutating); Ice.Object.prototype.ice_ping.call(this, current); }, - ice_ids: function(current) { test(current.mode === Ice.OperationMode.Nonmutating); return Ice.Object.prototype.ice_ids.call(this, current); }, - ice_id: function(current) { test(current.mode === Ice.OperationMode.Nonmutating); return Ice.Object.prototype.ice_id.call(this, current); }, - shutdown: function(current) { current.adapter.getCommunicator().shutdown(); }, - delay: function(cb, ms, current) { Ice.Timer.setTimeout( @@ -68,41 +62,34 @@ cb.ice_response(); }, ms); }, - opVoid: function(current) { test(current.mode === Ice.OperationMode.Normal); }, - opBool: function(p1, p2, current) { return [p2, p1]; }, - opBoolS: function(p1, p2, current) { var p3 = p1.concat(p2); return [p1.reverse(), p3]; }, - opBoolSS: function(p1, p2, current) { var p3 = p1.concat(p2); return [p1.reverse(), p3]; }, - opByte: function(p1, p2, current) { return [p1, (p1 ^ p2) & 0xff]; }, - opByteBoolD: function(p1, p2, current) { var r = p1.clone(); r.merge(p2); return [r, p1]; }, - opByteS: function(p1, p2, current) { var i; @@ -123,39 +110,33 @@ } return [r, p3]; }, - opByteSS: function(p1, p2, current) { var r = p1.concat(p2); return [r, p1.reverse()]; }, - opFloatDouble: function(p1, p2, current) { return [p2, p1, p2]; }, - opFloatDoubleS: function(p1, p2, current) { var r = p2.concat(p1); var p4 = p2.reverse(); return [r, p1, p4]; }, - opFloatDoubleSS: function(p1, p2, current) { var r = p2.concat(p2); var p4 = p2.reverse(); return [r, p1, p4]; }, - opLongFloatD: function(p1, p2, current) { var r = p1.clone(); r.merge(p2); return [r, p1]; }, - opMyClass: function(p1, current) { var p2 = p1; @@ -164,109 +145,92 @@ var r = Test.MyClassPrx.uncheckedCast(current.adapter.createProxy(current.id)); return [r, p2, p3]; }, - opMyEnum: function(p1, current) { return [Test.MyEnum.enum3, p1]; }, - opShortIntD: function(p1, p2, current) { var r = p1.clone(); r.merge(p2); return [r, p1]; }, - opShortIntLong: function(p1, p2, p3, current) { return [p3, p1, p2, p3]; }, - opShortIntLongS: function(p1, p2, p3, current) { return [p3, p1, p2.reverse(), p3.concat(p3)]; }, - opShortIntLongSS: function(p1, p2, p3, current) { return [p3, p1, p2.reverse(), p3.concat(p3)]; }, - opString: function(p1, p2, current) { return [p1 + " " + p2, p2 + " " + p1]; }, - opStringMyEnumD: function(p1, p2, current) { var r = p1.clone(); r.merge(p2); return [r, p1]; }, - opMyEnumStringD: function(p1, p2, current) { var r = p1.clone(); r.merge(p2); return [r, p1]; }, - opMyStructMyEnumD: function(p1, p2, current) { var r = p1.clone(); r.merge(p2); return [r, p1]; }, - opByteBoolDS: function(p1, p2, current) { var p3 = p2.concat(p1); var r = p1.reverse(); return [r, p3]; }, - opShortIntDS: function(p1, p2, current) { var p3 = p2.concat(p1); var r = p1.reverse(); return [r, p3]; }, - opLongFloatDS: function(p1, p2, current) { var p3 = p2.concat(p1); var r = p1.reverse(); return [r, p3]; }, - opStringStringDS: function(p1, p2, current) { var p3 = p2.concat(p1); var r = p1.reverse(); return [r, p3]; }, - opStringMyEnumDS: function(p1, p2, current) { var p3 = p2.concat(p1); var r = p1.reverse(); return [r, p3]; }, - opMyEnumStringDS: function(p1, p2, current) { var p3 = p2.concat(p1); var r = p1.reverse(); return [r, p3]; }, - opMyStructMyEnumDS: function(p1, p2, current) { var p3 = p2.concat(p1); var r = p1.reverse(); return [r, p3]; }, - opByteByteSD: function(p1, p2, current) { var r = p1.clone(); @@ -274,7 +238,6 @@ var p3 = p2.clone(); return [r, p3]; }, - opBoolBoolSD: function(p1, p2, current) { var r = p1.clone(); @@ -282,7 +245,6 @@ var p3 = p2.clone(); return [r, p3]; }, - opShortShortSD: function(p1, p2, current) { var r = p1.clone(); @@ -290,7 +252,6 @@ var p3 = p2.clone(); return [r, p3]; }, - opIntIntSD: function(p1, p2, current) { var r = p1.clone(); @@ -298,7 +259,6 @@ var p3 = p2.clone(); return [r, p3]; }, - opLongLongSD: function(p1, p2, current) { var r = p1.clone(); @@ -306,7 +266,6 @@ var p3 = p2.clone(); return [r, p3]; }, - opStringFloatSD: function(p1, p2, current) { var r = p1.clone(); @@ -314,7 +273,6 @@ var p3 = p2.clone(); return [r, p3]; }, - opStringDoubleSD: function(p1, p2, current) { var r = p1.clone(); @@ -322,7 +280,6 @@ var p3 = p2.clone(); return [r, p3]; }, - opStringStringSD: function(p1, p2, current) { var r = p1.clone(); @@ -330,7 +287,6 @@ var p3 = p2.clone(); return [r, p3]; }, - opMyEnumMyEnumSD: function(p1, p2, current) { var r = p1.clone(); @@ -338,29 +294,24 @@ var p3 = p2.clone(); return [r, p3]; }, - opIntS: function(s, current) { return s.map(function(v, i, arr) { return -v; }); }, - opByteSOneway: function(s, current) { this._opByteSOnewayCount += 1; }, - opByteSOnewayCallCount: function(current) { var count = this._opByteSOnewayCount; this._opByteSOnewayCount = 0; return count; }, - opContext: function(current) { return current.ctx; }, - opDoubleMarshaling: function(p1, p2, current) { var d = 1278312346.0 / 13.0; @@ -370,124 +321,102 @@ test(p2[i] === d); } }, - opStringS: function(p1, p2, current) { var p3 = p1.concat(p2); var r = p1.reverse(); return [r, p3]; }, - opStringSS: function(p1, p2, current) { var p3 = p1.concat(p2); var r = p2.reverse(); return [r, p3]; }, - opStringSSS: function(p1, p2, current) { var p3 = p1.concat(p2); var r = p2.reverse(); return [r, p3]; }, - opStringStringD: function(p1, p2, current) { var r = p1.clone(); r.merge(p2); return [r, p1]; }, - opStruct: function(p1, p2, current) { p1.s.s = "a new string"; return [p2, p1]; }, - opIdempotent: function(current) { test(current.mode === Ice.OperationMode.Idempotent); }, - opNonmutating: function(current) { test(current.mode === Ice.OperationMode.Nonmutating); }, - opDerived: function(current) { }, - opByte1: function(value, current) { return value; }, - opShort1: function(value, current) { return value; }, - opInt1: function(value, current) { return value; }, - opLong1: function(value, current) { return value; }, - opFloat1: function(value, current) { return value; }, - opDouble1: function(value, current) { return value; }, - opString1: function(value, current) { return value; }, - opStringS1: function(value, current) { return value; }, - opByteBoolD1: function(value, current) { return value; }, - opStringS2: function(value, current) { return value; }, - opByteBoolD2: function(value, current) { return value; }, - opMyClass1: function(value, current) { return value; }, - opMyStruct1: function(value, current) { return value; } - }); exports.MyDerivedClassI = MyDerivedClassI; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/optional/Client.js b/js/test/Ice/optional/Client.js index 2d23a42d4a4..723e6e9f404 100644 --- a/js/test/Ice/optional/Client.js +++ b/js/test/Ice/optional/Client.js @@ -1007,5 +1007,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/optionalBidir/AMDInitialI.js b/js/test/Ice/optionalBidir/AMDInitialI.js index 41302532b24..89e1ca49076 100644 --- a/js/test/Ice/optionalBidir/AMDInitialI.js +++ b/js/test/Ice/optionalBidir/AMDInitialI.js @@ -376,5 +376,5 @@ exports.AMDInitialI = AMDInitialI; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/optionalBidir/Client.js b/js/test/Ice/optionalBidir/Client.js index 1d92c129a13..9a5f2ce4e76 100644 --- a/js/test/Ice/optionalBidir/Client.js +++ b/js/test/Ice/optionalBidir/Client.js @@ -101,5 +101,5 @@ exports.__runEchoServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/optionalBidir/InitialI.js b/js/test/Ice/optionalBidir/InitialI.js index 19d932a195c..a41644334b9 100644 --- a/js/test/Ice/optionalBidir/InitialI.js +++ b/js/test/Ice/optionalBidir/InitialI.js @@ -373,5 +373,5 @@ exports.InitialI = InitialI; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/promise/Client.js b/js/test/Ice/promise/Client.js index bcc42aa9550..7a6b4a2efb5 100644 --- a/js/test/Ice/promise/Client.js +++ b/js/test/Ice/promise/Client.js @@ -901,5 +901,5 @@ exports.__test__ = run; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/properties/Client.js b/js/test/Ice/properties/Client.js index 9f2a3331875..770849c143e 100644 --- a/js/test/Ice/properties/Client.js +++ b/js/test/Ice/properties/Client.js @@ -65,34 +65,41 @@ } else { - // - // We are runing in a web browser load the properties file from the web server. - // - var p = new Promise(); - /*jshint jquery: true */ - $.ajax( + if(typeof window !== 'undefined') { - url: "escapes.cfg", // - // Use text data type to avoid problems interpreting the data. + //Skiped when running in a worker, we don't load JQuery in the workers + // + + // + // We are runing in a web browser load the properties file from the web server. // - dataType: "text" - }).done( - function(data) - { - properties.parse(data); - for(var key in props) + var p = new Promise(); + /*jshint jquery: true */ + $.ajax( { - test(props[key] == properties.getProperty(key)); - } - p.succeed(); - } - ).fail( - function() - { - p.fail(); - }); - return p; + url: "escapes.cfg", + // + // Use text data type to avoid problems interpreting the data. + // + dataType: "text" + }).done( + function(data) + { + properties.parse(data); + for(var key in props) + { + test(props[key] == properties.getProperty(key)); + } + p.succeed(); + } + ).fail( + function() + { + p.fail(); + }); + return p; + } } } ).then( @@ -104,5 +111,5 @@ exports.__test__ = run; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/proxy/Client.js b/js/test/Ice/proxy/Client.js index 5796ba5c11d..073a838c01f 100644 --- a/js/test/Ice/proxy/Client.js +++ b/js/test/Ice/proxy/Client.js @@ -1057,8 +1057,8 @@ // // Ensure that non connectable endpoints are skipped. // - var p = (typeof window === 'undefined') ? - communicator.stringToProxy("test:ws -p 12010:default -p 12010") : + var p = (typeof window === 'undefined' && typeof WorkerGlobalScope === 'undefined') ? + communicator.stringToProxy("test:ws -p 12010:default -p 12010") : communicator.stringToProxy("test:tcp -p 12010:default -p 12010"); p = p.ice_endpointSelection(Ice.EndpointSelectionType.Ordered); @@ -1092,5 +1092,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/retry/Client.js b/js/test/Ice/retry/Client.js index 9fc5504d39b..f6c0adfcd19 100644 --- a/js/test/Ice/retry/Client.js +++ b/js/test/Ice/retry/Client.js @@ -79,8 +79,14 @@ }, function(ex) { - test((typeof(window) === undefined && ex instanceof Ice.ConnectionLostException) || - (typeof(window) !== undefined && ex instanceof Ice.SocketException)); + if(typeof(window) === 'undefined' && typeof(WorkerGlobalScope) === 'undefined') // Nodejs + { + test(ex instanceof Ice.ConnectionLostException); + } + else // Browser + { + test(ex instanceof Ice.SocketException); + } out.writeLine("ok"); out.write("calling regular operation with first proxy again... "); return retry1.op(false); @@ -181,5 +187,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/slicing/exceptions/Client.js b/js/test/Ice/slicing/exceptions/Client.js index 28478294a97..784c6d53a3b 100644 --- a/js/test/Ice/slicing/exceptions/Client.js +++ b/js/test/Ice/slicing/exceptions/Client.js @@ -282,5 +282,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/slicing/objects/Client.js b/js/test/Ice/slicing/objects/Client.js index be1a068ca37..df5a684561e 100644 --- a/js/test/Ice/slicing/objects/Client.js +++ b/js/test/Ice/slicing/objects/Client.js @@ -871,5 +871,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); diff --git a/js/test/Ice/timeout/Client.js b/js/test/Ice/timeout/Client.js index 47462aec495..5b5aad7b407 100644 --- a/js/test/Ice/timeout/Client.js +++ b/js/test/Ice/timeout/Client.js @@ -471,5 +471,5 @@ exports.__runServer__ = true; } (typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require, - typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window)); + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : this.Ice.__require, + typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : this)); |