<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [GTK] No way for applications to set notification permissions without waiting for permission request"
   href="https://bugs.webkit.org/show_bug.cgi?id=163366">163366</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[GTK] No way for applications to set notification permissions without waiting for permission request
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>WebKit Gtk
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>mcatanzaro&#64;igalia.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>aperez&#64;igalia.com, bugs-noreply&#64;webkitgtk.org, gns&#64;gnome.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Websites can check the Notification.permission DOM property [1] to check if they have permission to show notifications without triggering an intrusive permission request (that's done via Notification.requestPermission()). But the WebKitGTK+ API has no way to affirmatively indicate notifications are allowed. The only way is via the permission request API, which is too late. It's a problem for Epiphany. For example, open the Riot Matrix client in a web app; you will immediately see an info bar informing the user that Riot does not have permission to send desktop notifications, even though Epiphany automatically grants notification permission in web app mode when requested.

The problem is in WebKitNotificationProvider.cpp, where we need to implement notificationPermissionsCallback of WKNotificationProviderV0. The WKDictionaryRef returned by that callback should be set by some new API function. Simple proposal:

void webkit_web_context_set_notification_permissions (WebKitWebContext *context, GHashTable *permissions);

where the hash table is a map of strings to bools.

[1] <a href="https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API/Using_the_Notifications_API">https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API/Using_the_Notifications_API</a></pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>