@angular/core 9.1.9 → 9.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v9.1.9
2
+ * @license Angular v9.1.13
3
3
  * (c) 2010-2020 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
package/fesm5/core.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v9.1.9
2
+ * @license Angular v9.1.13
3
3
  * (c) 2010-2020 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -4057,18 +4057,28 @@ function ɵɵgetFactoryOf(type) {
4057
4057
  */
4058
4058
  function ɵɵgetInheritedFactory(type) {
4059
4059
  return noSideEffects(function () {
4060
- var proto = Object.getPrototypeOf(type.prototype).constructor;
4061
- var factory = proto[NG_FACTORY_DEF] || ɵɵgetFactoryOf(proto);
4062
- if (factory !== null) {
4063
- return factory;
4064
- }
4065
- else {
4066
- // There is no factory defined. Either this was improper usage of inheritance
4067
- // (no Angular decorator on the superclass) or there is no constructor at all
4068
- // in the inheritance chain. Since the two cases cannot be distinguished, the
4069
- // latter has to be assumed.
4070
- return function (t) { return new t(); };
4071
- }
4060
+ var ownConstructor = type.prototype.constructor;
4061
+ var ownFactory = ownConstructor[NG_FACTORY_DEF] || ɵɵgetFactoryOf(ownConstructor);
4062
+ var objectPrototype = Object.prototype;
4063
+ var parent = Object.getPrototypeOf(type.prototype).constructor;
4064
+ // Go up the prototype until we hit `Object`.
4065
+ while (parent && parent !== objectPrototype) {
4066
+ var factory = parent[NG_FACTORY_DEF] || ɵɵgetFactoryOf(parent);
4067
+ // If we hit something that has a factory and the factory isn't the same as the type,
4068
+ // we've found the inherited factory. Note the check that the factory isn't the type's
4069
+ // own factory is redundant in most cases, but if the user has custom decorators on the
4070
+ // class, this lookup will start one level down in the prototype chain, causing us to
4071
+ // find the own factory first and potentially triggering an infinite loop downstream.
4072
+ if (factory && factory !== ownFactory) {
4073
+ return factory;
4074
+ }
4075
+ parent = Object.getPrototypeOf(parent);
4076
+ }
4077
+ // There is no factory defined. Either this was improper usage of inheritance
4078
+ // (no Angular decorator on the superclass) or there is no constructor at all
4079
+ // in the inheritance chain. Since the two cases cannot be distinguished, the
4080
+ // latter has to be assumed.
4081
+ return function (t) { return new t(); };
4072
4082
  });
4073
4083
  }
4074
4084
 
@@ -4402,6 +4412,11 @@ function enableProdMode() {
4402
4412
  if (_runModeLocked) {
4403
4413
  throw new Error('Cannot enable prod mode after platform setup.');
4404
4414
  }
4415
+ // The below check is there so when ngDevMode is set via terser
4416
+ // `global['ngDevMode'] = false;` is also dropped.
4417
+ if (typeof ngDevMode === undefined || !!ngDevMode) {
4418
+ _global['ngDevMode'] = false;
4419
+ }
4405
4420
  _devMode = false;
4406
4421
  }
4407
4422
 
@@ -5230,6 +5245,42 @@ function getSanitizer() {
5230
5245
  return lView && lView[SANITIZER];
5231
5246
  }
5232
5247
 
5248
+ /**
5249
+ * @license
5250
+ * Copyright Google Inc. All Rights Reserved.
5251
+ *
5252
+ * Use of this source code is governed by an MIT-style license that can be
5253
+ * found in the LICENSE file at https://angular.io/license
5254
+ */
5255
+ var END_COMMENT = /-->/g;
5256
+ var END_COMMENT_ESCAPED = '-\u200B-\u200B>';
5257
+ /**
5258
+ * Escape the content of the strings so that it can be safely inserted into a comment node.
5259
+ *
5260
+ * The issue is that HTML does not specify any way to escape comment end text inside the comment.
5261
+ * `<!-- The way you close a comment is with "-->". -->`. Above the `"-->"` is meant to be text not
5262
+ * an end to the comment. This can be created programmatically through DOM APIs.
5263
+ *
5264
+ * ```
5265
+ * div.innerHTML = div.innerHTML
5266
+ * ```
5267
+ *
5268
+ * One would expect that the above code would be safe to do, but it turns out that because comment
5269
+ * text is not escaped, the comment may contain text which will prematurely close the comment
5270
+ * opening up the application for XSS attack. (In SSR we programmatically create comment nodes which
5271
+ * may contain such text and expect them to be safe.)
5272
+ *
5273
+ * This function escapes the comment text by looking for the closing char sequence `-->` and replace
5274
+ * it with `-_-_>` where the `_` is a zero width space `\u200B`. The result is that if a comment
5275
+ * contains `-->` text it will render normally but it will not cause the HTML parser to close the
5276
+ * comment.
5277
+ *
5278
+ * @param value text to make safe for comment node by escaping the comment close character sequence
5279
+ */
5280
+ function escapeCommentText(value) {
5281
+ return value.replace(END_COMMENT, END_COMMENT_ESCAPED);
5282
+ }
5283
+
5233
5284
  /**
5234
5285
  * @license
5235
5286
  * Copyright Google Inc. All Rights Reserved.
@@ -8195,7 +8246,7 @@ function setNgReflectProperty(lView, element, type, attrName, value) {
8195
8246
  }
8196
8247
  }
8197
8248
  else {
8198
- var textContent = "bindings=" + JSON.stringify((_a = {}, _a[attrName] = debugValue, _a), null, 2);
8249
+ var textContent = escapeCommentText("bindings=" + JSON.stringify((_a = {}, _a[attrName] = debugValue, _a), null, 2));
8199
8250
  if (isProceduralRenderer(renderer)) {
8200
8251
  renderer.setValue(element, textContent);
8201
8252
  }
@@ -20049,7 +20100,7 @@ var Version = /** @class */ (function () {
20049
20100
  /**
20050
20101
  * @publicApi
20051
20102
  */
20052
- var VERSION = new Version('9.1.9');
20103
+ var VERSION = new Version('9.1.13');
20053
20104
 
20054
20105
  /**
20055
20106
  * @license
@@ -32114,7 +32165,7 @@ function debugCheckAndUpdateNode(view, nodeDef, argStyle, givenValues) {
32114
32165
  var el = asElementData(view, elDef.nodeIndex).renderElement;
32115
32166
  if (!elDef.element.name) {
32116
32167
  // a comment.
32117
- view.renderer.setValue(el, "bindings=" + JSON.stringify(bindingValues, null, 2));
32168
+ view.renderer.setValue(el, escapeCommentText("bindings=" + JSON.stringify(bindingValues, null, 2)));
32118
32169
  }
32119
32170
  else {
32120
32171
  // a regular element.
@@ -32403,7 +32454,7 @@ var DebugRenderer2 = /** @class */ (function () {
32403
32454
  return el;
32404
32455
  };
32405
32456
  DebugRenderer2.prototype.createComment = function (value) {
32406
- var comment = this.delegate.createComment(value);
32457
+ var comment = this.delegate.createComment(escapeCommentText(value));
32407
32458
  var debugCtx = this.createDebugContext(comment);
32408
32459
  if (debugCtx) {
32409
32460
  indexDebugNode(new DebugNode__PRE_R3__(comment, null, debugCtx));