Title: [207384] trunk/Source/WebCore
Revision
207384
Author
da...@apple.com
Date
2016-10-15 16:23:33 -0700 (Sat, 15 Oct 2016)

Log Message

Move Web SQL database and WebSockets off legacy exceptions
https://bugs.webkit.org/show_bug.cgi?id=163284

Reviewed by Chris Dumez.

* Modules/webdatabase/DOMWindowWebDatabase.cpp:
(WebCore::DOMWindowWebDatabase::openDatabase): Use ExceptionOr.
* Modules/webdatabase/DOMWindowWebDatabase.h: Update for above.
* Modules/webdatabase/DOMWindowWebDatabase.idl: Ditto.

* Modules/webdatabase/SQLResultSet.cpp:
(WebCore::SQLResultSet::SQLResultSet): Move initialization of
many data members into the class definition.
(WebCore::SQLResultSet::insertId): Use ExceptionOr.
(WebCore::SQLResultSet::rowsAffected): Moved into class definition.
(WebCore::SQLResultSet::rows): Ditto.
(WebCore::SQLResultSet::setInsertId): Ditto.
(WebCore::SQLResultSet::setRowsAffected): Ditto.

* Modules/webdatabase/SQLResultSet.h: Updated for above.

* Modules/webdatabase/SQLResultSet.idl: Use non-legacy exceptions.
Added a FIXME about the mismatch between long and int64_t.

* Modules/webdatabase/SQLStatement.cpp:
(WebCore::SQLStatement::execute): Use reference instead of pointer.

* Modules/websockets/WebSocket.cpp:
(WebCore::isValidProtocolString): Use StringView.
(WebCore::WebSocket::subprotocolSeparator): Fixed capitalization and
spelling error in the name of this function.
(WebCore::WebSocket::WebSocket): Move initialization of many data
members into the class definition.
(WebCore::WebSocket::create): Use ExceptionOr.
(WebCore::WebSocket::connect): Ditto.
(WebCore::WebSocket::send): Ditto.
(WebCore::WebSocket::close): Ditto.
(WebCore::WebSocket::binaryType): Update to use enum class.
(WebCore::WebSocket::setBinaryType): Use ExecptionOr and update to
use enum class.
(WebCore::WebSocket::didReceiveBinaryData): Ditto.

* Modules/websockets/WebSocket.h: Updated for above. Changed the
BinaryType enum into an enum class.

* Modules/websockets/WebSocket.idl: Use non-legacy exceptions.

* Modules/websockets/WebSocketHandshake.cpp:
(WebCore::WebSocketHandshake::checkResponseHeaders):
Updated for name change to subprotocolSeparator.

* dom/ExceptionOr.h: Added a constructor for scalar types that does not
require an rvalue reference. We can refine this more later, but for now
this is sufficient to obviate the need for WTFMove where it otherwise would
have been needed in the code above.

* inspector/InspectorDatabaseAgent.cpp: Use reference instead of pointer.

* page/DOMWindow.idl: Touched this file to work around bugs in the dependency
analysis of the current CMake build system, since otherwise it doesn't process the
change to the partial interface WebSocket. Edited lots of comments, removed many
others, and tweaked formatting.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (207383 => 207384)


--- trunk/Source/WebCore/ChangeLog	2016-10-15 23:21:32 UTC (rev 207383)
+++ trunk/Source/WebCore/ChangeLog	2016-10-15 23:23:33 UTC (rev 207384)
@@ -1,3 +1,68 @@
+2016-10-15  Darin Adler  <da...@apple.com>
+
+        Move Web SQL database and WebSockets off legacy exceptions
+        https://bugs.webkit.org/show_bug.cgi?id=163284
+
+        Reviewed by Chris Dumez.
+
+        * Modules/webdatabase/DOMWindowWebDatabase.cpp:
+        (WebCore::DOMWindowWebDatabase::openDatabase): Use ExceptionOr.
+        * Modules/webdatabase/DOMWindowWebDatabase.h: Update for above.
+        * Modules/webdatabase/DOMWindowWebDatabase.idl: Ditto.
+
+        * Modules/webdatabase/SQLResultSet.cpp:
+        (WebCore::SQLResultSet::SQLResultSet): Move initialization of
+        many data members into the class definition.
+        (WebCore::SQLResultSet::insertId): Use ExceptionOr.
+        (WebCore::SQLResultSet::rowsAffected): Moved into class definition.
+        (WebCore::SQLResultSet::rows): Ditto.
+        (WebCore::SQLResultSet::setInsertId): Ditto.
+        (WebCore::SQLResultSet::setRowsAffected): Ditto.
+
+        * Modules/webdatabase/SQLResultSet.h: Updated for above.
+
+        * Modules/webdatabase/SQLResultSet.idl: Use non-legacy exceptions.
+        Added a FIXME about the mismatch between long and int64_t.
+
+        * Modules/webdatabase/SQLStatement.cpp:
+        (WebCore::SQLStatement::execute): Use reference instead of pointer.
+
+        * Modules/websockets/WebSocket.cpp:
+        (WebCore::isValidProtocolString): Use StringView.
+        (WebCore::WebSocket::subprotocolSeparator): Fixed capitalization and
+        spelling error in the name of this function.
+        (WebCore::WebSocket::WebSocket): Move initialization of many data
+        members into the class definition.
+        (WebCore::WebSocket::create): Use ExceptionOr.
+        (WebCore::WebSocket::connect): Ditto.
+        (WebCore::WebSocket::send): Ditto.
+        (WebCore::WebSocket::close): Ditto.
+        (WebCore::WebSocket::binaryType): Update to use enum class.
+        (WebCore::WebSocket::setBinaryType): Use ExecptionOr and update to
+        use enum class.
+        (WebCore::WebSocket::didReceiveBinaryData): Ditto.
+
+        * Modules/websockets/WebSocket.h: Updated for above. Changed the
+        BinaryType enum into an enum class.
+
+        * Modules/websockets/WebSocket.idl: Use non-legacy exceptions.
+
+        * Modules/websockets/WebSocketHandshake.cpp:
+        (WebCore::WebSocketHandshake::checkResponseHeaders):
+        Updated for name change to subprotocolSeparator.
+
+        * dom/ExceptionOr.h: Added a constructor for scalar types that does not
+        require an rvalue reference. We can refine this more later, but for now
+        this is sufficient to obviate the need for WTFMove where it otherwise would
+        have been needed in the code above.
+
+        * inspector/InspectorDatabaseAgent.cpp: Use reference instead of pointer.
+
+        * page/DOMWindow.idl: Touched this file to work around bugs in the dependency
+        analysis of the current CMake build system, since otherwise it doesn't process the
+        change to the partial interface WebSocket. Edited lots of comments, removed many
+        others, and tweaked formatting.
+
 2016-10-14  Sam Weinig  <s...@webkit.org>
 
         MessageEvent's source property should be a (DOMWindow or MessagePort)? rather than a EventTarget?

Modified: trunk/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.cpp (207383 => 207384)


--- trunk/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.cpp	2016-10-15 23:21:32 UTC (rev 207383)
+++ trunk/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.cpp	2016-10-15 23:23:33 UTC (rev 207384)
@@ -29,30 +29,33 @@
 
 #include "DOMWindow.h"
 #include "Database.h"
-#include "DatabaseCallback.h"
 #include "DatabaseManager.h"
 #include "Document.h"
-#include "Frame.h"
 #include "SecurityOrigin.h"
 
 namespace WebCore {
 
-RefPtr<Database> DOMWindowWebDatabase::openDatabase(DOMWindow& window, const String& name, const String& version, const String& displayName, unsigned long estimatedSize, RefPtr<DatabaseCallback>&& creationCallback, ExceptionCode& ec)
+ExceptionOr<RefPtr<Database>> DOMWindowWebDatabase::openDatabase(DOMWindow& window, const String& name, const String& version, const String& displayName, unsigned estimatedSize, RefPtr<DatabaseCallback>&& creationCallback)
 {
     if (!window.isCurrentlyDisplayedInFrame())
-        return nullptr;
-
-    RefPtr<Database> database;
-    DatabaseManager& dbManager = DatabaseManager::singleton();
-    DatabaseError error = DatabaseError::None;
-    if (dbManager.isAvailable() && window.document()->securityOrigin()->canAccessDatabase(window.document()->topOrigin())) {
-        database = dbManager.openDatabase(window.document(), name, version, displayName, estimatedSize, WTFMove(creationCallback), error);
-        ASSERT(database || error != DatabaseError::None);
-        ec = DatabaseManager::exceptionCodeForDatabaseError(error);
-    } else
-        ec = SECURITY_ERR;
-
-    return database;
+        return RefPtr<Database> { nullptr };
+    auto& manager = DatabaseManager::singleton();
+    if (!manager.isAvailable())
+        return Exception { SECURITY_ERR };
+    auto* document = window.document();
+    if (!document)
+        return Exception { SECURITY_ERR };
+    auto* securityOrigin = document->securityOrigin();
+    if (!securityOrigin)
+        return Exception { SECURITY_ERR };
+    if (!securityOrigin->canAccessDatabase(document->topOrigin()))
+        return Exception { SECURITY_ERR };
+    auto error = DatabaseError::None;
+    auto database = manager.openDatabase(window.document(), name, version, displayName, estimatedSize, WTFMove(creationCallback), error);
+    if (error != DatabaseError::None)
+        return Exception { DatabaseManager::exceptionCodeForDatabaseError(error) };
+    ASSERT(database);
+    return WTFMove(database);
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.h (207383 => 207384)


--- trunk/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.h	2016-10-15 23:21:32 UTC (rev 207383)
+++ trunk/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.h	2016-10-15 23:23:33 UTC (rev 207384)
@@ -24,13 +24,9 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef DOMWindowWebDatabase_h
-#define DOMWindowWebDatabase_h
+#pragma once
 
-#include "ExceptionCode.h"
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-#include <wtf/text/WTFString.h>
+#include "ExceptionOr.h"
 
 namespace WebCore {
 
@@ -37,11 +33,10 @@
 class DOMWindow;
 class Database;
 class DatabaseCallback;
-class Frame;
 
 class DOMWindowWebDatabase {
 public:
-    static RefPtr<Database> openDatabase(DOMWindow&, const String& name, const String& version, const String& displayName, unsigned long estimatedSize, RefPtr<DatabaseCallback>&& creationCallback, ExceptionCode&);
+    static ExceptionOr<RefPtr<Database>> openDatabase(DOMWindow&, const String& name, const String& version, const String& displayName, unsigned estimatedSize, RefPtr<DatabaseCallback>&& creationCallback);
 
     DOMWindowWebDatabase() = delete;
     ~DOMWindowWebDatabase() = delete;
@@ -48,5 +43,3 @@
 };
 
 } // namespace WebCore
-
-#endif // DOMWindowWebDatabase_h

Modified: trunk/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.idl (207383 => 207384)


--- trunk/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.idl	2016-10-15 23:21:32 UTC (rev 207383)
+++ trunk/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.idl	2016-10-15 23:23:33 UTC (rev 207384)
@@ -24,8 +24,6 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-[
-] partial interface DOMWindow {
-    [MayThrowLegacyException] Database openDatabase(DOMString name, DOMString version, DOMString displayName, unsigned long estimatedSize, optional DatabaseCallback? creationCallback);
+partial interface DOMWindow {
+    [MayThrowException] Database? openDatabase(DOMString name, DOMString version, DOMString displayName, unsigned long estimatedSize, optional DatabaseCallback? creationCallback);
 };
-

Modified: trunk/Source/WebCore/Modules/webdatabase/SQLResultSet.cpp (207383 => 207384)


--- trunk/Source/WebCore/Modules/webdatabase/SQLResultSet.cpp	2016-10-15 23:21:32 UTC (rev 207383)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLResultSet.cpp	2016-10-15 23:23:33 UTC (rev 207384)
@@ -35,44 +35,16 @@
 
 SQLResultSet::SQLResultSet()
     : m_rows(SQLResultSetRowList::create())
-    , m_insertId(0)
-    , m_insertIdSet(false)
-    , m_rowsAffected(0)
 {
 }
 
-int64_t SQLResultSet::insertId(ExceptionCode& e) const
+ExceptionOr<int64_t> SQLResultSet::insertId() const
 {
     // 4.11.4 - Return the id of the last row inserted as a result of the query
     // If the query didn't result in any rows being added, raise an INVALID_ACCESS_ERR exception
-    if (m_insertIdSet)
-        return m_insertId;
-
-    e = INVALID_ACCESS_ERR;
-    return -1;
+    if (!m_insertId)
+        return Exception { INVALID_ACCESS_ERR };
+    return m_insertId.value();
 }
 
-int SQLResultSet::rowsAffected() const
-{
-    return m_rowsAffected;
 }
-
-SQLResultSetRowList* SQLResultSet::rows() const
-{
-    return m_rows.get();
-}
-
-void SQLResultSet::setInsertId(int64_t id)
-{
-    ASSERT(!m_insertIdSet);
-
-    m_insertId = id;
-    m_insertIdSet = true;
-}
-
-void SQLResultSet::setRowsAffected(int count)
-{
-    m_rowsAffected = count;
-}
-
-}

Modified: trunk/Source/WebCore/Modules/webdatabase/SQLResultSet.h (207383 => 207384)


--- trunk/Source/WebCore/Modules/webdatabase/SQLResultSet.h	2016-10-15 23:21:32 UTC (rev 207383)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLResultSet.h	2016-10-15 23:23:33 UTC (rev 207384)
@@ -26,10 +26,9 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef SQLResultSet_h
-#define SQLResultSet_h
+#pragma once
 
-#include "DatabaseBasicTypes.h"
+#include "ExceptionOr.h"
 #include "SQLResultSetRowList.h"
 #include <wtf/ThreadSafeRefCounted.h>
 
@@ -39,12 +38,11 @@
 public:
     static Ref<SQLResultSet> create() { return adoptRef(*new SQLResultSet); }
 
-    SQLResultSetRowList* rows() const;
+    SQLResultSetRowList& rows() { return m_rows.get(); }
 
-    int64_t insertId(ExceptionCode&) const;
-    int rowsAffected() const;
+    ExceptionOr<int64_t> insertId() const;
+    int rowsAffected() const { return m_rowsAffected; }
 
-// For internal (non-JS) use
     void setInsertId(int64_t);
     void setRowsAffected(int);
 
@@ -51,12 +49,20 @@
 private:
     SQLResultSet();
 
-    RefPtr<SQLResultSetRowList> m_rows;
-    int64_t m_insertId;
-    bool m_insertIdSet;
-    int m_rowsAffected;
+    Ref<SQLResultSetRowList> m_rows;
+    Optional<int64_t> m_insertId;
+    int m_rowsAffected { 0 };
 };
 
+inline void SQLResultSet::setInsertId(int64_t id)
+{
+    ASSERT(!m_insertId);
+    m_insertId = id;
+}
+
+inline void SQLResultSet::setRowsAffected(int count)
+{
+    m_rowsAffected = count;
+}
+
 } // namespace WebCore
-
-#endif // SQLResultSet_h

Modified: trunk/Source/WebCore/Modules/webdatabase/SQLResultSet.idl (207383 => 207384)


--- trunk/Source/WebCore/Modules/webdatabase/SQLResultSet.idl	2016-10-15 23:21:32 UTC (rev 207383)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLResultSet.idl	2016-10-15 23:23:33 UTC (rev 207384)
@@ -30,6 +30,6 @@
     ImplementationLacksVTable
 ] interface SQLResultSet {
     readonly attribute SQLResultSetRowList rows;
-    [GetterMayThrowLegacyException] readonly attribute long insertId;
+    [GetterMayThrowException] readonly attribute long insertId;
     readonly attribute long rowsAffected;
 };

Modified: trunk/Source/WebCore/Modules/webdatabase/SQLStatement.cpp (207383 => 207384)


--- trunk/Source/WebCore/Modules/webdatabase/SQLStatement.cpp	2016-10-15 23:21:32 UTC (rev 207383)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLStatement.cpp	2016-10-15 23:23:33 UTC (rev 207384)
@@ -154,14 +154,14 @@
     switch (result) {
     case SQLITE_ROW: {
         int columnCount = statement.columnCount();
-        SQLResultSetRowList* rows = resultSet->rows();
+        auto& rows = resultSet->rows();
 
         for (int i = 0; i < columnCount; i++)
-            rows->addColumn(statement.getColumnName(i));
+            rows.addColumn(statement.getColumnName(i));
 
         do {
             for (int i = 0; i < columnCount; i++)
-                rows->addResult(statement.getColumnValue(i));
+                rows.addResult(statement.getColumnValue(i));
 
             result = statement.step();
         } while (result == SQLITE_ROW);

Modified: trunk/Source/WebCore/Modules/websockets/WebSocket.cpp (207383 => 207384)


--- trunk/Source/WebCore/Modules/websockets/WebSocket.cpp	2016-10-15 23:21:32 UTC (rev 207383)
+++ trunk/Source/WebCore/Modules/websockets/WebSocket.cpp	2016-10-15 23:23:33 UTC (rev 207384)
@@ -85,12 +85,12 @@
         && character != '{' && character != '}';
 }
 
-static bool isValidProtocolString(const String& protocol)
+static bool isValidProtocolString(StringView protocol)
 {
     if (protocol.isEmpty())
         return false;
-    for (size_t i = 0; i < protocol.length(); ++i) {
-        if (!isValidProtocolCharacter(protocol[i]))
+    for (auto codeUnit : protocol.codeUnits()) {
+        if (!isValidProtocolCharacter(codeUnit))
             return false;
     }
     return true;
@@ -140,7 +140,7 @@
     return webSocketsAvailable;
 }
 
-const char* WebSocket::subProtocolSeperator()
+const char* WebSocket::subprotocolSeparator()
 {
     return ", ";
 }
@@ -147,10 +147,6 @@
 
 WebSocket::WebSocket(ScriptExecutionContext& context)
     : ActiveDOMObject(&context)
-    , m_state(CONNECTING)
-    , m_bufferedAmount(0)
-    , m_bufferedAmountAfterClose(0)
-    , m_binaryType(BinaryTypeBlob)
     , m_subprotocol(emptyString())
     , m_extensions(emptyString())
     , m_resumeTimer(*this, &WebSocket::resumeTimerFired)
@@ -163,57 +159,42 @@
         m_channel->disconnect();
 }
 
-Ref<WebSocket> WebSocket::create(ScriptExecutionContext& context)
+ExceptionOr<Ref<WebSocket>> WebSocket::create(ScriptExecutionContext& context, const String& url)
 {
-    Ref<WebSocket> webSocket(adoptRef(*new WebSocket(context)));
-    webSocket->suspendIfNeeded();
-    return webSocket;
+    return create(context, url, Vector<String> { });
 }
 
-RefPtr<WebSocket> WebSocket::create(ScriptExecutionContext& context, const String& url, ExceptionCode& ec)
+ExceptionOr<Ref<WebSocket>> WebSocket::create(ScriptExecutionContext& context, const String& url, const Vector<String>& protocols)
 {
-    Vector<String> protocols;
-    return WebSocket::create(context, url, protocols, ec);
-}
+    if (url.isNull())
+        return Exception { SYNTAX_ERR };
 
-RefPtr<WebSocket> WebSocket::create(ScriptExecutionContext& context, const String& url, const Vector<String>& protocols, ExceptionCode& ec)
-{
-    if (url.isNull()) {
-        ec = SYNTAX_ERR;
-        return nullptr;
-    }
+    auto socket = adoptRef(*new WebSocket(context));
+    socket->suspendIfNeeded();
 
-    RefPtr<WebSocket> webSocket(adoptRef(*new WebSocket(context)));
-    webSocket->suspendIfNeeded();
+    auto result = socket->connect(context.completeURL(url), protocols);
+    if (result.hasException())
+        return result.releaseException();
 
-    webSocket->connect(context.completeURL(url), protocols, ec);
-    if (ec)
-        return nullptr;
-
-    return webSocket;
+    return WTFMove(socket);
 }
 
-RefPtr<WebSocket> WebSocket::create(ScriptExecutionContext& context, const String& url, const String& protocol, ExceptionCode& ec)
+ExceptionOr<Ref<WebSocket>> WebSocket::create(ScriptExecutionContext& context, const String& url, const String& protocol)
 {
-    Vector<String> protocols;
-    protocols.append(protocol);
-    return WebSocket::create(context, url, protocols, ec);
+    return create(context, url, Vector<String> { 1, protocol });
 }
 
-void WebSocket::connect(const String& url, ExceptionCode& ec)
+ExceptionOr<void> WebSocket::connect(const String& url)
 {
-    Vector<String> protocols;
-    connect(url, protocols, ec);
+    return connect(url, Vector<String> { });
 }
 
-void WebSocket::connect(const String& url, const String& protocol, ExceptionCode& ec)
+ExceptionOr<void> WebSocket::connect(const String& url, const String& protocol)
 {
-    Vector<String> protocols;
-    protocols.append(protocol);
-    connect(url, protocols, ec);
+    return connect(url, Vector<String> { 1, protocol });
 }
 
-void WebSocket::connect(const String& url, const Vector<String>& protocols, ExceptionCode& ec)
+ExceptionOr<void> WebSocket::connect(const String& url, const Vector<String>& protocols)
 {
     LOG(Network, "WebSocket %p connect() url=''", this, url.utf8().data());
     m_url = URL(URL(), url);
@@ -224,21 +205,18 @@
     if (!m_url.isValid()) {
         context.addConsoleMessage(MessageSource::JS, MessageLevel::Error, "Invalid url for WebSocket " + m_url.stringCenterEllipsizedToLength());
         m_state = CLOSED;
-        ec = SYNTAX_ERR;
-        return;
+        return Exception { SYNTAX_ERR };
     }
 
     if (!m_url.protocolIs("ws") && !m_url.protocolIs("wss")) {
         context.addConsoleMessage(MessageSource::JS, MessageLevel::Error, "Wrong url scheme for WebSocket " + m_url.stringCenterEllipsizedToLength());
         m_state = CLOSED;
-        ec = SYNTAX_ERR;
-        return;
+        return Exception { SYNTAX_ERR };
     }
     if (m_url.hasFragmentIdentifier()) {
         context.addConsoleMessage(MessageSource::JS, MessageLevel::Error, "URL has fragment component " + m_url.stringCenterEllipsizedToLength());
         m_state = CLOSED;
-        ec = SYNTAX_ERR;
-        return;
+        return Exception { SYNTAX_ERR };
     }
 
     ASSERT(context.contentSecurityPolicy());
@@ -249,8 +227,7 @@
     if (!portAllowed(m_url)) {
         context.addConsoleMessage(MessageSource::JS, MessageLevel::Error, "WebSocket port " + String::number(m_url.port()) + " blocked");
         m_state = CLOSED;
-        ec = SECURITY_ERR;
-        return;
+        return Exception { SECURITY_ERR };
     }
 
     // FIXME: Convert this to check the isolated world's Content Security Policy once webkit.org/b/104520 is solved.
@@ -258,8 +235,7 @@
         m_state = CLOSED;
 
         // FIXME: Should this be throwing an exception?
-        ec = SECURITY_ERR;
-        return;
+        return Exception { SECURITY_ERR };
     }
 
     if (auto* provider = context.socketProvider())
@@ -279,8 +255,7 @@
         if (!isValidProtocolString(protocol)) {
             context.addConsoleMessage(MessageSource::JS, MessageLevel::Error, "Wrong protocol for WebSocket '" + encodeProtocolString(protocol) + "'");
             m_state = CLOSED;
-            ec = SYNTAX_ERR;
-            return;
+            return Exception { SYNTAX_ERR };
         }
     }
     HashSet<String> visited;
@@ -288,8 +263,7 @@
         if (!visited.add(protocol).isNewEntry) {
             context.addConsoleMessage(MessageSource::JS, MessageLevel::Error, "WebSocket protocols contain duplicates: '" + encodeProtocolString(protocol) + "'");
             m_state = CLOSED;
-            ec = SYNTAX_ERR;
-            return;
+            return Exception { SYNTAX_ERR };
         }
     }
 
@@ -318,7 +292,7 @@
                 stop();
             });
 #endif
-            return;
+            return { };
         } else
             ResourceLoadObserver::sharedObserver().logWebSocketLoading(document.frame(), m_url);
     }
@@ -325,83 +299,81 @@
 
     String protocolString;
     if (!protocols.isEmpty())
-        protocolString = joinStrings(protocols, subProtocolSeperator());
+        protocolString = joinStrings(protocols, subprotocolSeparator());
 
     m_channel->connect(m_url, protocolString);
     ActiveDOMObject::setPendingActivity(this);
+
+    return { };
 }
 
-void WebSocket::send(const String& message, ExceptionCode& ec)
+ExceptionOr<void> WebSocket::send(const String& message)
 {
     LOG(Network, "WebSocket %p send() Sending String '%s'", this, message.utf8().data());
-    if (m_state == CONNECTING) {
-        ec = INVALID_STATE_ERR;
-        return;
-    }
+    if (m_state == CONNECTING)
+        return Exception { INVALID_STATE_ERR };
     // No exception is raised if the connection was once established but has subsequently been closed.
     if (m_state == CLOSING || m_state == CLOSED) {
         size_t payloadSize = message.utf8().length();
         m_bufferedAmountAfterClose = saturateAdd(m_bufferedAmountAfterClose, payloadSize);
         m_bufferedAmountAfterClose = saturateAdd(m_bufferedAmountAfterClose, getFramingOverhead(payloadSize));
-        return;
+        return { };
     }
     ASSERT(m_channel);
     m_channel->send(message);
+    return { };
 }
 
-void WebSocket::send(ArrayBuffer& binaryData, ExceptionCode& ec)
+ExceptionOr<void> WebSocket::send(ArrayBuffer& binaryData)
 {
     LOG(Network, "WebSocket %p send() Sending ArrayBuffer %p", this, &binaryData);
-    if (m_state == CONNECTING) {
-        ec = INVALID_STATE_ERR;
-        return;
-    }
+    if (m_state == CONNECTING)
+        return Exception { INVALID_STATE_ERR };
     if (m_state == CLOSING || m_state == CLOSED) {
         unsigned payloadSize = binaryData.byteLength();
         m_bufferedAmountAfterClose = saturateAdd(m_bufferedAmountAfterClose, payloadSize);
         m_bufferedAmountAfterClose = saturateAdd(m_bufferedAmountAfterClose, getFramingOverhead(payloadSize));
-        return;
+        return { };
     }
     ASSERT(m_channel);
     m_channel->send(binaryData, 0, binaryData.byteLength());
+    return { };
 }
 
-void WebSocket::send(ArrayBufferView& arrayBufferView, ExceptionCode& ec)
+ExceptionOr<void> WebSocket::send(ArrayBufferView& arrayBufferView)
 {
     LOG(Network, "WebSocket %p send() Sending ArrayBufferView %p", this, &arrayBufferView);
 
-    if (m_state == CONNECTING) {
-        ec = INVALID_STATE_ERR;
-        return;
-    }
+    if (m_state == CONNECTING)
+        return Exception { INVALID_STATE_ERR };
     if (m_state == CLOSING || m_state == CLOSED) {
         unsigned payloadSize = arrayBufferView.byteLength();
         m_bufferedAmountAfterClose = saturateAdd(m_bufferedAmountAfterClose, payloadSize);
         m_bufferedAmountAfterClose = saturateAdd(m_bufferedAmountAfterClose, getFramingOverhead(payloadSize));
-        return;
+        return { };
     }
     ASSERT(m_channel);
     m_channel->send(*arrayBufferView.buffer(), arrayBufferView.byteOffset(), arrayBufferView.byteLength());
+    return { };
 }
 
-void WebSocket::send(Blob& binaryData, ExceptionCode& ec)
+ExceptionOr<void> WebSocket::send(Blob& binaryData)
 {
     LOG(Network, "WebSocket %p send() Sending Blob '%s'", this, binaryData.url().stringCenterEllipsizedToLength().utf8().data());
-    if (m_state == CONNECTING) {
-        ec = INVALID_STATE_ERR;
-        return;
-    }
+    if (m_state == CONNECTING)
+        return Exception { INVALID_STATE_ERR };
     if (m_state == CLOSING || m_state == CLOSED) {
         unsigned payloadSize = static_cast<unsigned>(binaryData.size());
         m_bufferedAmountAfterClose = saturateAdd(m_bufferedAmountAfterClose, payloadSize);
         m_bufferedAmountAfterClose = saturateAdd(m_bufferedAmountAfterClose, getFramingOverhead(payloadSize));
-        return;
+        return { };
     }
     ASSERT(m_channel);
     m_channel->send(binaryData);
+    return { };
 }
 
-void WebSocket::close(Optional<unsigned short> optionalCode, const String& reason, ExceptionCode& ec)
+ExceptionOr<void> WebSocket::close(Optional<unsigned short> optionalCode, const String& reason)
 {
     int code = optionalCode ? optionalCode.value() : static_cast<int>(WebSocketChannel::CloseEventCodeNotSpecified);
     if (code == WebSocketChannel::CloseEventCodeNotSpecified)
@@ -408,28 +380,26 @@
         LOG(Network, "WebSocket %p close() without code and reason", this);
     else {
         LOG(Network, "WebSocket %p close() code=%d reason='%s'", this, code, reason.utf8().data());
-        if (!(code == WebSocketChannel::CloseEventCodeNormalClosure || (WebSocketChannel::CloseEventCodeMinimumUserDefined <= code && code <= WebSocketChannel::CloseEventCodeMaximumUserDefined))) {
-            ec = INVALID_ACCESS_ERR;
-            return;
-        }
+        if (!(code == WebSocketChannel::CloseEventCodeNormalClosure || (WebSocketChannel::CloseEventCodeMinimumUserDefined <= code && code <= WebSocketChannel::CloseEventCodeMaximumUserDefined)))
+            return Exception { INVALID_ACCESS_ERR };
         CString utf8 = reason.utf8(StrictConversionReplacingUnpairedSurrogatesWithFFFD);
         if (utf8.length() > maxReasonSizeInBytes) {
             scriptExecutionContext()->addConsoleMessage(MessageSource::JS, MessageLevel::Error, ASCIILiteral("WebSocket close message is too long."));
-            ec = SYNTAX_ERR;
-            return;
+            return Exception { SYNTAX_ERR };
         }
     }
 
     if (m_state == CLOSING || m_state == CLOSED)
-        return;
+        return { };
     if (m_state == CONNECTING) {
         m_state = CLOSING;
         m_channel->fail("WebSocket is closed before the connection is established.");
-        return;
+        return { };
     }
     m_state = CLOSING;
     if (m_channel)
         m_channel->close(code, reason);
+    return { };
 }
 
 const URL& WebSocket::url() const
@@ -460,9 +430,9 @@
 String WebSocket::binaryType() const
 {
     switch (m_binaryType) {
-    case BinaryTypeBlob:
+    case BinaryType::Blob:
         return ASCIILiteral("blob");
-    case BinaryTypeArrayBuffer:
+    case BinaryType::ArrayBuffer:
         return ASCIILiteral("arraybuffer");
     }
     ASSERT_NOT_REACHED();
@@ -469,18 +439,18 @@
     return String();
 }
 
-void WebSocket::setBinaryType(const String& binaryType, ExceptionCode& ec)
+ExceptionOr<void> WebSocket::setBinaryType(const String& binaryType)
 {
     if (binaryType == "blob") {
-        m_binaryType = BinaryTypeBlob;
-        return;
+        m_binaryType = BinaryType::Blob;
+        return { };
     }
     if (binaryType == "arraybuffer") {
-        m_binaryType = BinaryTypeArrayBuffer;
-        return;
+        m_binaryType = BinaryType::ArrayBuffer;
+        return { };
     }
-    ec = SYNTAX_ERR;
     scriptExecutionContext()->addConsoleMessage(MessageSource::JS, MessageLevel::Error, "'" + binaryType + "' is not a valid value for binaryType; binaryType remains unchanged.");
+    return Exception { SYNTAX_ERR };
 }
 
 EventTargetInterface WebSocket::eventTargetInterface() const
@@ -591,11 +561,11 @@
 {
     LOG(Network, "WebSocket %p didReceiveBinaryData() %u byte binary message", this, static_cast<unsigned>(binaryData.size()));
     switch (m_binaryType) {
-    case BinaryTypeBlob:
+    case BinaryType::Blob:
         // FIXME: We just received the data from NetworkProcess, and are sending it back. This is inefficient.
         dispatchEvent(MessageEvent::create(Blob::create(WTFMove(binaryData), emptyString()), SecurityOrigin::create(m_url)->toString()));
         break;
-    case BinaryTypeArrayBuffer:
+    case BinaryType::ArrayBuffer:
         dispatchEvent(MessageEvent::create(ArrayBuffer::create(binaryData.data(), binaryData.size()), SecurityOrigin::create(m_url)->toString()));
         break;
     }

Modified: trunk/Source/WebCore/Modules/websockets/WebSocket.h (207383 => 207384)


--- trunk/Source/WebCore/Modules/websockets/WebSocket.h	2016-10-15 23:21:32 UTC (rev 207383)
+++ trunk/Source/WebCore/Modules/websockets/WebSocket.h	2016-10-15 23:23:33 UTC (rev 207384)
@@ -28,36 +28,38 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef WebSocket_h
-#define WebSocket_h
+#pragma once
 
 #if ENABLE(WEB_SOCKETS)
 
 #include "ActiveDOMObject.h"
-#include "EventListener.h"
 #include "EventTarget.h"
+#include "ExceptionOr.h"
+#include "Timer.h"
 #include "URL.h"
-#include "WebSocketChannel.h"
 #include "WebSocketChannelClient.h"
-#include <wtf/Forward.h>
-#include <wtf/RefCounted.h>
-#include <wtf/text/AtomicStringHash.h>
+#include <wtf/Deque.h>
 
+namespace JSC {
+class ArrayBuffer;
+class ArrayBufferView;
+}
+
 namespace WebCore {
 
 class Blob;
-class CloseEvent;
 class ThreadableWebSocketChannel;
 
-class WebSocket final : public RefCounted<WebSocket>, public EventTargetWithInlineData, public ActiveDOMObject, public WebSocketChannelClient {
+class WebSocket final : public RefCounted<WebSocket>, public EventTargetWithInlineData, public ActiveDOMObject, private WebSocketChannelClient {
 public:
     static void setIsAvailable(bool);
     static bool isAvailable();
-    static const char* subProtocolSeperator();
-    static Ref<WebSocket> create(ScriptExecutionContext&);
-    static RefPtr<WebSocket> create(ScriptExecutionContext&, const String& url, ExceptionCode&);
-    static RefPtr<WebSocket> create(ScriptExecutionContext&, const String& url, const String& protocol, ExceptionCode&);
-    static RefPtr<WebSocket> create(ScriptExecutionContext&, const String& url, const Vector<String>& protocols, ExceptionCode&);
+
+    static const char* subprotocolSeparator();
+
+    static ExceptionOr<Ref<WebSocket>> create(ScriptExecutionContext&, const String& url);
+    static ExceptionOr<Ref<WebSocket>> create(ScriptExecutionContext&, const String& url, const String& protocol);
+    static ExceptionOr<Ref<WebSocket>> create(ScriptExecutionContext&, const String& url, const Vector<String>& protocols);
     virtual ~WebSocket();
 
     enum State {
@@ -67,16 +69,16 @@
         CLOSED = 3
     };
 
-    void connect(const String& url, ExceptionCode&);
-    void connect(const String& url, const String& protocol, ExceptionCode&);
-    void connect(const String& url, const Vector<String>& protocols, ExceptionCode&);
+    ExceptionOr<void> connect(const String& url);
+    ExceptionOr<void> connect(const String& url, const String& protocol);
+    ExceptionOr<void> connect(const String& url, const Vector<String>& protocols);
 
-    void send(const String& message, ExceptionCode&);
-    void send(JSC::ArrayBuffer&, ExceptionCode&);
-    void send(JSC::ArrayBufferView&, ExceptionCode&);
-    void send(Blob&, ExceptionCode&);
+    ExceptionOr<void> send(const String& message);
+    ExceptionOr<void> send(JSC::ArrayBuffer&);
+    ExceptionOr<void> send(JSC::ArrayBufferView&);
+    ExceptionOr<void> send(Blob&);
 
-    void close(Optional<unsigned short> code, const String& reason, ExceptionCode&);
+    ExceptionOr<void> close(Optional<unsigned short> code, const String& reason);
 
     const URL& url() const;
     State readyState() const;
@@ -86,16 +88,31 @@
     String extensions() const;
 
     String binaryType() const;
-    void setBinaryType(const String&, ExceptionCode&);
+    ExceptionOr<void> setBinaryType(const String&);
 
-    // EventTarget functions.
-    EventTargetInterface eventTargetInterface() const override;
-    ScriptExecutionContext* scriptExecutionContext() const override;
+    using RefCounted::ref;
+    using RefCounted::deref;
 
-    using RefCounted<WebSocket>::ref;
-    using RefCounted<WebSocket>::deref;
+private:
+    explicit WebSocket(ScriptExecutionContext&);
 
-    // WebSocketChannelClient functions.
+    void resumeTimerFired();
+    void dispatchOrQueueErrorEvent();
+    void dispatchOrQueueEvent(Ref<Event>&&);
+
+    void contextDestroyed() final;
+    bool canSuspendForDocumentSuspension() const final;
+    void suspend(ReasonForSuspension) final;
+    void resume() final;
+    void stop() final;
+    const char* activeDOMObjectName() const final;
+
+    EventTargetInterface eventTargetInterface() const final;
+    ScriptExecutionContext* scriptExecutionContext() const final;
+
+    void refEventTarget() final { ref(); }
+    void derefEventTarget() final { deref(); }
+
     void didConnect() final;
     void didReceiveMessage(const String& message) final;
     void didReceiveBinaryData(Vector<uint8_t>&&) final;
@@ -105,38 +122,17 @@
     void didClose(unsigned unhandledBufferedAmount, ClosingHandshakeCompletionStatus, unsigned short code, const String& reason) final;
     void didUpgradeURL() final;
 
-private:
-    explicit WebSocket(ScriptExecutionContext&);
-
-    void resumeTimerFired();
-    void dispatchOrQueueErrorEvent();
-    void dispatchOrQueueEvent(Ref<Event>&&);
-
-    // ActiveDOMObject API.
-    void contextDestroyed() override;
-    bool canSuspendForDocumentSuspension() const override;
-    void suspend(ReasonForSuspension) override;
-    void resume() override;
-    void stop() override;
-    const char* activeDOMObjectName() const override;
-
-    void refEventTarget() override { ref(); }
-    void derefEventTarget() override { deref(); }
-
     size_t getFramingOverhead(size_t payloadSize);
 
-    enum BinaryType {
-        BinaryTypeBlob,
-        BinaryTypeArrayBuffer
-    };
+    enum class BinaryType { Blob, ArrayBuffer };
 
     RefPtr<ThreadableWebSocketChannel> m_channel;
 
-    State m_state;
+    State m_state { CONNECTING };
     URL m_url;
-    unsigned m_bufferedAmount;
-    unsigned m_bufferedAmountAfterClose;
-    BinaryType m_binaryType;
+    unsigned m_bufferedAmount { 0 };
+    unsigned m_bufferedAmountAfterClose { 0 };
+    BinaryType m_binaryType { BinaryType::Blob };
     String m_subprotocol;
     String m_extensions;
 
@@ -149,5 +145,3 @@
 } // namespace WebCore
 
 #endif // ENABLE(WEB_SOCKETS)
-
-#endif // WebSocket_h

Modified: trunk/Source/WebCore/Modules/websockets/WebSocket.idl (207383 => 207384)


--- trunk/Source/WebCore/Modules/websockets/WebSocket.idl	2016-10-15 23:21:32 UTC (rev 207383)
+++ trunk/Source/WebCore/Modules/websockets/WebSocket.idl	2016-10-15 23:23:33 UTC (rev 207384)
@@ -34,7 +34,7 @@
     Conditional=WEB_SOCKETS,
     Constructor(USVString url, optional sequence<DOMString> protocols = []),
     Constructor(USVString url, DOMString protocol),
-    ConstructorMayThrowLegacyException,
+    ConstructorMayThrowException,
     ConstructorCallWith=ScriptExecutionContext,
     EnabledAtRuntime,
     Exposed=(Window,Worker),
@@ -42,7 +42,6 @@
     readonly attribute USVString URL; // Lowercased .url is the one in the spec, but leaving .URL for compatibility reasons.
     readonly attribute USVString url;
 
-    // ready state
     const unsigned short CONNECTING = 0;
     const unsigned short OPEN = 1;
     const unsigned short CLOSING = 2;
@@ -51,7 +50,6 @@
 
     readonly attribute unsigned long bufferedAmount;
 
-    // networking
     attribute EventHandler onopen;
     attribute EventHandler onmessage;
     attribute EventHandler onerror;
@@ -60,12 +58,12 @@
     readonly attribute DOMString? protocol;
     readonly attribute DOMString? extensions;
 
-    [SetterMayThrowLegacyException] attribute DOMString binaryType;
+    [SetterMayThrowException] attribute DOMString binaryType;
 
-    [MayThrowLegacyException] void send(ArrayBuffer data);
-    [MayThrowLegacyException] void send(ArrayBufferView data);
-    [MayThrowLegacyException] void send(Blob data);
-    [MayThrowLegacyException] void send(USVString data);
+    [MayThrowException] void send(ArrayBuffer data);
+    [MayThrowException] void send(ArrayBufferView data);
+    [MayThrowException] void send(Blob data);
+    [MayThrowException] void send(USVString data);
 
-    [MayThrowLegacyException] void close([Clamp] optional unsigned short code, optional DOMString reason);
+    [MayThrowException] void close([Clamp] optional unsigned short code, optional DOMString reason);
 };

Modified: trunk/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp (207383 => 207384)


--- trunk/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp	2016-10-15 23:21:32 UTC (rev 207383)
+++ trunk/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp	2016-10-15 23:23:33 UTC (rev 207384)
@@ -605,7 +605,7 @@
             return false;
         }
         Vector<String> result;
-        m_clientProtocol.split(String(WebSocket::subProtocolSeperator()), result);
+        m_clientProtocol.split(WebSocket::subprotocolSeparator(), result);
         if (!result.contains(serverWebSocketProtocol)) {
             m_failureReason = ASCIILiteral("Error during WebSocket handshake: Sec-WebSocket-Protocol mismatch");
             return false;

Modified: trunk/Source/WebCore/dom/ExceptionOr.h (207383 => 207384)


--- trunk/Source/WebCore/dom/ExceptionOr.h	2016-10-15 23:21:32 UTC (rev 207383)
+++ trunk/Source/WebCore/dom/ExceptionOr.h	2016-10-15 23:23:33 UTC (rev 207384)
@@ -36,6 +36,7 @@
 public:
     ExceptionOr(Exception&&);
     ExceptionOr(ReturnType&&);
+    template<typename OtherType> ExceptionOr(const OtherType&, typename std::enable_if<std::is_scalar<OtherType>::value && std::is_convertible<OtherType, ReturnType>::value>::type* = nullptr);
 
     bool hasException() const;
     Exception&& releaseException();
@@ -67,6 +68,11 @@
 {
 }
 
+template<typename ReturnType> template<typename OtherType> inline ExceptionOr<ReturnType>::ExceptionOr(const OtherType& returnValue, typename std::enable_if<std::is_scalar<OtherType>::value && std::is_convertible<OtherType, ReturnType>::value>::type*)
+    : m_value(static_cast<ReturnType>(returnValue))
+{
+}
+
 template<typename ReturnType> inline bool ExceptionOr<ReturnType>::hasException() const
 {
     return std::experimental::holds_alternative<Exception>(m_value);

Modified: trunk/Source/WebCore/inspector/InspectorDatabaseAgent.cpp (207383 => 207384)


--- trunk/Source/WebCore/inspector/InspectorDatabaseAgent.cpp	2016-10-15 23:21:32 UTC (rev 207383)
+++ trunk/Source/WebCore/inspector/InspectorDatabaseAgent.cpp	2016-10-15 23:23:33 UTC (rev 207384)
@@ -77,14 +77,14 @@
 
     bool handleEvent(SQLTransaction*, SQLResultSet* resultSet) override
     {
-        SQLResultSetRowList* rowList = resultSet->rows();
+        auto& rowList = resultSet->rows();
 
         auto columnNames = Inspector::Protocol::Array<String>::create();
-        for (auto& column : rowList->columnNames())
+        for (auto& column : rowList.columnNames())
             columnNames->addItem(column);
 
         auto values = Inspector::Protocol::Array<InspectorValue>::create();
-        for (auto& value : rowList->values()) {
+        for (auto& value : rowList.values()) {
             RefPtr<InspectorValue> inspectorValue;
             switch (value.type()) {
             case SQLValue::StringValue: inspectorValue = InspectorValue::create(value.string()); break;

Modified: trunk/Source/WebCore/page/DOMWindow.idl (207383 => 207384)


--- trunk/Source/WebCore/page/DOMWindow.idl	2016-10-15 23:21:32 UTC (rev 207383)
+++ trunk/Source/WebCore/page/DOMWindow.idl	2016-10-15 23:23:33 UTC (rev 207384)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2016 Apple Inc. All rights reserved.
  * Copyright (C) 2011 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,6 @@
     JSCustomToNativeObject,
     JSLegacyParent=JSDOMWindowBase,
 ] interface DOMWindow : EventTarget {
-    // DOM Level 0
     [Replaceable] readonly attribute Screen screen;
     readonly attribute History history;
     [Replaceable] readonly attribute BarProp locationbar;
@@ -76,13 +75,7 @@
     DOMString? prompt(optional DOMString message = "", optional DOMString defaultValue = "");
 
     // FIXME: Using "undefined" as default parameter value is wrong.
-    boolean find(optional DOMString string = "undefined",
-                 optional boolean caseSensitive = false,
-                 optional boolean backwards = false,
-                 optional boolean wrap = false,
-                 optional boolean wholeWord = false,
-                 optional boolean searchInFrames = false,
-                 optional boolean showDialog = false);
+    boolean find(optional DOMString string = "undefined", optional boolean caseSensitive = false, optional boolean backwards = false, optional boolean wrap = false, optional boolean wholeWord = false, optional boolean searchInFrames = false, optional boolean showDialog = false);
 
     [Replaceable] readonly attribute  boolean offscreenBuffering;
 
@@ -108,10 +101,10 @@
     void scrollTo(optional ScrollToOptions options);
     [ImplementedAs=scrollTo] void scroll(optional ScrollToOptions options);
 
-    void moveBy(optional unrestricted float x = NaN, optional unrestricted float y = NaN); // FIXME: this should take longs not floats.
-    void moveTo(optional unrestricted float x = NaN, optional unrestricted float y = NaN); // FIXME: this should take longs not floats.
-    void resizeBy(optional unrestricted float x = NaN, optional unrestricted float y = NaN); // FIXME: this should take longs not floats.
-    void resizeTo(optional unrestricted float width = NaN, optional unrestricted float height = NaN); // FIXME: this should take longs not floats.
+    void moveBy(optional unrestricted float x = NaN, optional unrestricted float y = NaN); // FIXME: This should take longs, not floats.
+    void moveTo(optional unrestricted float x = NaN, optional unrestricted float y = NaN); // FIXME: This should take longs, not floats.
+    void resizeBy(optional unrestricted float x = NaN, optional unrestricted float y = NaN); // FIXME: This should take longs, not floats.
+    void resizeTo(optional unrestricted float width = NaN, optional unrestricted float height = NaN); // FIXME: This should take longs, not floats.
 
     [DoNotCheckSecurity, ForwardDeclareInHeader] readonly attribute boolean closed;
 
@@ -121,10 +114,8 @@
 
     attribute DOMString status;
     attribute DOMString defaultStatus;
-    // This attribute is an alias of defaultStatus and is necessary for legacy uses.
-    [ImplementedAs=defaultStatus] attribute DOMString defaultstatus;
+    [ImplementedAs=defaultStatus] attribute DOMString defaultstatus; // For compatibility with legacy content.
 
-    // Self referential attributes
     [Replaceable, DoNotCheckSecurityOnGetter] readonly attribute DOMWindow self;
     [DoNotCheckSecurity, Unforgeable] readonly attribute DOMWindow window;
     [Replaceable, DoNotCheckSecurityOnGetter] readonly attribute  DOMWindow frames;
@@ -133,29 +124,23 @@
     [Replaceable, DoNotCheckSecurityOnGetter] readonly attribute DOMWindow parent;
     [DoNotCheckSecurityOnGetter, Unforgeable] readonly attribute DOMWindow top;
 
-    // DOM Level 2 AbstractView Interface
     [Unforgeable] readonly attribute Document document;
 
-    // CSSOM View Module
     MediaQueryList matchMedia(DOMString query);
 
-    // styleMedia has been removed from the CSSOM View specification.
-    readonly attribute StyleMedia styleMedia;
+    readonly attribute StyleMedia styleMedia; // Keeping for now, but styleMedia has been removed from the CSSOM View specification.
 
-    // DOM Level 2 Style Interface
     [NewObject] CSSStyleDeclaration getComputedStyle(Element element, optional DOMString? pseudoElement = null);
-    // FIXME: Drop this overload once <rdar://problem/28016778> has been fixed.
+
+    // FIXME: Drop the following overload of getComputedStyle once <rdar://problem/28020681> has been fixed.
     [NewObject, MayThrowLegacyException] CSSStyleDeclaration getComputedStyle(Document document, optional DOMString? pseudoElement = null);
 
-    // WebKit extensions
     CSSRuleList getMatchedCSSRules(optional Element? element = null, optional DOMString? pseudoElement = null);
 
     [Replaceable] readonly attribute unrestricted double devicePixelRatio;
     
-    WebKitPoint webkitConvertPointFromPageToNode(optional Node? node = null,
-                                                 optional WebKitPoint? p = null);
-    WebKitPoint webkitConvertPointFromNodeToPage(optional Node? node = null,
-                                                 optional WebKitPoint? p = null);
+    WebKitPoint webkitConvertPointFromPageToNode(optional Node? node = null, optional WebKitPoint? p = null);
+    WebKitPoint webkitConvertPointFromNodeToPage(optional Node? node = null, optional WebKitPoint? p = null);
 
     readonly attribute DOMApplicationCache applicationCache;
 
@@ -162,12 +147,10 @@
     [GetterMayThrowLegacyException] readonly attribute Storage sessionStorage;
     [GetterMayThrowLegacyException] readonly attribute Storage localStorage;
 
-    // This is the interface orientation in degrees. Some examples are:
-    //  0 is straight up; -90 is when the device is rotated 90 clockwise;
-    //  90 is when rotated counter clockwise.
+    // This is the interface orientation in degrees. Some examples:
+    // 0 when straight up; -90 when rotated 90 degrees clockwise; 90 counter clockwise.
     [Conditional=ORIENTATION_EVENTS] readonly attribute long orientation;
 
-    // cross-document messaging
     [DoNotCheckSecurity, Custom, MayThrowLegacyException, ForwardDeclareInHeader] void postMessage(SerializedScriptValue message, USVString targetOrigin, optional Array messagePorts);
 
     [Conditional=WEB_TIMING, Replaceable] readonly attribute Performance performance;
@@ -178,20 +161,18 @@
     [Conditional=REQUEST_ANIMATION_FRAME, ImplementedAs=cancelAnimationFrame] void webkitCancelAnimationFrame(long id);
     [Conditional=REQUEST_ANIMATION_FRAME, ImplementedAs=cancelAnimationFrame] void webkitCancelRequestAnimationFrame(long id); // This is a deprecated alias for webkitCancelAnimationFrame(). Remove this when removing vendor prefix.
 
-    void captureEvents(/*in long eventFlags*/);
-    void releaseEvents(/*in long eventFlags*/);
+    void captureEvents(); // Not implemented. Also not in modern standards. Empty function may help compatibility with legacy content.
+    void releaseEvents(); // Not implemented. Also not in modern standards. Empty function may help compatibility with legacy content.
 
-    [CustomGetter, CustomConstructor] attribute HTMLImageElementNamedConstructor Image; // Usable with new operator
+    [CustomGetter, CustomConstructor] attribute HTMLImageElementNamedConstructor Image;
     attribute XMLDocumentConstructor SVGDocument;
 
-    attribute DOMURLConstructor webkitURL; // FIXME: deprecate this.
-    attribute MutationObserverConstructor WebKitMutationObserver; // FIXME: Add metrics to determine when we can remove this.
+    attribute DOMURLConstructor webkitURL; // FIXME: Deprecate this.
+    attribute MutationObserverConstructor WebKitMutationObserver; // FIXME: Remove once we prove it is not needed for compatibility with legacy content.
 
     [Conditional=CUSTOM_ELEMENTS, EnabledAtRuntime=CustomElements, ImplementedAs=ensureCustomElementRegistry] readonly attribute CustomElementRegistry customElements;
 
-    // Event Handlers
-
-    // Unique to Element and DOMWindow
+    // Event handlers unique to Element and DOMWindow.
     // FIXME: Should these be exposed on Document as well (and therefore moved to GlobalEventHandlers.idl)?
     [NotEnumerable] attribute EventHandler onanimationend;
     [NotEnumerable] attribute EventHandler onanimationiteration;
@@ -205,7 +186,7 @@
     [NotEnumerable, Conditional=IOS_GESTURE_EVENTS] attribute EventHandler ongestureend;
     [NotEnumerable, Conditional=IOS_GESTURE_EVENTS] attribute EventHandler ongesturestart;
 
-    // Unique to DOMWindow
+    // Event handlers unique to DOMWindow.
     [NotEnumerable, Conditional=DEVICE_ORIENTATION] attribute EventHandler ondevicemotion;
     [NotEnumerable, Conditional=DEVICE_ORIENTATION] attribute EventHandler ondeviceorientation;
     [NotEnumerable, Conditional=PROXIMITY_EVENTS] attribute EventHandler onwebkitdeviceproximity;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to