From db80b9b83c680615862e8af9f6433e4a7a07f071 Mon Sep 17 00:00:00 2001 From: Aymeric Mortemousque Date: Tue, 21 May 2024 15:42:42 +0200 Subject: [PATCH] Remove disable_replay_inline_css ff --- .../core/src/tools/experimentalFeatures.ts | 1 - .../serialization/serializeAttributes.ts | 5 ++- .../serialization/serializeNode.spec.ts | 32 +------------------ 3 files changed, 3 insertions(+), 35 deletions(-) diff --git a/packages/core/src/tools/experimentalFeatures.ts b/packages/core/src/tools/experimentalFeatures.ts index 3fd7306903..90663bb029 100644 --- a/packages/core/src/tools/experimentalFeatures.ts +++ b/packages/core/src/tools/experimentalFeatures.ts @@ -11,7 +11,6 @@ // string is an expected feature flag // eslint-disable-next-line no-restricted-syntax export enum ExperimentalFeature { - DISABLE_REPLAY_INLINE_CSS = 'disable_replay_inline_css', WRITABLE_RESOURCE_GRAPHQL = 'writable_resource_graphql', CUSTOM_VITALS = 'custom_vitals', TOLERANT_RESOURCE_TIMINGS = 'tolerant_resource_timings', diff --git a/packages/rum/src/domain/record/serialization/serializeAttributes.ts b/packages/rum/src/domain/record/serialization/serializeAttributes.ts index 39de074d79..b6465adf78 100644 --- a/packages/rum/src/domain/record/serialization/serializeAttributes.ts +++ b/packages/rum/src/domain/record/serialization/serializeAttributes.ts @@ -1,5 +1,4 @@ -import { ExperimentalFeature, isExperimentalFeatureEnabled, isSafari } from '@datadog/browser-core' - +import { isSafari } from '@datadog/browser-core' import { NodePrivacyLevel } from '../../../constants' import { shouldMaskNode } from '../privacy' import { getElementInputValue, switchToAbsoluteUrl, getValidTagName } from './serializationUtils' @@ -53,7 +52,7 @@ export function serializeAttributes( if (tagName === 'link') { const stylesheet = Array.from(doc.styleSheets).find((s) => s.href === (element as HTMLLinkElement).href) const cssText = getCssRulesString(stylesheet) - if (cssText && stylesheet && !isExperimentalFeatureEnabled(ExperimentalFeature.DISABLE_REPLAY_INLINE_CSS)) { + if (cssText && stylesheet) { safeAttrs._cssText = cssText } } diff --git a/packages/rum/src/domain/record/serialization/serializeNode.spec.ts b/packages/rum/src/domain/record/serialization/serializeNode.spec.ts index 461b6457da..42f4e97d09 100644 --- a/packages/rum/src/domain/record/serialization/serializeNode.spec.ts +++ b/packages/rum/src/domain/record/serialization/serializeNode.spec.ts @@ -1,11 +1,4 @@ -import { - ExperimentalFeature, - addExperimentalFeatures, - isIE, - noop, - resetExperimentalFeatures, -} from '@datadog/browser-core' - +import { isIE, noop } from '@datadog/browser-core' import type { RumConfiguration } from '@datadog/browser-rum-core' import { isAdoptedStyleSheetsSupported } from '@datadog/browser-core/test' import { @@ -70,10 +63,6 @@ describe('serializeNodeWithId', () => { } }) - afterEach(() => { - resetExperimentalFeatures() - }) - describe('document serialization', () => { it('serializes a document', () => { const document = new DOMParser().parseFromString('foo', 'text/html') @@ -634,25 +623,6 @@ describe('serializeNodeWithId', () => { }) }) - it('does not inline external CSS when DISABLE_REPLAY_INLINE_CSS is enabled', () => { - addExperimentalFeatures([ExperimentalFeature.DISABLE_REPLAY_INLINE_CSS]) - const linkNode = appendElement( - "", - document.head - ) - Object.defineProperty(document, 'styleSheets', { - value: [ - { - href: 'https://datadoghq.com/some/style.css', - cssRules: [{ cssText: 'body { width: 100%; }' }], - }, - ], - configurable: true, - }) - - expect((serializeNodeWithId(linkNode, DEFAULT_OPTIONS) as ElementNode).attributes._cssText).toBeUndefined() - }) - it('does not inline external CSS if the style sheet is behind CORS', () => { const linkNode = appendElement( "",