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

🐛 [RUMF-1079] limit session inconsistencies issue on chromium browsers #1327

Merged
merged 6 commits into from
Feb 14, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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
10 changes: 4 additions & 6 deletions packages/core/src/domain/session/sessionCookieStore.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { stubCookie, mockClock } from '../../../test/specHelper'
import { isChromium } from '../../tools/browserDetection'
import { resetExperimentalFeatures, updateExperimentalFeatures } from '../configuration'
import {
SESSION_COOKIE_NAME,
toSessionString,
Expand Down Expand Up @@ -29,6 +28,10 @@ describe('session cookie store', () => {
})

describe('with cookie-lock disabled', () => {
beforeEach(() => {
isChromium() && pending('cookie-lock only disabled on non chromium browsers')
})

it('should persist session when process return a value', () => {
persistSession(initialSession, COOKIE_OPTIONS)
processSpy.and.returnValue({ ...otherSession })
Expand Down Expand Up @@ -68,11 +71,6 @@ describe('session cookie store', () => {
describe('with cookie-lock enabled', () => {
beforeEach(() => {
!isChromium() && pending('cookie-lock only enabled on chromium browsers')
updateExperimentalFeatures(['cookie-lock'])
})

afterEach(() => {
resetExperimentalFeatures()
})

it('should persist session when process return a value', () => {
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/domain/session/sessionCookieStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type { CookieOptions } from '../../browser/cookie'
import { getCookie, setCookie } from '../../browser/cookie'
import { isChromium } from '../../tools/browserDetection'
import * as utils from '../../tools/utils'
import { isExperimentalFeatureEnabled } from '../configuration'
import { monitor } from '../internalMonitoring'
import type { SessionState } from './sessionStore'
import { SESSION_EXPIRATION_DELAY } from './sessionStore'
Expand Down Expand Up @@ -94,7 +93,7 @@ export function withCookieLockAccess(operations: Operations, numberOfRetries = 0
* This issue concerns only chromium browsers and enabling this on firefox increase cookie write failures.
*/
function isCookieLockEnabled() {
return isExperimentalFeatureEnabled('cookie-lock') && isChromium()
return isChromium()
}

function retryLater(operations: Operations, currentNumberOfRetries: number) {
Expand Down
3 changes: 2 additions & 1 deletion test/e2e/lib/helpers/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export async function renewSession() {

export async function expireSession() {
await deleteAllCookies()
expect(await findSessionCookie()).not.toBeDefined()
const sessionCookie = await findSessionCookie()
expect(sessionCookie === undefined || sessionCookie.value === '').toBeTrue()
// Cookies are cached for 1s, wait until the cache expires
await browser.pause(1100)
}
Expand Down