Skip to content

Commit

Permalink
Add desired capability to disable feature detection
Browse files Browse the repository at this point in the history
  • Loading branch information
csnover committed Apr 17, 2015
1 parent 23e62af commit 7fedefb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

var keys = require('./keys');
var lang = require('dojo/lang');
var Promise = require('dojo/Promise');
var request = require('dojo/request');
var Session = require('./Session');
Expand Down Expand Up @@ -287,12 +288,20 @@ Server.prototype = {
*/
createSession: function (desiredCapabilities, requiredCapabilities) {
var self = this;

var fixSessionCapabilities = desiredCapabilities.fixSessionCapabilities !== false &&
self.fixSessionCapabilities;

// Don’t send `fixSessionCapabilities` to the server
desiredCapabilities = lang.mixin({}, desiredCapabilities);
desiredCapabilities.fixSessionCapabilities = undefined;

return this._post('session', {
desiredCapabilities: desiredCapabilities,
requiredCapabilities: requiredCapabilities
}).then(function (response) {
var session = new self.sessionConstructor(response.sessionId, self, response.value);
if (self.fixSessionCapabilities) {
if (fixSessionCapabilities) {
return self._fillCapabilities(session);
}
else {
Expand Down
4 changes: 4 additions & 0 deletions typedefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@
* @property {boolean} dynamicViewport
* Environments with this capability have viewports that can be resized.
*
* @property {boolean} fixSessionCapabilities
* Set this desired capability to false to disable Leadfoot’s feature detection code. This will speed up startup but
* will disable most Leadfoot fixes, so some environments may stop working correctly.
*
* @property {(boolean|string[])} fixedLogTypes
* Environments with this capability break when the `getLogTypes` method is called. The list of log types provided here
* are used in lieu of the values provided by the server when calling `getLogTypes`.
Expand Down

0 comments on commit 7fedefb

Please sign in to comment.