Closed Bllacky closed 3 years ago
not totally sure what you're saying..
are you saying the following? :
When Chrome is launched with --disable-notifications
, you get these results:
const permissionStatus = await navigator.permissions.query({name: 'notifications'});
permissionStatus.state; // ''
I can't reproduce this behavior locally. i'll always see 'denied' as the .state
.
I think what happens is that when I run with --disabled-notifications the following code fails:
// Pass the Permissions Test.
await page.evaluateOnNewDocument(() => {
const originalQuery = window.navigator.permissions.query;
window.navigator.permissions.__proto__.query = parameters =>
parameters.name === 'notifications'
? Promise.resolve({state: Notification.permission})
: originalQuery(parameters);
The window.navigator.permissions.query returns an empty string or it returns as non-existent. Can't remember at this point since my testing was some time ago and I just left as it is. The rest of the JS evasion code works so that was good enough for me.
I'm running Chrome 75 under Centos. It's not a big deal.
If you pass --disable-notifications
flag, then window.Notification
doesn't exist
so just mock it like:
if (!window.Notification) {
window.Notification = {
permission: 'denied'
}
}
before apply the rest of tweaks
Fixed eventually.
Hello,
In some cases, for chrome Notification.permission is an empty string. I think it happens if I use options.add_argument('--disable-notifications')
In such cases, then window.navigator.permissions.query also becomes an empty string. Could we account for this situation so that we don't end up with empty strings?
Thank you.