Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove prototype overrides in FirebaseError and all subclasses #8552

Open
wants to merge 2 commits into
base: v11
Choose a base branch
from

Conversation

dlarocque
Copy link
Contributor

We override the prototype of this in all of the constructors for our custom error classes. This allowed us to adjust the prototype chain, so that we can perform instanceof checks on subclasses of Error.

Since ES2015, the built-in Error constructor uses new.target to adjust the prototype chain for us, so we no longer need to do it ourselves.

See https://github.com/Microsoft/TypeScript-wiki/blob/main/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work (the link doesn't work well since the linked header is hidden behind a rolled up section that can be expanded by clicking "See Changes for Older Releases" at the bottom).

Since new.target does not exist in ES5, the prototype chain won't be adjusted if our bundle is transpiled down to ES5.

Copy link

changeset-bot bot commented Sep 30, 2024

🦋 Changeset detected

Latest commit: 117527e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 29 packages
Name Type
@firebase/vertexai Patch
@firebase/storage Patch
@firebase/auth Patch
@firebase/util Patch
firebase Patch
@firebase/storage-compat Patch
@firebase/auth-compat Patch
@firebase/firestore Patch
@firebase/analytics-compat Patch
@firebase/analytics Patch
@firebase/app-check-compat Patch
@firebase/app-check Patch
@firebase/app-compat Patch
@firebase/app Patch
@firebase/component Patch
@firebase/database-compat Patch
@firebase/database-types Patch
@firebase/database Patch
@firebase/firestore-compat Patch
@firebase/functions-compat Patch
@firebase/functions Patch
@firebase/installations-compat Patch
@firebase/installations Patch
@firebase/messaging-compat Patch
@firebase/messaging Patch
@firebase/performance-compat Patch
@firebase/performance Patch
@firebase/remote-config-compat Patch
@firebase/remote-config Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@google-oss-bot
Copy link
Contributor

Size Report 1

Affected Products

  • @firebase/auth

    TypeBase (98bbf53)Merge (355fcaa)Diff
    browser182 kB182 kB-55 B (-0.0%)
    cordova161 kB161 kB-55 B (-0.0%)
    main142 kB142 kB-55 B (-0.0%)
    module182 kB182 kB-55 B (-0.0%)
    react-native157 kB157 kB-55 B (-0.0%)
  • @firebase/auth-cordova

    TypeBase (98bbf53)Merge (355fcaa)Diff
    browser161 kB161 kB-55 B (-0.0%)
    module161 kB161 kB-55 B (-0.0%)
  • @firebase/auth-web-extension

    TypeBase (98bbf53)Merge (355fcaa)Diff
    browser137 kB137 kB-55 B (-0.0%)
    main152 kB152 kB-55 B (-0.0%)
    module137 kB137 kB-55 B (-0.0%)
  • @firebase/auth/internal

    TypeBase (98bbf53)Merge (355fcaa)Diff
    browser193 kB193 kB-55 B (-0.0%)
    main168 kB168 kB-55 B (-0.0%)
    module193 kB193 kB-55 B (-0.0%)
  • @firebase/storage

    TypeBase (98bbf53)Merge (355fcaa)Diff
    browser57.8 kB57.8 kB-51 B (-0.1%)
    main59.3 kB59.2 kB-51 B (-0.1%)
    module57.8 kB57.8 kB-51 B (-0.1%)
  • @firebase/util

    TypeBase (98bbf53)Merge (355fcaa)Diff
    browser23.4 kB23.3 kB-52 B (-0.2%)
    main29.2 kB29.2 kB-52 B (-0.2%)
    module23.4 kB23.3 kB-52 B (-0.2%)
  • @firebase/vertexai

    TypeBase (98bbf53)Merge (355fcaa)Diff
    browser28.4 kB28.3 kB-52 B (-0.2%)
    main29.2 kB29.2 kB-52 B (-0.2%)
    module28.4 kB28.3 kB-52 B (-0.2%)
  • bundle

    46 size changes

    TypeBase (98bbf53)Merge (355fcaa)Diff
    analytics (logEvent)44.5 kB44.5 kB-40 B (-0.1%)
    app-check (CustomProvider)37.4 kB37.4 kB-40 B (-0.1%)
    app-check (ReCaptchaEnterpriseProvider)39.9 kB39.9 kB-40 B (-0.1%)
    app-check (ReCaptchaV3Provider)39.9 kB39.9 kB-40 B (-0.1%)
    auth (Anonymous)76.2 kB76.2 kB-40 B (-0.1%)
    auth (EmailAndPassword)84.5 kB84.4 kB-81 B (-0.1%)
    auth (GoogleFBTwitterGitHubPopup)103 kB103 kB-81 B (-0.1%)
    auth (GooglePopup)100 kB100 kB-81 B (-0.1%)
    auth (GoogleRedirect)100 kB100 kB-81 B (-0.1%)
    auth (Phone)86.9 kB86.8 kB-81 B (-0.1%)
    database (Append to a list of data)149 kB149 kB-40 B (-0.0%)
    database (Filtering data)148 kB148 kB-40 B (-0.0%)
    database (Listen for child events)164 kB164 kB-40 B (-0.0%)
    database (Listen for value events + Detach listeners)164 kB164 kB-40 B (-0.0%)
    database (Listen for value events)164 kB164 kB-40 B (-0.0%)
    database (Read data once)164 kB164 kB-40 B (-0.0%)
    database (Save data as transactions)166 kB166 kB-40 B (-0.0%)
    database (Sort data)150 kB150 kB-40 B (-0.0%)
    database (Write data)148 kB148 kB-40 B (-0.0%)
    firestore (CSI Auto Indexing Disable and Delete)272 kB272 kB-40 B (-0.0%)
    firestore (CSI Auto Indexing Enable)272 kB272 kB-40 B (-0.0%)
    firestore (Persistence)303 kB303 kB-40 B (-0.0%)
    firestore (Query Cursors)249 kB249 kB-40 B (-0.0%)
    firestore (Query)246 kB246 kB-40 B (-0.0%)
    firestore (Read data once)234 kB234 kB-40 B (-0.0%)
    firestore (Read Write w Persistence)328 kB328 kB-40 B (-0.0%)
    firestore (Realtime updates)236 kB236 kB-40 B (-0.0%)
    firestore (Transaction)214 kB213 kB-40 B (-0.0%)
    firestore (Write data)213 kB213 kB-40 B (-0.0%)
    firestore-lite (Query Cursors)91.4 kB91.3 kB-40 B (-0.0%)
    firestore-lite (Query)87.5 kB87.5 kB-40 B (-0.0%)
    firestore-lite (Read data once)63.0 kB63.0 kB-40 B (-0.1%)
    firestore-lite (Transaction)88.2 kB88.2 kB-40 B (-0.0%)
    firestore-lite (Write data)72.6 kB72.5 kB-40 B (-0.1%)
    functions (call)31.9 kB31.9 kB-40 B (-0.1%)
    messaging (send + receive)46.9 kB46.9 kB-40 B (-0.1%)
    performance (trace)51.7 kB51.7 kB-40 B (-0.1%)
    remote-config (getAndFetch)46.3 kB46.2 kB-40 B (-0.1%)
    storage (getBytes)42.1 kB42.0 kB-81 B (-0.2%)
    storage (getDownloadURL)44.1 kB44.1 kB-81 B (-0.2%)
    storage (getMetadata)43.6 kB43.5 kB-81 B (-0.2%)
    storage (list + listAll)43.0 kB42.9 kB-81 B (-0.2%)
    storage (updateMetadata)43.8 kB43.8 kB-81 B (-0.2%)
    storage (uploadBytes)48.7 kB48.6 kB-81 B (-0.2%)
    storage (uploadBytesResumable)58.7 kB58.6 kB-81 B (-0.1%)
    storage (uploadString)48.9 kB48.8 kB-81 B (-0.2%)

  • firebase

    29 size changes

    TypeBase (98bbf53)Merge (355fcaa)Diff
    firebase-analytics-compat.js26.5 kB26.4 kB-40 B (-0.2%)
    firebase-analytics.js29.7 kB29.7 kB-52 B (-0.2%)
    firebase-app-check-compat.js23.4 kB23.3 kB-40 B (-0.2%)
    firebase-app-check.js25.0 kB25.0 kB-52 B (-0.2%)
    firebase-app-compat.js31.7 kB31.7 kB-40 B (-0.1%)
    firebase-app.js103 kB103 kB-484 B (-0.5%)
    firebase-auth-compat.js139 kB139 kB-81 B (-0.1%)
    firebase-auth-cordova.js134 kB134 kB-107 B (-0.1%)
    firebase-auth-web-extension.js117 kB117 kB-107 B (-0.1%)
    firebase-auth.js151 kB151 kB-107 B (-0.1%)
    firebase-compat.js791 kB790 kB-122 B (-0.0%)
    firebase-firestore-compat.js346 kB346 kB-40 B (-0.0%)
    firebase-firestore-lite.js119 kB119 kB-52 B (-0.0%)
    firebase-firestore.js440 kB440 kB-52 B (-0.0%)
    firebase-functions-compat.js8.17 kB8.13 kB-40 B (-0.5%)
    firebase-functions.js11.9 kB11.9 kB-52 B (-0.4%)
    firebase-installations-compat.js13.3 kB13.2 kB-40 B (-0.3%)
    firebase-installations.js15.1 kB15.1 kB-52 B (-0.3%)
    firebase-messaging-compat.js38.4 kB38.4 kB-40 B (-0.1%)
    firebase-messaging-sw.js30.2 kB30.1 kB-52 B (-0.2%)
    firebase-messaging.js28.7 kB28.7 kB-52 B (-0.2%)
    firebase-performance-compat.js30.8 kB30.8 kB-40 B (-0.1%)
    firebase-performance-standalone-compat.js93.6 kB93.6 kB-40 B (-0.0%)
    firebase-performance.js35.0 kB35.0 kB-52 B (-0.1%)
    firebase-remote-config-compat.js27.3 kB27.2 kB-40 B (-0.1%)
    firebase-remote-config.js29.6 kB29.5 kB-52 B (-0.2%)
    firebase-storage-compat.js40.3 kB40.3 kB-80 B (-0.2%)
    firebase-storage.js46.2 kB46.1 kB-103 B (-0.2%)
    firebase-vertexai.js22.0 kB21.9 kB-104 B (-0.5%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/ccBBeUnTDl.html

@google-oss-bot
Copy link
Contributor

Size Analysis Report 1

This report is too large (158,183 characters) to be displayed here in a GitHub comment. Please use the below link to see the full report on Google Cloud Storage.

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/hsHeqhrD7V.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants