diff --git a/third_party/closure/goog/a11y/aria/aria.js b/third_party/closure/goog/a11y/aria/aria.js index 3908c89289648..1220d2382851e 100644 --- a/third_party/closure/goog/a11y/aria/aria.js +++ b/third_party/closure/goog/a11y/aria/aria.js @@ -171,7 +171,8 @@ goog.a11y.aria.setState = function(element, stateName, value) { */ goog.a11y.aria.toggleState = function(el, attr) { var val = goog.a11y.aria.getState(el, attr); - if (!goog.string.isEmptySafe(val) && !(val == 'true' || val == 'false')) { + if (!goog.string.isEmptyOrWhitespace(goog.string.makeSafe(val)) && + !(val == 'true' || val == 'false')) { goog.a11y.aria.removeState(el, /** @type {!goog.a11y.aria.State} */ (attr)); return; } diff --git a/third_party/closure/goog/asserts/asserts.js b/third_party/closure/goog/asserts/asserts.js index fc0be61cc8cd0..96a20818dc0e6 100644 --- a/third_party/closure/goog/asserts/asserts.js +++ b/third_party/closure/goog/asserts/asserts.js @@ -355,10 +355,9 @@ goog.asserts.assertObjectPrototypeIsIntact = function() { */ goog.asserts.getType_ = function(value) { if (value instanceof Function) { - // TODO(martone): unquote this after the next Closure Compiler release. - return value['displayName'] || value.name || 'unknown type name'; + return value.displayName || value.name || 'unknown type name'; } else if (value instanceof Object) { - return value.constructor['displayName'] || value.constructor.name || + return value.constructor.displayName || value.constructor.name || Object.prototype.toString.call(value); } else { return value === null ? 'null' : typeof value; diff --git a/third_party/closure/goog/base.js b/third_party/closure/goog/base.js index 8431abfdf9b82..7f37fdd627cfa 100644 --- a/third_party/closure/goog/base.js +++ b/third_party/closure/goog/base.js @@ -274,6 +274,17 @@ goog.constructNamespace_ = function(name, opt_obj) { }; +/** + * Module identifier validation regexp. + * Note: This is a conservative check, it is very possible to be more lienent, + * the primary exclusion here is "/" and "\" and a leading ".", these + * restrictions are intended to leave the door open for using goog.require + * with relative file paths rather than module identifiers. + * @private + */ +goog.VALID_MODULE_RE_ = /^[a-zA-Z_$][a-zA-Z0-9._$]*$/; + + /** * goog.module serves two purposes: * - marks a file that must be loaded as a module @@ -296,7 +307,9 @@ goog.constructNamespace_ = function(name, opt_obj) { * "goog.package.part", is expected but not required. */ goog.module = function(name) { - if (!goog.isString(name) || !name) { + if (!goog.isString(name) || + !name || + name.search(goog.VALID_MODULE_RE_) == -1) { throw Error('Invalid module identifier'); } if (!goog.isInModuleLoader_()) { @@ -888,58 +901,6 @@ if (goog.DEPENDENCIES_ENABLED) { goog.queuedModules_ = []; - /** - * Retrieve and execute a module. - * @param {string} src Script source URL. - * @private - */ - goog.retrieveAndExecModule_ = function(src) { - // The full but non-canonicalized URL for later use. - var originalPath = src; - - // Canonicalize the path, removing any /./ or /../ since Chrome's debugging - // console doesn't auto-canonicalize XHR loads as it does