Skip to content

Chromium: page born into setOffline(true) context keeps navigator.onLine === true (1.62.0) #42174

Description

@cursor

Summary

In Playwright 1.62.0, a page created on a BrowserContext that is already offline (context.setOffline(true) before newPage()) reports navigator.onLine === true from the first script and never receives an offline event. 1.61.1 correctly reports onLine === false.

Toggle-offline on an already-open page works in both versions.

Minimal repro

const { chromium } = require('@playwright/test');

(async () => {
  const browser = await chromium.launch();
  const context = await browser.newContext();
  await context.setOffline(true);
  const page = await context.newPage();
  const probe = await page.evaluate(() => ({
    initOnLine: navigator.onLine,
  }));
  console.log(probe); // 1.62.0: { initOnLine: true } — wrong
                      // 1.61.1: { initOnLine: false } — correct
  await browser.close();
})();

Context

Filed from Pyrenza (LIFTV-2200) after LIFTV-2189 adjudication. We currently pin @playwright/test at 1.62.1 in two package.json locations; confirming whether 1.62.1 still reproduces or if a later fix landed.

Nearest prior art mentioned: #34402.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions