Skip to content

[Regression]: requestFullscreen() in a popup rejects with "not granted" in 1.65 (Chromium 159) #44288

Open

Description

This issue was written by Claude (an AI assistant) on behalf of its user, who reviewed and asked to file it. The repro below was run as shown.

Version

1.65.1 (works in 1.64.1)

Steps to reproduce

const { chromium } = require('@playwright/test');
const http = require('node:http');
const html = `<!doctype html><body><div id=r>x</div><script>
addEventListener('keydown', e => { if (e.key === 'f') document.getElementById('r').requestFullscreen().then(() => window.res = 'ok', err => window.res = String(err)); });
</script>`;
(async () => {
  const srv = http.createServer((_, res) => res.end(html)).listen(0, '127.0.0.1');
  await new Promise((r) => srv.once('listening', r));
  const url = `http://127.0.0.1:${srv.address().port}/`;
  const browser = await chromium.launch();
  const page = await browser.newPage();
  await page.goto(url);
  await page.keyboard.press('f');
  await page.waitForTimeout(300);
  console.log('main', await page.evaluate(() => [window.res, !!document.fullscreenElement]));
  const [popup] = await Promise.all([page.waitForEvent('popup'), page.evaluate((u) => window.open(u, 'p', 'popup'), url)]);
  await popup.waitForLoadState();
  await popup.keyboard.press('f');
  await popup.waitForTimeout(300);
  console.log('popup', await popup.evaluate(() => [window.res, !!document.fullscreenElement]));
  await browser.close();
  srv.close();
})();

Expected behavior

As in 1.64.1 (Chromium 156.0.8078.4):

main [ 'ok', true ]
popup [ 'ok', true ]

Actual behavior

1.65.1 (Chromium 159.0.8154.6), headless:

main [ 'ok', true ]
popup [ 'TypeError: not granted', false ]

Environment

  • OS: Linux (Fedora 44)
  • Node: v24.22.3
  • @playwright/test 1.65.1, default headless Chromium

Activity

  1. wtfnixin commented on Nov 22, 2026

    @wtfnixin

    I investigated this regression on Chromium 159.0.8154.6. Here is the verified root cause and test matrix:

    Root Cause

    In Chromium 159, the feature flag SuppressFullscreenFromUnfocusedView was enabled by default (crbug.com/347495359, Gerrit 8414088, commit 8d1e242cb).

    In content/browser/renderer_host/render_frame_host_impl.cc (RenderFrameHostImpl::EnterFullscreen), Chromium now rejects fullscreen requests if the view lacks window focus, even when transient user activation is present:

    const bool missing_focus =
        base::FeatureList::IsEnabled(
            blink::features::kSuppressFullscreenFromUnfocusedView) &&
        !GetView()->HasFocus();
    
    if ((!consumed_activation || missing_focus) && !consumed_token) {
      DLOG(ERROR) << "Cannot enter fullscreen without a transient activation...";
      std::move(callback).Run(/*granted=*/false);
      return;
    }

    When granted == false, Blink's Fullscreen::DidResolveEnterFullscreenRequest maps this to RequestFullscreenError::kNotGranted, rejecting the JavaScript promise with TypeError: not granted.

    Why it triggers in Playwright

    1. In headless Chromium, newly opened popup targets do not receive window manager focus, leaving GetView()->HasFocus() as false.
    2. popup.keyboard.press() dispatches CDP Input.dispatchKeyEvent, which grants transient activation to the renderer but does not set RenderWidgetHostView::HasFocus().
    3. Because missing_focus is true, Chromium denies the fullscreen request.

    Confirmed Test Matrix (Chromium 159.0.8154.6)

    Scenario Result (popup)
    Default 1.65.1 (repro as written) [ 'TypeError: not granted', false ]
    With await popup.bringToFront() [ 'ok', true ]
    With --disable-features=SuppressFullscreenFromUnfocusedView [ 'ok', true ]

    await popup.bringToFront() resolves it because CDP Page.bringToFront calls WebContentsImpl::Focus() / view_->Focus().

    Next Steps / Potential Fix

    Since Playwright aims to emulate authentic user actions (where interacting with a popup implies window focus), should Playwright ensure target focus before dispatching user input, or activate/focus popups during initialization?

    Happy to contribute a PR for this if the team agrees on the preferred direction!

  2. julien-f commented on Nov 22, 2026

    @julien-f
    Author

    Thanks — reproduced your matrix on 1.65.1 / Chromium 159.0.8154.6: popup.bringToFront() before the key press and --disable-features=SuppressFullscreenFromUnfocusedView both make the popup's requestFullscreen() succeed. We'll use bringToFront() as a workaround meanwhile; leaving the fix direction to the maintainers.

  3. Archana20235 commented on Nov 22, 2026

    @Archana20235

    QA Observation – Playwright Issue #44288

    Issue: requestFullscreen() fails when invoked from a newly opened popup in headless Chromium.

    Environment:

    • Playwright: 1.66.0-next (local source)

    • Chromium: 159.0.8154.13

    • Node.js: v26.13.1

    • OS: Windows

    • Execution mode: Headless

    1. Observation

    During investigation, fullscreen behaviour was verified in three scenarios:

    Test Case | Scenario | Result -- | -- | -- TC_001 | Request fullscreen from the main page | Passed TC_002 | Request fullscreen from a popup without bringing it to the foreground | Failed – TypeError: not granted TC_003 | Bring the popup to the foreground using bringToFront() and request fullscreen | Passed

    The issue is reproducible in the popup scenario, while the main-page fullscreen request works as expected.

    The reproduction indicates that keyboard input and transient user activation alone do not guarantee that the popup has the required window focus for fullscreen.

    2. Root Cause Analysis

    The investigation points to Chromium's SuppressFullscreenFromUnfocusedView behaviour.

    In headless Chromium, a newly opened popup may remain an unfocused window. Although Playwright can dispatch keyboard input to the popup, this does not necessarily make the popup the focused browser window.

    Consequently, Chromium rejects the Fullscreen API request with:

    TypeError: not granted

    Calling popup.bringToFront() before requesting fullscreen allows the operation to succeed, indicating that window focus is relevant to the failure.

    3. Conclusion

    The observed failure is associated with fullscreen requests originating from an unfocused popup in Chromium 159.

    The main-page fullscreen scenario succeeds, and the popup scenario succeeds after bringing the popup to the foreground.

    Further investigation is required to determine the appropriate Playwright-side handling without introducing unintended focus changes or affecting existing popup behaviour.

    4. Current Status

    • Issue reproduced locally.

    • Three execution scenarios investigated.

    • Popup focus behaviour identified as a contributing factor.

    • Regression test implementation pending.

    • Permanent code fix pending.

    • Full regression validation pending.

  4. microsoft-playwright-automation commented on Nov 23, 2026

    @microsoft-playwright-automation
  5. microsoft-playwright-automation commented on Nov 23, 2026

    @microsoft-playwright-automation
    Contributor

    Hi, I'm the Playwright bot. I reproduced this on Linux and prepared a fix.

    Reproduced in 1.65.1 and current main (aa3c4453c15602f20ccf60c52fde74497e1ac268), in headless Chromium only. Firefox and WebKit pass. Chromium's new fullscreen check requires actual window focus even when Playwright emulates focus. The proposed fix disables SuppressFullscreenFromUnfocusedView for Playwright launches, so fullscreen works without bringing the popup to front or changing focus during input.

    The bisect found the commit that enabled the check: Chromium r1715938. 8d1e242cb introduced the check earlier, but left it disabled.

    Regression test

    Added this case to the existing CA-020 requestFullscreen test, after its main-page fullscreen checks:

    const [popup] = await Promise.all([
      page.waitForEvent('popup'),
      page.evaluate(url => window.open(url, 'popup', 'popup'), server.EMPTY_PAGE),
    ]);
    await popup.waitForLoadState();
    await popup.evaluate(() => {
      document.addEventListener('keydown', event => {
        if (event.key === 'f')
          document.documentElement.requestFullscreen().then(
            () => window['fullscreenResult'] = 'success',
            error => window['fullscreenResult'] = String(error)
          );
      });
    });
    await popup.keyboard.press('f');
    await expect.poll(() => popup.evaluate(() => window['fullscreenResult'])).toBe('success');
    expect(await popup.evaluate(() => document.fullscreenElement === document.documentElement)).toBe(true);

    Without the fix, the assertion receives TypeError: not granted. With the fix, it passes.

    Versions, variations, and checks

    All runs were on Linux with Node.js 24.22.3. Stable-version checks used a locally supplied HTML page with a keyboard handler; the main page remained fullscreen when opening the popup, as in the report.

    Version / browser Mode Default popup With bringToFront() With feature disabled
    1.64.1 / Chromium 156.0.8078.4 Headless Pass Pass Pass
    1.65.1 / Chromium 159.0.8154.6 Headless TypeError: not granted Pass Pass
    1.65.1 / Chromium 159.0.8154.6 Headed, Xvfb Pass Pass Pass
    Main / Chromium 159.0.8154.13, before fix Headless TypeError: not granted — —
    Main / Chromium 159.0.8154.13, with fix Headless Pass Pass Pass
    Main / Firefox 159.0 Headless Pass — —
    Main / WebKit 27.2 Headless Pass — —

    The main-page requests passed in every stable-version variation. In the failing 1.65.1 popup, document.hasFocus() still returned true.

    After the fix, CA-020 also passed in headed Chromium and WebKit under Xvfb, and in full Chromium's headless mode (PWTEST_CHANNEL=chromium). Headed Firefox retains the test's existing skip.

    Bisect command:

    node utils/bisect-chromium.mjs --good 156.0.8078.4 --bad 159.0.8154.6 \
      --check 'npm run ctest -- tests/library/capabilities.spec.ts --grep CA-020 --workers=1 --retries=0 --reporter=line'

    Good builds: r1706652, r1715169, r1715645, r1715924, r1715933, r1715936.
    Bad builds: r1739868, r1723380, r1719394, r1717167, r1716204, r1716081, r1716001, r1715958, r1715941, r1715939, r1715938.
    The last good available build is r1715936; the first bad is r1715938.

    Validation:

    npm run build
    xvfb-run -a npm run test -- tests/library/capabilities.spec.ts \
      tests/library/emulation-focus.spec.ts tests/page/page-event-popup.spec.ts \
      --workers=2 --retries=0 --reporter=line
    npm run flint

    Results: 162 passed, 6 existing skips; build and all lint/type checks passed. An initial run without a display passed 160 tests and failed only the two Firefox WebGL checks. Those checks passed with a display, including in the final headless run under Xvfb. WebKit initially lacked system libraries; it passed after installing them.

    The Chromium regression was checked again with the fix removed and failed with the same error, then passed after restoring the fix.

    Draft PR: #44315

    Triaged on Linux by the Playwright bot - agent run

  6. dgozman commented on Nov 24, 2026

    @dgozman
    Collaborator

    Agent, let's also prepare a crbug draft, focusing on headless behavior diverging from headed. I think chromium headless should align with headed here.

  7. added and removed
    agent-triage-done
    on Nov 24, 2026
  8. microsoft-playwright-automation commented on Nov 24, 2026

    @microsoft-playwright-automation
  9. microsoft-playwright-automation commented on Nov 24, 2026

    @microsoft-playwright-automation
    Contributor

    Hi, I'm the Playwright bot. I prepared a Chromium bug draft with a tested, standalone CDP reproduction.

    Chrome Headless Shell 159.0.8154.13 rejects the popup's fullscreen request; full Chrome at the same version passes in both headed and headless modes. The reduced reproduction needs neither Playwright nor focus emulation, and the opener need not be fullscreen. The popup reports document focus and transient user activation in all three modes.

    The draft below is ready to copy into https://crbug.com/new. The existing draft PR, #44315, is unchanged.

    Chromium bug draft

    Category: Developer Tools

    Operating System: Linux

    Channel: Not sure

    Chrome version: 159.0.8154.13

    Summary: Chrome Headless Shell rejects popup requestFullscreen() while headed Chrome allows it

    Steps to reproduce:

    1. Download Chrome for Testing and Chrome Headless Shell 159.0.8154.13 for Linux. Use Node.js 24 or later.
    2. Save this script as fullscreen-repro.mjs:
    import { spawn } from 'node:child_process';
    import { once } from 'node:events';
    import { mkdtemp, rm } from 'node:fs/promises';
    import { tmpdir } from 'node:os';
    import { join } from 'node:path';
    
    // Run: node fullscreen-repro.mjs /path/to/chrome-headless-shell
    // Compare: node fullscreen-repro.mjs /path/to/chrome
    // Compare: node fullscreen-repro.mjs /path/to/chrome --headless
    const profile = await mkdtemp(join(tmpdir(), 'fullscreen-repro-'));
    const chrome = spawn(process.argv[2], [
      `--user-data-dir=${profile}`, '--remote-debugging-port=0',
      '--no-first-run', '--no-default-browser-check', '--no-sandbox',
      ...process.argv.slice(3),
    ], { stdio: ['ignore', 'ignore', 'pipe'] });
    let ws;
    const timeout = setTimeout(() => {
      console.error('Reproduction timed out');
      chrome.kill();
      ws?.close();
      process.exitCode = 1;
    }, 15000);
    try {
      const endpoint = await new Promise((resolve, reject) => {
        let stderr = '';
        chrome.stderr.on('data', chunk => {
          stderr += chunk;
          const match = stderr.match(/DevTools listening on (ws:\/\/\S+)/);
          if (match)
            resolve(match[1]);
        });
        chrome.on('error', reject);
        chrome.on('exit', code => reject(new Error(`Chrome exited ${code}: ${stderr}`)));
      });
      ws = new WebSocket(endpoint);
      await once(ws, 'open');
      let id = 0;
      const pending = new Map();
      ws.addEventListener('message', event => {
        const reply = JSON.parse(event.data);
        if (!reply.id)
          return;
        const { resolve, reject } = pending.get(reply.id);
        pending.delete(reply.id);
        reply.error ? reject(new Error(JSON.stringify(reply.error))) : resolve(reply.result);
      });
      function send(method, params = {}, sessionId) {
        return new Promise((resolve, reject) => {
          pending.set(++id, { resolve, reject });
          ws.send(JSON.stringify({ id, method, params, sessionId }));
        });
      }
      console.log('version', await send('Browser.getVersion'));
      const { targetId } = await send('Target.createTarget', { url: 'about:blank' });
      const { sessionId: main } = await send('Target.attachToTarget', { targetId, flatten: true });
      await send('Runtime.evaluate', {
        expression: `window.open('about:blank', 'popup', 'popup')`,
        userGesture: true,
      }, main);
      let popupTarget;
      while (!popupTarget) {
        const { targetInfos } = await send('Target.getTargets');
        popupTarget = targetInfos.find(target => target.openerId === targetId);
        if (!popupTarget)
          await new Promise(resolve => setTimeout(resolve, 20));
      }
      const { sessionId: popup } = await send('Target.attachToTarget', {
        targetId: popupTarget.targetId, flatten: true,
      });
      await send('Runtime.evaluate', {
        expression: `new Promise(resolve => {
          if (document.readyState === 'complete') resolve();
          else addEventListener('load', resolve, { once: true });
        })`,
        awaitPromise: true,
      }, popup);
      await send('Runtime.evaluate', {
        expression: `document.body.innerHTML = '<div>Fullscreen test</div>';
          window.result = new Promise(resolve => {
            addEventListener('keydown', event => {
              if (event.key === 'f') {
                const activation = navigator.userActivation.isActive;
                document.documentElement.requestFullscreen().then(
                  () => resolve(['ok', !!document.fullscreenElement, document.hasFocus(), activation]),
                  error => resolve([String(error), !!document.fullscreenElement, document.hasFocus(), activation])
                );
              }
            }, { once: true });
          });`,
      }, popup);
      await send('Input.dispatchKeyEvent', {
        type: 'keyDown', key: 'f', code: 'KeyF', text: 'f', windowsVirtualKeyCode: 70,
      }, popup);
      await send('Input.dispatchKeyEvent', {
        type: 'keyUp', key: 'f', code: 'KeyF', windowsVirtualKeyCode: 70,
      }, popup);
      const result = await send('Runtime.evaluate', {
        expression: 'result', awaitPromise: true, returnByValue: true,
      }, popup);
      if (result.exceptionDetails)
        throw new Error(JSON.stringify(result.exceptionDetails));
      console.log('[result, fullscreen, document focus, user activation]', result.result.value);
      await send('Browser.close');
    } finally {
      clearTimeout(timeout);
      ws?.close();
      if (chrome.exitCode === null) {
        const exited = once(chrome, 'exit');
        chrome.kill();
        await exited;
      }
      await rm(profile, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 });
    }
    1. Run the three commands in the script's comments. Headed Chrome needs a display; xvfb-run -a was used on Linux. Compare the printed result.

    Problem:

    This is a regression between Chrome Headless Shell 156.0.8078.4 and 159.0.8154.13.

    In Headless Shell 159.0.8154.13, the result is:

    [ 'TypeError: not granted', false, true, true ]
    

    Full Chrome 159.0.8154.13, both headed and with --headless, returns:

    [ 'ok', true, true, true ]
    

    The values are the fullscreen promise result, whether a fullscreen element exists, document.hasFocus(), and navigator.userActivation.isActive at the key event. Both browser products report source revision 4d790f9eb4c8abe65b8aaa3feba664e7c734ba56.

    Expected: opening and interacting with a popup should allow requestFullscreen() in Headless Shell as it does in headed Chrome. The focused document has transient user activation. This script uses only CDP and Node.js built-ins; it does not emulate focus or request fullscreen in the opener.

    The regression boundary was confirmed with the same script: Headless Shell r1715936 passes; r1715938 rejects. Both report version 157.0.8096.0. Commit 031f5860c5fc99aadeb34b55bdc143cbb0359a79, r1715938, enabled SuppressFullscreenFromUnfocusedView. The earlier 8d1e242cb955d87bc84117fcb8010fd6d4119d5e added the browser-view focus check in RenderFrameHostImpl::EnterFullscreen.

    Passing --disable-features=SuppressFullscreenFromUnfocusedView makes the same script pass in Headless Shell 159.0.8154.13. In the reproduction that also requests fullscreen in the opener, sending Page.bringToFront to the popup before keyboard input also makes it pass.

    Found in #44288.

    Did this work before? Yes

    • Last good tested release build: Chrome Headless Shell 156.0.8078.4.
    • Bad tested release build: Chrome Headless Shell 159.0.8154.13.
    • Last good available per-commit build: r1715936, version 157.0.8096.0.
    • First bad available per-commit build: r1715938, version 157.0.8096.0.

    Send a Chrome feedback report: No

    Checks in this run

    All checks ran on Linux with Node.js 24.22.3, without Playwright. The standalone script above produced:

    Browser build Mode Popup result
    Chrome Headless Shell 156.0.8078.4 Headless Pass
    Chrome Headless Shell 159.0.8154.13 Headless TypeError: not granted
    Chrome for Testing 159.0.8154.13 Headed, Xvfb Pass
    Chrome for Testing 159.0.8154.13 Headless Pass
    Chrome Headless Shell 159.0.8154.13, feature disabled Headless Pass
    Chrome Headless Shell r1715936 / 157.0.8096.0 Headless Pass
    Chrome Headless Shell r1715938 / 157.0.8096.0 Headless TypeError: not granted

    An additional CDP reproduction kept the opener fullscreen, as in the original report. Headless Shell 159.0.8154.13 failed both with and without focus emulation; Page.bringToFront and disabling the feature each made it pass. Full Chrome 159.0.8154.13 passed in headed and headless modes. Headless Shell 156.0.8078.4 passed.

    This narrows the report to Headless Shell, rather than all headless Chrome. Windows and macOS were not tested in this run. The Chromium form requires a Google sign-in, so the report is a draft, not a filed issue.

    Triaged on Linux by the Playwright bot - agent run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-triage-done

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions