Commit 88d28cc
authored
[fix]: make
# why
- currently, we add the init scripts to the main world
- this is problematic, because `page.evaluate()` uses the `v3-world`
- this means that you can't easily evaluate the script you add with
`addInitScript()`
# what changed
- makes sure that `page.evaluate()` uses the main world
# test plan
- added a test which calls `page.evaluate()` on a script added via
`context.addInitScript()`
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Fixes a context mismatch: page.evaluate now runs in the main world so
scripts injected via context.addInitScript are callable. Frame.evaluate
was updated to use the main world too.
## Why:
- evaluate() used the v3 isolated world while init scripts were in the
main world, making injected globals inaccessible.
## What:
- Switched page.evaluate and frame.evaluate to use the main-world
execution context via executionContextRegistry.
- Added a test verifying an init-script function is callable from
page.evaluate.
## Test Plan:
- [x] New test: init-script function is callable from page.evaluate
(passes).
- [x] Ran existing context.addInitScript tests to ensure no regressions.
<sup>Written for commit d4bf59d.
Summary will update automatically on new commits.</sup>
<!-- End of auto-generated description by cubic. -->page.evaluate() use main world (#1331)1 parent 6b5a3c9 commit 88d28cc
File tree
4 files changed
+47
-30
lines changed- .changeset
- packages/core/lib/v3
- tests
- understudy
4 files changed
+47
-30
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
116 | 137 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
116 | 117 | | |
117 | 118 | | |
118 | 119 | | |
119 | | - | |
| 120 | + | |
120 | 121 | | |
121 | 122 | | |
122 | 123 | | |
| |||
125 | 126 | | |
126 | 127 | | |
127 | 128 | | |
128 | | - | |
| 129 | + | |
129 | 130 | | |
130 | 131 | | |
131 | 132 | | |
| |||
293 | 294 | | |
294 | 295 | | |
295 | 296 | | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
307 | 300 | | |
308 | 301 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
132 | 133 | | |
133 | 134 | | |
134 | 135 | | |
135 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
136 | 139 | | |
137 | 140 | | |
138 | 141 | | |
| |||
975 | 978 | | |
976 | 979 | | |
977 | 980 | | |
978 | | - | |
| 981 | + | |
979 | 982 | | |
980 | 983 | | |
981 | 984 | | |
| |||
1157 | 1160 | | |
1158 | 1161 | | |
1159 | 1162 | | |
1160 | | - | |
| 1163 | + | |
1161 | 1164 | | |
1162 | 1165 | | |
1163 | 1166 | | |
| |||
1168 | 1171 | | |
1169 | 1172 | | |
1170 | 1173 | | |
1171 | | - | |
| 1174 | + | |
1172 | 1175 | | |
1173 | 1176 | | |
1174 | 1177 | | |
| |||
1979 | 1982 | | |
1980 | 1983 | | |
1981 | 1984 | | |
1982 | | - | |
1983 | | - | |
1984 | | - | |
1985 | | - | |
1986 | | - | |
1987 | | - | |
1988 | | - | |
1989 | | - | |
1990 | | - | |
1991 | | - | |
1992 | | - | |
1993 | | - | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
1994 | 1992 | | |
1995 | 1993 | | |
1996 | 1994 | | |
| |||
2009 | 2007 | | |
2010 | 2008 | | |
2011 | 2009 | | |
2012 | | - | |
| 2010 | + | |
2013 | 2011 | | |
2014 | 2012 | | |
2015 | 2013 | | |
| |||
0 commit comments