Skip to content

Commit b9ccd3e

Browse files
authored
Merge 4efa91a into ecb4454
2 parents ecb4454 + 4efa91a commit b9ccd3e

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

.changeset/dry-cats-lick.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/auth': patch
3+
---
4+
5+
Increase the popup poller timeout to 8s to support blocking functions + Firefox

packages/auth/src/platform_browser/strategies/popup.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,13 @@ import { FederatedAuthProvider } from '../../core/providers/federated';
4646
import { getModularInstance } from '@firebase/util';
4747

4848
/*
49-
* The event timeout is the same on mobile and desktop, no need for Delay.
49+
* The event timeout is the same on mobile and desktop, no need for Delay. Set this to 8s since
50+
* blocking functions can take upto 7s to complete sign in, as documented in:
51+
* https://cloud.google.com/identity-platform/docs/blocking-functions#understanding_blocking_functions
52+
* https://firebase.google.com/docs/auth/extend-with-blocking-functions#understanding_blocking_functions
5053
*/
5154
export const enum _Timeout {
52-
AUTH_EVENT = 2000
55+
AUTH_EVENT = 8000
5356
}
5457
export const _POLL_WINDOW_CLOSE_TIMEOUT = new Delay(2000, 10000);
5558

@@ -282,7 +285,9 @@ class PopupOperation extends AbstractPopupRedirectOperation {
282285
if (this.authWindow?.window?.closed) {
283286
// Make sure that there is sufficient time for whatever action to
284287
// complete. The window could have closed but the sign in network
285-
// call could still be in flight.
288+
// call could still be in flight. This is specifically true for
289+
// Firefox or if the opener is in an iframe, in which case the oauth
290+
// helper closes the popup.
286291
this.pollId = window.setTimeout(() => {
287292
this.pollId = null;
288293
this.reject(

packages/auth/test/integration/webdriver/popup.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ browserDescribe('Popup IdP tests', driver => {
192192
await widget.fillEmail('[email protected]');
193193
await widget.clickSignIn();
194194

195-
// On redirect, check that the signed in user is different
195+
// On return to main window, check that the signed in user is different
196196
await driver.selectMainWindow();
197197
const curUser = await driver.getUserSnapshot();
198198
expect(curUser.uid).not.to.eq(anonUser.uid);
@@ -210,7 +210,7 @@ browserDescribe('Popup IdP tests', driver => {
210210
await widget.fillEmail('[email protected]');
211211
await widget.clickSignIn();
212212

213-
// On redirect, check that the signed in user is upgraded
213+
// On return to main window, check that the signed in user is upgraded
214214
await driver.selectMainWindow();
215215
const curUser = await driver.getUserSnapshot();
216216
expect(curUser.uid).to.eq(anonUser.uid);
@@ -396,6 +396,7 @@ browserDescribe('Popup IdP tests', driver => {
396396
user = await driver.getUserSnapshot();
397397
expect(user.uid).to.eq(user1.uid);
398398
expect(user.email).to.eq(user1.email);
399-
}).timeout(12_000); // Test takes a while due to the closed-by-user errors
399+
}).timeout(25_000); // Test takes a while due to the closed-by-user errors. Each closed-by-user
400+
// takes 8s to timeout, and we have 2 instances.
400401
});
401402
});

0 commit comments

Comments
 (0)