<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[207025] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/207025">207025</a></dd>
<dt>Author</dt> <dd>darin@apple.com</dd>
<dt>Date</dt> <dd>2016-10-10 14:33:25 -0700 (Mon, 10 Oct 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Move NotificationCenter from legacy to new DOM exceptions
https://bugs.webkit.org/show_bug.cgi?id=163217

Reviewed by Chris Dumez.

Source/WebCore:

* Modules/notifications/DOMWindowNotifications.cpp:
(WebCore::DOMWindowNotifications::webkitNotifications): Pass reference to
document instead of pointer. Also use auto and early return.

* Modules/notifications/Notification.cpp:
(WebCore::Notification::Notification): Move checks that can lead to
throwing an exception out of the constructor into the create function.
(WebCore::Notification::create): Changed to use ExceptionOr. Also moved
checks that can lead to throwing an exception here.
(WebCore::Notification::show): Update since NotificationController::client
now returns a reference.
(WebCore::Notification::permission): Ditto.
(WebCore::Notification::requestPermission): Ditto.

* Modules/notifications/Notification.h: Updated for above changes.

* Modules/notifications/NotificationCenter.cpp:
(WebCore::NotificationCenter::create): Take a reference to the script execution
context instead of a pointer.
(WebCore::NotificationCenter::NotificationCenter): Ditto.
(WebCore::NotificationCenter::createNotification): Use ExceptionOr.
(WebCore::NotificationCenter::requestPermission): Take an rvalue reference.

* Modules/notifications/NotificationCenter.h: Use pragma once.
Marked the class final. Updated for changes above.

* Modules/notifications/NotificationCenter.idl: Use non-legacy exceptions.

* Modules/notifications/NotificationController.cpp:
(WebCore::NotificationController::NotificationController): Use a reference rather
than a pointer for m_client, since it is never null.
(WebCore::NotificationController::~NotificationController): Ditto.
(WebCore::NotificationController::clientFrom): Updated for the change above.

* Modules/notifications/NotificationController.h: Updated for the change above.

* Modules/notifications/WorkerGlobalScopeNotifications.cpp:
(WebCore::WorkerGlobalScopeNotifications::webkitNotifications): Updated to
pass a reference for the script execution context. Also added FIXME about the
fact that the client is always null.

Source/WebKit/mac:

* WebView/WebView.mm:
(-[WebView _notificationIDForTesting:]): Pass reference to page rather than pointer.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesnotificationsDOMWindowNotificationscpp">trunk/Source/WebCore/Modules/notifications/DOMWindowNotifications.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesnotificationsNotificationcpp">trunk/Source/WebCore/Modules/notifications/Notification.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesnotificationsNotificationh">trunk/Source/WebCore/Modules/notifications/Notification.h</a></li>
<li><a href="#trunkSourceWebCoreModulesnotificationsNotificationCentercpp">trunk/Source/WebCore/Modules/notifications/NotificationCenter.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesnotificationsNotificationCenterh">trunk/Source/WebCore/Modules/notifications/NotificationCenter.h</a></li>
<li><a href="#trunkSourceWebCoreModulesnotificationsNotificationCenteridl">trunk/Source/WebCore/Modules/notifications/NotificationCenter.idl</a></li>
<li><a href="#trunkSourceWebCoreModulesnotificationsNotificationControllercpp">trunk/Source/WebCore/Modules/notifications/NotificationController.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesnotificationsNotificationControllerh">trunk/Source/WebCore/Modules/notifications/NotificationController.h</a></li>
<li><a href="#trunkSourceWebCoreModulesnotificationsWorkerGlobalScopeNotificationscpp">trunk/Source/WebCore/Modules/notifications/WorkerGlobalScopeNotifications.cpp</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewmm">trunk/Source/WebKit/mac/WebView/WebView.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (207024 => 207025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-10-10 21:17:47 UTC (rev 207024)
+++ trunk/Source/WebCore/ChangeLog        2016-10-10 21:33:25 UTC (rev 207025)
</span><span class="lines">@@ -1,3 +1,51 @@
</span><ins>+2016-10-10  Darin Adler  &lt;darin@apple.com&gt;
+
+        Move NotificationCenter from legacy to new DOM exceptions
+        https://bugs.webkit.org/show_bug.cgi?id=163217
+
+        Reviewed by Chris Dumez.
+
+        * Modules/notifications/DOMWindowNotifications.cpp:
+        (WebCore::DOMWindowNotifications::webkitNotifications): Pass reference to
+        document instead of pointer. Also use auto and early return.
+
+        * Modules/notifications/Notification.cpp:
+        (WebCore::Notification::Notification): Move checks that can lead to
+        throwing an exception out of the constructor into the create function.
+        (WebCore::Notification::create): Changed to use ExceptionOr. Also moved
+        checks that can lead to throwing an exception here.
+        (WebCore::Notification::show): Update since NotificationController::client
+        now returns a reference.
+        (WebCore::Notification::permission): Ditto.
+        (WebCore::Notification::requestPermission): Ditto.
+
+        * Modules/notifications/Notification.h: Updated for above changes.
+
+        * Modules/notifications/NotificationCenter.cpp:
+        (WebCore::NotificationCenter::create): Take a reference to the script execution
+        context instead of a pointer.
+        (WebCore::NotificationCenter::NotificationCenter): Ditto.
+        (WebCore::NotificationCenter::createNotification): Use ExceptionOr.
+        (WebCore::NotificationCenter::requestPermission): Take an rvalue reference.
+
+        * Modules/notifications/NotificationCenter.h: Use pragma once.
+        Marked the class final. Updated for changes above.
+
+        * Modules/notifications/NotificationCenter.idl: Use non-legacy exceptions.
+
+        * Modules/notifications/NotificationController.cpp:
+        (WebCore::NotificationController::NotificationController): Use a reference rather
+        than a pointer for m_client, since it is never null.
+        (WebCore::NotificationController::~NotificationController): Ditto.
+        (WebCore::NotificationController::clientFrom): Updated for the change above.
+
+        * Modules/notifications/NotificationController.h: Updated for the change above.
+
+        * Modules/notifications/WorkerGlobalScopeNotifications.cpp:
+        (WebCore::WorkerGlobalScopeNotifications::webkitNotifications): Updated to
+        pass a reference for the script execution context. Also added FIXME about the
+        fact that the client is always null.
+
</ins><span class="cx"> 2016-10-10  Antoine Quint  &lt;graouts@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Modern Media Controls] Placards
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesnotificationsDOMWindowNotificationscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/notifications/DOMWindowNotifications.cpp (207024 => 207025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/notifications/DOMWindowNotifications.cpp        2016-10-10 21:17:47 UTC (rev 207024)
+++ trunk/Source/WebCore/Modules/notifications/DOMWindowNotifications.cpp        2016-10-10 21:33:25 UTC (rev 207025)
</span><span class="lines">@@ -101,23 +101,24 @@
</span><span class="cx"> NotificationCenter* DOMWindowNotifications::webkitNotifications()
</span><span class="cx"> {
</span><span class="cx">     if (!m_window-&gt;isCurrentlyDisplayedInFrame())
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx"> 
</span><span class="cx">     if (m_notificationCenter)
</span><span class="cx">         return m_notificationCenter.get();
</span><span class="cx"> 
</span><del>-    Document* document = m_window-&gt;document();
</del><ins>+    auto* document = m_window-&gt;document();
</ins><span class="cx">     if (!document)
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx">     
</span><del>-    Page* page = document-&gt;page();
</del><ins>+    auto* page = document-&gt;page();
</ins><span class="cx">     if (!page)
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx"> 
</span><del>-    NotificationClient* provider = NotificationController::clientFrom(page);
-    if (provider) 
-        m_notificationCenter = NotificationCenter::create(document, provider);    
</del><ins>+    auto* provider = NotificationController::clientFrom(*page);
+    if (!provider)
+        return nullptr;
</ins><span class="cx"> 
</span><ins>+    m_notificationCenter = NotificationCenter::create(*document, provider);
</ins><span class="cx">     return m_notificationCenter.get();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesnotificationsNotificationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/notifications/Notification.cpp (207024 => 207025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/notifications/Notification.cpp        2016-10-10 21:17:47 UTC (rev 207024)
+++ trunk/Source/WebCore/Modules/notifications/Notification.cpp        2016-10-10 21:33:25 UTC (rev 207025)
</span><span class="lines">@@ -50,22 +50,13 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(LEGACY_NOTIFICATIONS)
</span><span class="cx"> 
</span><del>-Notification::Notification(const String&amp; title, const String&amp; body, const String&amp; iconURI, ScriptExecutionContext&amp; context, ExceptionCode&amp; ec, NotificationCenter&amp; notificationCenter)
</del><ins>+Notification::Notification(const String&amp; title, const String&amp; body, URL&amp;&amp; iconURL, ScriptExecutionContext&amp; context, NotificationCenter&amp; notificationCenter)
</ins><span class="cx">     : ActiveDOMObject(&amp;context)
</span><ins>+    , m_icon(WTFMove(iconURL))
</ins><span class="cx">     , m_title(title)
</span><span class="cx">     , m_body(body)
</span><span class="cx">     , m_notificationCenter(&amp;notificationCenter)
</span><span class="cx"> {
</span><del>-    if (m_notificationCenter-&gt;checkPermission() != NotificationClient::PermissionAllowed) {
-        ec = SECURITY_ERR;
-        return;
-    }
-
-    m_icon = iconURI.isEmpty() ? URL() : scriptExecutionContext()-&gt;completeURL(iconURI);
-    if (!m_icon.isEmpty() &amp;&amp; !m_icon.isValid()) {
-        ec = SYNTAX_ERR;
-        return;
-    }
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif
</span><span class="lines">@@ -93,11 +84,18 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(LEGACY_NOTIFICATIONS)
</span><span class="cx"> 
</span><del>-Ref&lt;Notification&gt; Notification::create(const String&amp; title, const String&amp; body, const String&amp; iconURI, ScriptExecutionContext&amp; context, ExceptionCode&amp; ec, NotificationCenter&amp; provider)
</del><ins>+ExceptionOr&lt;Ref&lt;Notification&gt;&gt; Notification::create(const String&amp; title, const String&amp; body, const String&amp; iconURL, ScriptExecutionContext&amp; context, NotificationCenter&amp; provider)
</ins><span class="cx"> { 
</span><del>-    auto notification = adoptRef(*new Notification(title, body, iconURI, context, ec, provider));
</del><ins>+    if (provider.checkPermission() != NotificationClient::PermissionAllowed)
+        return Exception { SECURITY_ERR };
+
+    URL completedIconURL = iconURL.isEmpty() ? URL() : context.completeURL(iconURL);
+    if (!completedIconURL.isEmpty() &amp;&amp; !completedIconURL.isValid())
+        return Exception { SYNTAX_ERR };
+
+    auto notification = adoptRef(*new Notification(title, body, WTFMove(completedIconURL), context, provider));
</ins><span class="cx">     notification.get().suspendIfNeeded();
</span><del>-    return notification;
</del><ins>+    return WTFMove(notification);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif
</span><span class="lines">@@ -146,7 +144,7 @@
</span><span class="cx">         auto* page = downcast&lt;Document&gt;(*scriptExecutionContext()).page();
</span><span class="cx">         if (!page)
</span><span class="cx">             return;
</span><del>-        if (NotificationController::from(page)-&gt;client()-&gt;checkPermission(scriptExecutionContext()) != NotificationClient::PermissionAllowed) {
</del><ins>+        if (NotificationController::from(page)-&gt;client().checkPermission(scriptExecutionContext()) != NotificationClient::PermissionAllowed) {
</ins><span class="cx">             dispatchErrorEvent();
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="lines">@@ -224,7 +222,7 @@
</span><span class="cx"> 
</span><span class="cx"> String Notification::permission(Document&amp; document)
</span><span class="cx"> {
</span><del>-    return permissionString(NotificationController::from(document.page())-&gt;client()-&gt;checkPermission(&amp;document));
</del><ins>+    return permissionString(NotificationController::from(document.page())-&gt;client().checkPermission(&amp;document));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String Notification::permissionString(NotificationClient::Permission permission)
</span><span class="lines">@@ -243,7 +241,7 @@
</span><span class="cx"> 
</span><span class="cx"> void Notification::requestPermission(Document&amp; document, RefPtr&lt;NotificationPermissionCallback&gt;&amp;&amp; callback)
</span><span class="cx"> {
</span><del>-    NotificationController::from(document.page())-&gt;client()-&gt;requestPermission(&amp;document, WTFMove(callback));
</del><ins>+    NotificationController::from(document.page())-&gt;client().requestPermission(&amp;document, WTFMove(callback));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesnotificationsNotificationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/notifications/Notification.h (207024 => 207025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/notifications/Notification.h        2016-10-10 21:17:47 UTC (rev 207024)
+++ trunk/Source/WebCore/Modules/notifications/Notification.h        2016-10-10 21:33:25 UTC (rev 207025)
</span><span class="lines">@@ -35,14 +35,12 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;ActiveDOMObject.h&quot;
</span><span class="cx"> #include &quot;EventTarget.h&quot;
</span><ins>+#include &quot;ExceptionOr.h&quot;
</ins><span class="cx"> #include &quot;NotificationClient.h&quot;
</span><ins>+#include &quot;Timer.h&quot;
</ins><span class="cx"> #include &quot;URL.h&quot;
</span><span class="cx"> #include &quot;WritingMode.h&quot;
</span><span class="cx"> 
</span><del>-#if ENABLE(NOTIFICATIONS)
-#include &quot;Timer.h&quot;
-#endif
-
</del><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class Document;
</span><span class="lines">@@ -55,7 +53,7 @@
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><span class="cx"> #if ENABLE(LEGACY_NOTIFICATIONS)
</span><del>-    static Ref&lt;Notification&gt; create(const String&amp; title, const String&amp; body, const String&amp; iconURL, ScriptExecutionContext&amp;, ExceptionCode&amp;, NotificationCenter&amp;);
</del><ins>+    static ExceptionOr&lt;Ref&lt;Notification&gt;&gt; create(const String&amp; title, const String&amp; body, const String&amp; iconURL, ScriptExecutionContext&amp;, NotificationCenter&amp;);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(NOTIFICATIONS)
</span><span class="lines">@@ -111,7 +109,7 @@
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx"> #if ENABLE(LEGACY_NOTIFICATIONS)
</span><del>-    Notification(const String&amp; title, const String&amp; body, const String&amp; iconURL, ScriptExecutionContext&amp;, ExceptionCode&amp;, NotificationCenter&amp;);
</del><ins>+    Notification(const String&amp; title, const String&amp; body, URL&amp;&amp; iconURL, ScriptExecutionContext&amp;, NotificationCenter&amp;);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(NOTIFICATIONS)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesnotificationsNotificationCentercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/notifications/NotificationCenter.cpp (207024 => 207025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/notifications/NotificationCenter.cpp        2016-10-10 21:17:47 UTC (rev 207024)
+++ trunk/Source/WebCore/Modules/notifications/NotificationCenter.cpp        2016-10-10 21:33:25 UTC (rev 207025)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;NotificationCenter.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;ExceptionCode.h&quot;
</ins><span class="cx"> #include &quot;Notification.h&quot;
</span><span class="cx"> #include &quot;ScriptExecutionContext.h&quot;
</span><span class="cx"> #include &quot;SecurityOrigin.h&quot;
</span><span class="lines">@@ -42,7 +43,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-Ref&lt;NotificationCenter&gt; NotificationCenter::create(ScriptExecutionContext* context, NotificationClient* client)
</del><ins>+Ref&lt;NotificationCenter&gt; NotificationCenter::create(ScriptExecutionContext&amp; context, NotificationClient* client)
</ins><span class="cx"> {
</span><span class="cx">     auto notificationCenter = adoptRef(*new NotificationCenter(context, client));
</span><span class="cx">     notificationCenter-&gt;suspendIfNeeded();
</span><span class="lines">@@ -49,8 +50,8 @@
</span><span class="cx">     return notificationCenter;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-NotificationCenter::NotificationCenter(ScriptExecutionContext* context, NotificationClient* client)
-    : ActiveDOMObject(context)
</del><ins>+NotificationCenter::NotificationCenter(ScriptExecutionContext&amp; context, NotificationClient* client)
+    : ActiveDOMObject(&amp;context)
</ins><span class="cx">     , m_client(client)
</span><span class="cx">     , m_timer([this]() { timerFired(); })
</span><span class="cx"> {
</span><span class="lines">@@ -58,13 +59,11 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(LEGACY_NOTIFICATIONS)
</span><span class="cx"> 
</span><del>-RefPtr&lt;Notification&gt; NotificationCenter::createNotification(const String&amp; iconURI, const String&amp; title, const String&amp; body, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;Ref&lt;Notification&gt;&gt; NotificationCenter::createNotification(const String&amp; iconURI, const String&amp; title, const String&amp; body)
</ins><span class="cx"> {
</span><del>-    if (!m_client || !scriptExecutionContext()) {
-        ec = INVALID_STATE_ERR;
-        return nullptr;
-    }
-    return Notification::create(title, body, iconURI, *scriptExecutionContext(), ec, *this);
</del><ins>+    if (!m_client || !scriptExecutionContext())
+        return Exception { INVALID_STATE_ERR };
+    return Notification::create(title, body, iconURI, *scriptExecutionContext(), *this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> int NotificationCenter::checkPermission()
</span><span class="lines">@@ -85,7 +84,7 @@
</span><span class="cx">     return m_client-&gt;checkPermission(scriptExecutionContext());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void NotificationCenter::requestPermission(const RefPtr&lt;VoidCallback&gt;&amp; callback)
</del><ins>+void NotificationCenter::requestPermission(RefPtr&lt;VoidCallback&gt;&amp;&amp; callback)
</ins><span class="cx"> {
</span><span class="cx">     if (!m_client || !scriptExecutionContext())
</span><span class="cx">         return;
</span><span class="lines">@@ -103,12 +102,12 @@
</span><span class="cx">         });
</span><span class="cx">         return;
</span><span class="cx">     case SecurityOrigin::Ask:
</span><del>-        m_client-&gt;requestPermission(scriptExecutionContext(), callback.get());
</del><ins>+        m_client-&gt;requestPermission(scriptExecutionContext(), WTFMove(callback));
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     ASSERT_NOT_REACHED();
</span><del>-    m_client-&gt;requestPermission(scriptExecutionContext(), callback.get());
</del><ins>+    m_client-&gt;requestPermission(scriptExecutionContext(), WTFMove(callback));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesnotificationsNotificationCenterh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/notifications/NotificationCenter.h (207024 => 207025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/notifications/NotificationCenter.h        2016-10-10 21:17:47 UTC (rev 207024)
+++ trunk/Source/WebCore/Modules/notifications/NotificationCenter.h        2016-10-10 21:33:25 UTC (rev 207025)
</span><span class="lines">@@ -29,11 +29,10 @@
</span><span class="cx">  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef NotificationCenter_h
-#define NotificationCenter_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;ActiveDOMObject.h&quot;
</span><del>-#include &quot;ExceptionCode.h&quot;
</del><ins>+#include &quot;ExceptionOr.h&quot;
</ins><span class="cx"> #include &quot;Timer.h&quot;
</span><span class="cx"> #include &lt;wtf/RefCounted.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -45,15 +44,15 @@
</span><span class="cx"> class NotificationClient;
</span><span class="cx"> class VoidCallback;
</span><span class="cx"> 
</span><del>-class NotificationCenter : public RefCounted&lt;NotificationCenter&gt;, private ActiveDOMObject {
</del><ins>+class NotificationCenter final : public RefCounted&lt;NotificationCenter&gt;, private ActiveDOMObject {
</ins><span class="cx"> public:
</span><del>-    static Ref&lt;NotificationCenter&gt; create(ScriptExecutionContext*, NotificationClient*);
</del><ins>+    static Ref&lt;NotificationCenter&gt; create(ScriptExecutionContext&amp;, NotificationClient*);
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(LEGACY_NOTIFICATIONS)
</span><del>-    RefPtr&lt;Notification&gt; createNotification(const String&amp; iconURI, const String&amp; title, const String&amp; body, ExceptionCode&amp;);
</del><ins>+    ExceptionOr&lt;Ref&lt;Notification&gt;&gt; createNotification(const String&amp; iconURL, const String&amp; title, const String&amp; body);
</ins><span class="cx"> 
</span><span class="cx">     int checkPermission();
</span><del>-    void requestPermission(const RefPtr&lt;VoidCallback&gt;&amp;);
</del><ins>+    void requestPermission(RefPtr&lt;VoidCallback&gt;&amp;&amp;);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     NotificationClient* client() const { return m_client; }
</span><span class="lines">@@ -61,11 +60,11 @@
</span><span class="cx">     using ActiveDOMObject::hasPendingActivity;
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    NotificationCenter(ScriptExecutionContext*, NotificationClient*);
</del><ins>+    NotificationCenter(ScriptExecutionContext&amp;, NotificationClient*);
</ins><span class="cx"> 
</span><del>-    void stop() override;
-    const char* activeDOMObjectName() const override;
-    bool canSuspendForDocumentSuspension() const override;
</del><ins>+    void stop() final;
+    const char* activeDOMObjectName() const final;
+    bool canSuspendForDocumentSuspension() const final;
</ins><span class="cx"> 
</span><span class="cx">     void timerFired();
</span><span class="cx"> 
</span><span class="lines">@@ -77,5 +76,3 @@
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
</span><del>-
-#endif // NotificationCenter_h
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesnotificationsNotificationCenteridl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/notifications/NotificationCenter.idl (207024 => 207025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/notifications/NotificationCenter.idl        2016-10-10 21:17:47 UTC (rev 207024)
+++ trunk/Source/WebCore/Modules/notifications/NotificationCenter.idl        2016-10-10 21:33:25 UTC (rev 207025)
</span><span class="lines">@@ -34,7 +34,7 @@
</span><span class="cx">     Conditional=LEGACY_NOTIFICATIONS,
</span><span class="cx">     NoInterfaceObject,
</span><span class="cx"> ] interface NotificationCenter {
</span><del>-   [MayThrowLegacyException] Notification createNotification(DOMString iconUrl, DOMString title, DOMString body);
</del><ins>+   [MayThrowException] Notification createNotification(DOMString iconUrl, DOMString title, DOMString body);
</ins><span class="cx"> 
</span><span class="cx">    long checkPermission();
</span><span class="cx">    void requestPermission(optional VoidCallback? callback);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesnotificationsNotificationControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/notifications/NotificationController.cpp (207024 => 207025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/notifications/NotificationController.cpp        2016-10-10 21:17:47 UTC (rev 207024)
+++ trunk/Source/WebCore/Modules/notifications/NotificationController.cpp        2016-10-10 21:33:25 UTC (rev 207025)
</span><span class="lines">@@ -33,21 +33,22 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> NotificationController::NotificationController(NotificationClient* client)
</span><del>-    : m_client(client)
</del><ins>+    : m_client(*client)
</ins><span class="cx"> {
</span><ins>+    ASSERT(client);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> NotificationController::~NotificationController()
</span><span class="cx"> {
</span><del>-    if (m_client)
-        m_client-&gt;notificationControllerDestroyed();
</del><ins>+    m_client.notificationControllerDestroyed();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-NotificationClient* NotificationController::clientFrom(Page* page)
</del><ins>+NotificationClient* NotificationController::clientFrom(Page&amp; page)
</ins><span class="cx"> {
</span><del>-    if (NotificationController* controller = NotificationController::from(page))
-        return controller-&gt;client();
-    return 0;
</del><ins>+    auto* controller = NotificationController::from(&amp;page);
+    if (!controller)
+        return nullptr;
+    return &amp;controller-&gt;client();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> const char* NotificationController::supplementName()
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesnotificationsNotificationControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/notifications/NotificationController.h (207024 => 207025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/notifications/NotificationController.h        2016-10-10 21:17:47 UTC (rev 207024)
+++ trunk/Source/WebCore/Modules/notifications/NotificationController.h        2016-10-10 21:33:25 UTC (rev 207025)
</span><span class="lines">@@ -23,14 +23,12 @@
</span><span class="cx"> * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
</span><span class="cx"> */
</span><span class="cx"> 
</span><del>-#ifndef NotificationController_h
-#define NotificationController_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;Page.h&quot;
</span><span class="cx"> #include &lt;wtf/Forward.h&gt;
</span><del>-#include &lt;wtf/Noncopyable.h&gt;
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -38,7 +36,6 @@
</span><span class="cx"> 
</span><span class="cx"> class NotificationController : public Supplement&lt;Page&gt; {
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><del>-    WTF_MAKE_NONCOPYABLE(NotificationController);
</del><span class="cx"> public:
</span><span class="cx">     explicit NotificationController(NotificationClient*);
</span><span class="cx">     ~NotificationController();
</span><span class="lines">@@ -45,16 +42,14 @@
</span><span class="cx"> 
</span><span class="cx">     static const char* supplementName();
</span><span class="cx">     static NotificationController* from(Page* page) { return static_cast&lt;NotificationController*&gt;(Supplement&lt;Page&gt;::from(page, supplementName())); }
</span><del>-    WEBCORE_EXPORT static NotificationClient* clientFrom(Page*);
</del><ins>+    WEBCORE_EXPORT static NotificationClient* clientFrom(Page&amp;);
</ins><span class="cx"> 
</span><del>-    NotificationClient* client() { return m_client; }
-    
</del><ins>+    NotificationClient&amp; client() { return m_client; }
+
</ins><span class="cx"> private:
</span><del>-    NotificationClient* m_client;
</del><ins>+    NotificationClient&amp; m_client;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
</span><del>-
-#endif // NotificationController_h
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesnotificationsWorkerGlobalScopeNotificationscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/notifications/WorkerGlobalScopeNotifications.cpp (207024 => 207025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/notifications/WorkerGlobalScopeNotifications.cpp        2016-10-10 21:17:47 UTC (rev 207024)
+++ trunk/Source/WebCore/Modules/notifications/WorkerGlobalScopeNotifications.cpp        2016-10-10 21:33:25 UTC (rev 207025)
</span><span class="lines">@@ -68,8 +68,11 @@
</span><span class="cx"> 
</span><span class="cx"> NotificationCenter* WorkerGlobalScopeNotifications::webkitNotifications()
</span><span class="cx"> {
</span><ins>+    // FIXME: As of this writing, this always passes nullptr for the client.
+    // If it wasn't for that, the notification center create function could be taking a reference.
+    // How is it useful to create a notification center with no client?
</ins><span class="cx">     if (!m_notificationCenter)
</span><del>-        m_notificationCenter = NotificationCenter::create(m_context, m_context-&gt;thread().getNotificationClient());
</del><ins>+        m_notificationCenter = NotificationCenter::create(*m_context, m_context-&gt;thread().getNotificationClient());
</ins><span class="cx">     return m_notificationCenter.get();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (207024 => 207025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2016-10-10 21:17:47 UTC (rev 207024)
+++ trunk/Source/WebKit/mac/ChangeLog        2016-10-10 21:33:25 UTC (rev 207025)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2016-10-10  Darin Adler  &lt;darin@apple.com&gt;
+
+        Move NotificationCenter from legacy to new DOM exceptions
+        https://bugs.webkit.org/show_bug.cgi?id=163217
+
+        Reviewed by Chris Dumez.
+
+        * WebView/WebView.mm:
+        (-[WebView _notificationIDForTesting:]): Pass reference to page rather than pointer.
+
</ins><span class="cx"> 2016-10-09  Wenson Hsieh  &lt;wenson_hsieh@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Support InputEvent.inputType for the new InputEvent spec
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (207024 => 207025)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebView.mm        2016-10-10 21:17:47 UTC (rev 207024)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm        2016-10-10 21:33:25 UTC (rev 207025)
</span><span class="lines">@@ -9002,9 +9002,12 @@
</span><span class="cx"> - (uint64_t)_notificationIDForTesting:(JSValueRef)jsNotification
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
</span><ins>+    auto* page = _private-&gt;page;
+    if (!page)
+        return 0;
</ins><span class="cx">     JSContextRef context = [[self mainFrame] globalContext];
</span><del>-    WebCore::Notification* notification = JSNotification::toWrapped(toJS(toJS(context), jsNotification));
-    return static_cast&lt;WebNotificationClient*&gt;(NotificationController::clientFrom(_private-&gt;page))-&gt;notificationIDForTesting(notification);
</del><ins>+    auto* notification = JSNotification::toWrapped(toJS(toJS(context), jsNotification));
+    return static_cast&lt;WebNotificationClient*&gt;(NotificationController::clientFrom(*page))-&gt;notificationIDForTesting(notification);
</ins><span class="cx"> #else
</span><span class="cx">     return 0;
</span><span class="cx"> #endif
</span></span></pre>
</div>
</div>

</body>
</html>