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

[BUG] Firefox and WebKit request.resourceType() incorrect with EventSource connection #2189

Closed
rdmurphy opened this issue May 11, 2020 · 0 comments · Fixed by #2430
Closed
Assignees

Comments

@rdmurphy
Copy link

rdmurphy commented May 11, 2020

Context:

  • Playwright Version: 1.0.1
  • Operating System: Mac
  • Node version: v14.1.0
  • Browser: Firefox, WebKit

Code Snippet

Help us help you! Put down a short code snippet that illustrates your bug and
that we can run and debug locally. For example:

const { chromium, webkit, firefox } = require('playwright');

Promise.all([chromium, webkit, firefox].map(async (b) => {
  const browser = await b.launch();
  const page = await browser.newPage();

  page.on('request', (req) => {
    console.log(req.url(), req.resourceType());
  });

  await page.goto('...');
});

Describe the bug

Hello! 👋

I've been experimenting with Playwright and using it to test interactions with an EventSource, and as part of that process I was trying to use this library to ensure that the EventSource successfully connects in each browser. However, each browser reports out the request.resourceType() of an EventSource connection differently.

Chromium reports it out correctly, and returns eventsource. Firefox confusingly returns xhr. And Webkit has no idea and reports out unknown.

I assume this may be a byproduct of how each browser reports out network connections and is out of the control of Playwright, but just in case it's an actual bug I wanted to drop it here. If it is by design, is there any other way to confidently detect EventSource connections in those browsers?

Thank you!

@rdmurphy rdmurphy changed the title [BUG] Firefox and WebKit resourceType incorrect with EventSource connection [BUG] Firefox and WebKit request.resourceType() incorrect with EventSource connection May 11, 2020
aslushnikov added a commit to aslushnikov/playwright that referenced this issue May 28, 2020
aslushnikov added a commit to aslushnikov/playwright that referenced this issue May 28, 2020
aslushnikov added a commit that referenced this issue May 28, 2020
aslushnikov added a commit to aslushnikov/playwright that referenced this issue May 28, 2020
Internal request cause helps clarify certain types of requests,
e.g. event source.

Review URL: aslushnikov/juggler@296ecad

References microsoft#2189
aslushnikov added a commit to aslushnikov/playwright that referenced this issue May 28, 2020
The resource type for `eventsource` events in webkit seems to be hard to
reach from our instrumentation points.

This suggests an alternative approach for webkit to treat all requests
with 'accept' header of server-sent events as server-sent events.

References microsoft#2189
aslushnikov added a commit that referenced this issue May 28, 2020
aslushnikov added a commit to aslushnikov/playwright that referenced this issue May 29, 2020
aslushnikov added a commit to aslushnikov/playwright that referenced this issue May 31, 2020
Review URL: aslushnikov/WebKit@77a2901

This uses `initiatorIdentifier` to mark resource request as
originating from event source.

This is alternative to microsoft#2396.

References microsoft#2189
aslushnikov added a commit to aslushnikov/playwright that referenced this issue Jun 1, 2020
Review URL: aslushnikov/WebKit@77a2901

This uses `initiatorIdentifier` to mark resource request as
originating from event source.

This is alternative to microsoft#2396.

References microsoft#2189
aslushnikov added a commit that referenced this issue Jun 1, 2020
Review URL: aslushnikov/WebKit@77a2901

This uses `initiatorIdentifier` to mark resource request as
originating from event source.

This is alternative to #2396.

References #2189
aslushnikov added a commit to aslushnikov/playwright that referenced this issue Jun 1, 2020
This rolls webkit to r1250 where we report event source.

Fixes microsoft#2189
aslushnikov added a commit that referenced this issue Jun 1, 2020
This rolls webkit to r1250 where we report event source.

Fixes #2189
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 a pull request may close this issue.

3 participants