@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.
@@ -576,10 +576,9 @@ export declare function forceWebSockets(): void;
576
576
  export declare function get(query: Query): Promise<DataSnapshot>;
577
577
 
578
578
  /**
579
- * Returns the instance of the Realtime Database SDK that is associated
580
- * with the provided {@link @firebase/app#FirebaseApp}. Initializes a new instance with
581
- * with default settings if no instance exists or if the existing instance uses
582
- * a custom database URL.
579
+ * Returns the instance of the Realtime Database SDK that is associated with the provided
580
+ * {@link @firebase/app#FirebaseApp}. Initializes a new instance with default settings if
581
+ * no instance exists or if the existing instance uses a custom database URL.
583
582
  *
584
583
  * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned Realtime
585
584
  * Database instance is associated with.
@@ -2965,7 +2964,7 @@ declare interface ViewProcessor {
2965
2964
 
2966
2965
  /**
2967
2966
  * Defines a single user-initiated write operation. May be the result of a set(), transaction(), or update() call. In
2968
- * the case of a set() or transaction, snap wil be non-null. In the case of an update(), children will be non-null.
2967
+ * the case of a set() or transaction, snap will be non-null. In the case of an update(), children will be non-null.
2969
2968
  */
2970
2969
  declare interface WriteRecord {
2971
2970
  writeId: number;
@@ -573,7 +573,7 @@ const isWindowsStoreApp = function () {
573
573
  return typeof Windows === 'object' && typeof Windows.UI === 'object';
574
574
  };
575
575
  /**
576
- * Converts a server error code to a Javascript Error
576
+ * Converts a server error code to a JavaScript Error
577
577
  */
578
578
  function errorForServerCode(code, query) {
579
579
  let reason = 'Unknown Error';
@@ -602,7 +602,7 @@ const INTEGER_REGEXP_ = new RegExp('^-?(0*)\\d{1,10}$');
602
602
  */
603
603
  const INTEGER_32_MIN = -2147483648;
604
604
  /**
605
- * For use in kyes, the maximum possible 32-bit integer.
605
+ * For use in keys, the maximum possible 32-bit integer.
606
606
  */
607
607
  const INTEGER_32_MAX = 2147483647;
608
608
  /**
@@ -1251,7 +1251,7 @@ WebSocketConnection.responsesRequiredToBeHealthy = 2;
1251
1251
  WebSocketConnection.healthyTimeout = 30000;
1252
1252
 
1253
1253
  const name = "@firebase/database";
1254
- const version = "1.0.6-canary.4b4db85ff";
1254
+ const version = "1.0.6-canary.62661245f";
1255
1255
 
1256
1256
  /**
1257
1257
  * @license
@@ -1287,7 +1287,7 @@ class AppCheckTokenProvider {
1287
1287
  // Support delayed initialization of FirebaseAppCheck. This allows our
1288
1288
  // customers to initialize the RTDB SDK before initializing Firebase
1289
1289
  // AppCheck and ensures that all requests are authenticated if a token
1290
- // becomes available before the timoeout below expires.
1290
+ // becomes available before the timeout below expires.
1291
1291
  setTimeout(() => {
1292
1292
  if (this.appCheck) {
1293
1293
  this.getToken(forceRefresh).then(resolve, reject);
@@ -1346,7 +1346,7 @@ class FirebaseAuthTokenProvider {
1346
1346
  // Support delayed initialization of FirebaseAuth. This allows our
1347
1347
  // customers to initialize the RTDB SDK before initializing Firebase
1348
1348
  // Auth and ensures that all requests are authenticated if a token
1349
- // becomes available before the timoeout below expires.
1349
+ // becomes available before the timeout below expires.
1350
1350
  setTimeout(() => {
1351
1351
  if (this.auth_) {
1352
1352
  this.getToken(forceRefresh).then(resolve, reject);
@@ -1816,7 +1816,7 @@ class BrowserPollConnection {
1816
1816
  *********************************************************************************************/
1817
1817
  class FirebaseIFrameScriptHolder {
1818
1818
  /**
1819
- * @param commandCB - The callback to be called when control commands are recevied from the server.
1819
+ * @param commandCB - The callback to be called when control commands are received from the server.
1820
1820
  * @param onMessageCB - The callback to be triggered when responses arrive from the server.
1821
1821
  * @param onDisconnect - The callback to be triggered when this tag holder is closed
1822
1822
  * @param urlFn - A function that provides the URL of the endpoint to send data to.
@@ -1861,6 +1861,8 @@ class FirebaseIFrameScriptHolder {
1861
1861
  const iframeContents = '<html><body>' + script + '</body></html>';
1862
1862
  try {
1863
1863
  this.myIFrame.doc.open();
1864
+ // TODO: Do not use document.write, since it can lead to XSS. Instead, use the safevalues
1865
+ // library to sanitize the HTML in the iframeContents.
1864
1866
  this.myIFrame.doc.write(iframeContents);
1865
1867
  this.myIFrame.doc.close();
1866
1868
  }
@@ -2083,6 +2085,10 @@ class FirebaseIFrameScriptHolder {
2083
2085
  const newScript = this.myIFrame.doc.createElement('script');
2084
2086
  newScript.type = 'text/javascript';
2085
2087
  newScript.async = true;
2088
+ // TODO: We cannot assign an arbitrary URL to a script attached to the DOM, since it is
2089
+ // at risk of XSS. We should use the safevalues library to create a safeScriptEl, and
2090
+ // assign a sanitized trustedResourceURL to it. Since the URL must be a template string
2091
+ // literal, this could require some heavy refactoring.
2086
2092
  newScript.src = url;
2087
2093
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2088
2094
  newScript.onload = newScript.onreadystatechange =
@@ -10319,7 +10325,7 @@ function treeHasChildren(tree) {
10319
10325
  return tree.node.childCount > 0;
10320
10326
  }
10321
10327
  /**
10322
- * @returns Whethe rthe tree is empty (no value or children).
10328
+ * @returns Whether the tree is empty (no value or children).
10323
10329
  */
10324
10330
  function treeIsEmpty(tree) {
10325
10331
  return treeGetValue(tree) === undefined && !treeHasChildren(tree);
@@ -12647,7 +12653,7 @@ function push(parent, value) {
12647
12653
  // then() and catch() methods and is used as the return value of push(). The
12648
12654
  // second remains a regular Reference and is used as the fulfilled value of
12649
12655
  // the first ThennableReference.
12650
- const thennablePushRef = child(parent, name);
12656
+ const thenablePushRef = child(parent, name);
12651
12657
  const pushRef = child(parent, name);
12652
12658
  let promise;
12653
12659
  if (value != null) {
@@ -12656,9 +12662,9 @@ function push(parent, value) {
12656
12662
  else {
12657
12663
  promise = Promise.resolve(pushRef);
12658
12664
  }
12659
- thennablePushRef.then = promise.then.bind(promise);
12660
- thennablePushRef.catch = promise.then.bind(promise, undefined);
12661
- return thennablePushRef;
12665
+ thenablePushRef.then = promise.then.bind(promise);
12666
+ thenablePushRef.catch = promise.then.bind(promise, undefined);
12667
+ return thenablePushRef;
12662
12668
  }
12663
12669
  /**
12664
12670
  * Removes the data at this Database location.
@@ -13633,10 +13639,9 @@ function forceLongPolling() {
13633
13639
  BrowserPollConnection.forceAllow();
13634
13640
  }
13635
13641
  /**
13636
- * Returns the instance of the Realtime Database SDK that is associated
13637
- * with the provided {@link @firebase/app#FirebaseApp}. Initializes a new instance with
13638
- * with default settings if no instance exists or if the existing instance uses
13639
- * a custom database URL.
13642
+ * Returns the instance of the Realtime Database SDK that is associated with the provided
13643
+ * {@link @firebase/app#FirebaseApp}. Initializes a new instance with default settings if
13644
+ * no instance exists or if the existing instance uses a custom database URL.
13640
13645
  *
13641
13646
  * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned Realtime
13642
13647
  * Database instance is associated with.