Skip to content

Commit e7e0304

Browse files
committed
Runtime.enable patch: enabled by default, more errors logs
1 parent 574dbe3 commit e7e0304

File tree

3 files changed

+55
-52
lines changed

3 files changed

+55
-52
lines changed

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ This triggers `Runtime.executionContextCreated` events, allowing us to catch the
3131

3232
> 🎉 Our tests show that both approaches are currently undetectable by Cloudflare or DataDome.
3333
34-
**Important:** After applying the patch, you need to enable it by setting `REBROWSER_PATCHES_RUNTIME_FIX_MODE` environment variable. This allows you to easily switch between patched and non-patched versions based on your business logic.
34+
Note: you can change settings for this patch on the fly using an environment variable. This allows you to easily switch between patched and non-patched versions based on your business logic.
3535

36-
- `REBROWSER_PATCHES_RUNTIME_FIX_MODE=alwaysIsolated` — always run all scripts in isolated context
36+
- `REBROWSER_PATCHES_RUNTIME_FIX_MODE=alwaysIsolated` — always run all scripts in isolated context (default)
3737
- `REBROWSER_PATCHES_RUNTIME_FIX_MODE=enableDisable` — use Enable/Disable technique
38+
- `REBROWSER_PATCHES_RUNTIME_FIX_MODE=0` — completely disable this patch
3839
- `REBROWSER_PATCHES_DEBUG=1` — enable some debugging messages
3940

4041
Remember, you can set these variables in different ways, for example, in code:
@@ -57,9 +58,9 @@ By default, Puppeteer adds `//# sourceURL=pptr:...` to every script in `page.eva
5758
This patch changes it to `//# sourceURL=app.js`. You can also adjust it via environment variable:
5859
```shell
5960
# use any generic filename
60-
process.env.REBROWSER_PATCHES_SOURCE_URL = "jquery.min.js"
61+
REBROWSER_PATCHES_SOURCE_URL=jquery.min.js
6162
# use 0 to completely disable this patch
62-
process.env.REBROWSER_PATCHES_SOURCE_URL = "0"
63+
REBROWSER_PATCHES_SOURCE_URL=0
6364
```
6465

6566
### Method to access browser CDP connection
@@ -73,11 +74,11 @@ browser._connection().on('Rebrowser.addRunEvent', (params) => { ... })
7374
### Change default utility world name
7475
The default utility world name is `'__puppeteer_utility_world__' + packageVersion`. Sometimes you might want to change it to something else. This patch changes it to `util` and allows you to customize it via env variable:
7576
```shell
76-
REBROWSER_PATCHES_UTILITY_WORLD_NAME = "customUtilityWorld"
77+
REBROWSER_PATCHES_UTILITY_WORLD_NAME=customUtilityWorld
7778
# use 0 to completely disable this patch
78-
REBROWSER_PATCHES_UTILITY_WORLD_NAME = "0"
79+
REBROWSER_PATCHES_UTILITY_WORLD_NAME=0
7980
```
80-
*This env variable cannot be changed on the fly, you have to set it before running your script because it's used at the moment when the module is getting imported.*
81+
This env variable cannot be changed on the fly, you have to set it before running your script because it's used at the moment when the module is getting imported.
8182

8283
*Note: it's not detectable by external website scripts, but Google might use this information in their proprietary Chrome; we never know.*
8384

0 commit comments

Comments
 (0)