@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.
package/fesm2015/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
  */
@@ -6148,23 +6148,36 @@ function ɵɵgetInheritedFactory(type) {
6148
6148
  */
6149
6149
  () => {
6150
6150
  /** @type {?} */
6151
- const proto = (/** @type {?} */ (Object.getPrototypeOf(type.prototype).constructor));
6151
+ const ownConstructor = type.prototype.constructor;
6152
6152
  /** @type {?} */
6153
- const factory = ((/** @type {?} */ (proto)))[NG_FACTORY_DEF] || ɵɵgetFactoryOf(proto);
6154
- if (factory !== null) {
6155
- return factory;
6156
- }
6157
- else {
6158
- // There is no factory defined. Either this was improper usage of inheritance
6159
- // (no Angular decorator on the superclass) or there is no constructor at all
6160
- // in the inheritance chain. Since the two cases cannot be distinguished, the
6161
- // latter has to be assumed.
6162
- return (/**
6163
- * @param {?} t
6164
- * @return {?}
6165
- */
6166
- (t) => new t());
6153
+ const ownFactory = ownConstructor[NG_FACTORY_DEF] || ɵɵgetFactoryOf(ownConstructor);
6154
+ /** @type {?} */
6155
+ const objectPrototype = Object.prototype;
6156
+ /** @type {?} */
6157
+ let parent = Object.getPrototypeOf(type.prototype).constructor;
6158
+ // Go up the prototype until we hit `Object`.
6159
+ while (parent && parent !== objectPrototype) {
6160
+ /** @type {?} */
6161
+ const factory = parent[NG_FACTORY_DEF] || ɵɵgetFactoryOf(parent);
6162
+ // If we hit something that has a factory and the factory isn't the same as the type,
6163
+ // we've found the inherited factory. Note the check that the factory isn't the type's
6164
+ // own factory is redundant in most cases, but if the user has custom decorators on the
6165
+ // class, this lookup will start one level down in the prototype chain, causing us to
6166
+ // find the own factory first and potentially triggering an infinite loop downstream.
6167
+ if (factory && factory !== ownFactory) {
6168
+ return factory;
6169
+ }
6170
+ parent = Object.getPrototypeOf(parent);
6167
6171
  }
6172
+ // There is no factory defined. Either this was improper usage of inheritance
6173
+ // (no Angular decorator on the superclass) or there is no constructor at all
6174
+ // in the inheritance chain. Since the two cases cannot be distinguished, the
6175
+ // latter has to be assumed.
6176
+ return (/**
6177
+ * @param {?} t
6178
+ * @return {?}
6179
+ */
6180
+ t => new t());
6168
6181
  }));
6169
6182
  }
6170
6183
 
@@ -6632,6 +6645,11 @@ function enableProdMode() {
6632
6645
  if (_runModeLocked) {
6633
6646
  throw new Error('Cannot enable prod mode after platform setup.');
6634
6647
  }
6648
+ // The below check is there so when ngDevMode is set via terser
6649
+ // `global['ngDevMode'] = false;` is also dropped.
6650
+ if (typeof ngDevMode === undefined || !!ngDevMode) {
6651
+ _global['ngDevMode'] = false;
6652
+ }
6635
6653
  _devMode = false;
6636
6654
  }
6637
6655
 
@@ -7654,6 +7672,42 @@ function getSanitizer() {
7654
7672
  return lView && lView[SANITIZER];
7655
7673
  }
7656
7674
 
7675
+ /**
7676
+ * @license
7677
+ * Copyright Google Inc. All Rights Reserved.
7678
+ *
7679
+ * Use of this source code is governed by an MIT-style license that can be
7680
+ * found in the LICENSE file at https://angular.io/license
7681
+ */
7682
+ const END_COMMENT = /-->/g;
7683
+ const END_COMMENT_ESCAPED = '-\u200B-\u200B>';
7684
+ /**
7685
+ * Escape the content of the strings so that it can be safely inserted into a comment node.
7686
+ *
7687
+ * The issue is that HTML does not specify any way to escape comment end text inside the comment.
7688
+ * `<!-- The way you close a comment is with "-->". -->`. Above the `"-->"` is meant to be text not
7689
+ * an end to the comment. This can be created programmatically through DOM APIs.
7690
+ *
7691
+ * ```
7692
+ * div.innerHTML = div.innerHTML
7693
+ * ```
7694
+ *
7695
+ * One would expect that the above code would be safe to do, but it turns out that because comment
7696
+ * text is not escaped, the comment may contain text which will prematurely close the comment
7697
+ * opening up the application for XSS attack. (In SSR we programmatically create comment nodes which
7698
+ * may contain such text and expect them to be safe.)
7699
+ *
7700
+ * This function escapes the comment text by looking for the closing char sequence `-->` and replace
7701
+ * it with `-_-_>` where the `_` is a zero width space `\u200B`. The result is that if a comment
7702
+ * contains `-->` text it will render normally but it will not cause the HTML parser to close the
7703
+ * comment.
7704
+ *
7705
+ * @param value text to make safe for comment node by escaping the comment close character sequence
7706
+ */
7707
+ function escapeCommentText(value) {
7708
+ return value.replace(END_COMMENT, END_COMMENT_ESCAPED);
7709
+ }
7710
+
7657
7711
  /**
7658
7712
  * @license
7659
7713
  * Copyright Google Inc. All Rights Reserved.
@@ -12711,7 +12765,7 @@ function setNgReflectProperty(lView, element, type, attrName, value) {
12711
12765
  }
12712
12766
  else {
12713
12767
  /** @type {?} */
12714
- const textContent = `bindings=${JSON.stringify({ [attrName]: debugValue }, null, 2)}`;
12768
+ const textContent = escapeCommentText(`bindings=${JSON.stringify({ [attrName]: debugValue }, null, 2)}`);
12715
12769
  if (isProceduralRenderer(renderer)) {
12716
12770
  renderer.setValue(((/** @type {?} */ (element))), textContent);
12717
12771
  }
@@ -28169,7 +28223,7 @@ if (false) {
28169
28223
  * \@publicApi
28170
28224
  * @type {?}
28171
28225
  */
28172
- const VERSION = new Version('9.1.9');
28226
+ const VERSION = new Version('9.1.13');
28173
28227
 
28174
28228
  /**
28175
28229
  * @fileoverview added by tsickle
@@ -47536,7 +47590,7 @@ function debugCheckAndUpdateNode(view, nodeDef, argStyle, givenValues) {
47536
47590
  const el = asElementData(view, elDef.nodeIndex).renderElement;
47537
47591
  if (!(/** @type {?} */ (elDef.element)).name) {
47538
47592
  // a comment.
47539
- view.renderer.setValue(el, `bindings=${JSON.stringify(bindingValues, null, 2)}`);
47593
+ view.renderer.setValue(el, escapeCommentText(`bindings=${JSON.stringify(bindingValues, null, 2)}`));
47540
47594
  }
47541
47595
  else {
47542
47596
  // a regular element.
@@ -47960,7 +48014,7 @@ class DebugRenderer2 {
47960
48014
  */
47961
48015
  createComment(value) {
47962
48016
  /** @type {?} */
47963
- const comment = this.delegate.createComment(value);
48017
+ const comment = this.delegate.createComment(escapeCommentText(value));
47964
48018
  /** @type {?} */
47965
48019
  const debugCtx = this.createDebugContext(comment);
47966
48020
  if (debugCtx) {