Merge pull request #2461 from imurchie/isaac-fix-context

Fix iOS context change
This commit is contained in:
Jonathan Lipps
2014-05-02 15:01:47 -07:00

View File

@@ -1497,7 +1497,7 @@ iOSController.setContext = function (name, cb, skipReadyCheck) {
// allow user to pass in "WEBVIEW" without an index
idx = '1';
}
this.getContexts(function () {
var pickContext = function () {
if (_.contains(this.contexts, idx)) {
var pageIdKey = parseInt(idx, 10);
var next = function () {
@@ -1538,7 +1538,16 @@ iOSController.setContext = function (name, cb, skipReadyCheck) {
, value: "Context '" + name + "' does not exist"
});
}
}.bind(this));
}.bind(this);
// only get contexts if they haven't already been gotten
if (typeof this.contexts === 'undefined') {
this.getContexts(function () {
pickContext();
}.bind(this));
} else {
pickContext();
}
}
};