@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
  */
@@ -4597,6 +4597,11 @@
4597
4597
  if (_runModeLocked) {
4598
4598
  throw new Error('Cannot enable prod mode after platform setup.');
4599
4599
  }
4600
+ // The below check is there so when ngDevMode is set via terser
4601
+ // `global['ngDevMode'] = false;` is also dropped.
4602
+ if (typeof ngDevMode === undefined || !!ngDevMode) {
4603
+ _global['ngDevMode'] = false;
4604
+ }
4600
4605
  _devMode = false;
4601
4606
  }
4602
4607
 
@@ -5415,6 +5420,42 @@
5415
5420
  return lView && lView[SANITIZER];
5416
5421
  }
5417
5422
 
5423
+ /**
5424
+ * @license
5425
+ * Copyright Google Inc. All Rights Reserved.
5426
+ *
5427
+ * Use of this source code is governed by an MIT-style license that can be
5428
+ * found in the LICENSE file at https://angular.io/license
5429
+ */
5430
+ var END_COMMENT = /-->/g;
5431
+ var END_COMMENT_ESCAPED = '-\u200B-\u200B>';
5432
+ /**
5433
+ * Escape the content of the strings so that it can be safely inserted into a comment node.
5434
+ *
5435
+ * The issue is that HTML does not specify any way to escape comment end text inside the comment.
5436
+ * `<!-- The way you close a comment is with "-->". -->`. Above the `"-->"` is meant to be text not
5437
+ * an end to the comment. This can be created programmatically through DOM APIs.
5438
+ *
5439
+ * ```
5440
+ * div.innerHTML = div.innerHTML
5441
+ * ```
5442
+ *
5443
+ * One would expect that the above code would be safe to do, but it turns out that because comment
5444
+ * text is not escaped, the comment may contain text which will prematurely close the comment
5445
+ * opening up the application for XSS attack. (In SSR we programmatically create comment nodes which
5446
+ * may contain such text and expect them to be safe.)
5447
+ *
5448
+ * This function escapes the comment text by looking for the closing char sequence `-->` and replace
5449
+ * it with `-_-_>` where the `_` is a zero width space `\u200B`. The result is that if a comment
5450
+ * contains `-->` text it will render normally but it will not cause the HTML parser to close the
5451
+ * comment.
5452
+ *
5453
+ * @param value text to make safe for comment node by escaping the comment close character sequence
5454
+ */
5455
+ function escapeCommentText(value) {
5456
+ return value.replace(END_COMMENT, END_COMMENT_ESCAPED);
5457
+ }
5458
+
5418
5459
  /**
5419
5460
  * @license
5420
5461
  * Copyright Google Inc. All Rights Reserved.
@@ -8380,7 +8421,7 @@
8380
8421
  }
8381
8422
  }
8382
8423
  else {
8383
- var textContent = "bindings=" + JSON.stringify((_a = {}, _a[attrName] = debugValue, _a), null, 2);
8424
+ var textContent = escapeCommentText("bindings=" + JSON.stringify((_a = {}, _a[attrName] = debugValue, _a), null, 2));
8384
8425
  if (isProceduralRenderer(renderer)) {
8385
8426
  renderer.setValue(element, textContent);
8386
8427
  }
@@ -20229,7 +20270,7 @@
20229
20270
  /**
20230
20271
  * @publicApi
20231
20272
  */
20232
- var VERSION = new Version('9.1.12');
20273
+ var VERSION = new Version('9.1.13');
20233
20274
 
20234
20275
  /**
20235
20276
  * @license
@@ -32266,7 +32307,7 @@
32266
32307
  var el = asElementData(view, elDef.nodeIndex).renderElement;
32267
32308
  if (!elDef.element.name) {
32268
32309
  // a comment.
32269
- view.renderer.setValue(el, "bindings=" + JSON.stringify(bindingValues, null, 2));
32310
+ view.renderer.setValue(el, escapeCommentText("bindings=" + JSON.stringify(bindingValues, null, 2)));
32270
32311
  }
32271
32312
  else {
32272
32313
  // a regular element.
@@ -32555,7 +32596,7 @@
32555
32596
  return el;
32556
32597
  };
32557
32598
  DebugRenderer2.prototype.createComment = function (value) {
32558
- var comment = this.delegate.createComment(value);
32599
+ var comment = this.delegate.createComment(escapeCommentText(value));
32559
32600
  var debugCtx = this.createDebugContext(comment);
32560
32601
  if (debugCtx) {
32561
32602
  indexDebugNode(new DebugNode__PRE_R3__(comment, null, debugCtx));