@alwaysmeticulous/record 2.255.0 → 2.255.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/record/utils/__tests__/wrap-in-should-record-condition.spec.js +1 -1
- package/dist/record/utils/wrap-in-should-record-condition.d.ts +12 -7
- package/dist/record/utils/wrap-in-should-record-condition.js +19 -12
- package/dist/record/utils/wrap-in-should-record-condition.js.map +1 -1
- package/package.json +2 -2
|
@@ -9,7 +9,7 @@ const wrap_in_should_record_condition_1 = require("../wrap-in-should-record-cond
|
|
|
9
9
|
"//# sourceMappingURL=main.bundle.js.map",
|
|
10
10
|
"",
|
|
11
11
|
].join("\n"))).toMatchInlineSnapshot(`
|
|
12
|
-
"if (window
|
|
12
|
+
"if (window.origin !== 'null' && !["https://app.meticulous.ai/docs/recording-a-test","https://app.meticulous.ai/docs/recording-a-login-flow","https://app.meticulous.ai/docs/recording-a-login-flow-saving"].includes(window.document.location.toString()) && !["chrome://","chrome-error://","about:"].some((protocol) => window.document.location.toString().startsWith(protocol))) {
|
|
13
13
|
console.log('Hello World')
|
|
14
14
|
}
|
|
15
15
|
//# sourceMappingURL=main.bundle.js.map
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* as soon as the script is loaded. This causes Aw Snap errors in Chrome when the script
|
|
4
|
-
* is injected too early inside certain iFrames. To avoid this we wrap the script in a condition to
|
|
5
|
-
* prevent it executing at all in certain contexts.
|
|
2
|
+
* The recorder must not run in every frame. In particular:
|
|
6
3
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
4
|
+
* - PollyJS has top-level (outside-function) code that executes as soon as the script is
|
|
5
|
+
* loaded. Running it in `about:blank`, `chrome-error://`, or other non-web frames causes
|
|
6
|
+
* Chrome to hang or show an "Aw Snap" crash. These are blocked via FORBIDDEN_PROTOCOLS.
|
|
7
|
+
* - Sentry and PollyJS each create hidden iframes as part of their initialization. If the
|
|
8
|
+
* recorder runs inside a sandboxed iframe (`sandbox` attribute without `allow-same-origin`,
|
|
9
|
+
* giving `window.origin === "null"`), those nested iframes appear blank and the recorder
|
|
10
|
+
* cannot function correctly anyway. These are blocked via the `window.origin !== 'null'` check.
|
|
11
|
+
*
|
|
12
|
+
* This isn't ideal, but unfortunately there's not a way to run page.evaluateOnNewDocument
|
|
13
|
+
* conditionally (we could listen for frames being attached, and then inject the script,
|
|
14
|
+
* though this has some complexities).
|
|
10
15
|
*/
|
|
11
16
|
export declare const wrapInShouldRecordCondition: (recorderCode: string) => string;
|
|
@@ -3,14 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.wrapInShouldRecordCondition = void 0;
|
|
4
4
|
const constants_1 = require("../constants");
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
* as soon as the script is loaded. This causes Aw Snap errors in Chrome when the script
|
|
8
|
-
* is injected too early inside certain iFrames. To avoid this we wrap the script in a condition to
|
|
9
|
-
* prevent it executing at all in certain contexts.
|
|
6
|
+
* The recorder must not run in every frame. In particular:
|
|
10
7
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
8
|
+
* - PollyJS has top-level (outside-function) code that executes as soon as the script is
|
|
9
|
+
* loaded. Running it in `about:blank`, `chrome-error://`, or other non-web frames causes
|
|
10
|
+
* Chrome to hang or show an "Aw Snap" crash. These are blocked via FORBIDDEN_PROTOCOLS.
|
|
11
|
+
* - Sentry and PollyJS each create hidden iframes as part of their initialization. If the
|
|
12
|
+
* recorder runs inside a sandboxed iframe (`sandbox` attribute without `allow-same-origin`,
|
|
13
|
+
* giving `window.origin === "null"`), those nested iframes appear blank and the recorder
|
|
14
|
+
* cannot function correctly anyway. These are blocked via the `window.origin !== 'null'` check.
|
|
15
|
+
*
|
|
16
|
+
* This isn't ideal, but unfortunately there's not a way to run page.evaluateOnNewDocument
|
|
17
|
+
* conditionally (we could listen for frames being attached, and then inject the script,
|
|
18
|
+
* though this has some complexities).
|
|
14
19
|
*/
|
|
15
20
|
const wrapInShouldRecordCondition = (recorderCode) => wrapScriptInCondition(recorderCode, constructShouldRecordCondition());
|
|
16
21
|
exports.wrapInShouldRecordCondition = wrapInShouldRecordCondition;
|
|
@@ -24,14 +29,16 @@ const constructShouldRecordCondition = () => {
|
|
|
24
29
|
/**
|
|
25
30
|
* The recorder crashes if it tries to initialize on a chrome-error page
|
|
26
31
|
* (Chrome e.g. uses this page for HTTP basic auth popups before the user has authenticated)
|
|
32
|
+
* because the recorder tries inserting an iframe into the head, which crashes Chrome on that page.
|
|
27
33
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
34
|
+
* `about:` covers `about:blank` frames, which browsers use as the initial state of iframes before
|
|
35
|
+
* their real URL loads — running PollyJS there causes the page to hang.
|
|
30
36
|
*/
|
|
31
|
-
const FORBIDDEN_PROTOCOLS = ["chrome://", "chrome-error://"];
|
|
37
|
+
const FORBIDDEN_PROTOCOLS = ["chrome://", "chrome-error://", "about:"];
|
|
32
38
|
const shouldRecordFrame =
|
|
33
|
-
//
|
|
34
|
-
|
|
39
|
+
// Skip sandboxed iframes without allow-same-origin: their origin is "null" and the
|
|
40
|
+
// recorder's Sentry/PollyJS iframes would appear blank and non-functional inside them.
|
|
41
|
+
`window.origin !== 'null'` +
|
|
35
42
|
` && !${JSON.stringify(FORBIDDEN_URLS)}.includes(window.document.location.toString())` +
|
|
36
43
|
` && !${JSON.stringify(FORBIDDEN_PROTOCOLS)}.some((protocol) => window.document.location.toString().startsWith(protocol))`;
|
|
37
44
|
return shouldRecordFrame;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrap-in-should-record-condition.js","sourceRoot":"","sources":["../../../src/record/utils/wrap-in-should-record-condition.ts"],"names":[],"mappings":";;;AAAA,4CAIsB;AAEtB
|
|
1
|
+
{"version":3,"file":"wrap-in-should-record-condition.js","sourceRoot":"","sources":["../../../src/record/utils/wrap-in-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ACf,GAAG;YACH,gBAAgB;YAChB,GAAG,kBAAkB;SACtB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KACd;SAAM;QACL,OAAO;YACL,OAAO,SAAS,KAAK;YACrB,GAAG,YAAY;YACf,gBAAgB;YAChB,GAAG;YACH,GAAG,kBAAkB;SACtB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KACd;AACH,CAAC,CAAC;AAEF,MAAM,0BAA0B,GAAG,CAAC,KAAe,EAAE,EAAE;IACrD,MAAM,kBAAkB,GAAa,EAAE,CAAC;IACxC,MAAM,aAAa,GAAa,EAAE,CAAC;IAEnC,CAAC,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACpC,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE;YACpD,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAC/B;aAAM;YACL,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAC1B;IACH,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,aAAa,EAAE,aAAa,CAAC,OAAO,EAAE;QACtC,kBAAkB,EAAE,kBAAkB,CAAC,OAAO,EAAE;KACjD,CAAC;AACJ,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alwaysmeticulous/record",
|
|
3
|
-
"version": "2.255.
|
|
3
|
+
"version": "2.255.3",
|
|
4
4
|
"description": "The Meticulous toolkit to record user sessions",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"bugs": {
|
|
47
47
|
"url": "https://github.com/alwaysmeticulous/meticulous-sdk/issues"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "405e5d3eaca34806523ba862e26637de70885bfd"
|
|
50
50
|
}
|