Issue 1:
Context:

GOOD Playwright Version: 1.25

BAD Playwright Version: 1.26

Operating System: Windows, Linux

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:

test.only("provides correct resource timings", async ({ page }) => {
const html = `
<!DOCTYPE html>
<html>
<head>
<title>Test page</title>
<script src="/script.js"></script>
</head>
<body>
<img src="/img/image.jpg" alt="text">
</body>
</html>
`;

await page.route(/something.php/, function (route) {
return route.fulfill({
headers: {},
body: html,
contentType: "text/html"
});
});
await page.goto("https://something.php");
await page.pause();
const resTimings = await page.evaluate(() => performance.getEntries());
const images = resTimings.filter(res => res.name.includes("image.jpg"));
expect(images.length).toBe(1);
});

Describe the bug

After update to 1.26 from 1.25 webkit started reporting duplicate resource timings.

It happens if script is requested in the head, along with images in the body.

I haven't tried other scenarios.

Might be an upstream webkit bug.

I have provided a simple test case.

Chrome and firefox pass this test, and webkit passed it on playwright version < 1.26.

This is how entries look on webkit with playwright 1.26.1

[{"connectEnd": 43, "connectStart": 43, "domainLookupEnd": 43, "domainLookupStart": 43, "duration": 16.000000000000007, "entryType": "resource", "fetchStart": 43, "initiatorType": "img", "name": "https://test.local/img/image.jpg", "nextHopProtoco
l": "", "redirectEnd": 0, "redirectStart": 0, "requestStart": 43, "responseEnd": 59.00000000000001, "responseStart": 43, "secureConnectionStart": 0, "serverTiming": [], "startTime": 43, "workerStart": 0}, {"connectEnd": 93, "connectStart": 93, "domainLookupEnd
": 93, "domainLookupStart": 93, "duration": 25.000000000000014, "entryType": "resource", "fetchStart": 93, "initiatorType": "img", "name": "https://test.local/img/image.jpg", "nextHopProtocol": "", "redirectEnd": 0, "redirectStart": 0, "requestStart": 93, "responseEnd": 118.00000000000001, "responseStart": 93, "secureConnectionStart": 0, "serverTiming": [], "startTime": 93, "workerStart": 0}]

Entries with playwright 1.25.1

[{"connectEnd": 36.00000000000001, "connectStart": 36.00000000000001, "domainLookupEnd": 36.00000000000001, "domainLookupStart": 36.00000000000001, "duration": 11.999999999999993, "entryType": "resource", "fetchStart": 36.00000000000001, "initiat
orType": "img", "name": "https://something.php/img/image.jpg", "nextHopProtocol": "", "redirectEnd": 0, "redirectStart": 0, "requestStart": 36.00000000000001, "responseEnd": 48, "responseStart": 36.00000000000001, "secureConnectionStart": 0, "serverTiming": [], "startTime": 36.00000000000001, "workerStart": 0}]

Issue 2:
System info

Playwright Version: [v1.32.0]

Operating System: [macOS 13.2]

Browser: [Chromium]

Other info:

Source code

The following test breaks only in Chromium because body is empty:

test('user is able to login', async ({ page }) => {
const email = 'test_email@abcd.com';
const password = 'test_password';

await page.route('**/signin', async (route, request) => {
const body = JSON.parse(request.postData() || '{}'); // Always empty in Chromium. Works with all other browsers.
await Promise.all([expect(body.email).toEqual(email), expect(body.password).toEqual(password)]);
const json = require('./fixtures/signin_successful.json');
await route.fulfill({ json });
});

await page.goto('/');
const emailInput = page.getByTestId('email');
const passwordInput = page.getByTestId('password');
const loginButton = page.getByTestId('login');
await emailInput.fill(email);
await passwordInput.fill(password);
await expect(loginButton).toBeEnabled();
await Promise.all([loginButton.click(), page.waitForResponse('**/signin')]);
});