Skip to content

Commit 6826f9d

Browse files
Integrate benoit/delay-initial-view (#3597) into staging-23
Integrated commit sha: 2b6121e Co-authored-by: BenoitZugmeyer <benoit.zugmeyer@datadoghq.com>
2 parents d768238 + 2b6121e commit 6826f9d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+2636
-551
lines changed

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,24 @@
1818
1919
---
2020

21+
## v6.9.0
22+
23+
**Public Changes:**
24+
25+
- ✨ use error.dd_context when logging an error ([#3562](https://github.com/DataDog/browser-sdk/pull/3562)) [LOGS]
26+
-[RUM-260] Support bfcache restore for web vitals ([#3527](https://github.com/DataDog/browser-sdk/pull/3527)) [FLAGGING] [LOGS] [RUM] [RUM-REACT] [RUM-SLIM] [WORKER]
27+
- 🐛 [RUM-10002] Verify the document was not hidden while loading ([#3573](https://github.com/DataDog/browser-sdk/pull/3573)) [RUM] [RUM-REACT] [RUM-SLIM]
28+
- 🐛 [RUM-9987] Bump attribute data url limit to 1Mb ([#3551](https://github.com/DataDog/browser-sdk/pull/3551)) [RUM] [RUM-REACT] [RUM-SLIM]
29+
- 🔥 🐛 fix Next.js 12 + swcMinify compatibility ([#3577](https://github.com/DataDog/browser-sdk/pull/3577)) [FLAGGING] [LOGS] [RUM] [RUM-REACT] [RUM-SLIM] [WORKER]
30+
- 📝 update bundle list ([#3572](https://github.com/DataDog/browser-sdk/pull/3572))
31+
32+
**Internal Changes:**
33+
34+
- 👷 Bump chrome to 137.0.7151.55-1 ([#3578](https://github.com/DataDog/browser-sdk/pull/3578))
35+
- ✅ Automatic mock clock cleanup ([#3581](https://github.com/DataDog/browser-sdk/pull/3581)) [FLAGGING] [LOGS] [RUM] [RUM-REACT] [RUM-SLIM] [WORKER]
36+
- ✅ Fix usage of non-existent configuration options in remoteConfiguration.spec.ts ([#3576](https://github.com/DataDog/browser-sdk/pull/3576)) [RUM] [RUM-REACT] [RUM-SLIM]
37+
- 🐛 [RUM Profiler] Simplify & fix logic for Long Task registry ([#3569](https://github.com/DataDog/browser-sdk/pull/3569)) [RUM]
38+
2139
## v6.8.0
2240

2341
**Public Changes:**

developer-extension/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
{
22
"name": "@datadog/browser-sdk-developer-extension",
3-
"version": "6.8.0",
3+
"version": "6.9.0",
44
"private": true,
55
"scripts": {
66
"build": "rm -rf dist && webpack --mode production",
77
"dev": "webpack --mode development --watch"
88
},
99
"devDependencies": {
10-
"@types/chrome": "0.0.323",
11-
"@types/react": "19.1.4",
10+
"@types/chrome": "0.0.326",
11+
"@types/react": "19.1.6",
1212
"@types/react-dom": "19.1.5",
1313
"@webextension-toolbox/webpack-webextension-plugin": "3.3.1",
1414
"copy-webpack-plugin": "13.0.0",
1515
"css-loader": "7.1.2",
1616
"html-webpack-plugin": "5.6.3",
1717
"style-loader": "4.0.0",
18-
"webpack": "5.99.8"
18+
"webpack": "5.99.9"
1919
},
2020
"dependencies": {
2121
"@datadog/browser-core": "workspace:*",
2222
"@datadog/browser-logs": "workspace:*",
2323
"@datadog/browser-rum": "workspace:*",
24-
"@mantine/core": "8.0.1",
25-
"@mantine/hooks": "8.0.1",
26-
"@tabler/icons-react": "3.33.0",
24+
"@mantine/core": "8.0.2",
25+
"@mantine/hooks": "8.0.2",
26+
"@tabler/icons-react": "3.34.0",
2727
"clsx": "2.1.1",
2828
"react": "19.1.0",
2929
"react-dom": "19.1.0"

eslint.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export default tseslint.config(
2727
'packages/*/esm',
2828
'developer-extension/dist',
2929
'test/**/dist',
30+
'test/apps/extensions/**',
3031
'sandbox',
3132
'coverage',
3233
'rum-events-format',

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"npmClient": "yarn",
3-
"version": "6.8.0"
3+
"version": "6.9.0"
44
}

package.json

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"build:bundle": "lerna run build:bundle --stream",
1414
"build:app": "lerna run pack --stream && cd test/apps/vanilla && rm -rf node_modules && yarn install --no-immutable && yarn build",
1515
"build:react-app": "lerna run pack --stream && cd test/apps/react && rm -rf node_modules && yarn install --no-immutable && yarn build",
16-
"build:apps": "yarn build:app && yarn build:react-app",
16+
"build:testing-extensions": "lerna run pack --stream && scripts/cli build_testing_extensions",
17+
"build:apps": "yarn build:app && yarn build:react-app && yarn build:testing-extensions",
1718
"format": "prettier --check .",
1819
"lint": "scripts/cli lint .",
1920
"typecheck": "scripts/cli typecheck . && scripts/cli typecheck developer-extension",
@@ -37,31 +38,31 @@
3738
"woke": "scripts/cli woke"
3839
},
3940
"devDependencies": {
40-
"@eslint/js": "9.27.0",
41+
"@eslint/js": "9.28.0",
4142
"@jsdevtools/coverage-istanbul-loader": "3.0.5",
4243
"@playwright/test": "1.52.0",
43-
"@swc/core": "1.11.24",
44-
"@types/chrome": "0.0.323",
44+
"@swc/core": "1.11.29",
45+
"@types/chrome": "0.0.326",
4546
"@types/connect-busboy": "1.0.3",
4647
"@types/cors": "2.8.18",
4748
"@types/express": "5.0.2",
4849
"@types/jasmine": "3.10.18",
49-
"@types/node": "22.15.19",
50+
"@types/node": "22.15.29",
5051
"ajv": "8.17.1",
5152
"browserstack-local": "1.5.6",
5253
"chrome-webstore-upload": "3.1.4",
5354
"connect-busboy": "1.0.0",
5455
"cors": "2.8.5",
5556
"emoji-name-map": "2.0.3",
56-
"eslint": "9.27.0",
57+
"eslint": "9.28.0",
5758
"eslint-module-utils": "2.12.0",
5859
"eslint-plugin-import": "2.31.0",
5960
"eslint-plugin-jasmine": "4.2.2",
60-
"eslint-plugin-jsdoc": "50.6.17",
61+
"eslint-plugin-jsdoc": "50.7.1",
6162
"eslint-plugin-unicorn": "59.0.1",
6263
"express": "5.1.0",
6364
"glob": "11.0.2",
64-
"globals": "16.1.0",
65+
"globals": "16.2.0",
6566
"html-webpack-plugin": "5.6.3",
6667
"jasmine-core": "3.99.1",
6768
"json-schema-to-typescript": "bcaudan/json-schema-to-typescript#bcaudan/add-readonly-support",
@@ -78,15 +79,15 @@
7879
"minimatch": "10.0.1",
7980
"npm-run-all": "4.1.5",
8081
"prettier": "3.5.3",
81-
"puppeteer": "24.9.0",
82+
"puppeteer": "24.10.0",
8283
"swc-loader": "0.2.6",
8384
"terser-webpack-plugin": "5.3.14",
8485
"ts-loader": "9.5.2",
8586
"ts-node": "10.9.2",
8687
"tsconfig-paths-webpack-plugin": "4.2.0",
8788
"typescript": "5.8.3",
88-
"typescript-eslint": "8.32.1",
89-
"webpack": "5.99.8",
89+
"typescript-eslint": "8.33.1",
90+
"webpack": "5.99.9",
9091
"webpack-cli": "6.0.1",
9192
"webpack-dev-middleware": "7.4.2"
9293
},
@@ -95,7 +96,7 @@
9596
},
9697
"volta": {
9798
"node": "23.11.1",
98-
"yarn": "1.22.22"
99+
"yarn": "4.9.1"
99100
},
100101
"packageManager": "yarn@4.9.1"
101102
}

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@datadog/browser-core",
3-
"version": "6.8.0",
3+
"version": "6.9.0",
44
"license": "Apache-2.0",
55
"main": "cjs/index.js",
66
"module": "esm/index.js",
Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
import { display } from '../tools/display'
2+
import {
3+
isAllowedTrackingOrigins,
4+
WARN_DOES_NOT_HAVE_ALLOWED_TRACKING_ORIGIN,
5+
ERROR_NOT_ALLOWED_TRACKING_ORIGIN,
6+
} from './allowedTrackingOrigins'
7+
8+
const DEFAULT_CONFIG = {
9+
applicationId: 'xxx',
10+
clientToken: 'xxx',
11+
allowedTrackingOrigins: undefined as any,
12+
}
13+
14+
describe('checkForAllowedTrackingOrigins', () => {
15+
let displayWarnSpy: jasmine.Spy
16+
let displayErrorSpy: jasmine.Spy
17+
18+
beforeEach(() => {
19+
displayWarnSpy = spyOn(display, 'warn')
20+
displayErrorSpy = spyOn(display, 'error')
21+
})
22+
23+
it('should not warn if not in extension environment', () => {
24+
const result = isAllowedTrackingOrigins(DEFAULT_CONFIG, 'https://app.example.com')
25+
expect(displayWarnSpy).not.toHaveBeenCalled()
26+
expect(displayErrorSpy).not.toHaveBeenCalled()
27+
expect(result).toBe(true)
28+
})
29+
30+
describe('when configuration has allowedTrackingOrigins and origin is allowed', () => {
31+
it('should not warn if origin matches exactly', () => {
32+
const result = isAllowedTrackingOrigins(
33+
{
34+
...DEFAULT_CONFIG,
35+
allowedTrackingOrigins: ['https://app.example.com'],
36+
},
37+
'https://app.example.com'
38+
)
39+
expect(displayWarnSpy).not.toHaveBeenCalled()
40+
expect(displayErrorSpy).not.toHaveBeenCalled()
41+
expect(result).toBe(true)
42+
})
43+
44+
it('should not warn if origin matches regex pattern', () => {
45+
const result = isAllowedTrackingOrigins(
46+
{
47+
...DEFAULT_CONFIG,
48+
allowedTrackingOrigins: [/^https:\/\/.*\.example\.com$/],
49+
},
50+
'https://app.example.com'
51+
)
52+
expect(displayWarnSpy).not.toHaveBeenCalled()
53+
expect(displayErrorSpy).not.toHaveBeenCalled()
54+
expect(result).toBe(true)
55+
})
56+
57+
it('should not warn if origin matches predicate function', () => {
58+
const result = isAllowedTrackingOrigins(
59+
{
60+
...DEFAULT_CONFIG,
61+
allowedTrackingOrigins: [(origin: string) => origin.includes('example.com')],
62+
},
63+
'https://app.example.com'
64+
)
65+
expect(displayWarnSpy).not.toHaveBeenCalled()
66+
expect(displayErrorSpy).not.toHaveBeenCalled()
67+
expect(result).toBe(true)
68+
})
69+
70+
it('should handle multiple patterns', () => {
71+
const result = isAllowedTrackingOrigins(
72+
{
73+
...DEFAULT_CONFIG,
74+
allowedTrackingOrigins: [
75+
'https://exact-match.com',
76+
/^https:\/\/.*\.example\.com$/,
77+
(origin: string) => origin.startsWith('https://app.'),
78+
],
79+
},
80+
'https://app.example.com'
81+
)
82+
expect(displayWarnSpy).not.toHaveBeenCalled()
83+
expect(displayErrorSpy).not.toHaveBeenCalled()
84+
expect(result).toBe(true)
85+
})
86+
})
87+
88+
describe('when configuration has allowedTrackingOrigins but origin is not allowed in extension context', () => {
89+
it('should error when origin does not match any allowed pattern', () => {
90+
const result = isAllowedTrackingOrigins(
91+
{
92+
...DEFAULT_CONFIG,
93+
allowedTrackingOrigins: ['https://different.com'],
94+
},
95+
'https://example.com',
96+
'Error: at chrome-extension://abcdefghijklmno/content.js:10:15'
97+
)
98+
expect(displayErrorSpy).toHaveBeenCalledWith(ERROR_NOT_ALLOWED_TRACKING_ORIGIN)
99+
expect(result).toBe(false)
100+
})
101+
102+
it('should error when origin does not match regex pattern', () => {
103+
const result = isAllowedTrackingOrigins(
104+
{
105+
...DEFAULT_CONFIG,
106+
allowedTrackingOrigins: [/^https:\/\/specific-[a-z]+\.com$/],
107+
},
108+
'https://example.com',
109+
'Error: at chrome-extension://abcdefghijklmno/content.js:10:15'
110+
)
111+
expect(displayErrorSpy).toHaveBeenCalledWith(ERROR_NOT_ALLOWED_TRACKING_ORIGIN)
112+
expect(result).toBe(false)
113+
})
114+
115+
it('should error when origin does not match predicate function', () => {
116+
const result = isAllowedTrackingOrigins(
117+
{
118+
...DEFAULT_CONFIG,
119+
allowedTrackingOrigins: [(origin: string) => origin.includes('specific-id')],
120+
},
121+
'https://example.com',
122+
'Error: at chrome-extension://abcdefghijklmno/content.js:10:15'
123+
)
124+
expect(displayErrorSpy).toHaveBeenCalledWith(ERROR_NOT_ALLOWED_TRACKING_ORIGIN)
125+
expect(result).toBe(false)
126+
})
127+
128+
it('should error when origin does not match any of multiple patterns', () => {
129+
const result = isAllowedTrackingOrigins(
130+
{
131+
...DEFAULT_CONFIG,
132+
allowedTrackingOrigins: [
133+
'https://specific.com',
134+
/^https:\/\/.*\.specific\.com$/,
135+
(origin: string) => origin.includes('specific-id'),
136+
],
137+
},
138+
'https://example.com',
139+
'Error: at chrome-extension://abcdefghijklmno/content.js:10:15'
140+
)
141+
expect(displayErrorSpy).toHaveBeenCalledWith(ERROR_NOT_ALLOWED_TRACKING_ORIGIN)
142+
expect(result).toBe(false)
143+
})
144+
145+
it('should error when origin is a partial match', () => {
146+
const result = isAllowedTrackingOrigins(
147+
{
148+
...DEFAULT_CONFIG,
149+
allowedTrackingOrigins: ['https://example.com'],
150+
},
151+
'https://example.com.extra.com',
152+
'Error: at chrome-extension://abcdefghijklmno/content.js:10:15'
153+
)
154+
expect(displayErrorSpy).toHaveBeenCalledWith(ERROR_NOT_ALLOWED_TRACKING_ORIGIN)
155+
expect(result).toBe(false)
156+
})
157+
158+
it('should not error when in extension and origin matches', () => {
159+
const result = isAllowedTrackingOrigins(
160+
{
161+
...DEFAULT_CONFIG,
162+
allowedTrackingOrigins: [/^chrome-extension:\/\//],
163+
},
164+
'chrome-extension://abcdefghijklmno',
165+
'Error: at chrome-extension://abcdefghijklmno/content.js:10:15'
166+
)
167+
expect(displayErrorSpy).not.toHaveBeenCalled()
168+
expect(result).toBe(true)
169+
})
170+
})
171+
172+
describe('when configuration does not have allowedTrackingOrigins', () => {
173+
it('should warn when in extension environment and allowedTrackingOrigins is undefined', () => {
174+
const result = isAllowedTrackingOrigins(
175+
{
176+
...DEFAULT_CONFIG,
177+
allowedTrackingOrigins: undefined,
178+
},
179+
'https://example.com',
180+
'Error: at chrome-extension://abcdefghijklmno/content.js:10:15'
181+
)
182+
expect(displayWarnSpy).toHaveBeenCalledWith(WARN_DOES_NOT_HAVE_ALLOWED_TRACKING_ORIGIN)
183+
expect(result).toBe(true)
184+
})
185+
186+
it('should error when in extension environment and allowedTrackingOrigins is an empty array', () => {
187+
const result = isAllowedTrackingOrigins(
188+
{
189+
...DEFAULT_CONFIG,
190+
allowedTrackingOrigins: [],
191+
},
192+
'https://example.com',
193+
'Error: at chrome-extension://abcdefghijklmno/content.js:10:15'
194+
)
195+
expect(displayErrorSpy).toHaveBeenCalledWith(ERROR_NOT_ALLOWED_TRACKING_ORIGIN)
196+
expect(result).toBe(false)
197+
})
198+
199+
it('should not warn when not in extension environment and allowedTrackingOrigins is undefined', () => {
200+
const result = isAllowedTrackingOrigins(
201+
{
202+
...DEFAULT_CONFIG,
203+
allowedTrackingOrigins: undefined,
204+
},
205+
'https://example.com',
206+
'Error: at https://example.com/script.js:10:15'
207+
)
208+
expect(displayWarnSpy).not.toHaveBeenCalled()
209+
expect(displayErrorSpy).not.toHaveBeenCalled()
210+
expect(result).toBe(true)
211+
})
212+
})
213+
})

0 commit comments

Comments
 (0)