Skip to content

Commit

Permalink
Merge 86f65b3 in staging-35
Browse files Browse the repository at this point in the history
Co-authored-by: Benoît Zugmeyer <[email protected]>
  • Loading branch information
dd-mergequeue[bot] and BenoitZugmeyer authored Aug 29, 2023
2 parents c5e5c0a + 86f65b3 commit 4fd8de7
Show file tree
Hide file tree
Showing 5 changed files with 156 additions and 175 deletions.
4 changes: 1 addition & 3 deletions packages/rum/src/domain/record/privacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ export function getTextContent(

const nodePrivacyLevel = parentNodePrivacyLevel

const isStyle = parentTagName === 'STYLE' ? true : undefined
const isScript = parentTagName === 'SCRIPT'

if (isScript) {
Expand All @@ -183,9 +182,8 @@ export function getTextContent(
// Should never occur, but just in case, we set to CENSORED_MARK.
textContent = CENSORED_STRING_MARK
} else if (
shouldMaskNode(textNode, nodePrivacyLevel) &&
shouldMaskNode(textNode, nodePrivacyLevel)
// Style tags are `overruled` (Use `hide` to enforce privacy)
!isStyle
) {
if (
// Scrambling the child list breaks text nodes for DATALIST/SELECT/OPTGROUP
Expand Down
30 changes: 6 additions & 24 deletions packages/rum/src/domain/record/serialization/htmlAst.specHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,8 @@ export const AST_MASK = {
{
type: 2,
tagName: 'style',
attributes: {},
childNodes: [
{
type: 3,
textContent: '\n .example {content: "anything";}\n ',
isStyle: true,
},
],
attributes: { _cssText: '.example { content: "anything"; }' },
childNodes: [],
},
{
type: 2,
Expand Down Expand Up @@ -455,14 +449,8 @@ export const AST_MASK_USER_INPUT = {
{
type: 2,
tagName: 'style',
attributes: {},
childNodes: [
{
type: 3,
textContent: '\n .example {content: "anything";}\n ',
isStyle: true,
},
],
attributes: { _cssText: '.example { content: "anything"; }' },
childNodes: [],
},
{
type: 2,
Expand Down Expand Up @@ -768,14 +756,8 @@ export const AST_ALLOW = {
{
type: 2,
tagName: 'style',
attributes: {},
childNodes: [
{
type: 3,
textContent: '\n .example {content: "anything";}\n ',
isStyle: true,
},
],
attributes: { _cssText: '.example { content: "anything"; }' },
childNodes: [],
},
{
type: 2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,7 @@ export function serializeAttributes(
}

// dynamic stylesheet
if (
tagName === 'style' &&
(element as HTMLStyleElement).sheet &&
// TODO: Currently we only try to get dynamic stylesheet when it is an empty style element
!((element as HTMLStyleElement).innerText || element.textContent || '').trim().length
) {
if (tagName === 'style' && (element as HTMLStyleElement).sheet) {
const cssText = getCssRulesString((element as HTMLStyleElement).sheet)
if (cssText) {
safeAttrs._cssText = cssText
Expand Down
Loading

0 comments on commit 4fd8de7

Please sign in to comment.