diff --git a/lib/blizzard/index.js b/lib/blizzard/index.js index a0c6a7dd..d90fbcf9 100644 --- a/lib/blizzard/index.js +++ b/lib/blizzard/index.js @@ -73,7 +73,6 @@ Blizzard.prototype.createSession = function (socket, instigator) { * @protected */ Blizzard.prototype.onClientUpgrade = function (cb, req, socket) { - //this.emit("connect", socket); cb(null, this.createSession(socket, true)); }; @@ -85,9 +84,6 @@ Blizzard.prototype.onClientUpgrade = function (cb, req, socket) { * @protected */ Blizzard.prototype.serverUpgrade = function (req, socket) { - // console.log("Recieved upgrade."); - // console.log("Headers =", req.headers); - var self = this, version = req.headers["sec-blizzard-version"]; diff --git a/lib/hub/batch.js b/lib/hub/batch.js index 180cc3be..f84bb8fc 100644 --- a/lib/hub/batch.js +++ b/lib/hub/batch.js @@ -9,6 +9,7 @@ var TestSpecification = require("./test-specification"); var TestServer = require("./http/test-server"); var WebDriverCollection = require("./webdriver-collection"); +var path = require("path"); /** * A Batch represents a collection of tests on the Hub. @@ -319,7 +320,7 @@ Batch.prototype.handleFileRequest = function (server, agentId, filename) { } fileInBatch = batch.spec.tests.some(function (test) { - return test === filename; + return path.normalize(test) === path.normalize(filename); }); this.getFile(filename, function (err, buffer) { diff --git a/lib/hub/index.js b/lib/hub/index.js index bb16d46e..83fa60ec 100644 --- a/lib/hub/index.js +++ b/lib/hub/index.js @@ -271,7 +271,6 @@ Hub.prototype._onTowerConnection = function (socket) { client.on("register", function (message) { var id = message.agentId; - if (!id || id === "undefined") { client.emit("error", "ID required"); } diff --git a/lib/hub/null-test.js b/lib/hub/null-test.js index 83741867..0b65807c 100644 --- a/lib/hub/null-test.js +++ b/lib/hub/null-test.js @@ -7,6 +7,7 @@ var util = require("util"); var Test = require("./test"); +var path = require("path"); /** * NullTest represents the absence of a Test. @@ -34,7 +35,7 @@ util.inherits(NullTest, Test); * @return {String} Relative URL for the capture page, relative to the mountpoint. */ NullTest.prototype.getUrlForAgentId = function (agentId) { - return this.mountpoint + "agent/" + agentId; + return this.mountpoint + "agent" + path.sep + agentId; }; /** diff --git a/lib/hub/test.js b/lib/hub/test.js index b8154735..452d49eb 100644 --- a/lib/hub/test.js +++ b/lib/hub/test.js @@ -1,5 +1,6 @@ "use strict"; +var path = require("path"); /** * @module test */ @@ -34,9 +35,9 @@ function Test(options) { */ Test.prototype.getUrlForAgentId = function (agentId) { var url = this.mountpoint; - url += "agent/" + agentId; - url += "/batch/" + this.batchId; - url += "/test/" + this.location; + url += "agent" + path.sep + agentId; + url += path.sep + "batch" + path.sep + this.batchId; + url += path.sep + "test" + path.sep + this.location; if (this.query) { url += "?" + this.query; } return url; }; diff --git a/lib/hub/tests.js b/lib/hub/tests.js index 823c347b..48030dce 100644 --- a/lib/hub/tests.js +++ b/lib/hub/tests.js @@ -7,6 +7,7 @@ var Test = require("./test"); var LiteralTest = require("./literal-test"); var NullTest = require("./null-test"); +var path = require("path"); /** * Tests represent a collection of Test objects. @@ -47,9 +48,9 @@ Tests.prototype.getByUrl = function (url) { location; for (; index < length; index += 1) { - location = locations[index]; + location = path.normalize(locations[index]); - if (url.indexOf(location) !== -1) { + if (path.normalize(url).indexOf(location) !== -1) { return this.children[location]; } } @@ -114,7 +115,6 @@ Tests.prototype.initializeFromSpecification = function (spec) { options.query = spec.query; options.mountpoint = self.mountpoint; } - self.children[location] = new TestCtor(options); }); }; diff --git a/lib/hub/url-builder.js b/lib/hub/url-builder.js index e58032fe..5241818a 100644 --- a/lib/hub/url-builder.js +++ b/lib/hub/url-builder.js @@ -1,20 +1,22 @@ "use strict"; +var path = require("path"); + module.exports = function makeURLFromComponents(mountpoint, agentId, batchId, test) { var url = mountpoint; - if (url !== "/") { + if (url !== path.sep) { // XXX So hacky. - url += "/"; + url += path.sep; } - url += "agent/" + agentId; + url += "agent" + path.sep + agentId; if (test && batchId) { // XXX if test is true, // batchId should always be set - url += "/batch/" + batchId; - url += "/test/" + test; + url += path.sep + "batch" + path.sep + batchId; + url += path.sep + "test" + path.sep + test; } return url;