Skip to content
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: page.goto should resolve to response for self request (#1391) #1781

Merged

Conversation

@aslushnikov
Copy link
Contributor

@yujiosaka thank you for the patch! The only thing I don't understand is how come this is related to request interception. Is this just a timing issue?

@yujiosaka
Copy link
Author

yujiosaka commented Jan 11, 2018

@aslushnikov
It's a very good point. I assume it was just a timing issue, and the same problem may occur without request interception.
While investigating this problem, I noticed that the request to the same url occurs after load event. It may be just that requestIntercepted is fired before requestWillBeSent.

If that's the case, I can add another test without request interception.
Let me see.

@yujiosaka
Copy link
Author

yujiosaka commented Jan 11, 2018

Is this just a timing issue?

It was right! I could repro the same problem even without request interception with this small html.

Thus, I added a test for non request interception version. 37f0d67

Thank you for pointing it out!

test/test.js Outdated
@@ -1397,6 +1402,13 @@ describe('Page', function() {
expect(requests.length).toBe(5);
expect(requests[2].resourceType()).toBe('document');
});
it('should work with self requesting page', async({page, server}) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please drop this test? It doesn't cover anything new wrt to another one you've added here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think so? I would like to hear more reasons.

With page.setRequestInterception(true) it goes different code path.
I thought that's the reason why we have such tests as redirect chain for both non interception and interception versions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With page.setRequestInterception(true) it goes different code path.

@yujiosaka from the point of view of Page class and page.goto method specifically, there's no difference in the codepath. Or am I missing something?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or am I missing something?

No! I understand your point, so I'll drop the test :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!
83daf47

@aslushnikov aslushnikov merged commit c866c17 into puppeteer:master Jan 12, 2018
@yujiosaka yujiosaka deleted the page_goto_should_resolve_to_response2 branch January 12, 2018 08:23
igorshapiro pushed a commit to WiserSolutions/puppeteer that referenced this pull request Jan 16, 2018
… (puppeteer#1781)

This patch fixes `page.goto` for websites that re-request document URL with javascript.

Fixes puppeteer#1391.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Page.goto returns null for some urls
2 participants