Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions packages/firestore/src/api/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1901,9 +1901,17 @@ function throwDocChangesMethodError(): never {
);
}

Object.defineProperty(QuerySnapshot.prototype.docChanges, 'length', {
get: () => throwDocChangesMethodError()
});
/**
* This is technically overwriting the `Function.prototype.length` property of
* `docChanges`. On IE11, the property is improperly defined with
* `{ configurable: false }` which causes this line to throw. Wrap in a
* try-catch to ensure that we still have a functional SDK.
*/
try {
Object.defineProperty(QuerySnapshot.prototype.docChanges, 'length', {
get: () => throwDocChangesMethodError()
});
} catch (err) {} // Ignore this failure intentionally

if (typeof Symbol !== 'undefined') {
Object.defineProperty(QuerySnapshot.prototype.docChanges, Symbol.iterator, {
Expand Down