File size: 576 Bytes
7e4b742
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
navigator_permissions = """
const handler = {
    apply: function (target, ctx, args) {
        const param = (args || [])[0]

        if (param && param.name && param.name === 'notifications') {
            const result = {state: Notification.permission}
            Object.setPrototypeOf(result, PermissionStatus.prototype)
            return Promise.resolve(result)
        }

        return utils.cache.Reflect.apply(...arguments)
    }
}

utils.replaceWithProxy(
    window.navigator.permissions.__proto__, // eslint-disable-line no-proto
    'query',
    handler
)

"""