-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
fix(webkit): do not swallow errors when returning by value #2723
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -228,6 +228,10 @@ describe('Page.evaluate', function() { | |
it('should properly serialize undefined fields', async({page}) => { | ||
expect(await page.evaluate(() => ({a: undefined}))).toEqual({}); | ||
}); | ||
it('should return undefined properties', async({page}) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you also add a test for the case where it previously would return undefined and now throws? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have a test for that called 'should not throw an error when evaluation does a synchronous navigation and returns undefined'. It's racy, so run with repeat(1000). |
||
const value = await page.evaluate(() => ({a: undefined})); | ||
expect('a' in value).toBe(true); | ||
}); | ||
it('should properly serialize null arguments', async({page}) => { | ||
expect(await page.evaluate(x => x, null)).toEqual(null); | ||
}); | ||
|
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 will likely break some of the code where no exception is currently expected. My understanding was that the current contract of returning undefined instead of throwing was intentional since ling ago. I personally agree that it's not good to silently swallow errors but Lusha/Joel might remember if there was a specific request for that behavior.
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 current behavior is webkit-specific. It has to do with returnByValue being a separate step from the evaluate itself, due to special promise handling.