- Notifications
You must be signed in to change notification settings - Fork1.3k
[fix]: makecontext.addInitScript() use correct isolated world#1308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
[fix]: makecontext.addInitScript() use correct isolated world#1308
Uh oh!
There was an error while loading.Please reload this page.
Conversation
🦋 Changeset detectedLatest commit:6d78851 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means?Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Greptile OverviewGreptile SummaryFixed Key changes:
Confidence Score: 5/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram participant User participant Context participant Page participant CDPSession participant Browser participant IsolatedWorld as v3-world (Isolated) User->>Context: addInitScript(fn) Context->>Page: registerInitScript(source) Page->>Page: Check if script already exists Page->>Page: Add to initScripts array Page->>CDPSession: Page.addScriptToEvaluateOnNewDocument Note over CDPSession,Browser: worldName: "v3-world" (NEW) CDPSession->>Browser: Install script in v3-world Browser->>IsolatedWorld: Script registered for future docs User->>Page: goto(url) Browser->>IsolatedWorld: Execute init script in v3-world Note over IsolatedWorld: window.sayHelloFromStagehand = ... User->>Page: evaluate(fn) Page->>Page: createIsolatedWorldForCurrentMain() Note over Page,IsolatedWorld: Creates/reuses v3-world context Page->>IsolatedWorld: Runtime.evaluate in v3-world IsolatedWorld-->>Page: Access to init script globals Page-->>User: Result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
2 files reviewed, no comments
why
page.evaluate()uses thev3-worldaddInitScript()what changed
v3-worldtest plan
page.evaluate()on a script added viacontext.addInitScript()