@firebase/database 1.0.6-canary.4b4db85ff → 1.0.6-canary.62661245f

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.
@@ -5,7 +5,7 @@ import { stringify, jsonEval, contains, assert, isNodeSdk, stringToByteArray, Sh
5
5
  import { Logger, LogLevel } from '@firebase/logger';
6
6
 
7
7
  var name = "@firebase/database";
8
- var version = "1.0.6-canary.4b4db85ff";
8
+ var version = "1.0.6-canary.62661245f";
9
9
 
10
10
  /**
11
11
  * @license
@@ -598,7 +598,7 @@ var isWindowsStoreApp = function () {
598
598
  return typeof Windows === 'object' && typeof Windows.UI === 'object';
599
599
  };
600
600
  /**
601
- * Converts a server error code to a Javascript Error
601
+ * Converts a server error code to a JavaScript Error
602
602
  */
603
603
  function errorForServerCode(code, query) {
604
604
  var reason = 'Unknown Error';
@@ -627,7 +627,7 @@ var INTEGER_REGEXP_ = new RegExp('^-?(0*)\\d{1,10}$');
627
627
  */
628
628
  var INTEGER_32_MIN = -2147483648;
629
629
  /**
630
- * For use in kyes, the maximum possible 32-bit integer.
630
+ * For use in keys, the maximum possible 32-bit integer.
631
631
  */
632
632
  var INTEGER_32_MAX = 2147483647;
633
633
  /**
@@ -754,7 +754,7 @@ var AppCheckTokenProvider = /** @class */ (function () {
754
754
  // Support delayed initialization of FirebaseAppCheck. This allows our
755
755
  // customers to initialize the RTDB SDK before initializing Firebase
756
756
  // AppCheck and ensures that all requests are authenticated if a token
757
- // becomes available before the timoeout below expires.
757
+ // becomes available before the timeout below expires.
758
758
  setTimeout(function () {
759
759
  if (_this.appCheck) {
760
760
  _this.getToken(forceRefresh).then(resolve, reject);
@@ -816,7 +816,7 @@ var FirebaseAuthTokenProvider = /** @class */ (function () {
816
816
  // Support delayed initialization of FirebaseAuth. This allows our
817
817
  // customers to initialize the RTDB SDK before initializing Firebase
818
818
  // Auth and ensures that all requests are authenticated if a token
819
- // becomes available before the timoeout below expires.
819
+ // becomes available before the timeout below expires.
820
820
  setTimeout(function () {
821
821
  if (_this.auth_) {
822
822
  _this.getToken(forceRefresh).then(resolve, reject);
@@ -1531,7 +1531,7 @@ var BrowserPollConnection = /** @class */ (function () {
1531
1531
  *********************************************************************************************/
1532
1532
  var FirebaseIFrameScriptHolder = /** @class */ (function () {
1533
1533
  /**
1534
- * @param commandCB - The callback to be called when control commands are recevied from the server.
1534
+ * @param commandCB - The callback to be called when control commands are received from the server.
1535
1535
  * @param onMessageCB - The callback to be triggered when responses arrive from the server.
1536
1536
  * @param onDisconnect - The callback to be triggered when this tag holder is closed
1537
1537
  * @param urlFn - A function that provides the URL of the endpoint to send data to.
@@ -1576,6 +1576,8 @@ var FirebaseIFrameScriptHolder = /** @class */ (function () {
1576
1576
  var iframeContents = '<html><body>' + script + '</body></html>';
1577
1577
  try {
1578
1578
  this.myIFrame.doc.open();
1579
+ // TODO: Do not use document.write, since it can lead to XSS. Instead, use the safevalues
1580
+ // library to sanitize the HTML in the iframeContents.
1579
1581
  this.myIFrame.doc.write(iframeContents);
1580
1582
  this.myIFrame.doc.close();
1581
1583
  }
@@ -1801,6 +1803,10 @@ var FirebaseIFrameScriptHolder = /** @class */ (function () {
1801
1803
  var newScript_1 = _this.myIFrame.doc.createElement('script');
1802
1804
  newScript_1.type = 'text/javascript';
1803
1805
  newScript_1.async = true;
1806
+ // TODO: We cannot assign an arbitrary URL to a script attached to the DOM, since it is
1807
+ // at risk of XSS. We should use the safevalues library to create a safeScriptEl, and
1808
+ // assign a sanitized trustedResourceURL to it. Since the URL must be a template string
1809
+ // literal, this could require some heavy refactoring.
1804
1810
  newScript_1.src = url;
1805
1811
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1806
1812
  newScript_1.onload = newScript_1.onreadystatechange =
@@ -10642,7 +10648,7 @@ function treeHasChildren(tree) {
10642
10648
  return tree.node.childCount > 0;
10643
10649
  }
10644
10650
  /**
10645
- * @returns Whethe rthe tree is empty (no value or children).
10651
+ * @returns Whether the tree is empty (no value or children).
10646
10652
  */
10647
10653
  function treeIsEmpty(tree) {
10648
10654
  return treeGetValue(tree) === undefined && !treeHasChildren(tree);
@@ -13053,7 +13059,7 @@ function push(parent, value) {
13053
13059
  // then() and catch() methods and is used as the return value of push(). The
13054
13060
  // second remains a regular Reference and is used as the fulfilled value of
13055
13061
  // the first ThennableReference.
13056
- var thennablePushRef = child(parent, name);
13062
+ var thenablePushRef = child(parent, name);
13057
13063
  var pushRef = child(parent, name);
13058
13064
  var promise;
13059
13065
  if (value != null) {
@@ -13062,9 +13068,9 @@ function push(parent, value) {
13062
13068
  else {
13063
13069
  promise = Promise.resolve(pushRef);
13064
13070
  }
13065
- thennablePushRef.then = promise.then.bind(promise);
13066
- thennablePushRef.catch = promise.then.bind(promise, undefined);
13067
- return thennablePushRef;
13071
+ thenablePushRef.then = promise.then.bind(promise);
13072
+ thenablePushRef.catch = promise.then.bind(promise, undefined);
13073
+ return thenablePushRef;
13068
13074
  }
13069
13075
  /**
13070
13076
  * Removes the data at this Database location.
@@ -14096,10 +14102,9 @@ function forceLongPolling() {
14096
14102
  BrowserPollConnection.forceAllow();
14097
14103
  }
14098
14104
  /**
14099
- * Returns the instance of the Realtime Database SDK that is associated
14100
- * with the provided {@link @firebase/app#FirebaseApp}. Initializes a new instance with
14101
- * with default settings if no instance exists or if the existing instance uses
14102
- * a custom database URL.
14105
+ * Returns the instance of the Realtime Database SDK that is associated with the provided
14106
+ * {@link @firebase/app#FirebaseApp}. Initializes a new instance with default settings if
14107
+ * no instance exists or if the existing instance uses a custom database URL.
14103
14108
  *
14104
14109
  * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned Realtime
14105
14110
  * Database instance is associated with.