@angular/core 9.1.12 → 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.12
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.12
2
+ * @license Angular v9.1.13
3
3
  * (c) 2010-2020 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -4412,6 +4412,11 @@ function enableProdMode() {
4412
4412
  if (_runModeLocked) {
4413
4413
  throw new Error('Cannot enable prod mode after platform setup.');
4414
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
+ }
4415
4420
  _devMode = false;
4416
4421
  }
4417
4422
 
@@ -5240,6 +5245,42 @@ function getSanitizer() {
5240
5245
  return lView && lView[SANITIZER];
5241
5246
  }
5242
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
+
5243
5284
  /**
5244
5285
  * @license
5245
5286
  * Copyright Google Inc. All Rights Reserved.
@@ -8205,7 +8246,7 @@ function setNgReflectProperty(lView, element, type, attrName, value) {
8205
8246
  }
8206
8247
  }
8207
8248
  else {
8208
- 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));
8209
8250
  if (isProceduralRenderer(renderer)) {
8210
8251
  renderer.setValue(element, textContent);
8211
8252
  }
@@ -20059,7 +20100,7 @@ var Version = /** @class */ (function () {
20059
20100
  /**
20060
20101
  * @publicApi
20061
20102
  */
20062
- var VERSION = new Version('9.1.12');
20103
+ var VERSION = new Version('9.1.13');
20063
20104
 
20064
20105
  /**
20065
20106
  * @license
@@ -32124,7 +32165,7 @@ function debugCheckAndUpdateNode(view, nodeDef, argStyle, givenValues) {
32124
32165
  var el = asElementData(view, elDef.nodeIndex).renderElement;
32125
32166
  if (!elDef.element.name) {
32126
32167
  // a comment.
32127
- view.renderer.setValue(el, "bindings=" + JSON.stringify(bindingValues, null, 2));
32168
+ view.renderer.setValue(el, escapeCommentText("bindings=" + JSON.stringify(bindingValues, null, 2)));
32128
32169
  }
32129
32170
  else {
32130
32171
  // a regular element.
@@ -32413,7 +32454,7 @@ var DebugRenderer2 = /** @class */ (function () {
32413
32454
  return el;
32414
32455
  };
32415
32456
  DebugRenderer2.prototype.createComment = function (value) {
32416
- var comment = this.delegate.createComment(value);
32457
+ var comment = this.delegate.createComment(escapeCommentText(value));
32417
32458
  var debugCtx = this.createDebugContext(comment);
32418
32459
  if (debugCtx) {
32419
32460
  indexDebugNode(new DebugNode__PRE_R3__(comment, null, debugCtx));