Bug 256201

Summary: The onchange event in navigator.permissions.query doesn't work properly in Safari 16.4.
Product: WebKit Reporter: jyunhanlin
Component: WebKit Misc.Assignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: cdumez, joshualuckers, jyunhanlin, karlcow, sihui_liu, webkit-bug-importer
Priority: P2 Keywords: BrowserCompat, InRadar
Version: Safari 16   
Hardware: Unspecified   
OS: iOS 16   

Description jyunhanlin 2023-05-02 00:34:14 PDT
# Steps to Reproduce:

1. Open a web page in Safari 16.4.
2. Try to register the onchange event with the following code:
```
navigator.permissions.query({ name: 'notifications' }).then(permissionStatus => {
  permissionStatus.onchange = () => {
    console.log('Notification permission status has changed:', permissionStatus.state);
  };
});
```
3. Choose to either allow or block the notification permission in the popped-up permission request dialog.
4. Observe if the console outputs a message indicating the change of notification permission status.

# Expected Results:

The console should output a message indicating the change of notification permission status when the permission status is changed.

# Actual Results:

The console doesn't output any message indicating the change of notification permission status when the permission status is changed.

# Version Information:

Safari browser version: 16.4
Operating system: macOS Big Sur 11.6.3

# Additional Information:

The onchange event works fine in other modern browsers such as Chrome, Firefox, and Edge.
Comment 1 Radar WebKit Bug Importer 2023-05-02 18:43:59 PDT
<rdar://problem/108820760>