1
0
mirror of https://github.com/google/nomulus synced 2026-02-03 19:42:39 +00:00

Update GCL dependency to avoid security alert (#1139)

* Update GCL dependency to avoid security alert

This required a few changes in addition to the dependency update.

- a few transitive / required dependency updates as well
- updating soyutils_usegoog.js and adding checks.js because they're
necessary as part of the Soy compilation process
- Using a trustedResourceUri in the buildSrc Soy compilation instead of
a string
- changing the arguments to the Soy-to-Java compiler to comply with the
new version
- Moving all Soy UI files to be in the registrar directory. This was
not the case before due to previous thinking that we'd have separate
admin and registrar consoles -- this is no longer the case so it's no
longer necessary. This necessitated various refactorings and reference
changes.
  - The new soy-to-javascript compiler requires this, as it removes the
  "deps" param that we were previously using to say "use the general UI
  utils as dependencies for the registrar-console files".
- Creating a SQL environment and loading test data in the test server
main method -- previously, the local test server did not work.
- Fix some JS code that was referencing now-deleted library functions
- Removal of the Karma tests, as the karma-closure library hasn't been
updated since 2018 and it no longer works. We never noticed any errors
from the Karma tests, we never change the JS, and we have the
Java+Selenium screenshot differ tests to test the UI anyway.
This commit is contained in:
gbrodman
2021-05-17 13:21:26 -04:00
committed by GitHub
parent bf1c34cc3b
commit 16641e05a1
103 changed files with 1336 additions and 3282 deletions

View File

@@ -0,0 +1,94 @@
/**
* @fileoverview Provides Soy runtime checks for safe types.
*
* NOTE (gbrodman) this file is taken from the open source version located at
* https://github.com/google/closure-templates/blob/6c8cf1c7916abd0ab5d7e9d259985873f8af4fd2/javascript/checks.js
*/
goog.provide('soy.checks');
goog.require('goog.asserts');
goog.require('goog.soy.data.SanitizedContentKind');
goog.require('goog.soy.data.SanitizedCss');
goog.require('goog.soy.data.SanitizedHtml');
goog.require('goog.soy.data.SanitizedHtmlAttribute');
goog.require('goog.soy.data.SanitizedJs');
goog.require('goog.soy.data.SanitizedTrustedResourceUri');
goog.require('goog.soy.data.SanitizedUri');
/**
* Checks whether a given value is of a given content kind.
*
* @param {?} value The value to be examined.
* @param {!goog.soy.data.SanitizedContentKind} contentKind The desired content
* kind.
* @param {!Object} constructor
* @return {boolean} Whether the given value is of the given kind.
* @private
*/
soy.checks.isContentKind_ = function(value, contentKind, constructor) {
var ret = value != null && value.contentKind === contentKind;
if (ret) {
goog.asserts.assert(value.constructor === constructor);
}
return ret;
};
/**
* @param {?} value
* @return {boolean}
*/
soy.checks.isHtml = function(value) {
return soy.checks.isContentKind_(
value, goog.soy.data.SanitizedContentKind.HTML,
goog.soy.data.SanitizedHtml);
};
/**
* @param {?} value
* @return {boolean}
*/
soy.checks.isCss = function(value) {
return soy.checks.isContentKind_(
value, goog.soy.data.SanitizedContentKind.CSS,
goog.soy.data.SanitizedCss);
};
/**
* @param {?} value
* @return {boolean}
*/
soy.checks.isAttribute = function(value) {
return soy.checks.isContentKind_(
value, goog.soy.data.SanitizedContentKind.ATTRIBUTES,
goog.soy.data.SanitizedHtmlAttribute);
};
/**
* @param {?} value
* @return {boolean}
*/
soy.checks.isJS = function(value) {
return soy.checks.isContentKind_(
value, goog.soy.data.SanitizedContentKind.JS, goog.soy.data.SanitizedJs);
};
/**
* @param {?} value
* @return {boolean}
*/
soy.checks.isTrustedResourceURI = function(value) {
return soy.checks.isContentKind_(
value, goog.soy.data.SanitizedContentKind.TRUSTED_RESOURCE_URI,
goog.soy.data.SanitizedTrustedResourceUri);
};
/**
* @param {?} value
* @return {boolean}
*/
soy.checks.isURI = function(value) {
return soy.checks.isContentKind_(
value, goog.soy.data.SanitizedContentKind.URI,
goog.soy.data.SanitizedUri);
};

View File

@@ -33,7 +33,7 @@ goog.forwardDeclare('goog.events.KeyEvent');
*/
registry.forms.focus = function(field) {
field = goog.dom.getElement(field);
if (!goog.isNull(field) && goog.dom.isFocusable(field)) {
if (field !== null && goog.dom.isFocusable(field)) {
goog.dom.forms.focusAndSelect(field);
}
};
@@ -45,7 +45,7 @@ registry.forms.focus = function(field) {
* @param {string=} opt_field Erroneous field name.
*/
registry.forms.displayError = function(message, opt_field) {
if (!goog.isDef(opt_field)) {
if (opt_field === undefined) {
registry.util.butter(message);
return;
}
@@ -53,7 +53,7 @@ registry.forms.displayError = function(message, opt_field) {
goog.dom.getElement(opt_field + '[0]');
// XXX: Transitioning to use of form.eltId instead of DOM id. If DOM id
// lookup fails, then search forms for the named field.
if (goog.isDefAndNotNull(opt_field) && goog.isNull(input)) {
if (opt_field != null && input === null) {
for (var fNdx in document.forms) {
var form = document.forms[fNdx];
if (form[opt_field]) {
@@ -62,7 +62,7 @@ registry.forms.displayError = function(message, opt_field) {
}
}
}
if (!goog.isNull(input)) {
if (input !== null) {
goog.dom.classlist.add(input, goog.getCssName('kd-formerror'));
goog.dom.insertSiblingAfter(
goog.dom.createDom(goog.dom.TagName.DIV,

View File

@@ -162,7 +162,7 @@ registry.registrar.Console.prototype.changeNavStyle = function() {
var regNavlist = goog.dom.getRequiredElement('reg-navlist');
var path = hashToken.substring(0, slashNdx);
var active = regNavlist.querySelector('a[href="#' + path + '"]');
if (goog.isNull(active)) {
if (active === null) {
registry.util.log('Unknown path or path form in changeNavStyle.');
return;
}

View File

@@ -54,7 +54,7 @@ goog.inherits(registry.registrar.ContactSettings, registry.ResourceComponent);
registry.registrar.ContactSettings.prototype.setupAppbar = function() {
registry.registrar.ContactSettings.base(this, 'setupAppbar');
// Setup delete only on existing items, not on creates.
if (goog.isDefAndNotNull(this.model)) {
if (this.model != null) {
var deleteBtn = goog.dom.createDom(
goog.dom.TagName.BUTTON, {
type: 'button',
@@ -159,7 +159,7 @@ registry.registrar.ContactSettings.prototype.sendDelete = function() {
ndxToDel = i;
}
}
if (goog.isNull(ndxToDel)) {
if (ndxToDel === null) {
throw new Error('Email to delete does not match model.');
}
var modelCopy = /** @type {!Object}

View File

@@ -25,8 +25,7 @@ goog.require('goog.soy');
*/
registry.util.log = function(var_args) {
if (goog.DEBUG) {
if (goog.isDef(goog.global.console) &&
goog.isDef(goog.global.console['log'])) {
if (goog.global.console !== undefined && goog.global.console['log'] !== undefined) {
goog.global.console.log.apply(goog.global.console, arguments);
}
}

File diff suppressed because it is too large Load Diff