MDL-59784 core: Check for non-promises rather than string

If a malformed value was passed, it may be that we can still display it.
We should not assume that, if a string is not passed, that we are
dealing with a promise.
This commit is contained in:
Andrew Nicols
2017-08-23 10:25:10 +08:00
parent 3e0df465db
commit e5bdf51ce5
2 changed files with 2 additions and 2 deletions

View File

@@ -608,7 +608,7 @@ define(['jquery', 'core/templates', 'core/notification', 'core/key_codes',
*/
Modal.prototype.asyncSet = function(value, setFunction) {
var p = value;
if (typeof value === 'string') {
if (typeof value !== 'object' || !value.hasOwnProperty('then')) {
p = $.Deferred();
p.resolve(value);
}