Skip to content

overridePermissions has no influence on Notification.permission property #3279

@velichkin

Description

@velichkin

Steps to reproduce

  • Puppeteer version: 1.8.0
  • Platform / OS version: macOS 10.3.6
  • Node.js version: 8.12.0

What steps will reproduce the problem?

I'm trying to allow push notifications in headless chrome with puppeteer. It was implemented in #846
After I call overridePermissions the Notification.requestPermission(); call returns me desired result - 'granted'. But Notification.permission still returns 'denied', but it should be 'granted' too.

Here is the code:

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  const context = browser.defaultBrowserContext();

  const page = await browser.newPage();

  await page.goto('https://serviceworke.rs/push-simple_demo.html');
  console.log(await page.evaluate(function(){return Notification.requestPermission();}));
  console.log(await page.evaluate(function(){return Notification.permission;}));

  await context.overridePermissions('https://serviceworke.rs', ['notifications']);

  await page.goto('https://serviceworke.rs/push-simple_demo.html');
  console.log(await page.evaluate(function(){return Notification.requestPermission();}));
  console.log(await page.evaluate(function(){return Notification.permission;}));

  await browser.close();
})();

What is the expected result?
default
denied
granted
granted

What happens instead?
default
denied
granted
denied

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