-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core(driver): move evaluateOnNewDocument to executionContext #12381
Conversation
__nativePromise: PromiseConstructor; | ||
__nativeURL: URL; | ||
__nativePerformance: Performance; | ||
__nativeURL: typeof URL; |
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.
this was typed incorrectly, but we never use it :)
617f9db
to
8daccd5
Compare
* Evaluate a function on every new frame from now on. | ||
* @template {any[]} T | ||
* @param {((...args: T) => void)} mainFn The main function to call. | ||
* @param {{args: T, deps?: Array<Function|string>}} options `args` should |
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.
yayyy
@@ -83,11 +85,10 @@ class ExecutionContext { | |||
// 3. Ensure that errors captured in the Promise are converted into plain-old JS Objects | |||
// so that they can be serialized properly b/c JSON.stringify(new Error('foo')) === '{}' | |||
expression: `(function wrapInNativePromise() { | |||
const __nativePromise = globalThis.__nativePromise || Promise; | |||
const URL = globalThis.__nativeURL || globalThis.URL; | |||
${ExecutionContext._cachedNativesPreamble}; |
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.
very nice!
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.
very nice!
indeed!
Co-authored-by: Brendan Kenny <bckenny@gmail.com>
…ighthouse into fr_refactor_cache_natives
Summary
Split out from #12366 and follow up to #12365, this moves the script evaluation on new document logic to executionContext, and aligns its call signature with our new preferred
evaluate
syntax that can be typechecked. This also completes the colocation of all the cached native definition and usage (except ElementMatches), so no need to referencewindow.__nativePromise
ever again :DRelated Issues/PRs
ref #11313 #12366