<!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>[206976] trunk/Source/WebCore</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/206976">206976</a></dd>
<dt>Author</dt> <dd>darin@apple.com</dd>
<dt>Date</dt> <dd>2016-10-09 19:13:28 -0700 (Sun, 09 Oct 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Replace all uses of ExceptionCodeWithMessage with WebCore::Exception
https://bugs.webkit.org/show_bug.cgi?id=163178
Reviewed by Sam Weinig.
* Modules/indexeddb/IDBCursor.cpp:
(WebCore::IDBCursor::stringToDirection): Return an Optional instead of
using an ExceptionCode out argument, since this function just needs to
indicate failure, not actually throw an exception.
(WebCore::IDBCursor::update): Return ExceptionOr instead of using an
ExceptionCodeWithMessage out argument.
(WebCore::IDBCursor::advance): Ditto.
(WebCore::IDBCursor::continueFunction): Ditto.
(WebCore::IDBCursor::deleteFunction): Ditto.
* Modules/indexeddb/IDBCursor.h: Updated for above changes.
* Modules/indexeddb/IDBCursor.idl: Sorted extended attributes alphabetically.
Use MayThrowException instead of MayThrowLegacyExceptionWithMessage.
* Modules/indexeddb/IDBDatabase.cpp:
(WebCore::IDBDatabase::createObjectStore): Return ExceptionOr instead of
using an ExceptionCodeWithMessage out argument.
(WebCore::IDBDatabase::transaction): Ditto.
(WebCore::IDBDatabase::deleteObjectStore): Ditto.
* Modules/indexeddb/IDBDatabase.h: Updated for above changes.
* Modules/indexeddb/IDBDatabase.idl: Use MayThrowException instead of
MayThrowLegacyExceptionWithMessage.
* Modules/indexeddb/IDBFactory.cpp:
(WebCore::IDBFactory::open): Return ExceptionOr instead of
using an ExceptionCodeWithMessage out argument.
(WebCore::IDBFactory::openInternal): Ditto.
(WebCore::IDBFactory::deleteDatabase): Ditto.
(WebCore::IDBFactory::cmp): Ditto.
* Modules/indexeddb/IDBFactory.h: Updated for above changes.
* Modules/indexeddb/IDBFactory.idl: Use MayThrowException instead of
MayThrowLegacyExceptionWithMessage.
* Modules/indexeddb/IDBIndex.cpp:
(WebCore::IDBIndex::openCursor): Return ExceptionOr instead of
using an ExceptionCodeWithMessage out argument.
(WebCore::IDBIndex::count): Ditto.
(WebCore::IDBIndex::doCount): Ditto.
(WebCore::IDBIndex::openKeyCursor): Ditto.
(WebCore::IDBIndex::get): Ditto.
(WebCore::IDBIndex::doGet): Ditto.
(WebCore::IDBIndex::getKey): Ditto.
(WebCore::IDBIndex::doGetKey): Ditto.
* Modules/indexeddb/IDBIndex.h: Updated for above changes.
* Modules/indexeddb/IDBIndex.idl: Use MayThrowException instead of
MayThrowLegacyExceptionWithMessage.
* Modules/indexeddb/IDBKeyRange.cpp:
(WebCore::IDBKeyRange::only): Return ExceptionOr instead of
using an ExceptionCode out argument.
(WebCore::IDBKeyRange::lowerBound): Ditto.
(WebCore::IDBKeyRange::upperBound): Ditto.
(WebCore::IDBKeyRange::bound): Ditto.
* Modules/indexeddb/IDBKeyRange.h: Updated for above changes.
* Modules/indexeddb/IDBKeyRange.idl: Use MayThrowException instead of
MayThrowLegacyException.
* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::openCursor): Return ExceptionOr instead of
using an ExceptionCodeWithMessage out argument.
(WebCore::IDBObjectStore::get): Ditto.
(WebCore::IDBObjectStore::add): Ditto.
(WebCore::IDBObjectStore::put): Ditto.
(WebCore::IDBObjectStore::putForCursorUpdate): Ditto.
(WebCore::IDBObjectStore::putOrAdd): Ditto.
(WebCore::IDBObjectStore::deleteFunction): Ditto.
(WebCore::IDBObjectStore::doDelete): Ditto.
(WebCore::IDBObjectStore::clear): Ditto.
(WebCore::IDBObjectStore::createIndex): Ditto.
(WebCore::IDBObjectStore::index): Ditto.
(WebCore::IDBObjectStore::deleteIndex): Ditto.
(WebCore::IDBObjectStore::count): Ditto.
(WebCore::IDBObjectStore::doCount): Ditto.
* Modules/indexeddb/IDBObjectStore.h: Updated for above changes.
* Modules/indexeddb/IDBObjectStore.idl: Use MayThrowException instead of
MayThrowLegacyExceptionWithMessage.
* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::errorCode): Deleted. Was dead code.
(WebCore::IDBRequest::error): Return ExceptionOr instead of
using an ExceptionCodeWithMessage out argument.
* Modules/indexeddb/IDBRequest.h: Updated for above changes.
* Modules/indexeddb/IDBRequest.idl: Use GetterMayThrowException instead of
GetterMayThrowLegacyExceptionWithMessage.
* Modules/indexeddb/IDBTransaction.cpp:
(WebCore::IDBTransaction::stringToMode): Return an Optional instead of
using an ExceptionCode out argument, since this function just needs to
indicate failure, not actually throw an exception.
(WebCore::IDBTransaction::db): Tweaked code a bit.
(WebCore::IDBTransaction::error): Return a pointer instead of a RefPtr.
(WebCore::IDBTransaction::objectStore): Return ExceptionOr instead of
using an ExceptionCodeWithMessage out argument.
(WebCore::IDBTransaction::abortDueToFailedRequest): Call internalAbort.
(WebCore::IDBTransaction::abort): Return ExceptionOr instead of
using an ExceptionCodeWithMessage out argument.
(WebCore::IDBTransaction::internalAbort): Added a version that asserts
instead of throwing an exception for internal use.
(WebCore::IDBTransaction::stop): Call internalAbort.
* Modules/indexeddb/IDBTransaction.h: Updated for above changes.
* Modules/indexeddb/IDBTransaction.idl: Use MayThrowException instead of
MayThrowLegacyExceptionWithMessage.
* Modules/indexeddb/client/IDBConnectionProxy.cpp:
(WebCore::IDBClient::IDBConnectionProxy::openDatabase): Updated to return
a Ref instead of a RefPtr, since the function can never return null.
(WebCore::IDBClient::IDBConnectionProxy::deleteDatabase): Ditto.
* Modules/indexeddb/client/IDBConnectionProxy.h: Updated for above changes.
* Modules/mediastream/MediaEndpointPeerConnection.cpp:
(WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask): Updated
exception handling to use ExceptionOr instead of ExceptionCodeWithMessage.
(WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask): Ditto.
* Modules/mediastream/MediaEndpointSessionDescription.cpp:
(WebCore::MediaEndpointSessionDescription::create): Ditto.
* Modules/mediastream/MediaEndpointSessionDescription.h: Updated for above change.
* bindings/js/JSDOMBinding.cpp:
(WebCore::createDOMException): Added overload for Exception.
(WebCore::throwDOMException): Deleted overload for ExceptionCodeWithMessage.
Updated code to call the new createDOMException function.
(WebCore::setDOMExceptionSlow): Ditto.
(WebCore::setDOMException): Ditto.
* bindings/js/JSDOMBinding.h: Added overload of createDOMException that takes
an Exception. Deleted functions dealing with ExceptionCodeWithMessage. Fixed
interface of toJSNumber and toJSNullableNumber and implemented toJSNumber.
* bindings/js/JSDOMPromise.cpp:
(WebCore::DeferredPromise::reject): Added overload that takes an Exception.
* bindings/js/JSDOMPromise.h: Updated for above change.
* bindings/js/JSHistoryCustom.cpp:
(WebCore::JSHistory::pushState): Use propagateException to deal with
ExceptionOr instead of ExceptionCodeWithMessage.
(WebCore::JSHistory::replaceState): Ditto.
* bindings/js/JSIDBDatabaseCustom.cpp:
(WebCore::JSIDBDatabase::createObjectStore): Use toJS and
to deal with ExceptionOr rather than setDOMException to deal
with ExceptionCodeWithMessage.
* bindings/js/JSIDBRequestCustom.cpp:
(WebCore::JSIDBRequest::result): Use propagateException and
Exception rather than setDOMException and ExceptionCodeWithMessage.
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation): Removed support for GetterMayThrowLegacyExceptionWithMessage,
SetterMayThrowLegacyExceptionWithMessage, and MayThrowLegacyExceptionWithMessage.
(GenerateReturnParameters): Ditto.
(GenerateImplementationFunctionCall): Ditto.
(GenerateConstructorDefinition): Ditto.
* bindings/scripts/IDLAttributes.txt: Removed GetterMayThrowLegacyExceptionWithMessage,
SetterMayThrowLegacyExceptionWithMessage, and MayThrowLegacyExceptionWithMessage.
* bindings/scripts/test/JS/JSTestObj.cpp: Regenerated.
* bindings/scripts/test/TestObj.idl: Removed tests cases for now-removed attributes.
* dom/CustomElementRegistry.idl: Use MayThrowException instead of
MayThrowLegacyExceptionWithMessage.
* dom/ExceptionCode.h: Removed ExceptionCodeWithMessage. Also updated to use pragma
once, removed include of WTFString.h and switched to using instead of typedef.
* history/HistoryItem.h: Return a pointer instead of a RefPtr from stateObject
to cut down a little on unnecessary reference count churn.
* inspector/InspectorIndexedDBAgent.cpp: Updated all the code that uses IDB
classes to use the new versions rather than the old ExceptionCodeWithMessage versions.
* page/DOMWindow.cpp:
(WebCore::DOMWindow::history): Pass a reference instead of a pointer.
* page/History.cpp:
(WebCore::History::History): Take a reference instead of a pointer.
(WebCore::History::length): Tweaked to use a local variable.
(WebCore::History::state): Return a pointer instead of a PassRefPtr.
(WebCore::History::stateInternal): Ditto. Also use early return consistently.
(WebCore::History::isSameAsCurrentState): Updated for above change.
(WebCore::History::stateObjectAdded): Return ExceptionOr rather than taking an
ExceptionCodeWithMessage out argument.
* page/History.h: Use pragma once. Removed some unneeded includes. Marked class final.
Updated for changes above.
* page/History.idl: Use MayThrowException instead of MayThrowLegacyException.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBCursorcpp">trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBCursorh">trunk/Source/WebCore/Modules/indexeddb/IDBCursor.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBCursoridl">trunk/Source/WebCore/Modules/indexeddb/IDBCursor.idl</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBDatabasecpp">trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBDatabaseh">trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBDatabaseidl">trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.idl</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBFactorycpp">trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBFactoryh">trunk/Source/WebCore/Modules/indexeddb/IDBFactory.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBFactoryidl">trunk/Source/WebCore/Modules/indexeddb/IDBFactory.idl</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBIndexcpp">trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBIndexh">trunk/Source/WebCore/Modules/indexeddb/IDBIndex.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBIndexidl">trunk/Source/WebCore/Modules/indexeddb/IDBIndex.idl</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBKeyRangecpp">trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBKeyRangeh">trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBKeyRangeidl">trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.idl</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBObjectStorecpp">trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBObjectStoreh">trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBObjectStoreidl">trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBRequestcpp">trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBRequesth">trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBRequestidl">trunk/Source/WebCore/Modules/indexeddb/IDBRequest.idl</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBTransactioncpp">trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBTransactionh">trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBTransactionidl">trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.idl</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBConnectionProxycpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBConnectionProxyh">trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.h</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamMediaEndpointPeerConnectioncpp">trunk/Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamMediaEndpointSessionDescriptioncpp">trunk/Source/WebCore/Modules/mediastream/MediaEndpointSessionDescription.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamMediaEndpointSessionDescriptionh">trunk/Source/WebCore/Modules/mediastream/MediaEndpointSessionDescription.h</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMBindingcpp">trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMBindingh">trunk/Source/WebCore/bindings/js/JSDOMBinding.h</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMPromisecpp">trunk/Source/WebCore/bindings/js/JSDOMPromise.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMPromiseh">trunk/Source/WebCore/bindings/js/JSDOMPromise.h</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSHistoryCustomcpp">trunk/Source/WebCore/bindings/js/JSHistoryCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSIDBDatabaseCustomcpp">trunk/Source/WebCore/bindings/js/JSIDBDatabaseCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSIDBRequestCustomcpp">trunk/Source/WebCore/bindings/js/JSIDBRequestCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsIDLAttributestxt">trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestTestObjidl">trunk/Source/WebCore/bindings/scripts/test/TestObj.idl</a></li>
<li><a href="#trunkSourceWebCoredomCustomElementRegistryidl">trunk/Source/WebCore/dom/CustomElementRegistry.idl</a></li>
<li><a href="#trunkSourceWebCoredomExceptionCodeh">trunk/Source/WebCore/dom/ExceptionCode.h</a></li>
<li><a href="#trunkSourceWebCorehistoryHistoryItemh">trunk/Source/WebCore/history/HistoryItem.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorIndexedDBAgentcpp">trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp</a></li>
<li><a href="#trunkSourceWebCorepageDOMWindowcpp">trunk/Source/WebCore/page/DOMWindow.cpp</a></li>
<li><a href="#trunkSourceWebCorepageHistorycpp">trunk/Source/WebCore/page/History.cpp</a></li>
<li><a href="#trunkSourceWebCorepageHistoryh">trunk/Source/WebCore/page/History.h</a></li>
<li><a href="#trunkSourceWebCorepageHistoryidl">trunk/Source/WebCore/page/History.idl</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/ChangeLog        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -1,3 +1,204 @@
</span><ins>+2016-10-09 Darin Adler <darin@apple.com>
+
+ Replace all uses of ExceptionCodeWithMessage with WebCore::Exception
+ https://bugs.webkit.org/show_bug.cgi?id=163178
+
+ Reviewed by Sam Weinig.
+
+ * Modules/indexeddb/IDBCursor.cpp:
+ (WebCore::IDBCursor::stringToDirection): Return an Optional instead of
+ using an ExceptionCode out argument, since this function just needs to
+ indicate failure, not actually throw an exception.
+ (WebCore::IDBCursor::update): Return ExceptionOr instead of using an
+ ExceptionCodeWithMessage out argument.
+ (WebCore::IDBCursor::advance): Ditto.
+ (WebCore::IDBCursor::continueFunction): Ditto.
+ (WebCore::IDBCursor::deleteFunction): Ditto.
+ * Modules/indexeddb/IDBCursor.h: Updated for above changes.
+
+ * Modules/indexeddb/IDBCursor.idl: Sorted extended attributes alphabetically.
+ Use MayThrowException instead of MayThrowLegacyExceptionWithMessage.
+
+ * Modules/indexeddb/IDBDatabase.cpp:
+ (WebCore::IDBDatabase::createObjectStore): Return ExceptionOr instead of
+ using an ExceptionCodeWithMessage out argument.
+ (WebCore::IDBDatabase::transaction): Ditto.
+ (WebCore::IDBDatabase::deleteObjectStore): Ditto.
+ * Modules/indexeddb/IDBDatabase.h: Updated for above changes.
+
+ * Modules/indexeddb/IDBDatabase.idl: Use MayThrowException instead of
+ MayThrowLegacyExceptionWithMessage.
+
+ * Modules/indexeddb/IDBFactory.cpp:
+ (WebCore::IDBFactory::open): Return ExceptionOr instead of
+ using an ExceptionCodeWithMessage out argument.
+ (WebCore::IDBFactory::openInternal): Ditto.
+ (WebCore::IDBFactory::deleteDatabase): Ditto.
+ (WebCore::IDBFactory::cmp): Ditto.
+ * Modules/indexeddb/IDBFactory.h: Updated for above changes.
+
+ * Modules/indexeddb/IDBFactory.idl: Use MayThrowException instead of
+ MayThrowLegacyExceptionWithMessage.
+
+ * Modules/indexeddb/IDBIndex.cpp:
+ (WebCore::IDBIndex::openCursor): Return ExceptionOr instead of
+ using an ExceptionCodeWithMessage out argument.
+ (WebCore::IDBIndex::count): Ditto.
+ (WebCore::IDBIndex::doCount): Ditto.
+ (WebCore::IDBIndex::openKeyCursor): Ditto.
+ (WebCore::IDBIndex::get): Ditto.
+ (WebCore::IDBIndex::doGet): Ditto.
+ (WebCore::IDBIndex::getKey): Ditto.
+ (WebCore::IDBIndex::doGetKey): Ditto.
+ * Modules/indexeddb/IDBIndex.h: Updated for above changes.
+
+ * Modules/indexeddb/IDBIndex.idl: Use MayThrowException instead of
+ MayThrowLegacyExceptionWithMessage.
+
+ * Modules/indexeddb/IDBKeyRange.cpp:
+ (WebCore::IDBKeyRange::only): Return ExceptionOr instead of
+ using an ExceptionCode out argument.
+ (WebCore::IDBKeyRange::lowerBound): Ditto.
+ (WebCore::IDBKeyRange::upperBound): Ditto.
+ (WebCore::IDBKeyRange::bound): Ditto.
+ * Modules/indexeddb/IDBKeyRange.h: Updated for above changes.
+ * Modules/indexeddb/IDBKeyRange.idl: Use MayThrowException instead of
+ MayThrowLegacyException.
+
+ * Modules/indexeddb/IDBObjectStore.cpp:
+ (WebCore::IDBObjectStore::openCursor): Return ExceptionOr instead of
+ using an ExceptionCodeWithMessage out argument.
+ (WebCore::IDBObjectStore::get): Ditto.
+ (WebCore::IDBObjectStore::add): Ditto.
+ (WebCore::IDBObjectStore::put): Ditto.
+ (WebCore::IDBObjectStore::putForCursorUpdate): Ditto.
+ (WebCore::IDBObjectStore::putOrAdd): Ditto.
+ (WebCore::IDBObjectStore::deleteFunction): Ditto.
+ (WebCore::IDBObjectStore::doDelete): Ditto.
+ (WebCore::IDBObjectStore::clear): Ditto.
+ (WebCore::IDBObjectStore::createIndex): Ditto.
+ (WebCore::IDBObjectStore::index): Ditto.
+ (WebCore::IDBObjectStore::deleteIndex): Ditto.
+ (WebCore::IDBObjectStore::count): Ditto.
+ (WebCore::IDBObjectStore::doCount): Ditto.
+ * Modules/indexeddb/IDBObjectStore.h: Updated for above changes.
+
+ * Modules/indexeddb/IDBObjectStore.idl: Use MayThrowException instead of
+ MayThrowLegacyExceptionWithMessage.
+
+ * Modules/indexeddb/IDBRequest.cpp:
+ (WebCore::IDBRequest::errorCode): Deleted. Was dead code.
+ (WebCore::IDBRequest::error): Return ExceptionOr instead of
+ using an ExceptionCodeWithMessage out argument.
+ * Modules/indexeddb/IDBRequest.h: Updated for above changes.
+
+ * Modules/indexeddb/IDBRequest.idl: Use GetterMayThrowException instead of
+ GetterMayThrowLegacyExceptionWithMessage.
+
+ * Modules/indexeddb/IDBTransaction.cpp:
+ (WebCore::IDBTransaction::stringToMode): Return an Optional instead of
+ using an ExceptionCode out argument, since this function just needs to
+ indicate failure, not actually throw an exception.
+ (WebCore::IDBTransaction::db): Tweaked code a bit.
+ (WebCore::IDBTransaction::error): Return a pointer instead of a RefPtr.
+ (WebCore::IDBTransaction::objectStore): Return ExceptionOr instead of
+ using an ExceptionCodeWithMessage out argument.
+ (WebCore::IDBTransaction::abortDueToFailedRequest): Call internalAbort.
+ (WebCore::IDBTransaction::abort): Return ExceptionOr instead of
+ using an ExceptionCodeWithMessage out argument.
+ (WebCore::IDBTransaction::internalAbort): Added a version that asserts
+ instead of throwing an exception for internal use.
+ (WebCore::IDBTransaction::stop): Call internalAbort.
+ * Modules/indexeddb/IDBTransaction.h: Updated for above changes.
+
+ * Modules/indexeddb/IDBTransaction.idl: Use MayThrowException instead of
+ MayThrowLegacyExceptionWithMessage.
+
+ * Modules/indexeddb/client/IDBConnectionProxy.cpp:
+ (WebCore::IDBClient::IDBConnectionProxy::openDatabase): Updated to return
+ a Ref instead of a RefPtr, since the function can never return null.
+ (WebCore::IDBClient::IDBConnectionProxy::deleteDatabase): Ditto.
+ * Modules/indexeddb/client/IDBConnectionProxy.h: Updated for above changes.
+
+ * Modules/mediastream/MediaEndpointPeerConnection.cpp:
+ (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask): Updated
+ exception handling to use ExceptionOr instead of ExceptionCodeWithMessage.
+ (WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask): Ditto.
+ * Modules/mediastream/MediaEndpointSessionDescription.cpp:
+ (WebCore::MediaEndpointSessionDescription::create): Ditto.
+ * Modules/mediastream/MediaEndpointSessionDescription.h: Updated for above change.
+
+ * bindings/js/JSDOMBinding.cpp:
+ (WebCore::createDOMException): Added overload for Exception.
+ (WebCore::throwDOMException): Deleted overload for ExceptionCodeWithMessage.
+ Updated code to call the new createDOMException function.
+ (WebCore::setDOMExceptionSlow): Ditto.
+ (WebCore::setDOMException): Ditto.
+
+ * bindings/js/JSDOMBinding.h: Added overload of createDOMException that takes
+ an Exception. Deleted functions dealing with ExceptionCodeWithMessage. Fixed
+ interface of toJSNumber and toJSNullableNumber and implemented toJSNumber.
+
+ * bindings/js/JSDOMPromise.cpp:
+ (WebCore::DeferredPromise::reject): Added overload that takes an Exception.
+ * bindings/js/JSDOMPromise.h: Updated for above change.
+
+ * bindings/js/JSHistoryCustom.cpp:
+ (WebCore::JSHistory::pushState): Use propagateException to deal with
+ ExceptionOr instead of ExceptionCodeWithMessage.
+ (WebCore::JSHistory::replaceState): Ditto.
+
+ * bindings/js/JSIDBDatabaseCustom.cpp:
+ (WebCore::JSIDBDatabase::createObjectStore): Use toJS and
+ to deal with ExceptionOr rather than setDOMException to deal
+ with ExceptionCodeWithMessage.
+
+ * bindings/js/JSIDBRequestCustom.cpp:
+ (WebCore::JSIDBRequest::result): Use propagateException and
+ Exception rather than setDOMException and ExceptionCodeWithMessage.
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateImplementation): Removed support for GetterMayThrowLegacyExceptionWithMessage,
+ SetterMayThrowLegacyExceptionWithMessage, and MayThrowLegacyExceptionWithMessage.
+ (GenerateReturnParameters): Ditto.
+ (GenerateImplementationFunctionCall): Ditto.
+ (GenerateConstructorDefinition): Ditto.
+
+ * bindings/scripts/IDLAttributes.txt: Removed GetterMayThrowLegacyExceptionWithMessage,
+ SetterMayThrowLegacyExceptionWithMessage, and MayThrowLegacyExceptionWithMessage.
+
+ * bindings/scripts/test/JS/JSTestObj.cpp: Regenerated.
+ * bindings/scripts/test/TestObj.idl: Removed tests cases for now-removed attributes.
+
+ * dom/CustomElementRegistry.idl: Use MayThrowException instead of
+ MayThrowLegacyExceptionWithMessage.
+
+ * dom/ExceptionCode.h: Removed ExceptionCodeWithMessage. Also updated to use pragma
+ once, removed include of WTFString.h and switched to using instead of typedef.
+
+ * history/HistoryItem.h: Return a pointer instead of a RefPtr from stateObject
+ to cut down a little on unnecessary reference count churn.
+
+ * inspector/InspectorIndexedDBAgent.cpp: Updated all the code that uses IDB
+ classes to use the new versions rather than the old ExceptionCodeWithMessage versions.
+
+ * page/DOMWindow.cpp:
+ (WebCore::DOMWindow::history): Pass a reference instead of a pointer.
+
+ * page/History.cpp:
+ (WebCore::History::History): Take a reference instead of a pointer.
+ (WebCore::History::length): Tweaked to use a local variable.
+ (WebCore::History::state): Return a pointer instead of a PassRefPtr.
+ (WebCore::History::stateInternal): Ditto. Also use early return consistently.
+ (WebCore::History::isSameAsCurrentState): Updated for above change.
+ (WebCore::History::stateObjectAdded): Return ExceptionOr rather than taking an
+ ExceptionCodeWithMessage out argument.
+
+ * page/History.h: Use pragma once. Removed some unneeded includes. Marked class final.
+ Updated for changes above.
+
+ * page/History.idl: Use MayThrowException instead of MayThrowLegacyException.
+
</ins><span class="cx"> 2016-10-07 Ryosuke Niwa <rniwa@webkit.org>
</span><span class="cx">
</span><span class="cx"> REGRESSION(r165103): labels list doesn't get invalidated when other lists are invalidated at document level
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBCursorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -71,7 +71,7 @@
</span><span class="cx"> return prevunique;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-IndexedDB::CursorDirection IDBCursor::stringToDirection(const String& directionString, ExceptionCode& ec)
</del><ins>+Optional<IndexedDB::CursorDirection> IDBCursor::stringToDirection(const String& directionString)
</ins><span class="cx"> {
</span><span class="cx"> if (directionString == directionNext())
</span><span class="cx"> return IndexedDB::CursorDirection::Next;
</span><span class="lines">@@ -82,8 +82,7 @@
</span><span class="cx"> if (directionString == directionPrevUnique())
</span><span class="cx"> return IndexedDB::CursorDirection::PrevNoDuplicate;
</span><span class="cx">
</span><del>- ec = TypeError;
- return IndexedDB::CursorDirection::Next;
</del><ins>+ return Nullopt;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> const AtomicString& IDBCursor::directionToString(IndexedDB::CursorDirection direction)
</span><span class="lines">@@ -169,162 +168,116 @@
</span><span class="cx"> return directionToString(m_info.cursorDirection());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<WebCore::IDBRequest> IDBCursor::update(ExecState& exec, JSValue value, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBRequest>> IDBCursor::update(ExecState& state, JSValue value)
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBCursor::update");
</span><span class="cx"> ASSERT(currentThread() == effectiveObjectStore().transaction().database().originThreadID());
</span><span class="cx">
</span><del>- if (sourcesDeleted()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'update' on 'IDBCursor': The cursor's source or effective object store has been deleted.");
- return nullptr;
- }
</del><ins>+ if (sourcesDeleted())
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'update' on 'IDBCursor': The cursor's source or effective object store has been deleted.") };
</ins><span class="cx">
</span><del>- if (!transaction().isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- ec.message = ASCIILiteral("Failed to execute 'update' on 'IDBCursor': The transaction is inactive or finished.");
- return nullptr;
- }
</del><ins>+ if (!transaction().isActive())
+ return Exception { IDBDatabaseException::TransactionInactiveError, ASCIILiteral("Failed to execute 'update' on 'IDBCursor': The transaction is inactive or finished.") };
</ins><span class="cx">
</span><del>- if (transaction().isReadOnly()) {
- ec.code = IDBDatabaseException::ReadOnlyError;
- ec.message = ASCIILiteral("Failed to execute 'update' on 'IDBCursor': The record may not be updated inside a read-only transaction.");
- return nullptr;
- }
</del><ins>+ if (transaction().isReadOnly())
+ return Exception { IDBDatabaseException::ReadOnlyError, ASCIILiteral("Failed to execute 'update' on 'IDBCursor': The record may not be updated inside a read-only transaction.") };
</ins><span class="cx">
</span><del>- if (!m_gotValue) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'update' on 'IDBCursor': The cursor is being iterated or has iterated past its end.");
- return nullptr;
- }
</del><ins>+ if (!m_gotValue)
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'update' on 'IDBCursor': The cursor is being iterated or has iterated past its end.") };
</ins><span class="cx">
</span><del>- if (!isKeyCursorWithValue()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'update' on 'IDBCursor': The cursor is a key cursor.");
- return nullptr;
- }
</del><ins>+ if (!isKeyCursorWithValue())
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'update' on 'IDBCursor': The cursor is a key cursor.") };
</ins><span class="cx">
</span><span class="cx"> auto& objectStore = effectiveObjectStore();
</span><span class="cx"> auto& keyPath = objectStore.info().keyPath();
</span><span class="cx"> const bool usesInLineKeys = !keyPath.isNull();
</span><span class="cx"> if (usesInLineKeys) {
</span><del>- RefPtr<IDBKey> keyPathKey = maybeCreateIDBKeyFromScriptValueAndKeyPath(exec, value, keyPath);
</del><ins>+ RefPtr<IDBKey> keyPathKey = maybeCreateIDBKeyFromScriptValueAndKeyPath(state, value, keyPath);
</ins><span class="cx"> IDBKeyData keyPathKeyData(keyPathKey.get());
</span><del>- if (!keyPathKey || keyPathKeyData != m_currentPrimaryKeyData) {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to execute 'update' on 'IDBCursor': The effective object store of this cursor uses in-line keys and evaluating the key path of the value parameter results in a different value than the cursor's effective key.");
- return nullptr;
- }
</del><ins>+ if (!keyPathKey || keyPathKeyData != m_currentPrimaryKeyData)
+ return Exception { IDBDatabaseException::DataError, ASCIILiteral("Failed to execute 'update' on 'IDBCursor': The effective object store of this cursor uses in-line keys and evaluating the key path of the value parameter results in a different value than the cursor's effective key.") };
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- auto request = effectiveObjectStore().putForCursorUpdate(exec, value, m_currentPrimaryKey.get(), ec);
- if (ec.code)
- return nullptr;
</del><ins>+ auto putResult = effectiveObjectStore().putForCursorUpdate(state, value, m_currentPrimaryKey.get());
+ if (putResult.hasException())
+ return putResult.releaseException();
</ins><span class="cx">
</span><del>- ASSERT(request);
</del><ins>+ auto request = putResult.releaseReturnValue();
</ins><span class="cx"> request->setSource(*this);
</span><span class="cx"> ++m_outstandingRequestCount;
</span><span class="cx">
</span><del>- return request;
</del><ins>+ return WTFMove(request);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void IDBCursor::advance(unsigned count, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<void> IDBCursor::advance(unsigned count)
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBCursor::advance");
</span><span class="cx"> ASSERT(currentThread() == effectiveObjectStore().transaction().database().originThreadID());
</span><span class="cx">
</span><del>- if (!m_request) {
- ec.code = IDBDatabaseException::InvalidStateError;
- return;
- }
-
- if (!count) {
- ec.code = TypeError;
- ec.message = ASCIILiteral("Failed to execute 'advance' on 'IDBCursor': A count argument with value 0 (zero) was supplied, must be greater than 0.");
- return;
- }
</del><ins>+ if (!m_request)
+ return Exception { IDBDatabaseException::InvalidStateError };
</ins><span class="cx">
</span><del>- if (sourcesDeleted()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'advance' on 'IDBCursor': The cursor's source or effective object store has been deleted.");
- return;
- }
</del><ins>+ if (!count)
+ return Exception { TypeError, ASCIILiteral("Failed to execute 'advance' on 'IDBCursor': A count argument with value 0 (zero) was supplied, must be greater than 0.") };
</ins><span class="cx">
</span><del>- if (!transaction().isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- ec.message = ASCIILiteral("Failed to execute 'advance' on 'IDBCursor': The transaction is inactive or finished.");
- return;
- }
</del><ins>+ if (sourcesDeleted())
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'advance' on 'IDBCursor': The cursor's source or effective object store has been deleted.") };
</ins><span class="cx">
</span><del>- if (!m_gotValue) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'advance' on 'IDBCursor': The cursor is being iterated or has iterated past its end.");
- return;
- }
</del><ins>+ if (!transaction().isActive())
+ return Exception { IDBDatabaseException::TransactionInactiveError, ASCIILiteral("Failed to execute 'advance' on 'IDBCursor': The transaction is inactive or finished.") };
</ins><span class="cx">
</span><ins>+ if (!m_gotValue)
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'advance' on 'IDBCursor': The cursor is being iterated or has iterated past its end.") };
+
</ins><span class="cx"> m_gotValue = false;
</span><span class="cx">
</span><span class="cx"> uncheckedIterateCursor(IDBKeyData(), count);
</span><ins>+
+ return { };
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void IDBCursor::continueFunction(ExecState& execState, JSValue keyValue, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<void> IDBCursor::continueFunction(ExecState& execState, JSValue keyValue)
</ins><span class="cx"> {
</span><span class="cx"> RefPtr<IDBKey> key;
</span><span class="cx"> if (!keyValue.isUndefined())
</span><span class="cx"> key = scriptValueToIDBKey(execState, keyValue);
</span><span class="cx">
</span><del>- continueFunction(key.get(), ec);
</del><ins>+ return continueFunction(key.get());
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void IDBCursor::continueFunction(const IDBKeyData& key, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<void> IDBCursor::continueFunction(const IDBKeyData& key)
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBCursor::continueFunction (to key %s)", key.loggingString().utf8().data());
</span><span class="cx"> ASSERT(currentThread() == effectiveObjectStore().transaction().database().originThreadID());
</span><span class="cx">
</span><del>- if (!m_request) {
- ec.code = IDBDatabaseException::InvalidStateError;
- return;
- }
</del><ins>+ if (!m_request)
+ return Exception { IDBDatabaseException::InvalidStateError };
</ins><span class="cx">
</span><del>- if (sourcesDeleted()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'continue' on 'IDBCursor': The cursor's source or effective object store has been deleted.");
- return;
- }
</del><ins>+ if (sourcesDeleted())
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'continue' on 'IDBCursor': The cursor's source or effective object store has been deleted.") };
</ins><span class="cx">
</span><del>- if (!transaction().isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- ec.message = ASCIILiteral("Failed to execute 'continue' on 'IDBCursor': The transaction is inactive or finished.");
- return;
- }
</del><ins>+ if (!transaction().isActive())
+ return Exception { IDBDatabaseException::TransactionInactiveError, ASCIILiteral("Failed to execute 'continue' on 'IDBCursor': The transaction is inactive or finished.") };
</ins><span class="cx">
</span><del>- if (!m_gotValue) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'continue' on 'IDBCursor': The cursor is being iterated or has iterated past its end.");
- return;
- }
</del><ins>+ if (!m_gotValue)
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'continue' on 'IDBCursor': The cursor is being iterated or has iterated past its end.") };
</ins><span class="cx">
</span><del>- if (!key.isNull() && !key.isValid()) {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to execute 'continue' on 'IDBCursor': The parameter is not a valid key.");
- return;
- }
</del><ins>+ if (!key.isNull() && !key.isValid())
+ return Exception { IDBDatabaseException::DataError, ASCIILiteral("Failed to execute 'continue' on 'IDBCursor': The parameter is not a valid key.") };
</ins><span class="cx">
</span><span class="cx"> if (m_info.isDirectionForward()) {
</span><del>- if (!key.isNull() && key.compare(m_currentKeyData) <= 0) {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to execute 'continue' on 'IDBCursor': The parameter is less than or equal to this cursor's position.");
- return;
- }
- } else if (!key.isNull() && key.compare(m_currentKeyData) >= 0) {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to execute 'continue' on 'IDBCursor': The parameter is greater than or equal to this cursor's position.");
- return;
</del><ins>+ if (!key.isNull() && key.compare(m_currentKeyData) <= 0)
+ return Exception { IDBDatabaseException::DataError, ASCIILiteral("Failed to execute 'continue' on 'IDBCursor': The parameter is less than or equal to this cursor's position.") };
+ } else {
+ if (!key.isNull() && key.compare(m_currentKeyData) >= 0)
+ return Exception { IDBDatabaseException::DataError, ASCIILiteral("Failed to execute 'continue' on 'IDBCursor': The parameter is greater than or equal to this cursor's position.") };
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> m_gotValue = false;
</span><span class="cx">
</span><span class="cx"> uncheckedIterateCursor(key, 0);
</span><ins>+
+ return { };
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void IDBCursor::uncheckedIterateCursor(const IDBKeyData& key, unsigned count)
</span><span class="lines">@@ -337,50 +290,35 @@
</span><span class="cx"> transaction().iterateCursor(*this, key, count);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<WebCore::IDBRequest> IDBCursor::deleteFunction(ExecState& execState, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<WebCore::IDBRequest>> IDBCursor::deleteFunction(ExecState& state)
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBCursor::deleteFunction");
</span><span class="cx"> ASSERT(currentThread() == effectiveObjectStore().transaction().database().originThreadID());
</span><span class="cx">
</span><del>- if (sourcesDeleted()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'delete' on 'IDBCursor': The cursor's source or effective object store has been deleted.");
- return nullptr;
- }
</del><ins>+ if (sourcesDeleted())
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'delete' on 'IDBCursor': The cursor's source or effective object store has been deleted.") };
</ins><span class="cx">
</span><del>- if (!transaction().isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- ec.message = ASCIILiteral("Failed to execute 'delete' on 'IDBCursor': The transaction is inactive or finished.");
- return nullptr;
- }
</del><ins>+ if (!transaction().isActive())
+ return Exception { IDBDatabaseException::TransactionInactiveError, ASCIILiteral("Failed to execute 'delete' on 'IDBCursor': The transaction is inactive or finished.") };
</ins><span class="cx">
</span><del>- if (transaction().isReadOnly()) {
- ec.code = IDBDatabaseException::ReadOnlyError;
- ec.message = ASCIILiteral("Failed to execute 'delete' on 'IDBCursor': The record may not be deleted inside a read-only transaction.");
- return nullptr;
- }
</del><ins>+ if (transaction().isReadOnly())
+ return Exception { IDBDatabaseException::ReadOnlyError, ASCIILiteral("Failed to execute 'delete' on 'IDBCursor': The record may not be deleted inside a read-only transaction.") };
</ins><span class="cx">
</span><del>- if (!m_gotValue) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'delete' on 'IDBCursor': The cursor is being iterated or has iterated past its end.");
- return nullptr;
- }
</del><ins>+ if (!m_gotValue)
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'delete' on 'IDBCursor': The cursor is being iterated or has iterated past its end.") };
</ins><span class="cx">
</span><del>- if (!isKeyCursorWithValue()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'delete' on 'IDBCursor': The cursor is a key cursor.");
- return nullptr;
- }
</del><ins>+ if (!isKeyCursorWithValue())
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'delete' on 'IDBCursor': The cursor is a key cursor.") };
</ins><span class="cx">
</span><del>- auto request = effectiveObjectStore().deleteFunction(execState, m_currentPrimaryKey.get(), ec);
- if (ec.code)
- return nullptr;
</del><ins>+ auto result = effectiveObjectStore().deleteFunction(state, m_currentPrimaryKey.get());
+ if (result.hasException())
+ return result.releaseException();
</ins><span class="cx">
</span><del>- ASSERT(request);
</del><ins>+ auto request = result.releaseReturnValue();
</ins><span class="cx"> request->setSource(*this);
</span><span class="cx"> ++m_outstandingRequestCount;
</span><span class="cx">
</span><del>- return request;
</del><ins>+ return WTFMove(request);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void IDBCursor::setGetResult(IDBRequest& request, const IDBGetResult& getResult)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBCursorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursor.h (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBCursor.h        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursor.h        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx">
</span><span class="cx"> #include "ActiveDOMObject.h"
</span><span class="cx"> #include "DOMWrapperWorld.h"
</span><ins>+#include "ExceptionOr.h"
</ins><span class="cx"> #include "IDBCursorInfo.h"
</span><span class="cx"> #include <heap/Strong.h>
</span><span class="cx">
</span><span class="lines">@@ -39,8 +40,6 @@
</span><span class="cx"> class IDBObjectStore;
</span><span class="cx"> class IDBTransaction;
</span><span class="cx">
</span><del>-struct ExceptionCodeWithMessage;
-
</del><span class="cx"> class IDBCursor : public ScriptWrappable, public RefCounted<IDBCursor>, public ActiveDOMObject {
</span><span class="cx"> public:
</span><span class="cx"> static Ref<IDBCursor> create(IDBTransaction&, IDBIndex&, const IDBCursorInfo&);
</span><span class="lines">@@ -50,7 +49,7 @@
</span><span class="cx"> static const AtomicString& directionPrev();
</span><span class="cx"> static const AtomicString& directionPrevUnique();
</span><span class="cx">
</span><del>- static IndexedDB::CursorDirection stringToDirection(const String& modeString, ExceptionCode&);
</del><ins>+ static Optional<IndexedDB::CursorDirection> stringToDirection(const String& modeString);
</ins><span class="cx"> static const AtomicString& directionToString(IndexedDB::CursorDirection mode);
</span><span class="cx">
</span><span class="cx"> virtual ~IDBCursor();
</span><span class="lines">@@ -62,12 +61,12 @@
</span><span class="cx"> IDBObjectStore* objectStore() const { return m_objectStore.get(); }
</span><span class="cx"> IDBIndex* index() const { return m_index.get(); }
</span><span class="cx">
</span><del>- RefPtr<IDBRequest> update(JSC::ExecState&, JSC::JSValue, ExceptionCodeWithMessage&);
- void advance(unsigned, ExceptionCodeWithMessage&);
- void continueFunction(JSC::ExecState&, JSC::JSValue key, ExceptionCodeWithMessage&);
- RefPtr<IDBRequest> deleteFunction(JSC::ExecState&, ExceptionCodeWithMessage&);
</del><ins>+ ExceptionOr<Ref<IDBRequest>> update(JSC::ExecState&, JSC::JSValue);
+ ExceptionOr<void> advance(unsigned);
+ ExceptionOr<void> continueFunction(JSC::ExecState&, JSC::JSValue key);
+ ExceptionOr<Ref<IDBRequest>> deleteFunction(JSC::ExecState&);
</ins><span class="cx">
</span><del>- void continueFunction(const IDBKeyData&, ExceptionCodeWithMessage&);
</del><ins>+ ExceptionOr<void> continueFunction(const IDBKeyData&);
</ins><span class="cx">
</span><span class="cx"> const IDBCursorInfo& info() const { return m_info; }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBCursoridl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursor.idl (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBCursor.idl        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursor.idl        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -24,12 +24,12 @@
</span><span class="cx"> */
</span><span class="cx">
</span><span class="cx"> [
</span><ins>+ ActiveDOMObject,
</ins><span class="cx"> Conditional=INDEXED_DATABASE,
</span><span class="cx"> CustomToJSObject,
</span><span class="cx"> EnabledAtRuntime=IndexedDB,
</span><del>- ActiveDOMObject,
</del><ins>+ JSCustomMarkFunction,
</ins><span class="cx"> SkipVTableValidation,
</span><del>- JSCustomMarkFunction,
</del><span class="cx"> ] interface IDBCursor {
</span><span class="cx"> [CustomGetter] readonly attribute any source;
</span><span class="cx"> readonly attribute DOMString direction;
</span><span class="lines">@@ -36,8 +36,8 @@
</span><span class="cx"> readonly attribute any key;
</span><span class="cx"> readonly attribute any primaryKey;
</span><span class="cx">
</span><del>- [CallWith=ScriptState, MayThrowLegacyExceptionWithMessage] IDBRequest update(any value);
- [MayThrowLegacyExceptionWithMessage] void advance([EnforceRange] unsigned long count);
- [CallWith=ScriptState, ImplementedAs=continueFunction, MayThrowLegacyExceptionWithMessage] void continue(optional any key);
- [CallWith=ScriptState, ImplementedAs=deleteFunction, MayThrowLegacyExceptionWithMessage] IDBRequest delete();
</del><ins>+ [CallWith=ScriptState, MayThrowException] IDBRequest update(any value);
+ [MayThrowException] void advance([EnforceRange] unsigned long count);
+ [CallWith=ScriptState, ImplementedAs=continueFunction, MayThrowException] void continue(optional any key);
+ [CallWith=ScriptState, ImplementedAs=deleteFunction, MayThrowException] IDBRequest delete();
</ins><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBDatabasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -106,13 +106,13 @@
</span><span class="cx"> return objectStoreNames;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<WebCore::IDBObjectStore> IDBDatabase::createObjectStore(const String&, const Dictionary&, ExceptionCodeWithMessage&)
</del><ins>+ExceptionOr<Ref<IDBObjectStore>> IDBDatabase::createObjectStore(const String&, const Dictionary&)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT_NOT_REACHED();
</span><del>- return nullptr;
</del><ins>+ return Exception { IDBDatabaseException::InvalidStateError };
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<WebCore::IDBObjectStore> IDBDatabase::createObjectStore(const String& name, const IDBKeyPath& keyPath, bool autoIncrement, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBObjectStore>> IDBDatabase::createObjectStore(const String& name, const IDBKeyPath& keyPath, bool autoIncrement)
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBDatabase::createObjectStore - (%s %s)", m_info.name().utf8().data(), name.utf8().data());
</span><span class="cx">
</span><span class="lines">@@ -119,132 +119,94 @@
</span><span class="cx"> ASSERT(currentThread() == originThreadID());
</span><span class="cx"> ASSERT(!m_versionChangeTransaction || m_versionChangeTransaction->isVersionChange());
</span><span class="cx">
</span><del>- if (!m_versionChangeTransaction) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'createObjectStore' on 'IDBDatabase': The database is not running a version change transaction.");
- return nullptr;
- }
</del><ins>+ if (!m_versionChangeTransaction)
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'createObjectStore' on 'IDBDatabase': The database is not running a version change transaction.") };
</ins><span class="cx">
</span><del>- if (!m_versionChangeTransaction->isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- return nullptr;
- }
</del><ins>+ if (!m_versionChangeTransaction->isActive())
+ return Exception { IDBDatabaseException::TransactionInactiveError };
</ins><span class="cx">
</span><del>- if (m_info.hasObjectStore(name)) {
- ec.code = IDBDatabaseException::ConstraintError;
- ec.message = ASCIILiteral("Failed to execute 'createObjectStore' on 'IDBDatabase': An object store with the specified name already exists.");
- return nullptr;
- }
</del><ins>+ if (m_info.hasObjectStore(name))
+ return Exception { IDBDatabaseException::ConstraintError, ASCIILiteral("Failed to execute 'createObjectStore' on 'IDBDatabase': An object store with the specified name already exists.") };
</ins><span class="cx">
</span><del>- if (!keyPath.isNull() && !keyPath.isValid()) {
- ec.code = IDBDatabaseException::SyntaxError;
- ec.message = ASCIILiteral("Failed to execute 'createObjectStore' on 'IDBDatabase': The keyPath option is not a valid key path.");
- return nullptr;
- }
</del><ins>+ if (!keyPath.isNull() && !keyPath.isValid())
+ return Exception { IDBDatabaseException::SyntaxError, ASCIILiteral("Failed to execute 'createObjectStore' on 'IDBDatabase': The keyPath option is not a valid key path.") };
</ins><span class="cx">
</span><del>- if (autoIncrement && !keyPath.isNull()) {
- if ((keyPath.type() == IDBKeyPath::Type::String && keyPath.string().isEmpty()) || keyPath.type() == IDBKeyPath::Type::Array) {
- ec.code = IDBDatabaseException::InvalidAccessError;
- ec.message = ASCIILiteral("Failed to execute 'createObjectStore' on 'IDBDatabase': The autoIncrement option was set but the keyPath option was empty or an array.");
- return nullptr;
- }
- }
</del><ins>+ if (autoIncrement && ((keyPath.type() == IDBKeyPath::Type::String && keyPath.string().isEmpty()) || keyPath.type() == IDBKeyPath::Type::Array))
+ return Exception { IDBDatabaseException::InvalidAccessError, ASCIILiteral("Failed to execute 'createObjectStore' on 'IDBDatabase': The autoIncrement option was set but the keyPath option was empty or an array.") };
</ins><span class="cx">
</span><span class="cx"> // Install the new ObjectStore into the connection's metadata.
</span><del>- IDBObjectStoreInfo info = m_info.createNewObjectStore(name, keyPath, autoIncrement);
</del><ins>+ auto info = m_info.createNewObjectStore(name, keyPath, autoIncrement);
</ins><span class="cx">
</span><span class="cx"> // Create the actual IDBObjectStore from the transaction, which also schedules the operation server side.
</span><del>- Ref<IDBObjectStore> objectStore = m_versionChangeTransaction->createObjectStore(info);
- return adoptRef(&objectStore.leakRef());
</del><ins>+ return m_versionChangeTransaction->createObjectStore(info);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<WebCore::IDBTransaction> IDBDatabase::transaction(const Vector<String>& objectStores, const String& modeString, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBTransaction>> IDBDatabase::transaction(const Vector<String>& objectStores, const String& modeString)
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBDatabase::transaction");
</span><span class="cx">
</span><span class="cx"> ASSERT(currentThread() == originThreadID());
</span><span class="cx">
</span><del>- if (m_closePending) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'transaction' on 'IDBDatabase': The database connection is closing.");
- return nullptr;
- }
</del><ins>+ if (m_closePending)
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'transaction' on 'IDBDatabase': The database connection is closing.") };
</ins><span class="cx">
</span><del>- if (objectStores.isEmpty()) {
- ec.code = IDBDatabaseException::InvalidAccessError;
- ec.message = ASCIILiteral("Failed to execute 'transaction' on 'IDBDatabase': The storeNames parameter was empty.");
- return nullptr;
- }
</del><ins>+ if (objectStores.isEmpty())
+ return Exception { IDBDatabaseException::InvalidAccessError, ASCIILiteral("Failed to execute 'transaction' on 'IDBDatabase': The storeNames parameter was empty.") };
</ins><span class="cx">
</span><del>- IndexedDB::TransactionMode mode = IDBTransaction::stringToMode(modeString, ec.code);
- if (ec.code) {
- ec.message = makeString(ASCIILiteral("Failed to execute 'transaction' on 'IDBDatabase': The mode provided ('"), modeString, ASCIILiteral("') is not one of 'readonly' or 'readwrite'."));
- return nullptr;
- }
</del><ins>+ auto mode = IDBTransaction::stringToMode(modeString);
+ if (!mode)
+ return Exception { TypeError, "Failed to execute 'transaction' on 'IDBDatabase': The mode provided ('" + modeString + "') is not one of 'readonly' or 'readwrite'." };
</ins><span class="cx">
</span><del>- if (mode != IndexedDB::TransactionMode::ReadOnly && mode != IndexedDB::TransactionMode::ReadWrite) {
- ec.code = TypeError;
- return nullptr;
- }
</del><ins>+ if (mode.value() != IndexedDB::TransactionMode::ReadOnly && mode.value() != IndexedDB::TransactionMode::ReadWrite)
+ return Exception { TypeError };
</ins><span class="cx">
</span><del>- if (m_versionChangeTransaction && !m_versionChangeTransaction->isFinishedOrFinishing()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'transaction' on 'IDBDatabase': A version change transaction is running.");
- return nullptr;
- }
</del><ins>+ if (m_versionChangeTransaction && !m_versionChangeTransaction->isFinishedOrFinishing())
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'transaction' on 'IDBDatabase': A version change transaction is running.") };
</ins><span class="cx">
</span><span class="cx"> for (auto& objectStoreName : objectStores) {
</span><span class="cx"> if (m_info.hasObjectStore(objectStoreName))
</span><span class="cx"> continue;
</span><del>- ec.code = IDBDatabaseException::NotFoundError;
- ec.message = ASCIILiteral("Failed to execute 'transaction' on 'IDBDatabase': One of the specified object stores was not found.");
- return nullptr;
</del><ins>+ return Exception { IDBDatabaseException::NotFoundError, ASCIILiteral("Failed to execute 'transaction' on 'IDBDatabase': One of the specified object stores was not found.") };
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- auto info = IDBTransactionInfo::clientTransaction(m_connectionProxy.get(), objectStores, mode);
</del><ins>+ auto info = IDBTransactionInfo::clientTransaction(m_connectionProxy.get(), objectStores, mode.value());
</ins><span class="cx"> auto transaction = IDBTransaction::create(*this, info);
</span><span class="cx">
</span><span class="cx"> LOG(IndexedDB, "IDBDatabase::transaction - Added active transaction %s", info.identifier().loggingString().utf8().data());
</span><span class="cx">
</span><del>- m_activeTransactions.set(info.identifier(), &transaction.get());
</del><ins>+ m_activeTransactions.set(info.identifier(), transaction.ptr());
</ins><span class="cx">
</span><del>- return adoptRef(&transaction.leakRef());
</del><ins>+ return WTFMove(transaction);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<WebCore::IDBTransaction> IDBDatabase::transaction(const String& objectStore, const String& mode, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBTransaction>> IDBDatabase::transaction(const String& objectStore, const String& mode)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(currentThread() == originThreadID());
</span><span class="cx">
</span><span class="cx"> Vector<String> objectStores(1);
</span><span class="cx"> objectStores[0] = objectStore;
</span><del>- return transaction(objectStores, mode, ec);
</del><ins>+ return transaction(objectStores, mode);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void IDBDatabase::deleteObjectStore(const String& objectStoreName, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<void> IDBDatabase::deleteObjectStore(const String& objectStoreName)
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBDatabase::deleteObjectStore");
</span><span class="cx">
</span><span class="cx"> ASSERT(currentThread() == originThreadID());
</span><span class="cx">
</span><del>- if (!m_versionChangeTransaction) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'deleteObjectStore' on 'IDBDatabase': The database is not running a version change transaction.");
- return;
- }
</del><ins>+ if (!m_versionChangeTransaction)
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'deleteObjectStore' on 'IDBDatabase': The database is not running a version change transaction.") };
</ins><span class="cx">
</span><del>- if (!m_versionChangeTransaction->isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- return;
- }
</del><ins>+ if (!m_versionChangeTransaction->isActive())
+ return Exception { IDBDatabaseException::TransactionInactiveError };
</ins><span class="cx">
</span><del>- if (!m_info.hasObjectStore(objectStoreName)) {
- ec.code = IDBDatabaseException::NotFoundError;
- ec.message = ASCIILiteral("Failed to execute 'deleteObjectStore' on 'IDBDatabase': The specified object store was not found.");
- return;
- }
</del><ins>+ if (!m_info.hasObjectStore(objectStoreName))
+ return Exception { IDBDatabaseException::NotFoundError, ASCIILiteral("Failed to execute 'deleteObjectStore' on 'IDBDatabase': The specified object store was not found.") };
</ins><span class="cx">
</span><span class="cx"> m_info.deleteObjectStore(objectStoreName);
</span><span class="cx"> m_versionChangeTransaction->deleteObjectStore(objectStoreName);
</span><ins>+
+ return { };
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void IDBDatabase::close()
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBDatabaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.h (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.h        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.h        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -55,11 +55,11 @@
</span><span class="cx"> uint64_t version() const;
</span><span class="cx"> RefPtr<DOMStringList> objectStoreNames() const;
</span><span class="cx">
</span><del>- RefPtr<IDBObjectStore> createObjectStore(const String& name, const Dictionary&, ExceptionCodeWithMessage&);
- RefPtr<IDBObjectStore> createObjectStore(const String& name, const IDBKeyPath&, bool autoIncrement, ExceptionCodeWithMessage&);
- RefPtr<IDBTransaction> transaction(const Vector<String>&, const String& mode, ExceptionCodeWithMessage&);
- RefPtr<IDBTransaction> transaction(const String&, const String& mode, ExceptionCodeWithMessage&);
- void deleteObjectStore(const String& name, ExceptionCodeWithMessage&);
</del><ins>+ ExceptionOr<Ref<IDBObjectStore>> createObjectStore(const String& name, const Dictionary&);
+ ExceptionOr<Ref<IDBObjectStore>> createObjectStore(const String& name, const IDBKeyPath&, bool autoIncrement);
+ ExceptionOr<Ref<IDBTransaction>> transaction(const Vector<String>&, const String& mode);
+ ExceptionOr<Ref<IDBTransaction>> transaction(const String&, const String& mode);
+ ExceptionOr<void> deleteObjectStore(const String& name);
</ins><span class="cx"> void close();
</span><span class="cx">
</span><span class="cx"> // EventTarget
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBDatabaseidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.idl (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.idl        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.idl        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -34,13 +34,13 @@
</span><span class="cx"> readonly attribute unsigned long long version;
</span><span class="cx"> readonly attribute DOMStringList objectStoreNames;
</span><span class="cx">
</span><del>- [Custom, MayThrowLegacyExceptionWithMessage] IDBObjectStore createObjectStore(DOMString name, optional Dictionary options);
- [MayThrowLegacyExceptionWithMessage] void deleteObjectStore(DOMString name);
- [MayThrowLegacyExceptionWithMessage] IDBTransaction transaction(DOMString storeName, optional DOMString mode = "readonly");
- [MayThrowLegacyExceptionWithMessage] IDBTransaction transaction(sequence<DOMString> storeNames, optional DOMString mode = "readonly");
</del><ins>+ [Custom, MayThrowException] IDBObjectStore createObjectStore(DOMString name, optional Dictionary options);
+ [MayThrowException] void deleteObjectStore(DOMString name);
+ [MayThrowException] IDBTransaction transaction(DOMString storeName, optional DOMString mode = "readonly");
+ [MayThrowException] IDBTransaction transaction(sequence<DOMString> storeNames, optional DOMString mode = "readonly");
</ins><span class="cx"> // FIXME: This is not part of the spec, but is needed for compatibility.
</span><span class="cx"> // See https://github.com/w3c/IndexedDB/issues/85
</span><del>- [MayThrowLegacyExceptionWithMessage] IDBTransaction transaction(DOMStringList storeNames, optional DOMString mode = "readonly");
</del><ins>+ [MayThrowException] IDBTransaction transaction(DOMStringList storeNames, optional DOMString mode = "readonly");
</ins><span class="cx"> void close();
</span><span class="cx">
</span><span class="cx"> attribute EventHandler onabort;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBFactorycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -76,82 +76,59 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBOpenDBRequest> IDBFactory::open(ScriptExecutionContext& context, const String& name, Optional<uint64_t> version, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBOpenDBRequest>> IDBFactory::open(ScriptExecutionContext& context, const String& name, Optional<uint64_t> version)
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBFactory::open");
</span><span class="cx">
</span><del>- if (version && !version.value()) {
- ec.code = TypeError;
- ec.message = ASCIILiteral("IDBFactory.open() called with a version of 0");
- return nullptr;
- }
</del><ins>+ if (version && !version.value())
+ return Exception { TypeError, ASCIILiteral("IDBFactory.open() called with a version of 0") };
</ins><span class="cx">
</span><del>- return openInternal(context, name, version.valueOr(0), ec);
</del><ins>+ return openInternal(context, name, version.valueOr(0));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBOpenDBRequest> IDBFactory::openInternal(ScriptExecutionContext& context, const String& name, unsigned long long version, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBOpenDBRequest>> IDBFactory::openInternal(ScriptExecutionContext& context, const String& name, unsigned long long version)
</ins><span class="cx"> {
</span><del>- if (name.isNull()) {
- ec.code = TypeError;
- ec.message = ASCIILiteral("IDBFactory.open() called without a database name");
- return nullptr;
- }
</del><ins>+ if (name.isNull())
+ return Exception { TypeError, ASCIILiteral("IDBFactory.open() called without a database name") };
</ins><span class="cx">
</span><del>- if (shouldThrowSecurityException(context)) {
- ec.code = SECURITY_ERR;
- ec.message = ASCIILiteral("IDBFactory.open() called in an invalid security context");
- return nullptr;
- }
</del><ins>+ if (shouldThrowSecurityException(context))
+ return Exception { SECURITY_ERR, ASCIILiteral("IDBFactory.open() called in an invalid security context") };
</ins><span class="cx">
</span><span class="cx"> ASSERT(context.securityOrigin());
</span><span class="cx"> ASSERT(context.topOrigin());
</span><span class="cx"> IDBDatabaseIdentifier databaseIdentifier(name, *context.securityOrigin(), *context.topOrigin());
</span><del>- if (!databaseIdentifier.isValid()) {
- ec.code = TypeError;
- ec.message = ASCIILiteral("IDBFactory.open() called with an invalid security origin");
- return nullptr;
- }
</del><ins>+ if (!databaseIdentifier.isValid())
+ return Exception { TypeError, ASCIILiteral("IDBFactory.open() called with an invalid security origin") };
</ins><span class="cx">
</span><span class="cx"> return m_connectionProxy->openDatabase(context, databaseIdentifier, version);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBOpenDBRequest> IDBFactory::deleteDatabase(ScriptExecutionContext& context, const String& name, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBOpenDBRequest>> IDBFactory::deleteDatabase(ScriptExecutionContext& context, const String& name)
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBFactory::deleteDatabase - %s", name.utf8().data());
</span><span class="cx">
</span><del>- if (name.isNull()) {
- ec.code = TypeError;
- ec.message = ASCIILiteral("IDBFactory.deleteDatabase() called without a database name");
- }
-
- if (shouldThrowSecurityException(context)) {
- ec.code = SECURITY_ERR;
- ec.message = ASCIILiteral("IDBFactory.deleteDatabase() called in an invalid security context");
- return nullptr;
- }
</del><ins>+ if (name.isNull())
+ return Exception { TypeError, ASCIILiteral("IDBFactory.deleteDatabase() called without a database name") };
</ins><span class="cx">
</span><ins>+ if (shouldThrowSecurityException(context))
+ return Exception { SECURITY_ERR, ASCIILiteral("IDBFactory.deleteDatabase() called in an invalid security context") };
+
</ins><span class="cx"> ASSERT(context.securityOrigin());
</span><span class="cx"> ASSERT(context.topOrigin());
</span><span class="cx"> IDBDatabaseIdentifier databaseIdentifier(name, *context.securityOrigin(), *context.topOrigin());
</span><del>- if (!databaseIdentifier.isValid()) {
- ec.code = TypeError;
- ec.message = ASCIILiteral("IDBFactory.deleteDatabase() called with an invalid security origin");
- return nullptr;
- }
</del><ins>+ if (!databaseIdentifier.isValid())
+ return Exception { TypeError, ASCIILiteral("IDBFactory.deleteDatabase() called with an invalid security origin") };
</ins><span class="cx">
</span><span class="cx"> return m_connectionProxy->deleteDatabase(context, databaseIdentifier);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-short IDBFactory::cmp(ExecState& execState, JSValue firstValue, JSValue secondValue, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<short> IDBFactory::cmp(ExecState& execState, JSValue firstValue, JSValue secondValue)
</ins><span class="cx"> {
</span><del>- Ref<IDBKey> first = scriptValueToIDBKey(execState, firstValue);
- Ref<IDBKey> second = scriptValueToIDBKey(execState, secondValue);
</del><ins>+ auto first = scriptValueToIDBKey(execState, firstValue);
+ auto second = scriptValueToIDBKey(execState, secondValue);
</ins><span class="cx">
</span><del>- if (!first->isValid() || !second->isValid()) {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to execute 'cmp' on 'IDBFactory': The parameter is not a valid key.");
- return 0;
- }
</del><ins>+ if (!first->isValid() || !second->isValid())
+ return Exception { IDBDatabaseException::DataError, ASCIILiteral("Failed to execute 'cmp' on 'IDBFactory': The parameter is not a valid key.") };
</ins><span class="cx">
</span><span class="cx"> return first->compare(second.get());
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBFactoryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBFactory.h (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBFactory.h        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBFactory.h        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><ins>+#include "ExceptionOr.h"
</ins><span class="cx"> #include <functional>
</span><span class="cx"> #include <wtf/Forward.h>
</span><span class="cx"> #include <wtf/Ref.h>
</span><span class="lines">@@ -44,8 +45,6 @@
</span><span class="cx"> class ScriptExecutionContext;
</span><span class="cx"> class SecurityOrigin;
</span><span class="cx">
</span><del>-struct ExceptionCodeWithMessage;
-
</del><span class="cx"> namespace IDBClient {
</span><span class="cx"> class IDBConnectionProxy;
</span><span class="cx"> }
</span><span class="lines">@@ -57,10 +56,10 @@
</span><span class="cx"> static Ref<IDBFactory> create(IDBClient::IDBConnectionProxy&);
</span><span class="cx"> ~IDBFactory();
</span><span class="cx">
</span><del>- RefPtr<IDBOpenDBRequest> open(ScriptExecutionContext&, const String& name, Optional<uint64_t> version, ExceptionCodeWithMessage&);
- RefPtr<IDBOpenDBRequest> deleteDatabase(ScriptExecutionContext&, const String& name, ExceptionCodeWithMessage&);
</del><ins>+ ExceptionOr<Ref<IDBOpenDBRequest>> open(ScriptExecutionContext&, const String& name, Optional<uint64_t> version);
+ ExceptionOr<Ref<IDBOpenDBRequest>> deleteDatabase(ScriptExecutionContext&, const String& name);
</ins><span class="cx">
</span><del>- short cmp(JSC::ExecState&, JSC::JSValue first, JSC::JSValue second, ExceptionCodeWithMessage&);
</del><ins>+ ExceptionOr<short> cmp(JSC::ExecState&, JSC::JSValue first, JSC::JSValue second);
</ins><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT void getAllDatabaseNames(const SecurityOrigin& mainFrameOrigin, const SecurityOrigin& openingOrigin, std::function<void (const Vector<String>&)>);
</span><span class="cx">
</span><span class="lines">@@ -67,7 +66,7 @@
</span><span class="cx"> private:
</span><span class="cx"> explicit IDBFactory(IDBClient::IDBConnectionProxy&);
</span><span class="cx">
</span><del>- RefPtr<IDBOpenDBRequest> openInternal(ScriptExecutionContext&, const String& name, unsigned long long version, ExceptionCodeWithMessage&);
</del><ins>+ ExceptionOr<Ref<IDBOpenDBRequest>> openInternal(ScriptExecutionContext&, const String& name, unsigned long long version);
</ins><span class="cx">
</span><span class="cx"> Ref<IDBClient::IDBConnectionProxy> m_connectionProxy;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBFactoryidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBFactory.idl (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBFactory.idl        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBFactory.idl        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -28,8 +28,7 @@
</span><span class="cx"> EnabledAtRuntime=IndexedDB,
</span><span class="cx"> SkipVTableValidation,
</span><span class="cx"> ] interface IDBFactory {
</span><del>- [CallWith=ScriptExecutionContext, MayThrowLegacyExceptionWithMessage] IDBOpenDBRequest open(DOMString name, [EnforceRange] optional unsigned long long version);
- [CallWith=ScriptExecutionContext, MayThrowLegacyExceptionWithMessage] IDBOpenDBRequest deleteDatabase(DOMString name);
- [CallWith=ScriptState, MayThrowLegacyExceptionWithMessage] short cmp(any first, any second);
</del><ins>+ [CallWith=ScriptExecutionContext, MayThrowException] IDBOpenDBRequest open(DOMString name, [EnforceRange] optional unsigned long long version);
+ [CallWith=ScriptExecutionContext, MayThrowException] IDBOpenDBRequest deleteDatabase(DOMString name);
+ [CallWith=ScriptState, MayThrowException] short cmp(any first, any second);
</ins><span class="cx"> };
</span><del>-
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBIndexcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -102,28 +102,20 @@
</span><span class="cx"> return m_info.multiEntry();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBRequest> IDBIndex::openCursor(ExecState& execState, IDBKeyRange* range, const String& directionString, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBRequest>> IDBIndex::openCursor(ExecState& execState, IDBKeyRange* range, const String& directionString)
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBIndex::openCursor");
</span><span class="cx"> ASSERT(currentThread() == m_objectStore.transaction().database().originThreadID());
</span><span class="cx">
</span><del>- if (m_deleted || m_objectStore.isDeleted()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'openCursor' on 'IDBIndex': The index or its object store has been deleted.");
- return nullptr;
- }
</del><ins>+ if (m_deleted || m_objectStore.isDeleted())
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'openCursor' on 'IDBIndex': The index or its object store has been deleted.") };
</ins><span class="cx">
</span><del>- if (!m_objectStore.transaction().isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- ec.message = ASCIILiteral("Failed to execute 'openCursor' on 'IDBIndex': The transaction is inactive or finished.");
- return nullptr;
- }
</del><ins>+ if (!m_objectStore.transaction().isActive())
+ return Exception { IDBDatabaseException::TransactionInactiveError, ASCIILiteral("Failed to execute 'openCursor' on 'IDBIndex': The transaction is inactive or finished.") };
</ins><span class="cx">
</span><del>- IndexedDB::CursorDirection direction = IDBCursor::stringToDirection(directionString, ec.code);
- if (ec.code) {
- ec.message = ASCIILiteral("Failed to execute 'openCursor' on 'IDBIndex': The direction provided ('invalid-direction') is not one of 'next', 'nextunique', 'prev', or 'prevunique'.");
- return nullptr;
- }
</del><ins>+ auto direction = IDBCursor::stringToDirection(directionString);
+ if (!direction)
+ return Exception { TypeError, ASCIILiteral("Failed to execute 'openCursor' on 'IDBIndex': The direction provided ('invalid-direction') is not one of 'next', 'nextunique', 'prev', or 'prevunique'.") };
</ins><span class="cx">
</span><span class="cx"> IDBKeyRangeData rangeData = range;
</span><span class="cx"> if (rangeData.lowerKey.isNull())
</span><span class="lines">@@ -131,196 +123,152 @@
</span><span class="cx"> if (rangeData.upperKey.isNull())
</span><span class="cx"> rangeData.upperKey = IDBKeyData::maximum();
</span><span class="cx">
</span><del>- auto info = IDBCursorInfo::indexCursor(m_objectStore.transaction(), m_objectStore.info().identifier(), m_info.identifier(), rangeData, direction, IndexedDB::CursorType::KeyAndValue);
</del><ins>+ auto info = IDBCursorInfo::indexCursor(m_objectStore.transaction(), m_objectStore.info().identifier(), m_info.identifier(), rangeData, direction.value(), IndexedDB::CursorType::KeyAndValue);
</ins><span class="cx"> return m_objectStore.transaction().requestOpenCursor(execState, *this, info);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBRequest> IDBIndex::openCursor(ExecState& execState, JSValue key, const String& direction, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBRequest>> IDBIndex::openCursor(ExecState& execState, JSValue key, const String& direction)
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBIndex::openCursor");
</span><span class="cx"> ASSERT(currentThread() == m_objectStore.transaction().database().originThreadID());
</span><span class="cx">
</span><del>- RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(execState, key, ec.code);
- if (ec.code) {
- ec.message = ASCIILiteral("Failed to execute 'openCursor' on 'IDBIndex': The parameter is not a valid key.");
- return nullptr;
- }
</del><ins>+ auto keyRange = IDBKeyRange::only(execState, key);
+ if (keyRange.hasException())
+ return Exception { IDBDatabaseException::DataError, ASCIILiteral("Failed to execute 'openCursor' on 'IDBIndex': The parameter is not a valid key.") };
</ins><span class="cx">
</span><del>- return openCursor(execState, keyRange.get(), direction, ec);
</del><ins>+ return openCursor(execState, keyRange.releaseReturnValue().ptr(), direction);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBRequest> IDBIndex::count(ExecState& execState, IDBKeyRange* range, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBRequest>> IDBIndex::count(ExecState& execState, IDBKeyRange* range)
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBIndex::count");
</span><span class="cx">
</span><del>- return doCount(execState, range ? IDBKeyRangeData(range) : IDBKeyRangeData::allKeys(), ec);
</del><ins>+ return doCount(execState, range ? IDBKeyRangeData(range) : IDBKeyRangeData::allKeys());
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBRequest> IDBIndex::count(ExecState& execState, JSValue key, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBRequest>> IDBIndex::count(ExecState& execState, JSValue key)
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBIndex::count");
</span><span class="cx">
</span><del>- Ref<IDBKey> idbKey = scriptValueToIDBKey(execState, key);
- if (!idbKey->isValid()) {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to execute 'count' on 'IDBIndex': The parameter is not a valid key.");
- return nullptr;
- }
</del><ins>+ auto idbKey = scriptValueToIDBKey(execState, key);
+ if (!idbKey->isValid())
+ return Exception { IDBDatabaseException::DataError, ASCIILiteral("Failed to execute 'count' on 'IDBIndex': The parameter is not a valid key.") };
</ins><span class="cx">
</span><del>- return doCount(execState, IDBKeyRangeData(idbKey.ptr()), ec);
</del><ins>+ return doCount(execState, IDBKeyRangeData(idbKey.ptr()));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBRequest> IDBIndex::doCount(ExecState& execState, const IDBKeyRangeData& range, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBRequest>> IDBIndex::doCount(ExecState& execState, const IDBKeyRangeData& range)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(currentThread() == m_objectStore.transaction().database().originThreadID());
</span><span class="cx">
</span><del>- if (m_deleted || m_objectStore.isDeleted()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'count' on 'IDBIndex': The index or its object store has been deleted.");
- return nullptr;
- }
</del><ins>+ if (m_deleted || m_objectStore.isDeleted())
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'count' on 'IDBIndex': The index or its object store has been deleted.") };
</ins><span class="cx">
</span><del>- if (!range.isValid()) {
- ec.code = IDBDatabaseException::DataError;
- return nullptr;
- }
</del><ins>+ if (!range.isValid())
+ return Exception { IDBDatabaseException::DataError };
</ins><span class="cx">
</span><span class="cx"> auto& transaction = m_objectStore.transaction();
</span><del>- if (!transaction.isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- ec.message = ASCIILiteral("Failed to execute 'count' on 'IDBIndex': The transaction is inactive or finished.");
- return nullptr;
- }
</del><ins>+ if (!transaction.isActive())
+ return Exception { IDBDatabaseException::TransactionInactiveError, ASCIILiteral("Failed to execute 'count' on 'IDBIndex': The transaction is inactive or finished.") };
</ins><span class="cx">
</span><span class="cx"> return transaction.requestCount(execState, *this, range);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBRequest> IDBIndex::openKeyCursor(ExecState& execState, IDBKeyRange* range, const String& directionString, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBRequest>> IDBIndex::openKeyCursor(ExecState& execState, IDBKeyRange* range, const String& directionString)
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBIndex::openKeyCursor");
</span><span class="cx"> ASSERT(currentThread() == m_objectStore.transaction().database().originThreadID());
</span><span class="cx">
</span><del>- if (m_deleted || m_objectStore.isDeleted()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'openKeyCursor' on 'IDBIndex': The index or its object store has been deleted.");
- return nullptr;
- }
</del><ins>+ if (m_deleted || m_objectStore.isDeleted())
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'openKeyCursor' on 'IDBIndex': The index or its object store has been deleted.") };
</ins><span class="cx">
</span><del>- if (!m_objectStore.transaction().isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- ec.message = ASCIILiteral("Failed to execute 'openKeyCursor' on 'IDBIndex': The transaction is inactive or finished.");
- return nullptr;
- }
</del><ins>+ if (!m_objectStore.transaction().isActive())
+ return Exception { IDBDatabaseException::TransactionInactiveError, ASCIILiteral("Failed to execute 'openKeyCursor' on 'IDBIndex': The transaction is inactive or finished.") };
</ins><span class="cx">
</span><del>- IndexedDB::CursorDirection direction = IDBCursor::stringToDirection(directionString, ec.code);
- if (ec.code) {
- ec.message = ASCIILiteral("Failed to execute 'openKeyCursor' on 'IDBIndex': The direction provided ('invalid-direction') is not one of 'next', 'nextunique', 'prev', or 'prevunique'.");
- return nullptr;
- }
</del><ins>+ auto direction = IDBCursor::stringToDirection(directionString);
+ if (!direction)
+ return Exception { TypeError, ASCIILiteral("Failed to execute 'openKeyCursor' on 'IDBIndex': The direction provided ('invalid-direction') is not one of 'next', 'nextunique', 'prev', or 'prevunique'.") };
</ins><span class="cx">
</span><del>- auto info = IDBCursorInfo::indexCursor(m_objectStore.transaction(), m_objectStore.info().identifier(), m_info.identifier(), range, direction, IndexedDB::CursorType::KeyOnly);
</del><ins>+ auto info = IDBCursorInfo::indexCursor(m_objectStore.transaction(), m_objectStore.info().identifier(), m_info.identifier(), range, direction.value(), IndexedDB::CursorType::KeyOnly);
</ins><span class="cx"> return m_objectStore.transaction().requestOpenCursor(execState, *this, info);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBRequest> IDBIndex::openKeyCursor(ExecState& execState, JSValue key, const String& direction, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBRequest>> IDBIndex::openKeyCursor(ExecState& execState, JSValue key, const String& direction)
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBIndex::openKeyCursor");
</span><del>- RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(execState, key, ec.code);
- if (ec.code) {
- ec.message = ASCIILiteral("Failed to execute 'openKeyCursor' on 'IDBIndex': The parameter is not a valid key.");
- return nullptr;
- }
- return openKeyCursor(execState, keyRange.get(), direction, ec);
</del><ins>+
+ auto keyRange = IDBKeyRange::only(execState, key);
+ if (keyRange.hasException())
+ return Exception { IDBDatabaseException::DataError, ASCIILiteral("Failed to execute 'openKeyCursor' on 'IDBIndex': The parameter is not a valid key.") };
+ return openKeyCursor(execState, keyRange.releaseReturnValue().ptr(), direction);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBRequest> IDBIndex::get(ExecState& execState, IDBKeyRange* range, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBRequest>> IDBIndex::get(ExecState& execState, IDBKeyRange* range)
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBIndex::get");
</span><span class="cx">
</span><del>- return doGet(execState, IDBKeyRangeData(range), ec);
</del><ins>+ return doGet(execState, IDBKeyRangeData(range));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBRequest> IDBIndex::get(ExecState& execState, JSValue key, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBRequest>> IDBIndex::get(ExecState& execState, JSValue key)
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBIndex::get");
</span><span class="cx">
</span><del>- Ref<IDBKey> idbKey = scriptValueToIDBKey(execState, key);
- if (!idbKey->isValid()) {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to execute 'get' on 'IDBIndex': The parameter is not a valid key.");
- return nullptr;
- }
</del><ins>+ auto idbKey = scriptValueToIDBKey(execState, key);
+ if (!idbKey->isValid())
+ return Exception { IDBDatabaseException::DataError, ASCIILiteral("Failed to execute 'get' on 'IDBIndex': The parameter is not a valid key.") };
</ins><span class="cx">
</span><del>- return doGet(execState, IDBKeyRangeData(idbKey.ptr()), ec);
</del><ins>+ return doGet(execState, IDBKeyRangeData(idbKey.ptr()));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBRequest> IDBIndex::doGet(ExecState& execState, const IDBKeyRangeData& range, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBRequest>> IDBIndex::doGet(ExecState& execState, const IDBKeyRangeData& range)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(currentThread() == m_objectStore.transaction().database().originThreadID());
</span><span class="cx">
</span><del>- if (m_deleted || m_objectStore.isDeleted()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'get' on 'IDBIndex': The index or its object store has been deleted.");
- return nullptr;
- }
</del><ins>+ if (m_deleted || m_objectStore.isDeleted())
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'get' on 'IDBIndex': The index or its object store has been deleted.") };
</ins><span class="cx">
</span><del>- if (range.isNull) {
- ec.code = IDBDatabaseException::DataError;
- return nullptr;
- }
</del><ins>+ if (range.isNull)
+ return Exception { IDBDatabaseException::DataError };
</ins><span class="cx">
</span><span class="cx"> auto& transaction = m_objectStore.transaction();
</span><del>- if (!transaction.isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- ec.message = ASCIILiteral("Failed to execute 'get' on 'IDBIndex': The transaction is inactive or finished.");
- return nullptr;
- }
</del><ins>+ if (!transaction.isActive())
+ return Exception { IDBDatabaseException::TransactionInactiveError, ASCIILiteral("Failed to execute 'get' on 'IDBIndex': The transaction is inactive or finished.") };
</ins><span class="cx">
</span><span class="cx"> return transaction.requestGetValue(execState, *this, range);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBRequest> IDBIndex::getKey(ExecState& execState, IDBKeyRange* range, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBRequest>> IDBIndex::getKey(ExecState& execState, IDBKeyRange* range)
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBIndex::getKey");
</span><span class="cx">
</span><del>- return doGetKey(execState, IDBKeyRangeData(range), ec);
</del><ins>+ return doGetKey(execState, IDBKeyRangeData(range));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBRequest> IDBIndex::getKey(ExecState& execState, JSValue key, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBRequest>> IDBIndex::getKey(ExecState& execState, JSValue key)
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBIndex::getKey");
</span><span class="cx">
</span><del>- Ref<IDBKey> idbKey = scriptValueToIDBKey(execState, key);
- if (!idbKey->isValid()) {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to execute 'getKey' on 'IDBIndex': The parameter is not a valid key.");
- return nullptr;
- }
</del><ins>+ auto idbKey = scriptValueToIDBKey(execState, key);
+ if (!idbKey->isValid())
+ return Exception { IDBDatabaseException::DataError, ASCIILiteral("Failed to execute 'getKey' on 'IDBIndex': The parameter is not a valid key.") };
</ins><span class="cx">
</span><del>- return doGetKey(execState, IDBKeyRangeData(idbKey.ptr()), ec);
</del><ins>+ return doGetKey(execState, IDBKeyRangeData(idbKey.ptr()));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBRequest> IDBIndex::doGetKey(ExecState& execState, const IDBKeyRangeData& range, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBRequest>> IDBIndex::doGetKey(ExecState& execState, const IDBKeyRangeData& range)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(currentThread() == m_objectStore.transaction().database().originThreadID());
</span><span class="cx">
</span><del>- if (m_deleted || m_objectStore.isDeleted()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'getKey' on 'IDBIndex': The index or its object store has been deleted.");
- return nullptr;
- }
</del><ins>+ if (m_deleted || m_objectStore.isDeleted())
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'getKey' on 'IDBIndex': The index or its object store has been deleted.") };
</ins><span class="cx">
</span><del>- if (range.isNull) {
- ec.code = IDBDatabaseException::DataError;
- return nullptr;
- }
</del><ins>+ if (range.isNull)
+ return Exception { IDBDatabaseException::DataError };
</ins><span class="cx">
</span><span class="cx"> auto& transaction = m_objectStore.transaction();
</span><del>- if (!transaction.isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- ec.message = ASCIILiteral("Failed to execute 'getKey' on 'IDBIndex': The transaction is inactive or finished.");
- return nullptr;
- }
</del><ins>+ if (!transaction.isActive())
+ return Exception { IDBDatabaseException::TransactionInactiveError, ASCIILiteral("Failed to execute 'getKey' on 'IDBIndex': The transaction is inactive or finished.") };
</ins><span class="cx">
</span><span class="cx"> return transaction.requestGetKey(execState, *this, range);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBIndexh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBIndex.h (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBIndex.h        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBIndex.h        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -53,19 +53,19 @@
</span><span class="cx"> bool unique() const;
</span><span class="cx"> bool multiEntry() const;
</span><span class="cx">
</span><del>- RefPtr<IDBRequest> openCursor(JSC::ExecState&, IDBKeyRange*, const String& direction, ExceptionCodeWithMessage&);
- RefPtr<IDBRequest> openCursor(JSC::ExecState&, JSC::JSValue key, const String& direction, ExceptionCodeWithMessage&);
</del><ins>+ ExceptionOr<Ref<IDBRequest>> openCursor(JSC::ExecState&, IDBKeyRange*, const String& direction);
+ ExceptionOr<Ref<IDBRequest>> openCursor(JSC::ExecState&, JSC::JSValue key, const String& direction);
</ins><span class="cx">
</span><del>- RefPtr<IDBRequest> count(JSC::ExecState&, IDBKeyRange*, ExceptionCodeWithMessage&);
- RefPtr<IDBRequest> count(JSC::ExecState&, JSC::JSValue key, ExceptionCodeWithMessage&);
</del><ins>+ ExceptionOr<Ref<IDBRequest>> count(JSC::ExecState&, IDBKeyRange*);
+ ExceptionOr<Ref<IDBRequest>> count(JSC::ExecState&, JSC::JSValue key);
</ins><span class="cx">
</span><del>- RefPtr<IDBRequest> openKeyCursor(JSC::ExecState&, IDBKeyRange*, const String& direction, ExceptionCodeWithMessage&);
- RefPtr<IDBRequest> openKeyCursor(JSC::ExecState&, JSC::JSValue key, const String& direction, ExceptionCodeWithMessage&);
</del><ins>+ ExceptionOr<Ref<IDBRequest>> openKeyCursor(JSC::ExecState&, IDBKeyRange*, const String& direction);
+ ExceptionOr<Ref<IDBRequest>> openKeyCursor(JSC::ExecState&, JSC::JSValue key, const String& direction);
</ins><span class="cx">
</span><del>- RefPtr<IDBRequest> get(JSC::ExecState&, IDBKeyRange*, ExceptionCodeWithMessage&);
- RefPtr<IDBRequest> get(JSC::ExecState&, JSC::JSValue key, ExceptionCodeWithMessage&);
- RefPtr<IDBRequest> getKey(JSC::ExecState&, IDBKeyRange*, ExceptionCodeWithMessage&);
- RefPtr<IDBRequest> getKey(JSC::ExecState&, JSC::JSValue key, ExceptionCodeWithMessage&);
</del><ins>+ ExceptionOr<Ref<IDBRequest>> get(JSC::ExecState&, IDBKeyRange*);
+ ExceptionOr<Ref<IDBRequest>> get(JSC::ExecState&, JSC::JSValue key);
+ ExceptionOr<Ref<IDBRequest>> getKey(JSC::ExecState&, IDBKeyRange*);
+ ExceptionOr<Ref<IDBRequest>> getKey(JSC::ExecState&, JSC::JSValue key);
</ins><span class="cx">
</span><span class="cx"> const IDBIndexInfo& info() const { return m_info; }
</span><span class="cx">
</span><span class="lines">@@ -78,9 +78,9 @@
</span><span class="cx"> void* objectStoreAsOpaqueRoot() { return &m_objectStore; }
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- RefPtr<IDBRequest> doCount(JSC::ExecState&, const IDBKeyRangeData&, ExceptionCodeWithMessage&);
- RefPtr<IDBRequest> doGet(JSC::ExecState&, const IDBKeyRangeData&, ExceptionCodeWithMessage&);
- RefPtr<IDBRequest> doGetKey(JSC::ExecState&, const IDBKeyRangeData&, ExceptionCodeWithMessage&);
</del><ins>+ ExceptionOr<Ref<IDBRequest>> doCount(JSC::ExecState&, const IDBKeyRangeData&);
+ ExceptionOr<Ref<IDBRequest>> doGet(JSC::ExecState&, const IDBKeyRangeData&);
+ ExceptionOr<Ref<IDBRequest>> doGetKey(JSC::ExecState&, const IDBKeyRangeData&);
</ins><span class="cx">
</span><span class="cx"> const char* activeDOMObjectName() const final;
</span><span class="cx"> bool canSuspendForDocumentSuspension() const final;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBIndexidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBIndex.idl (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBIndex.idl        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBIndex.idl        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -26,9 +26,9 @@
</span><span class="cx"> [
</span><span class="cx"> Conditional=INDEXED_DATABASE,
</span><span class="cx"> EnabledAtRuntime=IndexedDB,
</span><ins>+ GenerateIsReachable=Impl,
+ JSCustomMarkFunction,
</ins><span class="cx"> SkipVTableValidation,
</span><del>- JSCustomMarkFunction,
- GenerateIsReachable=Impl,
</del><span class="cx"> ] interface IDBIndex {
</span><span class="cx"> readonly attribute DOMString name;
</span><span class="cx"> readonly attribute IDBObjectStore objectStore;
</span><span class="lines">@@ -36,17 +36,17 @@
</span><span class="cx"> readonly attribute boolean multiEntry;
</span><span class="cx"> readonly attribute boolean unique;
</span><span class="cx">
</span><del>- [CallWith=ScriptState, MayThrowLegacyExceptionWithMessage] IDBRequest openCursor(optional IDBKeyRange? range = null, optional DOMString direction = "next");
- [CallWith=ScriptState, MayThrowLegacyExceptionWithMessage] IDBRequest openCursor(any key, optional DOMString direction = "next");
</del><ins>+ [CallWith=ScriptState, MayThrowException] IDBRequest openCursor(optional IDBKeyRange? range = null, optional DOMString direction = "next");
+ [CallWith=ScriptState, MayThrowException] IDBRequest openCursor(any key, optional DOMString direction = "next");
</ins><span class="cx">
</span><del>- [CallWith=ScriptState, MayThrowLegacyExceptionWithMessage] IDBRequest openKeyCursor(optional IDBKeyRange? range = null, optional DOMString direction = "next");
- [CallWith=ScriptState, MayThrowLegacyExceptionWithMessage] IDBRequest openKeyCursor(any key, optional DOMString direction = "next");
</del><ins>+ [CallWith=ScriptState, MayThrowException] IDBRequest openKeyCursor(optional IDBKeyRange? range = null, optional DOMString direction = "next");
+ [CallWith=ScriptState, MayThrowException] IDBRequest openKeyCursor(any key, optional DOMString direction = "next");
</ins><span class="cx">
</span><del>- [CallWith=ScriptState, MayThrowLegacyExceptionWithMessage] IDBRequest get(IDBKeyRange? key);
- [CallWith=ScriptState, MayThrowLegacyExceptionWithMessage] IDBRequest get(any key);
- [CallWith=ScriptState, MayThrowLegacyExceptionWithMessage] IDBRequest getKey(IDBKeyRange? key);
- [CallWith=ScriptState, MayThrowLegacyExceptionWithMessage] IDBRequest getKey(any key);
- [CallWith=ScriptState, MayThrowLegacyExceptionWithMessage] IDBRequest count(optional IDBKeyRange? range = null);
- [CallWith=ScriptState, MayThrowLegacyExceptionWithMessage] IDBRequest count(any key);
</del><ins>+ [CallWith=ScriptState, MayThrowException] IDBRequest get(IDBKeyRange? key);
+ [CallWith=ScriptState, MayThrowException] IDBRequest get(any key);
+ [CallWith=ScriptState, MayThrowException] IDBRequest getKey(IDBKeyRange? key);
+ [CallWith=ScriptState, MayThrowException] IDBRequest getKey(any key);
+ [CallWith=ScriptState, MayThrowException] IDBRequest count(optional IDBKeyRange? range = null);
+ [CallWith=ScriptState, MayThrowException] IDBRequest count(any key);
</ins><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBKeyRangecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.cpp (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.cpp        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.cpp        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -62,60 +62,48 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBKeyRange> IDBKeyRange::only(RefPtr<IDBKey>&& key, ExceptionCode& ec)
</del><ins>+ExceptionOr<Ref<IDBKeyRange>> IDBKeyRange::only(RefPtr<IDBKey>&& key)
</ins><span class="cx"> {
</span><del>- if (!key || !key->isValid()) {
- ec = IDBDatabaseException::DataError;
- return nullptr;
- }
</del><ins>+ if (!key || !key->isValid())
+ return Exception { IDBDatabaseException::DataError };
</ins><span class="cx">
</span><span class="cx"> return create(WTFMove(key));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBKeyRange> IDBKeyRange::only(ExecState& state, JSValue keyValue, ExceptionCode& ec)
</del><ins>+ExceptionOr<Ref<IDBKeyRange>> IDBKeyRange::only(ExecState& state, JSValue keyValue)
</ins><span class="cx"> {
</span><del>- return only(scriptValueToIDBKey(state, keyValue), ec);
</del><ins>+ return only(scriptValueToIDBKey(state, keyValue));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBKeyRange> IDBKeyRange::lowerBound(ExecState& state, JSValue boundValue, bool open, ExceptionCode& ec)
</del><ins>+ExceptionOr<Ref<IDBKeyRange>> IDBKeyRange::lowerBound(ExecState& state, JSValue boundValue, bool open)
</ins><span class="cx"> {
</span><span class="cx"> auto bound = scriptValueToIDBKey(state, boundValue);
</span><del>- if (!bound->isValid()) {
- ec = IDBDatabaseException::DataError;
- return nullptr;
- }
</del><ins>+ if (!bound->isValid())
+ return Exception { IDBDatabaseException::DataError };
</ins><span class="cx">
</span><span class="cx"> return create(WTFMove(bound), nullptr, open, true);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBKeyRange> IDBKeyRange::upperBound(ExecState& state, JSValue boundValue, bool open, ExceptionCode& ec)
</del><ins>+ExceptionOr<Ref<IDBKeyRange>> IDBKeyRange::upperBound(ExecState& state, JSValue boundValue, bool open)
</ins><span class="cx"> {
</span><span class="cx"> auto bound = scriptValueToIDBKey(state, boundValue);
</span><del>- if (!bound->isValid()) {
- ec = IDBDatabaseException::DataError;
- return nullptr;
- }
</del><ins>+ if (!bound->isValid())
+ return Exception { IDBDatabaseException::DataError };
</ins><span class="cx">
</span><span class="cx"> return create(nullptr, WTFMove(bound), true, open);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBKeyRange> IDBKeyRange::bound(ExecState& state, JSValue lowerValue, JSValue upperValue, bool lowerOpen, bool upperOpen, ExceptionCode& ec)
</del><ins>+ExceptionOr<Ref<IDBKeyRange>> IDBKeyRange::bound(ExecState& state, JSValue lowerValue, JSValue upperValue, bool lowerOpen, bool upperOpen)
</ins><span class="cx"> {
</span><span class="cx"> auto lower = scriptValueToIDBKey(state, lowerValue);
</span><span class="cx"> auto upper = scriptValueToIDBKey(state, upperValue);
</span><span class="cx">
</span><del>- if (!lower->isValid() || !upper->isValid()) {
- ec = IDBDatabaseException::DataError;
- return nullptr;
- }
- if (upper->isLessThan(lower.get())) {
- ec = IDBDatabaseException::DataError;
- return nullptr;
- }
- if (upper->isEqual(lower.get()) && (lowerOpen || upperOpen)) {
- ec = IDBDatabaseException::DataError;
- return nullptr;
- }
</del><ins>+ if (!lower->isValid() || !upper->isValid())
+ return Exception { IDBDatabaseException::DataError };
+ if (upper->isLessThan(lower.get()))
+ return Exception { IDBDatabaseException::DataError };
+ if (upper->isEqual(lower.get()) && (lowerOpen || upperOpen))
+ return Exception { IDBDatabaseException::DataError };
</ins><span class="cx">
</span><span class="cx"> return create(WTFMove(lower), WTFMove(upper), lowerOpen, upperOpen);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBKeyRangeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.h (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.h        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.h        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><ins>+#include "ExceptionOr.h"
</ins><span class="cx"> #include "ScriptWrappable.h"
</span><span class="cx"> #include <wtf/RefCounted.h>
</span><span class="cx"> #include <wtf/RefPtr.h>
</span><span class="lines">@@ -54,13 +55,13 @@
</span><span class="cx"> bool lowerOpen() const { return m_isLowerOpen; }
</span><span class="cx"> bool upperOpen() const { return m_isUpperOpen; }
</span><span class="cx">
</span><del>- static RefPtr<IDBKeyRange> only(RefPtr<IDBKey>&& value, ExceptionCode&);
- static RefPtr<IDBKeyRange> only(JSC::ExecState&, JSC::JSValue key, ExceptionCode&);
</del><ins>+ static ExceptionOr<Ref<IDBKeyRange>> only(RefPtr<IDBKey>&& value);
+ static ExceptionOr<Ref<IDBKeyRange>> only(JSC::ExecState&, JSC::JSValue key);
</ins><span class="cx">
</span><del>- static RefPtr<IDBKeyRange> lowerBound(JSC::ExecState&, JSC::JSValue bound, bool open, ExceptionCode&);
- static RefPtr<IDBKeyRange> upperBound(JSC::ExecState&, JSC::JSValue bound, bool open, ExceptionCode&);
</del><ins>+ static ExceptionOr<Ref<IDBKeyRange>> lowerBound(JSC::ExecState&, JSC::JSValue bound, bool open);
+ static ExceptionOr<Ref<IDBKeyRange>> upperBound(JSC::ExecState&, JSC::JSValue bound, bool open);
</ins><span class="cx">
</span><del>- static RefPtr<IDBKeyRange> bound(JSC::ExecState&, JSC::JSValue lower, JSC::JSValue upper, bool lowerOpen, bool upperOpen, ExceptionCode&);
</del><ins>+ static ExceptionOr<Ref<IDBKeyRange>> bound(JSC::ExecState&, JSC::JSValue lower, JSC::JSValue upper, bool lowerOpen, bool upperOpen);
</ins><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT bool isOnlyKey() const;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBKeyRangeidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.idl (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.idl        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.idl        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -33,8 +33,8 @@
</span><span class="cx"> readonly attribute boolean lowerOpen;
</span><span class="cx"> readonly attribute boolean upperOpen;
</span><span class="cx">
</span><del>- [CallWith=ScriptState, MayThrowLegacyException] static IDBKeyRange only(any value);
- [CallWith=ScriptState, MayThrowLegacyException] static IDBKeyRange lowerBound(any lower, optional boolean open = false);
- [CallWith=ScriptState, MayThrowLegacyException] static IDBKeyRange upperBound(any upper, optional boolean open = false);
- [CallWith=ScriptState, MayThrowLegacyException] static IDBKeyRange bound(any lower, any upper, optional boolean lowerOpen = false, optional boolean upperOpen = false);
</del><ins>+ [CallWith=ScriptState, MayThrowException] static IDBKeyRange only(any value);
+ [CallWith=ScriptState, MayThrowException] static IDBKeyRange lowerBound(any lower, optional boolean open = false);
+ [CallWith=ScriptState, MayThrowException] static IDBKeyRange upperBound(any upper, optional boolean open = false);
+ [CallWith=ScriptState, MayThrowException] static IDBKeyRange bound(any lower, any upper, optional boolean lowerOpen = false, optional boolean upperOpen = false);
</ins><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBObjectStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -125,116 +125,92 @@
</span><span class="cx"> return m_info.autoIncrement();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBRequest> IDBObjectStore::openCursor(ExecState& execState, IDBKeyRange* range, const String& directionString, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::openCursor(ExecState& execState, IDBKeyRange* range, const String& directionString)
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBObjectStore::openCursor");
</span><span class="cx"> ASSERT(currentThread() == m_transaction->database().originThreadID());
</span><span class="cx">
</span><del>- if (m_deleted) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'openCursor' on 'IDBObjectStore': The object store has been deleted.");
- return nullptr;
- }
</del><ins>+ if (m_deleted)
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'openCursor' on 'IDBObjectStore': The object store has been deleted.") };
</ins><span class="cx">
</span><del>- if (!m_transaction->isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- ec.message = ASCIILiteral("Failed to execute 'openCursor' on 'IDBObjectStore': The transaction is inactive or finished.");
- return nullptr;
- }
</del><ins>+ if (!m_transaction->isActive())
+ return Exception { IDBDatabaseException::TransactionInactiveError, ASCIILiteral("Failed to execute 'openCursor' on 'IDBObjectStore': The transaction is inactive or finished.") };
</ins><span class="cx">
</span><del>- IndexedDB::CursorDirection direction = IDBCursor::stringToDirection(directionString, ec.code);
- if (ec.code)
- return nullptr;
</del><ins>+ auto direction = IDBCursor::stringToDirection(directionString);
+ if (!direction)
+ return Exception { TypeError };
</ins><span class="cx">
</span><del>- auto info = IDBCursorInfo::objectStoreCursor(m_transaction.get(), m_info.identifier(), range, direction);
</del><ins>+ auto info = IDBCursorInfo::objectStoreCursor(m_transaction.get(), m_info.identifier(), range, direction.value());
</ins><span class="cx"> return m_transaction->requestOpenCursor(execState, *this, info);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBRequest> IDBObjectStore::openCursor(ExecState& execState, JSValue key, const String& direction, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::openCursor(ExecState& execState, JSValue key, const String& direction)
</ins><span class="cx"> {
</span><del>- RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(execState, key, ec.code);
- if (ec.code) {
- ec.message = ASCIILiteral("Failed to execute 'openCursor' on 'IDBObjectStore': The parameter is not a valid key.");
- return 0;
- }
</del><ins>+ auto onlyResult = IDBKeyRange::only(execState, key);
+ if (onlyResult.hasException())
+ return Exception { IDBDatabaseException::DataError, ASCIILiteral("Failed to execute 'openCursor' on 'IDBObjectStore': The parameter is not a valid key.") };
</ins><span class="cx">
</span><del>- return openCursor(execState, keyRange.get(), direction, ec);
</del><ins>+ return openCursor(execState, onlyResult.releaseReturnValue().ptr(), direction);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBRequest> IDBObjectStore::get(ExecState& execState, JSValue key, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::get(ExecState& execState, JSValue key)
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBObjectStore::get");
</span><span class="cx"> ASSERT(currentThread() == m_transaction->database().originThreadID());
</span><span class="cx">
</span><del>- if (!m_transaction->isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- ec.message = ASCIILiteral("Failed to execute 'get' on 'IDBObjectStore': The transaction is inactive or finished.");
- return nullptr;
- }
</del><ins>+ if (!m_transaction->isActive())
+ return Exception { IDBDatabaseException::TransactionInactiveError, ASCIILiteral("Failed to execute 'get' on 'IDBObjectStore': The transaction is inactive or finished.") };
</ins><span class="cx">
</span><del>- if (m_deleted) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'get' on 'IDBObjectStore': The object store has been deleted.");
- return nullptr;
- }
</del><ins>+ if (m_deleted)
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'get' on 'IDBObjectStore': The object store has been deleted.") };
</ins><span class="cx">
</span><del>- Ref<IDBKey> idbKey = scriptValueToIDBKey(execState, key);
- if (!idbKey->isValid()) {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to execute 'get' on 'IDBObjectStore': The parameter is not a valid key.");
- return nullptr;
- }
</del><ins>+ auto idbKey = scriptValueToIDBKey(execState, key);
+ if (!idbKey->isValid())
+ return Exception { IDBDatabaseException::DataError, ASCIILiteral("Failed to execute 'get' on 'IDBObjectStore': The parameter is not a valid key.") };
</ins><span class="cx">
</span><span class="cx"> return m_transaction->requestGetRecord(execState, *this, { idbKey.ptr() });
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBRequest> IDBObjectStore::get(ExecState& execState, IDBKeyRange* keyRange, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::get(ExecState& execState, IDBKeyRange* keyRange)
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBObjectStore::get");
</span><span class="cx"> ASSERT(currentThread() == m_transaction->database().originThreadID());
</span><span class="cx">
</span><del>- if (!m_transaction->isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- return nullptr;
- }
</del><ins>+ if (!m_transaction->isActive())
+ return Exception { IDBDatabaseException::TransactionInactiveError };
</ins><span class="cx">
</span><del>- if (m_deleted) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'get' on 'IDBObjectStore': The object store has been deleted.");
- return nullptr;
- }
</del><ins>+ if (m_deleted)
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'get' on 'IDBObjectStore': The object store has been deleted.") };
</ins><span class="cx">
</span><span class="cx"> IDBKeyRangeData keyRangeData(keyRange);
</span><del>- if (!keyRangeData.isValid()) {
- ec.code = IDBDatabaseException::DataError;
- return nullptr;
- }
</del><ins>+ if (!keyRangeData.isValid())
+ return Exception { IDBDatabaseException::DataError };
</ins><span class="cx">
</span><span class="cx"> return m_transaction->requestGetRecord(execState, *this, { keyRangeData });
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBRequest> IDBObjectStore::add(ExecState& execState, JSValue value, JSValue key, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::add(ExecState& execState, JSValue value, JSValue key)
</ins><span class="cx"> {
</span><span class="cx"> RefPtr<IDBKey> idbKey;
</span><span class="cx"> if (!key.isUndefined())
</span><span class="cx"> idbKey = scriptValueToIDBKey(execState, key);
</span><del>- return putOrAdd(execState, value, idbKey, IndexedDB::ObjectStoreOverwriteMode::NoOverwrite, InlineKeyCheck::Perform, ec);
</del><ins>+ return putOrAdd(execState, value, idbKey, IndexedDB::ObjectStoreOverwriteMode::NoOverwrite, InlineKeyCheck::Perform);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBRequest> IDBObjectStore::put(ExecState& execState, JSValue value, JSValue key, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::put(ExecState& execState, JSValue value, JSValue key)
</ins><span class="cx"> {
</span><span class="cx"> RefPtr<IDBKey> idbKey;
</span><span class="cx"> if (!key.isUndefined())
</span><span class="cx"> idbKey = scriptValueToIDBKey(execState, key);
</span><del>- return putOrAdd(execState, value, idbKey, IndexedDB::ObjectStoreOverwriteMode::Overwrite, InlineKeyCheck::Perform, ec);
</del><ins>+ return putOrAdd(execState, value, idbKey, IndexedDB::ObjectStoreOverwriteMode::Overwrite, InlineKeyCheck::Perform);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBRequest> IDBObjectStore::putForCursorUpdate(ExecState& state, JSValue value, JSValue key, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::putForCursorUpdate(ExecState& state, JSValue value, JSValue key)
</ins><span class="cx"> {
</span><del>- return putOrAdd(state, value, scriptValueToIDBKey(state, key), IndexedDB::ObjectStoreOverwriteMode::OverwriteForCursor, InlineKeyCheck::DoNotPerform, ec);
</del><ins>+ return putOrAdd(state, value, scriptValueToIDBKey(state, key), IndexedDB::ObjectStoreOverwriteMode::OverwriteForCursor, InlineKeyCheck::DoNotPerform);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBRequest> IDBObjectStore::putOrAdd(ExecState& state, JSValue value, RefPtr<IDBKey> key, IndexedDB::ObjectStoreOverwriteMode overwriteMode, InlineKeyCheck inlineKeyCheck, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::putOrAdd(ExecState& state, JSValue value, RefPtr<IDBKey> key, IndexedDB::ObjectStoreOverwriteMode overwriteMode, InlineKeyCheck inlineKeyCheck)
</ins><span class="cx"> {
</span><span class="cx"> VM& vm = state.vm();
</span><span class="cx"> auto scope = DECLARE_CATCH_SCOPE(vm);
</span><span class="lines">@@ -243,11 +219,8 @@
</span><span class="cx"> ASSERT(currentThread() == m_transaction->database().originThreadID());
</span><span class="cx">
</span><span class="cx"> auto context = scriptExecutionContextFromExecState(&state);
</span><del>- if (!context) {
- ec.code = IDBDatabaseException::UnknownError;
- ec.message = ASCIILiteral("Unable to store record in object store because it does not have a valid script execution context");
- return nullptr;
- }
</del><ins>+ if (!context)
+ return Exception { IDBDatabaseException::UnknownError, ASCIILiteral("Unable to store record in object store because it does not have a valid script execution context") };
</ins><span class="cx">
</span><span class="cx"> // The IDB spec for several IDBObjectStore methods states that transaction related exceptions should fire before
</span><span class="cx"> // the exception for an object store being deleted.
</span><span class="lines">@@ -254,23 +227,14 @@
</span><span class="cx"> // However, a handful of W3C IDB tests expect the deleted exception even though the transaction inactive exception also applies.
</span><span class="cx"> // Additionally, Chrome and Edge agree with the test, as does Legacy IDB in WebKit.
</span><span class="cx"> // Until this is sorted out, we'll agree with the test and the majority share browsers.
</span><del>- if (m_deleted) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: The object store has been deleted.");
- return nullptr;
- }
</del><ins>+ if (m_deleted)
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to store record in an IDBObjectStore: The object store has been deleted.") };
</ins><span class="cx">
</span><del>- if (!m_transaction->isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: The transaction is inactive or finished.");
- return nullptr;
- }
</del><ins>+ if (!m_transaction->isActive())
+ return Exception { IDBDatabaseException::TransactionInactiveError, ASCIILiteral("Failed to store record in an IDBObjectStore: The transaction is inactive or finished.") };
</ins><span class="cx">
</span><del>- if (m_transaction->isReadOnly()) {
- ec.code = IDBDatabaseException::ReadOnlyError;
- ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: The transaction is read-only.");
- return nullptr;
- }
</del><ins>+ if (m_transaction->isReadOnly())
+ return Exception { IDBDatabaseException::ReadOnlyError, ASCIILiteral("Failed to store record in an IDBObjectStore: The transaction is read-only.") };
</ins><span class="cx">
</span><span class="cx"> RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::create(&state, value, nullptr, nullptr);
</span><span class="cx"> if (UNLIKELY(scope.exception())) {
</span><span class="lines">@@ -277,9 +241,7 @@
</span><span class="cx"> // Clear the DOM exception from the serializer so we can give a more targeted exception.
</span><span class="cx"> scope.clearException();
</span><span class="cx">
</span><del>- ec.code = IDBDatabaseException::DataCloneError;
- ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: An object could not be cloned.");
- return nullptr;
</del><ins>+ return Exception { IDBDatabaseException::DataCloneError, ASCIILiteral("Failed to store record in an IDBObjectStore: An object could not be cloned.") };
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool privateBrowsingEnabled = false;
</span><span class="lines">@@ -290,44 +252,27 @@
</span><span class="cx">
</span><span class="cx"> if (serializedValue->hasBlobURLs() && privateBrowsingEnabled) {
</span><span class="cx"> // https://bugs.webkit.org/show_bug.cgi?id=156347 - Support Blobs in private browsing.
</span><del>- ec.code = IDBDatabaseException::DataCloneError;
- ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: BlobURLs are not yet supported.");
- return nullptr;
</del><ins>+ return Exception { IDBDatabaseException::DataCloneError, ASCIILiteral("Failed to store record in an IDBObjectStore: BlobURLs are not yet supported.") };
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- if (key && !key->isValid()) {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: The parameter is not a valid key.");
- return nullptr;
- }
</del><ins>+ if (key && !key->isValid())
+ return Exception { IDBDatabaseException::DataError, ASCIILiteral("Failed to store record in an IDBObjectStore: The parameter is not a valid key.") };
</ins><span class="cx">
</span><span class="cx"> bool usesInlineKeys = !m_info.keyPath().isNull();
</span><span class="cx"> bool usesKeyGenerator = autoIncrement();
</span><span class="cx"> if (usesInlineKeys && inlineKeyCheck == InlineKeyCheck::Perform) {
</span><del>- if (key) {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: The object store uses in-line keys and the key parameter was provided.");
- return nullptr;
- }
</del><ins>+ if (key)
+ return Exception { IDBDatabaseException::DataError, ASCIILiteral("Failed to store record in an IDBObjectStore: The object store uses in-line keys and the key parameter was provided.") };
</ins><span class="cx">
</span><span class="cx"> RefPtr<IDBKey> keyPathKey = maybeCreateIDBKeyFromScriptValueAndKeyPath(state, value, m_info.keyPath());
</span><del>- if (keyPathKey && !keyPathKey->isValid()) {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: Evaluating the object store's key path yielded a value that is not a valid key.");
- return nullptr;
- }
</del><ins>+ if (keyPathKey && !keyPathKey->isValid())
+ return Exception { IDBDatabaseException::DataError, ASCIILiteral("Failed to store record in an IDBObjectStore: Evaluating the object store's key path yielded a value that is not a valid key.") };
</ins><span class="cx">
</span><span class="cx"> if (!keyPathKey) {
</span><del>- if (usesKeyGenerator) {
- if (!canInjectIDBKeyIntoScriptValue(state, value, m_info.keyPath())) {
- ec.code = IDBDatabaseException::DataError;
- return nullptr;
- }
- } else {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: Evaluating the object store's key path did not yield a value.");
- return nullptr;
- }
</del><ins>+ if (!usesKeyGenerator)
+ return Exception { IDBDatabaseException::DataError, ASCIILiteral("Failed to store record in an IDBObjectStore: Evaluating the object store's key path did not yield a value.") };
+ if (!canInjectIDBKeyIntoScriptValue(state, value, m_info.keyPath()))
+ return Exception { IDBDatabaseException::DataError };
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (keyPathKey) {
</span><span class="lines">@@ -334,21 +279,18 @@
</span><span class="cx"> ASSERT(!key);
</span><span class="cx"> key = keyPathKey;
</span><span class="cx"> }
</span><del>- } else if (!usesKeyGenerator && !key) {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to store record in an IDBObjectStore: The object store uses out-of-line keys and has no key generator and the key parameter was not provided.");
- return nullptr;
- }
</del><ins>+ } else if (!usesKeyGenerator && !key)
+ return Exception { IDBDatabaseException::DataError, ASCIILiteral("Failed to store record in an IDBObjectStore: The object store uses out-of-line keys and has no key generator and the key parameter was not provided.") };
</ins><span class="cx">
</span><span class="cx"> return m_transaction->requestPutOrAdd(state, *this, key.get(), *serializedValue, overwriteMode);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBRequest> IDBObjectStore::deleteFunction(ExecState& execState, IDBKeyRange* keyRange, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::deleteFunction(ExecState& execState, IDBKeyRange* keyRange)
</ins><span class="cx"> {
</span><del>- return doDelete(execState, keyRange, ec);
</del><ins>+ return doDelete(execState, keyRange);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBRequest> IDBObjectStore::doDelete(ExecState& execState, IDBKeyRange* keyRange, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::doDelete(ExecState& execState, IDBKeyRange* keyRange)
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBObjectStore::deleteFunction");
</span><span class="cx"> ASSERT(currentThread() == m_transaction->database().originThreadID());
</span><span class="lines">@@ -358,47 +300,31 @@
</span><span class="cx"> // However, a handful of W3C IDB tests expect the deleted exception even though the transaction inactive exception also applies.
</span><span class="cx"> // Additionally, Chrome and Edge agree with the test, as does Legacy IDB in WebKit.
</span><span class="cx"> // Until this is sorted out, we'll agree with the test and the majority share browsers.
</span><del>- if (m_deleted) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'delete' on 'IDBObjectStore': The object store has been deleted.");
- return nullptr;
- }
</del><ins>+ if (m_deleted)
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'delete' on 'IDBObjectStore': The object store has been deleted.") };
</ins><span class="cx">
</span><del>- if (!m_transaction->isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- ec.message = ASCIILiteral("Failed to execute 'delete' on 'IDBObjectStore': The transaction is inactive or finished.");
- return nullptr;
- }
</del><ins>+ if (!m_transaction->isActive())
+ return Exception { IDBDatabaseException::TransactionInactiveError, ASCIILiteral("Failed to execute 'delete' on 'IDBObjectStore': The transaction is inactive or finished.") };
</ins><span class="cx">
</span><del>- if (m_transaction->isReadOnly()) {
- ec.code = IDBDatabaseException::ReadOnlyError;
- ec.message = ASCIILiteral("Failed to execute 'delete' on 'IDBObjectStore': The transaction is read-only.");
- return nullptr;
- }
</del><ins>+ if (m_transaction->isReadOnly())
+ return Exception { IDBDatabaseException::ReadOnlyError, ASCIILiteral("Failed to execute 'delete' on 'IDBObjectStore': The transaction is read-only.") };
</ins><span class="cx">
</span><span class="cx"> IDBKeyRangeData keyRangeData(keyRange);
</span><del>- if (!keyRangeData.isValid()) {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to execute 'delete' on 'IDBObjectStore': The parameter is not a valid key range.");
- return nullptr;
- }
</del><ins>+ if (!keyRangeData.isValid())
+ return Exception { IDBDatabaseException::DataError, ASCIILiteral("Failed to execute 'delete' on 'IDBObjectStore': The parameter is not a valid key range.") };
</ins><span class="cx">
</span><span class="cx"> return m_transaction->requestDeleteRecord(execState, *this, keyRangeData);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBRequest> IDBObjectStore::deleteFunction(ExecState& execState, JSValue key, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::deleteFunction(ExecState& execState, JSValue key)
</ins><span class="cx"> {
</span><span class="cx"> Ref<IDBKey> idbKey = scriptValueToIDBKey(execState, key);
</span><del>- if (!idbKey->isValid()) {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to execute 'delete' on 'IDBObjectStore': The parameter is not a valid key.");
- return nullptr;
- }
-
- return doDelete(execState, &IDBKeyRange::create(WTFMove(idbKey)).get(), ec);
</del><ins>+ if (!idbKey->isValid())
+ return Exception { IDBDatabaseException::DataError, ASCIILiteral("Failed to execute 'delete' on 'IDBObjectStore': The parameter is not a valid key.") };
+ return doDelete(execState, IDBKeyRange::create(WTFMove(idbKey)).ptr());
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBRequest> IDBObjectStore::clear(ExecState& execState, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::clear(ExecState& execState)
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBObjectStore::clear");
</span><span class="cx"> ASSERT(currentThread() == m_transaction->database().originThreadID());
</span><span class="lines">@@ -408,72 +334,43 @@
</span><span class="cx"> // However, a handful of W3C IDB tests expect the deleted exception even though the transaction inactive exception also applies.
</span><span class="cx"> // Additionally, Chrome and Edge agree with the test, as does Legacy IDB in WebKit.
</span><span class="cx"> // Until this is sorted out, we'll agree with the test and the majority share browsers.
</span><del>- if (m_deleted) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'clear' on 'IDBObjectStore': The object store has been deleted.");
- return nullptr;
- }
</del><ins>+ if (m_deleted)
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'clear' on 'IDBObjectStore': The object store has been deleted.") };
</ins><span class="cx">
</span><del>- if (!m_transaction->isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- ec.message = ASCIILiteral("Failed to execute 'clear' on 'IDBObjectStore': The transaction is inactive or finished.");
- return nullptr;
- }
</del><ins>+ if (!m_transaction->isActive())
+ return Exception { IDBDatabaseException::TransactionInactiveError, ASCIILiteral("Failed to execute 'clear' on 'IDBObjectStore': The transaction is inactive or finished.") };
</ins><span class="cx">
</span><del>- if (m_transaction->isReadOnly()) {
- ec.code = IDBDatabaseException::ReadOnlyError;
- ec.message = ASCIILiteral("Failed to execute 'clear' on 'IDBObjectStore': The transaction is read-only.");
- return nullptr;
- }
</del><ins>+ if (m_transaction->isReadOnly())
+ return Exception { IDBDatabaseException::ReadOnlyError, ASCIILiteral("Failed to execute 'clear' on 'IDBObjectStore': The transaction is read-only.") };
</ins><span class="cx">
</span><del>- Ref<IDBRequest> request = m_transaction->requestClearObjectStore(execState, *this);
- return adoptRef(request.leakRef());
</del><ins>+ return m_transaction->requestClearObjectStore(execState, *this);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBIndex> IDBObjectStore::createIndex(ExecState&, const String& name, const IDBKeyPath& keyPath, const IndexParameters& parameters, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBIndex>> IDBObjectStore::createIndex(ExecState&, const String& name, const IDBKeyPath& keyPath, const IndexParameters& parameters)
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBObjectStore::createIndex %s", name.utf8().data());
</span><span class="cx"> ASSERT(currentThread() == m_transaction->database().originThreadID());
</span><span class="cx">
</span><del>- if (m_deleted) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'createIndex' on 'IDBObjectStore': The object store has been deleted.");
- return nullptr;
- }
</del><ins>+ if (m_deleted)
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'createIndex' on 'IDBObjectStore': The object store has been deleted.") };
</ins><span class="cx">
</span><del>- if (!m_transaction->isVersionChange()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'createIndex' on 'IDBObjectStore': The database is not running a version change transaction.");
- return nullptr;
- }
</del><ins>+ if (!m_transaction->isVersionChange())
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'createIndex' on 'IDBObjectStore': The database is not running a version change transaction.") };
</ins><span class="cx">
</span><del>- if (!m_transaction->isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- return nullptr;
- }
</del><ins>+ if (!m_transaction->isActive())
+ return Exception { IDBDatabaseException::TransactionInactiveError };
</ins><span class="cx">
</span><del>- if (!keyPath.isValid()) {
- ec.code = IDBDatabaseException::SyntaxError;
- ec.message = ASCIILiteral("Failed to execute 'createIndex' on 'IDBObjectStore': The keyPath argument contains an invalid key path.");
- return nullptr;
- }
</del><ins>+ if (!keyPath.isValid())
+ return Exception { IDBDatabaseException::SyntaxError, ASCIILiteral("Failed to execute 'createIndex' on 'IDBObjectStore': The keyPath argument contains an invalid key path.") };
</ins><span class="cx">
</span><del>- if (name.isNull()) {
- ec.code = TypeError;
- return nullptr;
- }
</del><ins>+ if (name.isNull())
+ return Exception { TypeError };
</ins><span class="cx">
</span><del>- if (m_info.hasIndex(name)) {
- ec.code = IDBDatabaseException::ConstraintError;
- ec.message = ASCIILiteral("Failed to execute 'createIndex' on 'IDBObjectStore': An index with the specified name already exists.");
- return nullptr;
- }
</del><ins>+ if (m_info.hasIndex(name))
+ return Exception { IDBDatabaseException::ConstraintError, ASCIILiteral("Failed to execute 'createIndex' on 'IDBObjectStore': An index with the specified name already exists.") };
</ins><span class="cx">
</span><del>- if (keyPath.type() == IDBKeyPath::Type::Array && parameters.multiEntry) {
- ec.code = IDBDatabaseException::InvalidAccessError;
- ec.message = ASCIILiteral("Failed to execute 'createIndex' on 'IDBObjectStore': The keyPath argument was an array and the multiEntry option is true.");
- return nullptr;
- }
</del><ins>+ if (keyPath.type() == IDBKeyPath::Type::Array && parameters.multiEntry)
+ return Exception { IDBDatabaseException::InvalidAccessError, ASCIILiteral("Failed to execute 'createIndex' on 'IDBObjectStore': The keyPath argument was an array and the multiEntry option is true.") };
</ins><span class="cx">
</span><span class="cx"> // Install the new Index into the ObjectStore's info.
</span><span class="cx"> IDBIndexInfo info = m_info.createNewIndex(name, keyPath, parameters.unique, parameters.multiEntry);
</span><span class="lines">@@ -481,81 +378,63 @@
</span><span class="cx">
</span><span class="cx"> // Create the actual IDBObjectStore from the transaction, which also schedules the operation server side.
</span><span class="cx"> auto index = m_transaction->createIndex(*this, info);
</span><del>- RefPtr<IDBIndex> refIndex = index.get();
</del><span class="cx">
</span><ins>+ Ref<IDBIndex> referencedIndex { *index };
+
</ins><span class="cx"> Locker<Lock> locker(m_referencedIndexLock);
</span><span class="cx"> m_referencedIndexes.set(name, WTFMove(index));
</span><span class="cx">
</span><del>- return refIndex;
</del><ins>+ return WTFMove(referencedIndex);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBIndex> IDBObjectStore::index(const String& indexName, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBIndex>> IDBObjectStore::index(const String& indexName)
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBObjectStore::index");
</span><span class="cx"> ASSERT(currentThread() == m_transaction->database().originThreadID());
</span><span class="cx">
</span><span class="cx"> if (!scriptExecutionContext())
</span><del>- return nullptr;
</del><ins>+ return Exception { IDBDatabaseException::InvalidStateError }; // FIXME: Is this code tested? Is iteven reachable?
</ins><span class="cx">
</span><del>- if (m_deleted) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'index' on 'IDBObjectStore': The object store has been deleted.");
- return nullptr;
- }
</del><ins>+ if (m_deleted)
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'index' on 'IDBObjectStore': The object store has been deleted.") };
</ins><span class="cx">
</span><del>- if (m_transaction->isFinishedOrFinishing()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'index' on 'IDBObjectStore': The transaction is finished.");
- return nullptr;
- }
</del><ins>+ if (m_transaction->isFinishedOrFinishing())
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'index' on 'IDBObjectStore': The transaction is finished.") };
</ins><span class="cx">
</span><span class="cx"> Locker<Lock> locker(m_referencedIndexLock);
</span><span class="cx"> auto iterator = m_referencedIndexes.find(indexName);
</span><span class="cx"> if (iterator != m_referencedIndexes.end())
</span><del>- return iterator->value.get();
</del><ins>+ return Ref<IDBIndex> { *iterator->value };
</ins><span class="cx">
</span><span class="cx"> auto* info = m_info.infoForExistingIndex(indexName);
</span><del>- if (!info) {
- ec.code = IDBDatabaseException::NotFoundError;
- ec.message = ASCIILiteral("Failed to execute 'index' on 'IDBObjectStore': The specified index was not found.");
- return nullptr;
- }
</del><ins>+ if (!info)
+ return Exception { IDBDatabaseException::NotFoundError, ASCIILiteral("Failed to execute 'index' on 'IDBObjectStore': The specified index was not found.") };
</ins><span class="cx">
</span><span class="cx"> auto index = std::make_unique<IDBIndex>(*scriptExecutionContext(), *info, *this);
</span><del>- RefPtr<IDBIndex> refIndex = index.get();
</del><ins>+
+ Ref<IDBIndex> referencedIndex { *index };
+
</ins><span class="cx"> m_referencedIndexes.set(indexName, WTFMove(index));
</span><span class="cx">
</span><del>- return refIndex;
</del><ins>+ return WTFMove(referencedIndex);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void IDBObjectStore::deleteIndex(const String& name, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<void> IDBObjectStore::deleteIndex(const String& name)
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBObjectStore::deleteIndex %s", name.utf8().data());
</span><span class="cx"> ASSERT(currentThread() == m_transaction->database().originThreadID());
</span><span class="cx">
</span><del>- if (m_deleted) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'deleteIndex' on 'IDBObjectStore': The object store has been deleted.");
- return;
- }
</del><ins>+ if (m_deleted)
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'deleteIndex' on 'IDBObjectStore': The object store has been deleted.") };
</ins><span class="cx">
</span><del>- if (!m_transaction->isVersionChange()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'deleteIndex' on 'IDBObjectStore': The database is not running a version change transaction.");
- return;
- }
</del><ins>+ if (!m_transaction->isVersionChange())
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'deleteIndex' on 'IDBObjectStore': The database is not running a version change transaction.") };
</ins><span class="cx">
</span><del>- if (!m_transaction->isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- ec.message = ASCIILiteral("Failed to execute 'deleteIndex' on 'IDBObjectStore': The transaction is inactive or finished.");
- return;
- }
</del><ins>+ if (!m_transaction->isActive())
+ return Exception { IDBDatabaseException::TransactionInactiveError, ASCIILiteral("Failed to execute 'deleteIndex' on 'IDBObjectStore': The transaction is inactive or finished.") };
</ins><span class="cx">
</span><del>- if (!m_info.hasIndex(name)) {
- ec.code = IDBDatabaseException::NotFoundError;
- ec.message = ASCIILiteral("Failed to execute 'deleteIndex' on 'IDBObjectStore': The specified index was not found.");
- return;
- }
</del><ins>+ if (!m_info.hasIndex(name))
+ return Exception { IDBDatabaseException::NotFoundError, ASCIILiteral("Failed to execute 'deleteIndex' on 'IDBObjectStore': The specified index was not found.") };
</ins><span class="cx">
</span><span class="cx"> auto* info = m_info.infoForExistingIndex(name);
</span><span class="cx"> ASSERT(info);
</span><span class="lines">@@ -573,30 +452,29 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> m_transaction->deleteIndex(m_info.identifier(), name);
</span><ins>+
+ return { };
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBRequest> IDBObjectStore::count(ExecState& execState, JSValue key, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::count(ExecState& execState, JSValue key)
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBObjectStore::count");
</span><span class="cx">
</span><span class="cx"> Ref<IDBKey> idbKey = scriptValueToIDBKey(execState, key);
</span><del>- if (!idbKey->isValid()) {
- ec.code = IDBDatabaseException::DataError;
- ec.message = ASCIILiteral("Failed to execute 'count' on 'IDBObjectStore': The parameter is not a valid key.");
- return nullptr;
- }
</del><ins>+ if (!idbKey->isValid())
+ return Exception { IDBDatabaseException::DataError, ASCIILiteral("Failed to execute 'count' on 'IDBObjectStore': The parameter is not a valid key.") };
</ins><span class="cx">
</span><del>- return doCount(execState, IDBKeyRangeData(idbKey.ptr()), ec);
</del><ins>+ return doCount(execState, IDBKeyRangeData(idbKey.ptr()));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBRequest> IDBObjectStore::count(ExecState& execState, IDBKeyRange* range, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::count(ExecState& execState, IDBKeyRange* range)
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBObjectStore::count");
</span><span class="cx">
</span><del>- return doCount(execState, range ? IDBKeyRangeData(range) : IDBKeyRangeData::allKeys(), ec);
</del><ins>+ return doCount(execState, range ? IDBKeyRangeData(range) : IDBKeyRangeData::allKeys());
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBRequest> IDBObjectStore::doCount(ExecState& execState, const IDBKeyRangeData& range, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::doCount(ExecState& execState, const IDBKeyRangeData& range)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(currentThread() == m_transaction->database().originThreadID());
</span><span class="cx">
</span><span class="lines">@@ -605,22 +483,14 @@
</span><span class="cx"> // However, a handful of W3C IDB tests expect the deleted exception even though the transaction inactive exception also applies.
</span><span class="cx"> // Additionally, Chrome and Edge agree with the test, as does Legacy IDB in WebKit.
</span><span class="cx"> // Until this is sorted out, we'll agree with the test and the majority share browsers.
</span><del>- if (m_deleted) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'count' on 'IDBObjectStore': The object store has been deleted.");
- return nullptr;
- }
</del><ins>+ if (m_deleted)
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'count' on 'IDBObjectStore': The object store has been deleted.") };
</ins><span class="cx">
</span><del>- if (!m_transaction->isActive()) {
- ec.code = IDBDatabaseException::TransactionInactiveError;
- ec.message = ASCIILiteral("Failed to execute 'count' on 'IDBObjectStore': The transaction is inactive or finished.");
- return nullptr;
- }
</del><ins>+ if (!m_transaction->isActive())
+ return Exception { IDBDatabaseException::TransactionInactiveError, ASCIILiteral("Failed to execute 'count' on 'IDBObjectStore': The transaction is inactive or finished.") };
</ins><span class="cx">
</span><del>- if (!range.isValid()) {
- ec.code = IDBDatabaseException::DataError;
- return nullptr;
- }
</del><ins>+ if (!range.isValid())
+ return Exception { IDBDatabaseException::DataError };
</ins><span class="cx">
</span><span class="cx"> return m_transaction->requestCount(execState, *this, range);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBObjectStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><span class="cx"> #include "ActiveDOMObject.h"
</span><ins>+#include "ExceptionOr.h"
</ins><span class="cx"> #include "IDBObjectStoreInfo.h"
</span><span class="cx"> #include <wtf/HashSet.h>
</span><span class="cx">
</span><span class="lines">@@ -46,7 +47,6 @@
</span><span class="cx"> class IDBRequest;
</span><span class="cx"> class IDBTransaction;
</span><span class="cx">
</span><del>-struct ExceptionCodeWithMessage;
</del><span class="cx"> struct IDBKeyRangeData;
</span><span class="cx">
</span><span class="cx"> namespace IndexedDB {
</span><span class="lines">@@ -70,22 +70,22 @@
</span><span class="cx"> bool multiEntry;
</span><span class="cx"> };
</span><span class="cx">
</span><del>- RefPtr<IDBRequest> openCursor(JSC::ExecState&, IDBKeyRange*, const String& direction, ExceptionCodeWithMessage&);
- RefPtr<IDBRequest> openCursor(JSC::ExecState&, JSC::JSValue key, const String& direction, ExceptionCodeWithMessage&);
- RefPtr<IDBRequest> get(JSC::ExecState&, JSC::JSValue key, ExceptionCodeWithMessage&);
- RefPtr<IDBRequest> get(JSC::ExecState&, IDBKeyRange*, ExceptionCodeWithMessage&);
- RefPtr<IDBRequest> add(JSC::ExecState&, JSC::JSValue, JSC::JSValue key, ExceptionCodeWithMessage&);
- RefPtr<IDBRequest> put(JSC::ExecState&, JSC::JSValue, JSC::JSValue key, ExceptionCodeWithMessage&);
- RefPtr<IDBRequest> deleteFunction(JSC::ExecState&, IDBKeyRange*, ExceptionCodeWithMessage&);
- RefPtr<IDBRequest> deleteFunction(JSC::ExecState&, JSC::JSValue key, ExceptionCodeWithMessage&);
- RefPtr<IDBRequest> clear(JSC::ExecState&, ExceptionCodeWithMessage&);
- RefPtr<IDBIndex> createIndex(JSC::ExecState&, const String& name, const IDBKeyPath&, const IndexParameters&, ExceptionCodeWithMessage&);
- RefPtr<IDBIndex> index(const String& name, ExceptionCodeWithMessage&);
- void deleteIndex(const String& name, ExceptionCodeWithMessage&);
- RefPtr<IDBRequest> count(JSC::ExecState&, IDBKeyRange*, ExceptionCodeWithMessage&);
- RefPtr<IDBRequest> count(JSC::ExecState&, JSC::JSValue key, ExceptionCodeWithMessage&);
</del><ins>+ ExceptionOr<Ref<IDBRequest>> openCursor(JSC::ExecState&, IDBKeyRange*, const String& direction);
+ ExceptionOr<Ref<IDBRequest>> openCursor(JSC::ExecState&, JSC::JSValue key, const String& direction);
+ ExceptionOr<Ref<IDBRequest>> get(JSC::ExecState&, JSC::JSValue key);
+ ExceptionOr<Ref<IDBRequest>> get(JSC::ExecState&, IDBKeyRange*);
+ ExceptionOr<Ref<IDBRequest>> add(JSC::ExecState&, JSC::JSValue, JSC::JSValue key);
+ ExceptionOr<Ref<IDBRequest>> put(JSC::ExecState&, JSC::JSValue, JSC::JSValue key);
+ ExceptionOr<Ref<IDBRequest>> deleteFunction(JSC::ExecState&, IDBKeyRange*);
+ ExceptionOr<Ref<IDBRequest>> deleteFunction(JSC::ExecState&, JSC::JSValue key);
+ ExceptionOr<Ref<IDBRequest>> clear(JSC::ExecState&);
+ ExceptionOr<Ref<IDBIndex>> createIndex(JSC::ExecState&, const String& name, const IDBKeyPath&, const IndexParameters&);
+ ExceptionOr<Ref<IDBIndex>> index(const String& name);
+ ExceptionOr<void> deleteIndex(const String& name);
+ ExceptionOr<Ref<IDBRequest>> count(JSC::ExecState&, IDBKeyRange*);
+ ExceptionOr<Ref<IDBRequest>> count(JSC::ExecState&, JSC::JSValue key);
</ins><span class="cx">
</span><del>- RefPtr<IDBRequest> putForCursorUpdate(JSC::ExecState&, JSC::JSValue, JSC::JSValue key, ExceptionCodeWithMessage&);
</del><ins>+ ExceptionOr<Ref<IDBRequest>> putForCursorUpdate(JSC::ExecState&, JSC::JSValue, JSC::JSValue key);
</ins><span class="cx">
</span><span class="cx"> void markAsDeleted();
</span><span class="cx"> bool isDeleted() const { return m_deleted; }
</span><span class="lines">@@ -100,9 +100,9 @@
</span><span class="cx"> IDBObjectStore(ScriptExecutionContext&, const IDBObjectStoreInfo&, IDBTransaction&);
</span><span class="cx">
</span><span class="cx"> enum class InlineKeyCheck { Perform, DoNotPerform };
</span><del>- RefPtr<IDBRequest> putOrAdd(JSC::ExecState&, JSC::JSValue, RefPtr<IDBKey>, IndexedDB::ObjectStoreOverwriteMode, InlineKeyCheck, ExceptionCodeWithMessage&);
- RefPtr<IDBRequest> doCount(JSC::ExecState&, const IDBKeyRangeData&, ExceptionCodeWithMessage&);
- RefPtr<IDBRequest> doDelete(JSC::ExecState&, IDBKeyRange*, ExceptionCodeWithMessage&);
</del><ins>+ ExceptionOr<Ref<IDBRequest>> putOrAdd(JSC::ExecState&, JSC::JSValue, RefPtr<IDBKey>, IndexedDB::ObjectStoreOverwriteMode, InlineKeyCheck);
+ ExceptionOr<Ref<IDBRequest>> doCount(JSC::ExecState&, const IDBKeyRangeData&);
+ ExceptionOr<Ref<IDBRequest>> doDelete(JSC::ExecState&, IDBKeyRange*);
</ins><span class="cx">
</span><span class="cx"> const char* activeDOMObjectName() const final;
</span><span class="cx"> bool canSuspendForDocumentSuspension() const final;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBObjectStoreidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -36,21 +36,21 @@
</span><span class="cx"> readonly attribute IDBTransaction transaction;
</span><span class="cx"> readonly attribute boolean autoIncrement;
</span><span class="cx">
</span><del>- [CallWith=ScriptState, MayThrowLegacyExceptionWithMessage] IDBRequest put(any value, optional any key);
- [CallWith=ScriptState, MayThrowLegacyExceptionWithMessage] IDBRequest add(any value, optional any key);
- [CallWith=ScriptState, ImplementedAs=deleteFunction, MayThrowLegacyExceptionWithMessage] IDBRequest delete(IDBKeyRange? keyRange);
- [CallWith=ScriptState, ImplementedAs=deleteFunction, MayThrowLegacyExceptionWithMessage] IDBRequest delete(any key);
- [CallWith=ScriptState, MayThrowLegacyExceptionWithMessage] IDBRequest get(IDBKeyRange? key);
- [CallWith=ScriptState, MayThrowLegacyExceptionWithMessage] IDBRequest get(any key);
- [CallWith=ScriptState, MayThrowLegacyExceptionWithMessage] IDBRequest clear();
- [CallWith=ScriptState, MayThrowLegacyExceptionWithMessage] IDBRequest openCursor(optional IDBKeyRange? range = null, optional DOMString direction = "next");
- [CallWith=ScriptState, MayThrowLegacyExceptionWithMessage] IDBRequest openCursor(any key, optional DOMString direction = "next");
- [CallWith=ScriptState, MayThrowLegacyExceptionWithMessage] IDBIndex createIndex(DOMString name, sequence<DOMString> keyPath, optional IDBIndexParameters options);
- [CallWith=ScriptState, MayThrowLegacyExceptionWithMessage] IDBIndex createIndex(DOMString name, DOMString keyPath, optional IDBIndexParameters options);
- [MayThrowLegacyExceptionWithMessage] IDBIndex index(DOMString name);
- [MayThrowLegacyExceptionWithMessage] void deleteIndex(DOMString name);
- [CallWith=ScriptState, MayThrowLegacyExceptionWithMessage] IDBRequest count(optional IDBKeyRange? range = null);
- [CallWith=ScriptState, MayThrowLegacyExceptionWithMessage] IDBRequest count(any key);
</del><ins>+ [CallWith=ScriptState, MayThrowException] IDBRequest put(any value, optional any key);
+ [CallWith=ScriptState, MayThrowException] IDBRequest add(any value, optional any key);
+ [CallWith=ScriptState, ImplementedAs=deleteFunction, MayThrowException] IDBRequest delete(IDBKeyRange? keyRange);
+ [CallWith=ScriptState, ImplementedAs=deleteFunction, MayThrowException] IDBRequest delete(any key);
+ [CallWith=ScriptState, MayThrowException] IDBRequest get(IDBKeyRange? key);
+ [CallWith=ScriptState, MayThrowException] IDBRequest get(any key);
+ [CallWith=ScriptState, MayThrowException] IDBRequest clear();
+ [CallWith=ScriptState, MayThrowException] IDBRequest openCursor(optional IDBKeyRange? range = null, optional DOMString direction = "next");
+ [CallWith=ScriptState, MayThrowException] IDBRequest openCursor(any key, optional DOMString direction = "next");
+ [CallWith=ScriptState, MayThrowException] IDBIndex createIndex(DOMString name, sequence<DOMString> keyPath, optional IDBIndexParameters options);
+ [CallWith=ScriptState, MayThrowException] IDBIndex createIndex(DOMString name, DOMString keyPath, optional IDBIndexParameters options);
+ [MayThrowException] IDBIndex index(DOMString name);
+ [MayThrowException] void deleteIndex(DOMString name);
+ [CallWith=ScriptState, MayThrowException] IDBRequest count(optional IDBKeyRange? range = null);
+ [CallWith=ScriptState, MayThrowException] IDBRequest count(any key);
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> dictionary IDBIndexParameters {
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -126,23 +126,14 @@
</span><span class="cx"> m_cursorResult->clearRequest();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-unsigned short IDBRequest::errorCode(ExceptionCode&) const
</del><ins>+ExceptionOr<DOMError*> IDBRequest::error() const
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(currentThread() == originThreadID());
</span><span class="cx">
</span><del>- return 0;
-}
</del><ins>+ if (!m_isDone)
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to read the 'error' property from 'IDBRequest': The request has not finished.") };
</ins><span class="cx">
</span><del>-RefPtr<DOMError> IDBRequest::error(ExceptionCodeWithMessage& ec) const
-{
- ASSERT(currentThread() == originThreadID());
-
- if (m_isDone)
- return m_domError;
-
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to read the 'error' property from 'IDBRequest': The request has not finished.");
- return nullptr;
</del><ins>+ return m_domError.get();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void IDBRequest::setSource(IDBCursor& cursor)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBRequesth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><span class="cx"> #include "EventTarget.h"
</span><ins>+#include "ExceptionOr.h"
</ins><span class="cx"> #include "IDBActiveDOMObject.h"
</span><span class="cx"> #include "IDBError.h"
</span><span class="cx"> #include "IDBResourceIdentifier.h"
</span><span class="lines">@@ -66,8 +67,7 @@
</span><span class="cx"> IDBCursor* cursorResult() const { return m_cursorResult.get(); }
</span><span class="cx"> IDBDatabase* databaseResult() const { return m_databaseResult.get(); }
</span><span class="cx"> JSC::JSValue scriptResult() const { return m_scriptResult.get(); }
</span><del>- unsigned short errorCode(ExceptionCode&) const;
- RefPtr<DOMError> error(ExceptionCodeWithMessage&) const;
</del><ins>+ ExceptionOr<DOMError*> error() const;
</ins><span class="cx"> IDBObjectStore* objectStoreSource() const { return m_objectStoreSource.get(); }
</span><span class="cx"> IDBIndex* indexSource() const { return m_indexSource.get(); }
</span><span class="cx"> IDBCursor* cursorSource() const { return m_cursorSource.get(); }
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBRequestidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequest.idl (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBRequest.idl        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequest.idl        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -35,7 +35,7 @@
</span><span class="cx"> SkipVTableValidation,
</span><span class="cx"> ] interface IDBRequest : EventTarget {
</span><span class="cx"> [CustomGetter] readonly attribute any result;
</span><del>- [GetterMayThrowLegacyExceptionWithMessage] readonly attribute DOMError error;
</del><ins>+ [GetterMayThrowException] readonly attribute DOMError? error;
</ins><span class="cx"> [CustomGetter] readonly attribute any source;
</span><span class="cx"> readonly attribute IDBTransaction transaction;
</span><span class="cx"> readonly attribute DOMString readyState;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBTransactioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -88,16 +88,14 @@
</span><span class="cx"> return readwrite;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-IndexedDB::TransactionMode IDBTransaction::stringToMode(const String& modeString, ExceptionCode& ec)
</del><ins>+Optional<IndexedDB::TransactionMode> IDBTransaction::stringToMode(const String& modeString)
</ins><span class="cx"> {
</span><del>- if (modeString.isNull()
- || modeString == IDBTransaction::modeReadOnly())
</del><ins>+ if (modeString.isNull() || modeString == IDBTransaction::modeReadOnly())
</ins><span class="cx"> return IndexedDB::TransactionMode::ReadOnly;
</span><span class="cx"> if (modeString == IDBTransaction::modeReadWrite())
</span><span class="cx"> return IndexedDB::TransactionMode::ReadWrite;
</span><span class="cx">
</span><del>- ec = TypeError;
- return IndexedDB::TransactionMode::ReadOnly;
</del><ins>+ return Nullopt;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> const AtomicString& IDBTransaction::modeToString(IndexedDB::TransactionMode mode)
</span><span class="lines">@@ -186,35 +184,32 @@
</span><span class="cx"> RELEASE_ASSERT_NOT_REACHED();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-WebCore::IDBDatabase* IDBTransaction::db()
</del><ins>+IDBDatabase* IDBTransaction::db()
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(currentThread() == m_database->originThreadID());
</span><del>- return &m_database.get();
</del><ins>+ return m_database.ptr();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<DOMError> IDBTransaction::error() const
</del><ins>+DOMError* IDBTransaction::error() const
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(currentThread() == m_database->originThreadID());
</span><del>- return m_domError;
</del><ins>+ return m_domError.get();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<WebCore::IDBObjectStore> IDBTransaction::objectStore(const String& objectStoreName, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<Ref<IDBObjectStore>> IDBTransaction::objectStore(const String& objectStoreName)
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBTransaction::objectStore");
</span><span class="cx"> ASSERT(currentThread() == m_database->originThreadID());
</span><span class="cx">
</span><span class="cx"> if (!scriptExecutionContext())
</span><del>- return nullptr;
</del><ins>+ return Exception { IDBDatabaseException::InvalidStateError };
</ins><span class="cx">
</span><del>- if (isFinishedOrFinishing()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'objectStore' on 'IDBTransaction': The transaction finished.");
- return nullptr;
- }
</del><ins>+ if (isFinishedOrFinishing())
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'objectStore' on 'IDBTransaction': The transaction finished.") };
</ins><span class="cx">
</span><span class="cx"> auto iterator = m_referencedObjectStores.find(objectStoreName);
</span><span class="cx"> if (iterator != m_referencedObjectStores.end())
</span><del>- return iterator->value;
</del><ins>+ return Ref<IDBObjectStore> { *iterator->value };
</ins><span class="cx">
</span><span class="cx"> bool found = false;
</span><span class="cx"> for (auto& objectStore : m_info.objectStores()) {
</span><span class="lines">@@ -225,23 +220,17 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> auto* info = m_database->info().infoForExistingObjectStore(objectStoreName);
</span><del>- if (!info) {
- ec.code = IDBDatabaseException::NotFoundError;
- ec.message = ASCIILiteral("Failed to execute 'objectStore' on 'IDBTransaction': The specified object store was not found.");
- return nullptr;
- }
</del><ins>+ if (!info)
+ return Exception { IDBDatabaseException::NotFoundError, ASCIILiteral("Failed to execute 'objectStore' on 'IDBTransaction': The specified object store was not found.") };
</ins><span class="cx">
</span><span class="cx"> // Version change transactions are scoped to every object store in the database.
</span><del>- if (!info || (!found && !isVersionChange())) {
- ec.code = IDBDatabaseException::NotFoundError;
- ec.message = ASCIILiteral("Failed to execute 'objectStore' on 'IDBTransaction': The specified object store was not found.");
- return nullptr;
- }
</del><ins>+ if (!info || (!found && !isVersionChange()))
+ return Exception { IDBDatabaseException::NotFoundError, ASCIILiteral("Failed to execute 'objectStore' on 'IDBTransaction': The specified object store was not found.") };
</ins><span class="cx">
</span><span class="cx"> auto objectStore = IDBObjectStore::create(*scriptExecutionContext(), *info, *this);
</span><del>- m_referencedObjectStores.set(objectStoreName, &objectStore.get());
</del><ins>+ m_referencedObjectStores.set(objectStoreName, objectStore.ptr());
</ins><span class="cx">
</span><del>- return adoptRef(&objectStore.leakRef());
</del><ins>+ return WTFMove(objectStore);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -254,8 +243,7 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> m_domError = &error;
</span><del>- ExceptionCodeWithMessage ec;
- abort(ec);
</del><ins>+ internalAbort();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void IDBTransaction::transitionedToFinishing(IndexedDB::TransactionState state)
</span><span class="lines">@@ -268,17 +256,25 @@
</span><span class="cx"> m_referencedObjectStores.clear();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void IDBTransaction::abort(ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<void> IDBTransaction::abort()
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBTransaction::abort");
</span><span class="cx"> ASSERT(currentThread() == m_database->originThreadID());
</span><span class="cx">
</span><del>- if (isFinishedOrFinishing()) {
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to execute 'abort' on 'IDBTransaction': The transaction is inactive or finished.");
- return;
- }
</del><ins>+ if (isFinishedOrFinishing())
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'abort' on 'IDBTransaction': The transaction is inactive or finished.") };
</ins><span class="cx">
</span><ins>+ internalAbort();
+
+ return { };
+}
+
+void IDBTransaction::internalAbort()
+{
+ LOG(IndexedDB, "IDBTransaction::internalAbort");
+ ASSERT(currentThread() == m_database->originThreadID());
+ ASSERT(!isFinishedOrFinishing());
+
</ins><span class="cx"> m_database->willAbortTransaction(*this);
</span><span class="cx">
</span><span class="cx"> if (isVersionChange()) {
</span><span class="lines">@@ -290,8 +286,7 @@
</span><span class="cx">
</span><span class="cx"> m_abortQueue.swap(m_transactionOperationQueue);
</span><span class="cx">
</span><del>- auto operation = IDBClient::createTransactionOperation(*this, nullptr, &IDBTransaction::abortOnServerAndCancelRequests);
- scheduleOperation(WTFMove(operation));
</del><ins>+ scheduleOperation(IDBClient::createTransactionOperation(*this, nullptr, &IDBTransaction::abortOnServerAndCancelRequests));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void IDBTransaction::abortOnServerAndCancelRequests(IDBClient::TransactionOperation& operation)
</span><span class="lines">@@ -348,8 +343,7 @@
</span><span class="cx"> if (isFinishedOrFinishing())
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- ExceptionCodeWithMessage ec;
- abort(ec);
</del><ins>+ internalAbort();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool IDBTransaction::isActive() const
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBTransactionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -69,7 +69,7 @@
</span><span class="cx"> static const AtomicString& modeReadOnlyLegacy();
</span><span class="cx"> static const AtomicString& modeReadWriteLegacy();
</span><span class="cx">
</span><del>- static IndexedDB::TransactionMode stringToMode(const String&, ExceptionCode&);
</del><ins>+ static Optional<IndexedDB::TransactionMode> stringToMode(const String&);
</ins><span class="cx"> static const AtomicString& modeToString(IndexedDB::TransactionMode);
</span><span class="cx">
</span><span class="cx"> static Ref<IDBTransaction> create(IDBDatabase&, const IDBTransactionInfo&);
</span><span class="lines">@@ -80,9 +80,9 @@
</span><span class="cx"> // IDBTransaction IDL
</span><span class="cx"> const String& mode() const;
</span><span class="cx"> IDBDatabase* db();
</span><del>- RefPtr<DOMError> error() const;
- RefPtr<IDBObjectStore> objectStore(const String& name, ExceptionCodeWithMessage&);
- void abort(ExceptionCodeWithMessage&);
</del><ins>+ DOMError* error() const;
+ ExceptionOr<Ref<IDBObjectStore>> objectStore(const String& name);
+ ExceptionOr<void> abort();
</ins><span class="cx">
</span><span class="cx"> EventTargetInterface eventTargetInterface() const final { return IDBTransactionEventTargetInterfaceType; }
</span><span class="cx"> ScriptExecutionContext* scriptExecutionContext() const final { return ActiveDOMObject::scriptExecutionContext(); }
</span><span class="lines">@@ -152,6 +152,7 @@
</span><span class="cx">
</span><span class="cx"> void commit();
</span><span class="cx">
</span><ins>+ void internalAbort();
</ins><span class="cx"> void notifyDidAbort(const IDBError&);
</span><span class="cx"> void finishAbortOrCommit();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBTransactionidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.idl (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.idl        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.idl        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -25,8 +25,8 @@
</span><span class="cx"> */
</span><span class="cx">
</span><span class="cx"> [
</span><ins>+ ActiveDOMObject,
</ins><span class="cx"> Conditional=INDEXED_DATABASE,
</span><del>- ActiveDOMObject,
</del><span class="cx"> EnabledAtRuntime=IndexedDB,
</span><span class="cx"> SkipVTableValidation,
</span><span class="cx"> ] interface IDBTransaction : EventTarget {
</span><span class="lines">@@ -34,8 +34,8 @@
</span><span class="cx"> readonly attribute IDBDatabase db;
</span><span class="cx"> readonly attribute DOMError error;
</span><span class="cx">
</span><del>- [MayThrowLegacyExceptionWithMessage] IDBObjectStore objectStore (DOMString name);
- [MayThrowLegacyExceptionWithMessage] void abort ();
</del><ins>+ [MayThrowException] IDBObjectStore objectStore(DOMString name);
+ [MayThrowException] void abort();
</ins><span class="cx">
</span><span class="cx"> attribute EventHandler onabort;
</span><span class="cx"> attribute EventHandler oncomplete;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBConnectionProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.cpp (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.cpp        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.cpp        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -59,7 +59,7 @@
</span><span class="cx"> m_connectionToServer.deref();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBOpenDBRequest> IDBConnectionProxy::openDatabase(ScriptExecutionContext& context, const IDBDatabaseIdentifier& databaseIdentifier, uint64_t version)
</del><ins>+Ref<IDBOpenDBRequest> IDBConnectionProxy::openDatabase(ScriptExecutionContext& context, const IDBDatabaseIdentifier& databaseIdentifier, uint64_t version)
</ins><span class="cx"> {
</span><span class="cx"> RefPtr<IDBOpenDBRequest> request;
</span><span class="cx"> {
</span><span class="lines">@@ -72,10 +72,10 @@
</span><span class="cx">
</span><span class="cx"> callConnectionOnMainThread(&IDBConnectionToServer::openDatabase, IDBRequestData(*this, *request));
</span><span class="cx">
</span><del>- return request;
</del><ins>+ return request.releaseNonNull();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<IDBOpenDBRequest> IDBConnectionProxy::deleteDatabase(ScriptExecutionContext& context, const IDBDatabaseIdentifier& databaseIdentifier)
</del><ins>+Ref<IDBOpenDBRequest> IDBConnectionProxy::deleteDatabase(ScriptExecutionContext& context, const IDBDatabaseIdentifier& databaseIdentifier)
</ins><span class="cx"> {
</span><span class="cx"> RefPtr<IDBOpenDBRequest> request;
</span><span class="cx"> {
</span><span class="lines">@@ -88,7 +88,7 @@
</span><span class="cx">
</span><span class="cx"> callConnectionOnMainThread(&IDBConnectionToServer::deleteDatabase, IDBRequestData(*this, *request));
</span><span class="cx">
</span><del>- return request;
</del><ins>+ return request.releaseNonNull();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void IDBConnectionProxy::didOpenDatabase(const IDBResultData& resultData)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBConnectionProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.h (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.h        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.h        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -60,10 +60,10 @@
</span><span class="cx"> public:
</span><span class="cx"> IDBConnectionProxy(IDBConnectionToServer&);
</span><span class="cx">
</span><del>- RefPtr<IDBOpenDBRequest> openDatabase(ScriptExecutionContext&, const IDBDatabaseIdentifier&, uint64_t version);
</del><ins>+ Ref<IDBOpenDBRequest> openDatabase(ScriptExecutionContext&, const IDBDatabaseIdentifier&, uint64_t version);
</ins><span class="cx"> void didOpenDatabase(const IDBResultData&);
</span><span class="cx">
</span><del>- RefPtr<IDBOpenDBRequest> deleteDatabase(ScriptExecutionContext&, const IDBDatabaseIdentifier&);
</del><ins>+ Ref<IDBOpenDBRequest> deleteDatabase(ScriptExecutionContext&, const IDBDatabaseIdentifier&);
</ins><span class="cx"> void didDeleteDatabase(const IDBResultData&);
</span><span class="cx">
</span><span class="cx"> void createObjectStore(TransactionOperation&, const IDBObjectStoreInfo&);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamMediaEndpointPeerConnectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -322,12 +322,12 @@
</span><span class="cx"> if (m_client->internalSignalingState() == SignalingState::Closed)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- ExceptionCodeWithMessage exception;
- auto newDescription = MediaEndpointSessionDescription::create(WTFMove(description), *m_sdpProcessor, exception);
- if (exception.code) {
- promise.reject(exception.code, exception.message);
</del><ins>+ auto result = MediaEndpointSessionDescription::create(WTFMove(description), *m_sdpProcessor);
+ if (result.hasException()) {
+ promise.reject(result.releaseException());
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><ins>+ auto newDescription = result.releaseReturnValue();
</ins><span class="cx">
</span><span class="cx"> if (!localDescriptionTypeValidForState(newDescription->type())) {
</span><span class="cx"> promise.reject(INVALID_STATE_ERR, "Description type incompatible with current signaling state");
</span><span class="lines">@@ -389,12 +389,12 @@
</span><span class="cx"> // Update state and local descriptions according to setLocal/RemoteDescription processing model
</span><span class="cx"> switch (newDescription->type()) {
</span><span class="cx"> case RTCSessionDescription::SdpType::Offer:
</span><del>- m_pendingLocalDescription = newDescription;
</del><ins>+ m_pendingLocalDescription = WTFMove(newDescription);
</ins><span class="cx"> newSignalingState = SignalingState::HaveLocalOffer;
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> case RTCSessionDescription::SdpType::Answer:
</span><del>- m_currentLocalDescription = newDescription;
</del><ins>+ m_currentLocalDescription = WTFMove(newDescription);
</ins><span class="cx"> m_currentRemoteDescription = m_pendingRemoteDescription;
</span><span class="cx"> m_pendingLocalDescription = nullptr;
</span><span class="cx"> m_pendingRemoteDescription = nullptr;
</span><span class="lines">@@ -407,7 +407,7 @@
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> case RTCSessionDescription::SdpType::Pranswer:
</span><del>- m_pendingLocalDescription = newDescription;
</del><ins>+ m_pendingLocalDescription = WTFMove(newDescription);
</ins><span class="cx"> newSignalingState = SignalingState::HaveLocalPrAnswer;
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="lines">@@ -453,12 +453,12 @@
</span><span class="cx"> if (m_client->internalSignalingState() == SignalingState::Closed)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- ExceptionCodeWithMessage exception;
- auto newDescription = MediaEndpointSessionDescription::create(WTFMove(description), *m_sdpProcessor, exception);
- if (exception.code) {
- promise.reject(exception.code, exception.message);
</del><ins>+ auto result = MediaEndpointSessionDescription::create(WTFMove(description), *m_sdpProcessor);
+ if (result.hasException()) {
+ promise.reject(result.releaseException());
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><ins>+ auto newDescription = result.releaseReturnValue();
</ins><span class="cx">
</span><span class="cx"> if (!remoteDescriptionTypeValidForState(newDescription->type())) {
</span><span class="cx"> promise.reject(INVALID_STATE_ERR, "Description type incompatible with current signaling state");
</span><span class="lines">@@ -564,12 +564,12 @@
</span><span class="cx"> // Update state and local descriptions according to setLocal/RemoteDescription processing model
</span><span class="cx"> switch (newDescription->type()) {
</span><span class="cx"> case RTCSessionDescription::SdpType::Offer:
</span><del>- m_pendingRemoteDescription = newDescription;
</del><ins>+ m_pendingRemoteDescription = WTFMove(newDescription);
</ins><span class="cx"> newSignalingState = SignalingState::HaveRemoteOffer;
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> case RTCSessionDescription::SdpType::Answer:
</span><del>- m_currentRemoteDescription = newDescription;
</del><ins>+ m_currentRemoteDescription = WTFMove(newDescription);
</ins><span class="cx"> m_currentLocalDescription = m_pendingLocalDescription;
</span><span class="cx"> m_pendingRemoteDescription = nullptr;
</span><span class="cx"> m_pendingLocalDescription = nullptr;
</span><span class="lines">@@ -582,7 +582,7 @@
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> case RTCSessionDescription::SdpType::Pranswer:
</span><del>- m_pendingRemoteDescription = newDescription;
</del><ins>+ m_pendingRemoteDescription = WTFMove(newDescription);
</ins><span class="cx"> newSignalingState = SignalingState::HaveRemotePrAnswer;
</span><span class="cx"> break;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamMediaEndpointSessionDescriptioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/MediaEndpointSessionDescription.cpp (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/MediaEndpointSessionDescription.cpp        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/Modules/mediastream/MediaEndpointSessionDescription.cpp        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -55,23 +55,17 @@
</span><span class="cx"> return adoptRef(*new MediaEndpointSessionDescription(type, WTFMove(configuration), nullptr));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<MediaEndpointSessionDescription> MediaEndpointSessionDescription::create(RefPtr<RTCSessionDescription>&& rtcDescription, const SDPProcessor& sdpProcessor, ExceptionCodeWithMessage& exception)
</del><ins>+ExceptionOr<Ref<MediaEndpointSessionDescription>> MediaEndpointSessionDescription::create(RefPtr<RTCSessionDescription>&& rtcDescription, const SDPProcessor& sdpProcessor)
</ins><span class="cx"> {
</span><span class="cx"> RefPtr<MediaEndpointSessionConfiguration> configuration;
</span><del>- SDPProcessor::Result result = sdpProcessor.parse(rtcDescription->sdp(), configuration);
</del><ins>+ auto result = sdpProcessor.parse(rtcDescription->sdp(), configuration);
</ins><span class="cx"> if (result != SDPProcessor::Result::Success) {
</span><del>- if (result == SDPProcessor::Result::ParseError) {
- exception.code = INVALID_ACCESS_ERR;
- exception.message = ASCIILiteral("SDP content is invalid");
- return nullptr;
- }
</del><ins>+ if (result == SDPProcessor::Result::ParseError)
+ return Exception { INVALID_ACCESS_ERR, ASCIILiteral("SDP content is invalid") };
</ins><span class="cx"> LOG_ERROR("SDPProcessor internal error");
</span><del>- exception.code = ABORT_ERR;
- exception.message = ASCIILiteral("Internal error");
- return nullptr;
</del><ins>+ return Exception { ABORT_ERR, ASCIILiteral("Internal error") };
</ins><span class="cx"> }
</span><del>-
- return adoptRef(new MediaEndpointSessionDescription(rtcDescription->type(), WTFMove(configuration), WTFMove(rtcDescription)));
</del><ins>+ return adoptRef(*new MediaEndpointSessionDescription(rtcDescription->type(), WTFMove(configuration), WTFMove(rtcDescription)));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RefPtr<RTCSessionDescription> MediaEndpointSessionDescription::toRTCSessionDescription(const SDPProcessor& sdpProcessor) const
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamMediaEndpointSessionDescriptionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/MediaEndpointSessionDescription.h (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/MediaEndpointSessionDescription.h        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/Modules/mediastream/MediaEndpointSessionDescription.h        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -28,11 +28,11 @@
</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 MediaEndpointSessionDescription_h
-#define MediaEndpointSessionDescription_h
</del><ins>+#pragma once
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(WEB_RTC)
</span><span class="cx">
</span><ins>+#include "ExceptionOr.h"
</ins><span class="cx"> #include "RTCSessionDescription.h"
</span><span class="cx"> #include <wtf/RefCounted.h>
</span><span class="cx"> #include <wtf/RefPtr.h>
</span><span class="lines">@@ -46,8 +46,8 @@
</span><span class="cx"> class MediaEndpointSessionDescription : public RefCounted<MediaEndpointSessionDescription> {
</span><span class="cx"> public:
</span><span class="cx"> static Ref<MediaEndpointSessionDescription> create(RTCSessionDescription::SdpType, RefPtr<MediaEndpointSessionConfiguration>&&);
</span><del>- static RefPtr<MediaEndpointSessionDescription> create(RefPtr<RTCSessionDescription>&&, const SDPProcessor&, ExceptionCodeWithMessage&);
- virtual ~MediaEndpointSessionDescription() { }
</del><ins>+ static ExceptionOr<Ref<MediaEndpointSessionDescription>> create(RefPtr<RTCSessionDescription>&&, const SDPProcessor&);
+ virtual ~MediaEndpointSessionDescription() { } // FIXME: Why is this virtual? There are no other virtual functions in this class.
</ins><span class="cx">
</span><span class="cx"> RefPtr<RTCSessionDescription> toRTCSessionDescription(const SDPProcessor&) const;
</span><span class="cx">
</span><span class="lines">@@ -73,5 +73,3 @@
</span><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #endif // ENABLE(WEB_RTC)
</span><del>-
-#endif // MediaEndpointSessionDescription_h
</del></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMBindingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -335,6 +335,11 @@
</span><span class="cx"> return createDOMException(exec, ec, &message);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+JSValue createDOMException(ExecState& state, Exception&& exception)
+{
+ return createDOMException(&state, exception.code(), exception.releaseMessage());
+}
+
</ins><span class="cx"> ALWAYS_INLINE static void throwDOMException(ExecState* exec, ThrowScope& throwScope, ExceptionCode ec)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(ec && !throwScope.exception());
</span><span class="lines">@@ -341,16 +346,10 @@
</span><span class="cx"> throwException(exec, throwScope, createDOMException(exec, ec));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-ALWAYS_INLINE static void throwDOMException(ExecState* exec, ThrowScope& throwScope, const ExceptionCodeWithMessage& ec)
-{
- ASSERT(ec.code && !throwScope.exception());
- throwException(exec, throwScope, createDOMException(exec, ec.code, ec.message));
-}
-
</del><span class="cx"> void propagateExceptionSlowPath(JSC::ExecState& state, JSC::ThrowScope& throwScope, Exception&& exception)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(!throwScope.exception());
</span><del>- throwException(&state, throwScope, createDOMException(&state, exception.code(), exception.releaseMessage()));
</del><ins>+ throwException(&state, throwScope, createDOMException(state, WTFMove(exception)));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void propagateException(JSC::ExecState& state, Exception&& exception)
</span><span class="lines">@@ -365,11 +364,6 @@
</span><span class="cx"> throwDOMException(exec, throwScope, ec);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void setDOMExceptionSlow(ExecState* exec, ThrowScope& throwScope, const ExceptionCodeWithMessage& ec)
-{
- throwDOMException(exec, throwScope, ec);
-}
-
</del><span class="cx"> void setDOMException(ExecState* exec, ExceptionCode ec)
</span><span class="cx"> {
</span><span class="cx"> VM& vm = exec->vm();
</span><span class="lines">@@ -381,17 +375,6 @@
</span><span class="cx"> throwDOMException(exec, scope, ec);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void setDOMException(ExecState* exec, const ExceptionCodeWithMessage& ec)
-{
- VM& vm = exec->vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
-
- if (!ec.code || scope.exception())
- return;
-
- throwDOMException(exec, scope, ec);
-}
-
</del><span class="cx"> bool hasIteratorMethod(JSC::ExecState& state, JSC::JSValue value)
</span><span class="cx"> {
</span><span class="cx"> auto& vm = state.vm();
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMBindingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.h (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMBinding.h        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.h        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -181,22 +181,20 @@
</span><span class="cx"> WEBCORE_EXPORT void reportException(JSC::ExecState*, JSC::Exception*, CachedScript* = nullptr, ExceptionDetails* = nullptr);
</span><span class="cx"> void reportCurrentException(JSC::ExecState*);
</span><span class="cx">
</span><ins>+JSC::JSValue createDOMException(JSC::ExecState&, Exception&&);
</ins><span class="cx"> JSC::JSValue createDOMException(JSC::ExecState*, ExceptionCode, const String&);
</span><span class="cx">
</span><span class="cx"> // Convert a DOM implementation exception into a JavaScript exception in the execution state.
</span><span class="cx"> void propagateException(JSC::ExecState&, JSC::ThrowScope&, Exception&&);
</span><span class="cx"> void setDOMException(JSC::ExecState*, JSC::ThrowScope&, ExceptionCode);
</span><del>-void setDOMException(JSC::ExecState*, JSC::ThrowScope&, const ExceptionCodeWithMessage&);
</del><span class="cx">
</span><span class="cx"> // Slower versions of the above for use when the caller doesn't have a ThrowScope.
</span><span class="cx"> void propagateException(JSC::ExecState&, Exception&&);
</span><span class="cx"> WEBCORE_EXPORT void setDOMException(JSC::ExecState*, ExceptionCode);
</span><del>-void setDOMException(JSC::ExecState*, const ExceptionCodeWithMessage&);
</del><span class="cx">
</span><span class="cx"> // Implementation details of the above.
</span><ins>+void propagateExceptionSlowPath(JSC::ExecState&, JSC::ThrowScope&, Exception&&);
</ins><span class="cx"> WEBCORE_EXPORT void setDOMExceptionSlow(JSC::ExecState*, JSC::ThrowScope&, ExceptionCode);
</span><del>-void setDOMExceptionSlow(JSC::ExecState*, JSC::ThrowScope&, const ExceptionCodeWithMessage&);
-void propagateExceptionSlowPath(JSC::ExecState&, JSC::ThrowScope&, Exception&&);
</del><span class="cx">
</span><span class="cx"> JSC::JSValue jsString(JSC::ExecState*, const URL&); // empty if the URL is null
</span><span class="cx">
</span><span class="lines">@@ -364,8 +362,8 @@
</span><span class="cx"> JSC::JSValue toJSNullableDate(JSC::ExecState&, JSC::ThrowScope&, ExceptionOr<Optional<double>>&&);
</span><span class="cx"> JSC::JSValue toJSNullableString(JSC::ExecState&, JSC::ThrowScope&, ExceptionOr<String>&&);
</span><span class="cx"> template<typename T> JSC::JSValue toJSNewlyCreated(JSC::ExecState&, JSDOMGlobalObject&, JSC::ThrowScope&, ExceptionOr<T>&& value);
</span><del>-template<typename T> JSC::JSValue toJSNumber(JSC::ExecState&, JSDOMGlobalObject&, JSC::ThrowScope&, ExceptionOr<T>&& value);
-template<typename T> JSC::JSValue toJSNullableNumber(JSC::ExecState&, JSDOMGlobalObject&, JSC::ThrowScope&, ExceptionOr<T>&& value);
</del><ins>+template<typename T> JSC::JSValue toJSNumber(JSC::ExecState&, JSC::ThrowScope&, ExceptionOr<T>&& value);
+template<typename T> JSC::JSValue toJSNullableNumber(JSC::ExecState&, JSC::ThrowScope&, ExceptionOr<T>&& value);
</ins><span class="cx"> JSC::JSValue toJSString(JSC::ExecState&, JSC::ThrowScope&, ExceptionOr<String>&&);
</span><span class="cx">
</span><span class="cx"> // Inline functions and template definitions.
</span><span class="lines">@@ -903,13 +901,6 @@
</span><span class="cx"> setDOMExceptionSlow(exec, throwScope, ec);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-ALWAYS_INLINE void setDOMException(JSC::ExecState* exec, JSC::ThrowScope& throwScope, const ExceptionCodeWithMessage& exception)
-{
- if (LIKELY(!exception.code || throwScope.exception()))
- return;
- setDOMExceptionSlow(exec, throwScope, exception);
-}
-
</del><span class="cx"> inline void propagateException(JSC::ExecState& state, JSC::ThrowScope& throwScope, ExceptionOr<void>&& value)
</span><span class="cx"> {
</span><span class="cx"> if (UNLIKELY(value.hasException()))
</span><span class="lines">@@ -934,4 +925,13 @@
</span><span class="cx"> return toJSNewlyCreated(&state, &globalObject, value.releaseReturnValue());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+template<typename T> inline JSC::JSValue toJSNumber(JSC::ExecState& state, JSC::ThrowScope& throwScope, ExceptionOr<T>&& value)
+{
+ if (UNLIKELY(value.hasException())) {
+ propagateException(state, throwScope, value.releaseException());
+ return { };
+ }
+ return JSC::jsNumber(value.releaseReturnValue());
+}
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMPromisecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMPromise.cpp (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMPromise.cpp        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/bindings/js/JSDOMPromise.cpp        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -89,6 +89,18 @@
</span><span class="cx"> clear();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void DeferredPromise::reject(Exception&& exception)
+{
+ if (isSuspended())
+ return;
+
+ ASSERT(m_deferred);
+ ASSERT(m_globalObject);
+ auto& state = *m_globalObject->globalExec();
+ JSC::JSLockHolder locker(&state);
+ reject(state, createDOMException(state, WTFMove(exception)));
+}
+
</ins><span class="cx"> void DeferredPromise::reject(ExceptionCode ec, const String& message)
</span><span class="cx"> {
</span><span class="cx"> if (isSuspended())
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMPromiseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMPromise.h (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMPromise.h        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/bindings/js/JSDOMPromise.h        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -125,6 +125,7 @@
</span><span class="cx">
</span><span class="cx"> template<class ResolveResultType> void resolveWithNewlyCreated(Ref<ResolveResultType>&&);
</span><span class="cx">
</span><ins>+ void reject(Exception&&);
</ins><span class="cx"> void reject(ExceptionCode, const String& = { });
</span><span class="cx">
</span><span class="cx"> JSC::JSValue promise() const;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSHistoryCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSHistoryCustom.cpp (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSHistoryCustom.cpp        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/bindings/js/JSHistoryCustom.cpp        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -75,9 +75,7 @@
</span><span class="cx"> RETURN_IF_EXCEPTION(scope, JSValue());
</span><span class="cx"> }
</span><span class="cx">
</span><del>- ExceptionCodeWithMessage ec;
- wrapped().stateObjectAdded(WTFMove(historyState), title, url, History::StateObjectType::Push, ec);
- setDOMException(&state, ec);
</del><ins>+ propagateException(state, scope, wrapped().stateObjectAdded(WTFMove(historyState), title, url, History::StateObjectType::Push));
</ins><span class="cx">
</span><span class="cx"> m_state.clear();
</span><span class="cx">
</span><span class="lines">@@ -106,9 +104,7 @@
</span><span class="cx"> RETURN_IF_EXCEPTION(scope, JSValue());
</span><span class="cx"> }
</span><span class="cx">
</span><del>- ExceptionCodeWithMessage ec;
- wrapped().stateObjectAdded(WTFMove(historyState), title, url, History::StateObjectType::Replace, ec);
- setDOMException(&state, ec);
</del><ins>+ propagateException(state, scope, wrapped().stateObjectAdded(WTFMove(historyState), title, url, History::StateObjectType::Replace));
</ins><span class="cx">
</span><span class="cx"> m_state.clear();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSIDBDatabaseCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSIDBDatabaseCustom.cpp (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSIDBDatabaseCustom.cpp        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/bindings/js/JSIDBDatabaseCustom.cpp        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -76,10 +76,7 @@
</span><span class="cx"> RETURN_IF_EXCEPTION(scope, JSValue());
</span><span class="cx"> }
</span><span class="cx">
</span><del>- ExceptionCodeWithMessage ec;
- JSValue result = toJS(&state, globalObject(), wrapped().createObjectStore(name, keyPath, autoIncrement, ec));
- setDOMException(&state, ec);
- return result;
</del><ins>+ return toJS(state, *globalObject(), scope, wrapped().createObjectStore(name, keyPath, autoIncrement));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSIDBRequestCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSIDBRequestCustom.cpp (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSIDBRequestCustom.cpp        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/bindings/js/JSIDBRequestCustom.cpp        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -42,13 +42,9 @@
</span><span class="cx"> auto& request = wrapped();
</span><span class="cx">
</span><span class="cx"> if (!request.isDone()) {
</span><del>- ExceptionCodeWithMessage ec;
- ec.code = IDBDatabaseException::InvalidStateError;
- ec.message = ASCIILiteral("Failed to read the 'result' property from 'IDBRequest': The request has not finished.");
- setDOMException(&state, ec);
- return jsUndefined();
</del><ins>+ propagateException(state, Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to read the 'result' property from 'IDBRequest': The request has not finished.") });
+ return { };
</ins><span class="cx"> }
</span><del>-
</del><span class="cx"> if (auto* cursor = request.cursorResult())
</span><span class="cx"> return toJS(&state, globalObject(), *cursor);
</span><span class="cx"> if (auto* database = request.databaseResult())
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -2896,8 +2896,7 @@
</span><span class="cx"> my $type = $attribute->signature->type;
</span><span class="cx"> my $getFunctionName = GetAttributeGetterName($interface, $className, $attribute);
</span><span class="cx"> my $implGetterFunctionName = $codeGenerator->WK_lcfirst($attribute->signature->extendedAttributes->{ImplementedAs} || $name);
</span><del>- my $getterMayThrowLegacyExceptionWithMessage = $attribute->signature->extendedAttributes->{GetterMayThrowLegacyExceptionWithMessage};
- my $getterMayThrowLegacyException = $attribute->signature->extendedAttributes->{GetterMayThrowLegacyException} || $getterMayThrowLegacyExceptionWithMessage;
</del><ins>+ my $getterMayThrowLegacyException = $attribute->signature->extendedAttributes->{GetterMayThrowLegacyException};
</ins><span class="cx">
</span><span class="cx"> $implIncludes{"ExceptionCode.h"} = 1 if $getterMayThrowLegacyException;
</span><span class="cx">
</span><span class="lines">@@ -2938,11 +2937,7 @@
</span><span class="cx"> my @arguments = ();
</span><span class="cx"> if ($getterMayThrowLegacyException && !HasCustomGetter($attribute->signature->extendedAttributes)) {
</span><span class="cx"> push(@arguments, "ec");
</span><del>- if ($getterMayThrowLegacyExceptionWithMessage) {
- push(@implContent, " ExceptionCodeWithMessage ec;\n");
- } else {
- push(@implContent, " ExceptionCode ec = 0;\n");
- }
</del><ins>+ push(@implContent, " ExceptionCode ec = 0;\n");
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> # Global constructors can be disabled at runtime.
</span><span class="lines">@@ -2983,7 +2978,7 @@
</span><span class="cx">
</span><span class="cx"> my $nativeType = GetNativeType($interface, $type);
</span><span class="cx"> my $memoizedType = GetNativeTypeForMemoization($interface, $type);
</span><del>- my $exceptionCode = $getterMayThrowLegacyExceptionWithMessage ? "ec.code" : ($getterMayThrowLegacyException ? "ec" : "0");
</del><ins>+ my $exceptionCode = $getterMayThrowLegacyException ? "ec" : "0";
</ins><span class="cx"> push(@implContent, " static NeverDestroyed<const AtomicString> bindingName(\"$interfaceName.$name\", AtomicString::ConstructFromLiteral);\n");
</span><span class="cx"> push(@implContent, " if (cursor.isCapturing()) {\n");
</span><span class="cx"> push(@implContent, " $memoizedType memoizedResult = thisObject->wrapped().$implGetterFunctionName(" . join(", ", @arguments) . ");\n");
</span><span class="lines">@@ -3032,7 +3027,7 @@
</span><span class="cx"> AddToImplIncludes("JS" . $constructorType . ".h", $attribute->signature->extendedAttributes->{Conditional});
</span><span class="cx"> push(@implContent, " return JS" . $constructorType . "::getConstructor(state->vm(), thisObject->globalObject());\n");
</span><span class="cx"> }
</span><del>- } elsif (!$attribute->signature->extendedAttributes->{GetterMayThrowLegacyException} && !$attribute->signature->extendedAttributes->{GetterMayThrowLegacyExceptionWithMessage}) {
</del><ins>+ } elsif (!$attribute->signature->extendedAttributes->{GetterMayThrowLegacyException}) {
</ins><span class="cx"> my $cacheIndex = 0;
</span><span class="cx"> if ($attribute->signature->extendedAttributes->{CachedAttribute}) {
</span><span class="cx"> $cacheIndex = $currentCachedAttribute;
</span><span class="lines">@@ -3199,8 +3194,7 @@
</span><span class="cx"> my $type = $attribute->signature->type;
</span><span class="cx"> my $putFunctionName = GetAttributeSetterName($interface, $className, $attribute);
</span><span class="cx"> my $implSetterFunctionName = $codeGenerator->WK_ucfirst($name);
</span><del>- my $setterMayThrowLegacyExceptionWithMessage = $attribute->signature->extendedAttributes->{SetterMayThrowLegacyExceptionWithMessage};
- my $setterMayThrowLegacyException = $attribute->signature->extendedAttributes->{SetterMayThrowLegacyException} || $setterMayThrowLegacyExceptionWithMessage;
</del><ins>+ my $setterMayThrowLegacyException = $attribute->signature->extendedAttributes->{SetterMayThrowLegacyException};
</ins><span class="cx">
</span><span class="cx"> $implIncludes{"ExceptionCode.h"} = 1 if $setterMayThrowLegacyException;
</span><span class="cx">
</span><span class="lines">@@ -3293,12 +3287,9 @@
</span><span class="cx"> push(@implContent, " auto& impl = castedThis->wrapped();\n");
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- if ($setterMayThrowLegacyExceptionWithMessage) {
- push(@implContent, " ExceptionCodeWithMessage ec;\n");
- } elsif ($setterMayThrowLegacyException) {
- push(@implContent, " ExceptionCode ec = 0;\n");
- }
</del><span class="cx">
</span><ins>+ push(@implContent, " ExceptionCode ec = 0;\n") if $setterMayThrowLegacyException;
+
</ins><span class="cx"> my $shouldPassByReference = ShouldPassWrapperByReference($attribute->signature, $interface);
</span><span class="cx">
</span><span class="cx"> my ($nativeValue, $mayThrowException) = JSValueToNative($interface, $attribute->signature, "value", $attribute->signature->extendedAttributes->{Conditional});
</span><span class="lines">@@ -3348,10 +3339,7 @@
</span><span class="cx"> push(@implContent, " setDOMException(state, throwScope, ec);\n") if $setterMayThrowLegacyException;
</span><span class="cx"> }
</span><span class="cx"> if ($svgPropertyType) {
</span><del>- if ($setterMayThrowLegacyExceptionWithMessage) {
- push(@implContent, " if (LIKELY(!ec.code))\n");
- push(@implContent, " impl.commitChange();\n");
- } elsif ($setterMayThrowLegacyException) {
</del><ins>+ if ($setterMayThrowLegacyException) {
</ins><span class="cx"> push(@implContent, " if (LIKELY(!ec))\n");
</span><span class="cx"> push(@implContent, " impl.commitChange();\n");
</span><span class="cx"> } else {
</span><span class="lines">@@ -3449,11 +3437,8 @@
</span><span class="cx"> my $isCustom = HasCustomMethod($function->signature->extendedAttributes);
</span><span class="cx"> my $isOverloaded = $function->{overloads} && @{$function->{overloads}} > 1;
</span><span class="cx">
</span><del>- die "MayThrowLegacyException and MayThrowLegacyExceptionWithMessage are mutually exclusive" if $function->signature->extendedAttributes->{MayThrowLegacyException} && $function->signature->extendedAttributes->{MayThrowLegacyExceptionWithMessage};
</del><ins>+ my $mayThrowLegacyException = $function->signature->extendedAttributes->{MayThrowLegacyException};
</ins><span class="cx">
</span><del>- my $mayThrowLegacyExceptionWithMessage = $function->signature->extendedAttributes->{MayThrowLegacyExceptionWithMessage};
- my $mayThrowLegacyException = $function->signature->extendedAttributes->{MayThrowLegacyException} || $mayThrowLegacyExceptionWithMessage;
-
</del><span class="cx"> next if $isCustom && $isOverloaded && $function->{overloadIndex} > 1;
</span><span class="cx">
</span><span class="cx"> AddIncludesForTypeInImpl($function->signature->type) unless $isCustom or IsReturningPromise($function);
</span><span class="lines">@@ -3517,11 +3502,7 @@
</span><span class="cx"> } else {
</span><span class="cx"> GenerateArgumentsCountCheck(\@implContent, $function, $interface);
</span><span class="cx">
</span><del>- if ($mayThrowLegacyExceptionWithMessage) {
- push(@implContent, " ExceptionCodeWithMessage ec;\n");
- } elsif ($mayThrowLegacyException) {
- push(@implContent, " ExceptionCode ec = 0;\n");
- }
</del><ins>+ push(@implContent, " ExceptionCode ec = 0;\n") if $mayThrowLegacyException;
</ins><span class="cx">
</span><span class="cx"> my ($functionString, $dummy) = GenerateParametersCheck(\@implContent, $function, $interface, $functionImplementationName, $svgPropertyType, $svgPropertyOrListPropertyType, $svgListPropertyType);
</span><span class="cx"> GenerateImplementationFunctionCall($function, $functionString, " ", $svgPropertyType, $interface);
</span><span class="lines">@@ -3563,11 +3544,7 @@
</span><span class="cx">
</span><span class="cx"> GenerateArgumentsCountCheck(\@implContent, $function, $interface);
</span><span class="cx">
</span><del>- if ($mayThrowLegacyExceptionWithMessage) {
- push(@implContent, " ExceptionCodeWithMessage ec;\n");
- } elsif ($mayThrowLegacyException) {
- push(@implContent, " ExceptionCode ec = 0;\n");
- }
</del><ins>+ push(@implContent, " ExceptionCode ec = 0;\n") if $mayThrowLegacyException;
</ins><span class="cx">
</span><span class="cx"> if ($function->signature->extendedAttributes->{CheckSecurityForNode}) {
</span><span class="cx"> push(@implContent, " if (!shouldAllowAccessToNode(state, impl." . $function->signature->name . "(" . ($mayThrowLegacyException ? "ec" : "") .")))\n");
</span><span class="lines">@@ -4229,7 +4206,7 @@
</span><span class="cx">
</span><span class="cx"> my @arguments;
</span><span class="cx"> push(@arguments, "WTFMove(promise)") if IsReturningPromise($function);
</span><del>- push(@arguments, "ec") if $function->signature->extendedAttributes->{MayThrowLegacyException} || $function->signature->extendedAttributes->{MayThrowLegacyExceptionWithMessage};
</del><ins>+ push(@arguments, "ec") if $function->signature->extendedAttributes->{MayThrowLegacyException};
</ins><span class="cx"> return @arguments;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4516,8 +4493,7 @@
</span><span class="cx"> my ($function, $functionString, $indent, $svgPropertyType, $interface) = @_;
</span><span class="cx">
</span><span class="cx"> my $nondeterministic = $function->signature->extendedAttributes->{Nondeterministic};
</span><del>- my $mayThrowLegacyExceptionWithMessage = $function->signature->extendedAttributes->{MayThrowLegacyExceptionWithMessage};
- my $mayThrowLegacyException = $function->signature->extendedAttributes->{MayThrowLegacyException} || $mayThrowLegacyExceptionWithMessage;
</del><ins>+ my $mayThrowLegacyException = $function->signature->extendedAttributes->{MayThrowLegacyException};
</ins><span class="cx">
</span><span class="cx"> if ($function->signature->type eq "void" || IsReturningPromise($function)) {
</span><span class="cx"> if ($nondeterministic) {
</span><span class="lines">@@ -4538,10 +4514,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if ($svgPropertyType and !$function->isStatic) {
</span><del>- if ($mayThrowLegacyExceptionWithMessage) {
- push(@implContent, $indent . "if (LIKELY(!ec.code))\n");
- push(@implContent, $indent . " impl.commitChange();\n");
- } elsif ($mayThrowLegacyException) {
</del><ins>+ if ($mayThrowLegacyException) {
</ins><span class="cx"> push(@implContent, $indent . "if (LIKELY(!ec))\n");
</span><span class="cx"> push(@implContent, $indent . " impl.commitChange();\n");
</span><span class="cx"> } else {
</span><span class="lines">@@ -4566,7 +4539,7 @@
</span><span class="cx"> push(@implContent, $indent . "static NeverDestroyed<const AtomicString> bindingName(\"$bindingName\", AtomicString::ConstructFromLiteral);\n");
</span><span class="cx"> push(@implContent, $indent . "if (cursor.isCapturing()) {\n");
</span><span class="cx"> push(@implContent, $indent . " $nativeType memoizedResult = $functionString;\n");
</span><del>- my $exceptionCode = $mayThrowLegacyExceptionWithMessage ? "ec.code" : ($mayThrowLegacyException ? "ec" : "0");
</del><ins>+ my $exceptionCode = $mayThrowLegacyException ? "ec" : "0";
</ins><span class="cx"> push(@implContent, $indent . " cursor.appendInput<MemoizedDOMResult<$memoizedType>>(bindingName.get().string(), memoizedResult, $exceptionCode);\n");
</span><span class="cx"> push(@implContent, $indent . " result = " . NativeToJSValue($function->signature, 1, $interface, "memoizedResult", $thisObject) . ";\n");
</span><span class="cx"> push(@implContent, $indent . "} else if (cursor.isReplaying()) {\n");
</span><span class="lines">@@ -4575,8 +4548,7 @@
</span><span class="cx"> # FIXME: the generated code should report an error if an input cannot be fetched or converted.
</span><span class="cx"> push(@implContent, $indent . " if (input && input->convertTo<$memoizedType>(memoizedResult)) {\n");
</span><span class="cx"> push(@implContent, $indent . " result = " . NativeToJSValue($function->signature, 1, $interface, "memoizedResult", $thisObject) . ";\n");
</span><del>- push(@implContent, $indent . " ec.code = input->exceptionCode();\n") if $mayThrowLegacyExceptionWithMessage;
- push(@implContent, $indent . " ec = input->exceptionCode();\n") if $mayThrowLegacyException && !$mayThrowLegacyExceptionWithMessage;
</del><ins>+ push(@implContent, $indent . " ec = input->exceptionCode();\n") if $mayThrowLegacyException;
</ins><span class="cx"> push(@implContent, $indent . " } else\n");
</span><span class="cx"> push(@implContent, $indent . " result = " . NativeToJSValue($function->signature, 1, $interface, $functionString, $thisObject) . ";\n");
</span><span class="cx"> push(@implContent, $indent . "} else\n");
</span><span class="lines">@@ -5506,13 +5478,9 @@
</span><span class="cx">
</span><span class="cx"> GenerateArgumentsCountCheck($outputArray, $function, $interface);
</span><span class="cx">
</span><del>- if ($function->signature->extendedAttributes->{MayThrowLegacyException} || $function->signature->extendedAttributes->{MayThrowLegacyExceptionWithMessage} || $interface->extendedAttributes->{ConstructorMayThrowLegacyException}) {
</del><ins>+ if ($function->signature->extendedAttributes->{MayThrowLegacyException} || $interface->extendedAttributes->{ConstructorMayThrowLegacyException}) {
</ins><span class="cx"> $implIncludes{"ExceptionCode.h"} = 1;
</span><del>- if ($function->signature->extendedAttributes->{MayThrowLegacyExceptionWithMessage}) {
- push(@$outputArray, " ExceptionCodeWithMessage ec;\n");
- } else {
- push(@$outputArray, " ExceptionCode ec = 0;\n");
- }
</del><ins>+ push(@$outputArray, " ExceptionCode ec = 0;\n");
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> # FIXME: For now, we do not support SVG constructors.
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsIDLAttributestxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -70,7 +70,6 @@
</span><span class="cx"> GenerateIsReachable=|Impl|ImplWebGLRenderingContext|ImplDocument|ImplElementRoot|ImplFrame|ImplOwnerNodeRoot|ImplScriptExecutionContext
</span><span class="cx"> GetterMayThrowException
</span><span class="cx"> GetterMayThrowLegacyException
</span><del>-GetterMayThrowLegacyExceptionWithMessage
</del><span class="cx"> Immutable
</span><span class="cx"> ImplementedAs=*
</span><span class="cx"> ImplementationLacksVTable
</span><span class="lines">@@ -98,7 +97,6 @@
</span><span class="cx"> MasqueradesAsUndefined
</span><span class="cx"> MayThrowException
</span><span class="cx"> MayThrowLegacyException
</span><del>-MayThrowLegacyExceptionWithMessage
</del><span class="cx"> NamedConstructor=*
</span><span class="cx"> NewImpurePropertyFiresWatchpoints
</span><span class="cx"> NewObject
</span><span class="lines">@@ -118,7 +116,6 @@
</span><span class="cx"> SetterCallWith=ScriptExecutionContext|ScriptState|ScriptArguments|CallStack|ActiveWindow|FirstWindow
</span><span class="cx"> SetterMayThrowException
</span><span class="cx"> SetterMayThrowLegacyException
</span><del>-SetterMayThrowLegacyExceptionWithMessage
</del><span class="cx"> SkipVTableValidation
</span><span class="cx"> SuppressToJSObject
</span><span class="cx"> TreatNullAs=EmptyString
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -866,7 +866,6 @@
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithExceptionReturningLong(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithExceptionReturningObject(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithLegacyException(JSC::ExecState*);
</span><del>-JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithExceptionWithMessage(JSC::ExecState*);
</del><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethod(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethodWithArgs(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionPrivateMethod(JSC::ExecState*);
</span><span class="lines">@@ -1061,14 +1060,10 @@
</span><span class="cx"> bool setJSTestObjAttributeWithGetterException(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
</span><span class="cx"> JSC::EncodedJSValue jsTestObjAttributeWithGetterLegacyException(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
</span><span class="cx"> bool setJSTestObjAttributeWithGetterLegacyException(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
</span><del>-JSC::EncodedJSValue jsTestObjAttrWithGetterExceptionWithMessage(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
-bool setJSTestObjAttrWithGetterExceptionWithMessage(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
</del><span class="cx"> JSC::EncodedJSValue jsTestObjAttributeWithSetterException(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
</span><span class="cx"> bool setJSTestObjAttributeWithSetterException(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
</span><span class="cx"> JSC::EncodedJSValue jsTestObjAttributeWithSetterLegacyException(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
</span><span class="cx"> bool setJSTestObjAttributeWithSetterLegacyException(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
</span><del>-JSC::EncodedJSValue jsTestObjAttrWithSetterExceptionWithMessage(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
-bool setJSTestObjAttrWithSetterExceptionWithMessage(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
</del><span class="cx"> JSC::EncodedJSValue jsTestObjStringAttrWithGetterException(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
</span><span class="cx"> bool setJSTestObjStringAttrWithGetterException(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
</span><span class="cx"> JSC::EncodedJSValue jsTestObjStringAttrWithSetterException(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
</span><span class="lines">@@ -1378,10 +1373,8 @@
</span><span class="cx"> { "typedArrayAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjTypedArrayAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjTypedArrayAttr) } },
</span><span class="cx"> { "attributeWithGetterException", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAttributeWithGetterException), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjAttributeWithGetterException) } },
</span><span class="cx"> { "attributeWithGetterLegacyException", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAttributeWithGetterLegacyException), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjAttributeWithGetterLegacyException) } },
</span><del>- { "attrWithGetterExceptionWithMessage", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAttrWithGetterExceptionWithMessage), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjAttrWithGetterExceptionWithMessage) } },
</del><span class="cx"> { "attributeWithSetterException", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAttributeWithSetterException), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjAttributeWithSetterException) } },
</span><span class="cx"> { "attributeWithSetterLegacyException", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAttributeWithSetterLegacyException), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjAttributeWithSetterLegacyException) } },
</span><del>- { "attrWithSetterExceptionWithMessage", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAttrWithSetterExceptionWithMessage), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjAttrWithSetterExceptionWithMessage) } },
</del><span class="cx"> { "stringAttrWithGetterException", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjStringAttrWithGetterException), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjStringAttrWithGetterException) } },
</span><span class="cx"> { "stringAttrWithSetterException", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjStringAttrWithSetterException), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjStringAttrWithSetterException) } },
</span><span class="cx"> { "customAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCustomAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjCustomAttr) } },
</span><span class="lines">@@ -1478,7 +1471,6 @@
</span><span class="cx"> { "methodWithExceptionReturningLong", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithExceptionReturningLong), (intptr_t) (0) } },
</span><span class="cx"> { "methodWithExceptionReturningObject", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithExceptionReturningObject), (intptr_t) (0) } },
</span><span class="cx"> { "methodWithLegacyException", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithLegacyException), (intptr_t) (0) } },
</span><del>- { "methodWithExceptionWithMessage", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithExceptionWithMessage), (intptr_t) (0) } },
</del><span class="cx"> { "customMethod", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionCustomMethod), (intptr_t) (0) } },
</span><span class="cx"> { "customMethodWithArgs", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionCustomMethodWithArgs), (intptr_t) (3) } },
</span><span class="cx"> #if ENABLE(Condition3)
</span><span class="lines">@@ -2391,24 +2383,6 @@
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static inline JSValue jsTestObjAttrWithGetterExceptionWithMessageGetter(ExecState*, JSTestObj*, ThrowScope& throwScope);
-
-EncodedJSValue jsTestObjAttrWithGetterExceptionWithMessage(ExecState* state, EncodedJSValue thisValue, PropertyName)
-{
- return BindingCaller<JSTestObj>::attribute<jsTestObjAttrWithGetterExceptionWithMessageGetter>(state, thisValue, "attrWithGetterExceptionWithMessage");
-}
-
-static inline JSValue jsTestObjAttrWithGetterExceptionWithMessageGetter(ExecState* state, JSTestObj* thisObject, ThrowScope& throwScope)
-{
- UNUSED_PARAM(throwScope);
- UNUSED_PARAM(state);
- ExceptionCodeWithMessage ec;
- auto& impl = thisObject->wrapped();
- JSValue result = jsNumber(impl.attrWithGetterExceptionWithMessage(ec));
- setDOMException(state, throwScope, ec);
- return result;
-}
-
</del><span class="cx"> static inline JSValue jsTestObjAttributeWithSetterExceptionGetter(ExecState*, JSTestObj*, ThrowScope& throwScope);
</span><span class="cx">
</span><span class="cx"> EncodedJSValue jsTestObjAttributeWithSetterException(ExecState* state, EncodedJSValue thisValue, PropertyName)
</span><span class="lines">@@ -2441,22 +2415,6 @@
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static inline JSValue jsTestObjAttrWithSetterExceptionWithMessageGetter(ExecState*, JSTestObj*, ThrowScope& throwScope);
-
-EncodedJSValue jsTestObjAttrWithSetterExceptionWithMessage(ExecState* state, EncodedJSValue thisValue, PropertyName)
-{
- return BindingCaller<JSTestObj>::attribute<jsTestObjAttrWithSetterExceptionWithMessageGetter>(state, thisValue, "attrWithSetterExceptionWithMessage");
-}
-
-static inline JSValue jsTestObjAttrWithSetterExceptionWithMessageGetter(ExecState* state, JSTestObj* thisObject, ThrowScope& throwScope)
-{
- UNUSED_PARAM(throwScope);
- UNUSED_PARAM(state);
- auto& impl = thisObject->wrapped();
- JSValue result = jsNumber(impl.attrWithSetterExceptionWithMessage());
- return result;
-}
-
</del><span class="cx"> static inline JSValue jsTestObjStringAttrWithGetterExceptionGetter(ExecState*, JSTestObj*, ThrowScope& throwScope);
</span><span class="cx">
</span><span class="cx"> EncodedJSValue jsTestObjStringAttrWithGetterException(ExecState* state, EncodedJSValue thisValue, PropertyName)
</span><span class="lines">@@ -3920,24 +3878,6 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><del>-bool setJSTestObjAttrWithGetterExceptionWithMessage(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
-{
- VM& vm = state->vm();
- auto throwScope = DECLARE_THROW_SCOPE(vm);
- UNUSED_PARAM(throwScope);
- JSValue value = JSValue::decode(encodedValue);
- UNUSED_PARAM(thisValue);
- JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
- if (UNLIKELY(!castedThis))
- return throwSetterTypeError(*state, throwScope, "TestObject", "attrWithGetterExceptionWithMessage");
- auto& impl = castedThis->wrapped();
- auto nativeValue = convert<int32_t>(*state, value, NormalConversion);
- RETURN_IF_EXCEPTION(throwScope, false);
- impl.setAttrWithGetterExceptionWithMessage(WTFMove(nativeValue));
- return true;
-}
-
-
</del><span class="cx"> bool setJSTestObjAttributeWithSetterException(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
</span><span class="cx"> {
</span><span class="cx"> VM& vm = state->vm();
</span><span class="lines">@@ -3976,26 +3916,6 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><del>-bool setJSTestObjAttrWithSetterExceptionWithMessage(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
-{
- VM& vm = state->vm();
- auto throwScope = DECLARE_THROW_SCOPE(vm);
- UNUSED_PARAM(throwScope);
- JSValue value = JSValue::decode(encodedValue);
- UNUSED_PARAM(thisValue);
- JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
- if (UNLIKELY(!castedThis))
- return throwSetterTypeError(*state, throwScope, "TestObject", "attrWithSetterExceptionWithMessage");
- auto& impl = castedThis->wrapped();
- ExceptionCodeWithMessage ec;
- auto nativeValue = convert<int32_t>(*state, value, NormalConversion);
- RETURN_IF_EXCEPTION(throwScope, false);
- impl.setAttrWithSetterExceptionWithMessage(WTFMove(nativeValue), ec);
- setDOMException(state, throwScope, ec);
- return true;
-}
-
-
</del><span class="cx"> bool setJSTestObjStringAttrWithGetterException(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
</span><span class="cx"> {
</span><span class="cx"> VM& vm = state->vm();
</span><span class="lines">@@ -5281,23 +5201,6 @@
</span><span class="cx"> return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithExceptionWithMessage(ExecState* state)
-{
- VM& vm = state->vm();
- auto throwScope = DECLARE_THROW_SCOPE(vm);
- UNUSED_PARAM(throwScope);
- JSValue thisValue = state->thisValue();
- auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
- if (UNLIKELY(!castedThis))
- return throwThisTypeError(*state, throwScope, "TestObject", "methodWithExceptionWithMessage");
- ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
- auto& impl = castedThis->wrapped();
- ExceptionCodeWithMessage ec;
- impl.methodWithExceptionWithMessage(ec);
- setDOMException(state, throwScope, ec);
- return JSValue::encode(jsUndefined());
-}
-
</del><span class="cx"> EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethod(ExecState* state)
</span><span class="cx"> {
</span><span class="cx"> VM& vm = state->vm();
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestTestObjidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -153,13 +153,10 @@
</span><span class="cx"> [MayThrowException] long methodWithExceptionReturningLong();
</span><span class="cx"> [MayThrowException] TestObj methodWithExceptionReturningObject();
</span><span class="cx"> [MayThrowLegacyException] void methodWithLegacyException();
</span><del>- [MayThrowLegacyExceptionWithMessage] void methodWithExceptionWithMessage();
</del><span class="cx"> [GetterMayThrowException] attribute long attributeWithGetterException;
</span><span class="cx"> [GetterMayThrowLegacyException] attribute long attributeWithGetterLegacyException;
</span><del>- [GetterMayThrowLegacyExceptionWithMessage] attribute long attrWithGetterExceptionWithMessage;
</del><span class="cx"> [SetterMayThrowException] attribute long attributeWithSetterException;
</span><span class="cx"> [SetterMayThrowLegacyException] attribute long attributeWithSetterLegacyException;
</span><del>- [SetterMayThrowLegacyExceptionWithMessage] attribute long attrWithSetterExceptionWithMessage;
</del><span class="cx"> [GetterMayThrowLegacyException] attribute DOMString stringAttrWithGetterException;
</span><span class="cx"> [SetterMayThrowLegacyException] attribute DOMString stringAttrWithSetterException;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoredomCustomElementRegistryidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/CustomElementRegistry.idl (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/CustomElementRegistry.idl        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/dom/CustomElementRegistry.idl        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -26,12 +26,10 @@
</span><span class="cx"> [
</span><span class="cx"> Conditional=CUSTOM_ELEMENTS,
</span><span class="cx"> EnabledAtRuntime=CustomElements,
</span><ins>+ ImplementationLacksVTable,
</ins><span class="cx"> JSGenerateToNativeObject,
</span><del>- ImplementationLacksVTable
</del><span class="cx"> ] interface CustomElementRegistry {
</span><del>-
</del><span class="cx"> [CEReactions, Custom] void define(DOMString name, Function constructor);
</span><span class="cx"> any get(DOMString name);
</span><del>- [MayThrowLegacyExceptionWithMessage, Custom] Promise whenDefined(DOMString name);
-
</del><ins>+ [Custom, MayThrowException] Promise whenDefined(DOMString name);
</ins><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoredomExceptionCodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ExceptionCode.h (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ExceptionCode.h        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/dom/ExceptionCode.h        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -16,11 +16,8 @@
</span><span class="cx"> * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#ifndef ExceptionCode_h
-#define ExceptionCode_h
</del><ins>+#pragma once
</ins><span class="cx">
</span><del>-#include <wtf/text/WTFString.h>
-
</del><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> // The DOM standards use unsigned short for exception codes.
</span><span class="lines">@@ -27,9 +24,8 @@
</span><span class="cx"> // In our DOM implementation we use int instead, and use different
</span><span class="cx"> // numerical ranges for different types of DOM exception, so that
</span><span class="cx"> // an exception of any type can be expressed with a single integer.
</span><del>-typedef int ExceptionCode;
</del><ins>+using ExceptionCode = int;
</ins><span class="cx">
</span><del>-
</del><span class="cx"> // Some of these are considered historical since they have been
</span><span class="cx"> // changed or removed from the specifications.
</span><span class="cx"> enum {
</span><span class="lines">@@ -82,11 +78,4 @@
</span><span class="cx"> RangeError = 106,
</span><span class="cx"> };
</span><span class="cx">
</span><del>-struct ExceptionCodeWithMessage {
- ExceptionCode code { 0 };
- String message;
-};
-
</del><span class="cx"> } // namespace WebCore
</span><del>-
-#endif // ExceptionCode_h
</del></span></pre></div>
<a id="trunkSourceWebCorehistoryHistoryItemh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/history/HistoryItem.h (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/history/HistoryItem.h        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/history/HistoryItem.h        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -125,7 +125,7 @@
</span><span class="cx"> WEBCORE_EXPORT void setIsTargetItem(bool);
</span><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT void setStateObject(RefPtr<SerializedScriptValue>&&);
</span><del>- RefPtr<SerializedScriptValue> stateObject() const { return m_stateObject; }
</del><ins>+ SerializedScriptValue* stateObject() const { return m_stateObject.get(); }
</ins><span class="cx">
</span><span class="cx"> void setItemSequenceNumber(long long number) { m_itemSequenceNumber = number; }
</span><span class="cx"> long long itemSequenceNumber() const { return m_itemSequenceNumber; }
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorIndexedDBAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -106,19 +106,17 @@
</span><span class="cx">
</span><span class="cx"> class OpenDatabaseCallback final : public EventListener {
</span><span class="cx"> public:
</span><del>- static Ref<OpenDatabaseCallback> create(ExecutableWithDatabase* executableWithDatabase)
</del><ins>+ static Ref<OpenDatabaseCallback> create(ExecutableWithDatabase& executableWithDatabase)
</ins><span class="cx"> {
</span><span class="cx"> return adoptRef(*new OpenDatabaseCallback(executableWithDatabase));
</span><span class="cx"> }
</span><span class="cx">
</span><del>- virtual ~OpenDatabaseCallback() { }
-
- bool operator==(const EventListener& other) const override
</del><ins>+ bool operator==(const EventListener& other) const final
</ins><span class="cx"> {
</span><span class="cx"> return this == &other;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- void handleEvent(ScriptExecutionContext*, Event* event) override
</del><ins>+ void handleEvent(ScriptExecutionContext*, Event* event) final
</ins><span class="cx"> {
</span><span class="cx"> if (event->type() != eventNames().successEvent) {
</span><span class="cx"> m_executableWithDatabase->requestCallback().sendFailure("Unexpected event type.");
</span><span class="lines">@@ -141,10 +139,10 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- OpenDatabaseCallback(ExecutableWithDatabase* executableWithDatabase)
</del><ins>+ OpenDatabaseCallback(ExecutableWithDatabase& executableWithDatabase)
</ins><span class="cx"> : EventListener(EventListener::CPPEventListenerType)
</span><span class="cx"> , m_executableWithDatabase(executableWithDatabase) { }
</span><del>- RefPtr<ExecutableWithDatabase> m_executableWithDatabase;
</del><ins>+ Ref<ExecutableWithDatabase> m_executableWithDatabase;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> void ExecutableWithDatabase::start(IDBFactory* idbFactory, SecurityOrigin*, const String& databaseName)
</span><span class="lines">@@ -154,15 +152,13 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- ExceptionCodeWithMessage ec;
- RefPtr<IDBOpenDBRequest> idbOpenDBRequest = idbFactory->open(*context(), databaseName, Nullopt, ec);
- if (ec.code) {
</del><ins>+ auto result = idbFactory->open(*context(), databaseName, Nullopt);
+ if (result.hasException()) {
</ins><span class="cx"> requestCallback().sendFailure("Could not open database.");
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- Ref<OpenDatabaseCallback> callback = OpenDatabaseCallback::create(this);
- idbOpenDBRequest->addEventListener(eventNames().successEvent, WTFMove(callback), false);
</del><ins>+ result.releaseReturnValue()->addEventListener(eventNames().successEvent, OpenDatabaseCallback::create(*this), false);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -203,29 +199,26 @@
</span><span class="cx">
</span><span class="cx"> static RefPtr<IDBTransaction> transactionForDatabase(IDBDatabase* idbDatabase, const String& objectStoreName, const String& mode = IDBTransaction::modeReadOnly())
</span><span class="cx"> {
</span><del>- ExceptionCodeWithMessage ec;
- RefPtr<IDBTransaction> idbTransaction = idbDatabase->transaction(objectStoreName, mode, ec);
- if (ec.code)
</del><ins>+ auto result = idbDatabase->transaction(objectStoreName, mode);
+ if (result.hasException())
</ins><span class="cx"> return nullptr;
</span><del>- return idbTransaction;
</del><ins>+ return result.releaseReturnValue();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static RefPtr<IDBObjectStore> objectStoreForTransaction(IDBTransaction* idbTransaction, const String& objectStoreName)
</span><span class="cx"> {
</span><del>- ExceptionCodeWithMessage ec;
- RefPtr<IDBObjectStore> idbObjectStore = idbTransaction->objectStore(objectStoreName, ec);
- if (ec.code)
</del><ins>+ auto result = idbTransaction->objectStore(objectStoreName);
+ if (result.hasException())
</ins><span class="cx"> return nullptr;
</span><del>- return idbObjectStore;
</del><ins>+ return result.releaseReturnValue();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static RefPtr<IDBIndex> indexForObjectStore(IDBObjectStore* idbObjectStore, const String& indexName)
</span><span class="cx"> {
</span><del>- ExceptionCodeWithMessage ec;
- RefPtr<IDBIndex> idbIndex = idbObjectStore->index(indexName, ec);
- if (ec.code)
</del><ins>+ auto index = idbObjectStore->index(indexName);
+ if (index.hasException())
</ins><span class="cx"> return nullptr;
</span><del>- return idbIndex;
</del><ins>+ return index.releaseReturnValue();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> class DatabaseLoader final : public ExecutableWithDatabase {
</span><span class="lines">@@ -253,7 +246,7 @@
</span><span class="cx"> auto indexes = Inspector::Protocol::Array<Inspector::Protocol::IndexedDB::ObjectStoreIndex>::create();
</span><span class="cx">
</span><span class="cx"> for (auto& indexInfo : objectStoreInfo->indexMap().values()) {
</span><del>- Ref<ObjectStoreIndex> objectStoreIndex = ObjectStoreIndex::create()
</del><ins>+ auto objectStoreIndex = ObjectStoreIndex::create()
</ins><span class="cx"> .setName(indexInfo.name())
</span><span class="cx"> .setKeyPath(keyPathFromIDBKeyPath(indexInfo.keyPath()))
</span><span class="cx"> .setUnique(indexInfo.unique())
</span><span class="lines">@@ -262,7 +255,7 @@
</span><span class="cx"> indexes->addItem(WTFMove(objectStoreIndex));
</span><span class="cx"> }
</span><span class="cx">
</span><del>- Ref<ObjectStore> objectStore = ObjectStore::create()
</del><ins>+ auto objectStore = ObjectStore::create()
</ins><span class="cx"> .setName(objectStoreInfo->name())
</span><span class="cx"> .setKeyPath(keyPathFromIDBKeyPath(objectStoreInfo->keyPath()))
</span><span class="cx"> .setAutoIncrement(objectStoreInfo->autoIncrement())
</span><span class="lines">@@ -271,7 +264,7 @@
</span><span class="cx"> objectStores->addItem(WTFMove(objectStore));
</span><span class="cx"> }
</span><span class="cx">
</span><del>- Ref<DatabaseWithObjectStores> result = DatabaseWithObjectStores::create()
</del><ins>+ auto result = DatabaseWithObjectStores::create()
</ins><span class="cx"> .setName(databaseInfo.name())
</span><span class="cx"> .setVersion(databaseInfo.version())
</span><span class="cx"> .setObjectStores(WTFMove(objectStores))
</span><span class="lines">@@ -403,9 +396,7 @@
</span><span class="cx"> auto& cursor = *cursorResult;
</span><span class="cx">
</span><span class="cx"> if (m_skipCount) {
</span><del>- ExceptionCodeWithMessage ec;
- cursor.advance(m_skipCount, ec);
- if (ec.code)
</del><ins>+ if (cursor.advance(m_skipCount).hasException())
</ins><span class="cx"> m_requestCallback->sendFailure("Could not advance cursor.");
</span><span class="cx"> m_skipCount = 0;
</span><span class="cx"> return;
</span><span class="lines">@@ -417,18 +408,16 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Continue cursor before making injected script calls, otherwise transaction might be finished.
</span><del>- ExceptionCodeWithMessage ec;
- cursor.continueFunction(nullptr, ec);
- if (ec.code) {
</del><ins>+ if (cursor.continueFunction(nullptr).hasException()) {
</ins><span class="cx"> m_requestCallback->sendFailure("Could not continue cursor.");
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- JSC::ExecState* state = context ? context->execState() : nullptr;
</del><ins>+ auto* state = context ? context->execState() : nullptr;
</ins><span class="cx"> if (!state)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- RefPtr<DataEntry> dataEntry = DataEntry::create()
</del><ins>+ auto dataEntry = DataEntry::create()
</ins><span class="cx"> .setKey(m_injectedScript.wrapObject(cursor.key(), String(), true))
</span><span class="cx"> .setPrimaryKey(m_injectedScript.wrapObject(cursor.primaryKey(), String(), true))
</span><span class="cx"> .setValue(m_injectedScript.wrapObject(cursor.value(), String(), true))
</span><span class="lines">@@ -474,13 +463,13 @@
</span><span class="cx"> if (!requestCallback().isActive())
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- RefPtr<IDBTransaction> idbTransaction = transactionForDatabase(&database, m_objectStoreName);
</del><ins>+ auto idbTransaction = transactionForDatabase(&database, m_objectStoreName);
</ins><span class="cx"> if (!idbTransaction) {
</span><span class="cx"> m_requestCallback->sendFailure("Could not get transaction");
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- RefPtr<IDBObjectStore> idbObjectStore = objectStoreForTransaction(idbTransaction.get(), m_objectStoreName);
</del><ins>+ auto idbObjectStore = objectStoreForTransaction(idbTransaction.get(), m_objectStoreName);
</ins><span class="cx"> if (!idbObjectStore) {
</span><span class="cx"> m_requestCallback->sendFailure("Could not get object store");
</span><span class="cx"> return;
</span><span class="lines">@@ -487,19 +476,27 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TransactionActivator activator(idbTransaction.get());
</span><del>- ExceptionCodeWithMessage ec;
</del><span class="cx"> RefPtr<IDBRequest> idbRequest;
</span><del>- JSC::ExecState* exec = context() ? context()->execState() : nullptr;
</del><ins>+ auto* exec = context() ? context()->execState() : nullptr;
</ins><span class="cx"> if (!m_indexName.isEmpty()) {
</span><del>- RefPtr<IDBIndex> idbIndex = indexForObjectStore(idbObjectStore.get(), m_indexName);
</del><ins>+ auto idbIndex = indexForObjectStore(idbObjectStore.get(), m_indexName);
</ins><span class="cx"> if (!idbIndex) {
</span><span class="cx"> m_requestCallback->sendFailure("Could not get index");
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- idbRequest = exec ? idbIndex->openCursor(*exec, m_idbKeyRange.get(), IDBCursor::directionNext(), ec) : nullptr;
- } else
- idbRequest = exec ? idbObjectStore->openCursor(*exec, m_idbKeyRange.get(), IDBCursor::directionNext(), ec) : nullptr;
</del><ins>+ if (exec) {
+ auto result = idbIndex->openCursor(*exec, m_idbKeyRange.get(), IDBCursor::directionNext());
+ if (!result.hasException())
+ idbRequest = result.releaseReturnValue();
+ }
+ } else {
+ if (exec) {
+ auto result = idbObjectStore->openCursor(*exec, m_idbKeyRange.get(), IDBCursor::directionNext());
+ if (!result.hasException())
+ idbRequest = result.releaseReturnValue();
+ }
+ }
</ins><span class="cx">
</span><span class="cx"> if (!idbRequest) {
</span><span class="cx"> m_requestCallback->sendFailure("Could not open cursor to populate database data");
</span><span class="lines">@@ -506,7 +503,7 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- Ref<OpenCursorCallback> openCursorCallback = OpenCursorCallback::create(m_injectedScript, m_requestCallback.copyRef(), m_skipCount, m_pageSize);
</del><ins>+ auto openCursorCallback = OpenCursorCallback::create(m_injectedScript, m_requestCallback.copyRef(), m_skipCount, m_pageSize);
</ins><span class="cx"> idbRequest->addEventListener(eventNames().successEvent, WTFMove(openCursorCallback), false);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -709,13 +706,13 @@
</span><span class="cx"> if (!requestCallback().isActive())
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- RefPtr<IDBTransaction> idbTransaction = transactionForDatabase(&database, m_objectStoreName, IDBTransaction::modeReadWrite());
</del><ins>+ auto idbTransaction = transactionForDatabase(&database, m_objectStoreName, IDBTransaction::modeReadWrite());
</ins><span class="cx"> if (!idbTransaction) {
</span><span class="cx"> m_requestCallback->sendFailure("Could not get transaction");
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- RefPtr<IDBObjectStore> idbObjectStore = objectStoreForTransaction(idbTransaction.get(), m_objectStoreName);
</del><ins>+ auto idbObjectStore = objectStoreForTransaction(idbTransaction.get(), m_objectStoreName);
</ins><span class="cx"> if (!idbObjectStore) {
</span><span class="cx"> m_requestCallback->sendFailure("Could not get object store");
</span><span class="cx"> return;
</span><span class="lines">@@ -722,13 +719,15 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TransactionActivator activator(idbTransaction.get());
</span><del>- ExceptionCodeWithMessage ec;
- JSC::ExecState* exec = context() ? context()->execState() : nullptr;
- RefPtr<IDBRequest> idbRequest = exec ? idbObjectStore->clear(*exec, ec) : nullptr;
- ASSERT(!ec.code);
- if (ec.code) {
- m_requestCallback->sendFailure(String::format("Could not clear object store '%s': %d", m_objectStoreName.utf8().data(), ec.code));
- return;
</del><ins>+ RefPtr<IDBRequest> idbRequest;
+ if (auto* exec = context() ? context()->execState() : nullptr) {
+ auto result = idbObjectStore->clear(*exec);
+ ASSERT(!result.hasException());
+ if (result.hasException()) {
+ m_requestCallback->sendFailure(String::format("Could not clear object store '%s': %d", m_objectStoreName.utf8().data(), result.releaseException().code()));
+ return;
+ }
+ idbRequest = result.releaseReturnValue();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> idbTransaction->addEventListener(eventNames().completeEvent, ClearObjectStoreListener::create(m_requestCallback.copyRef()), false);
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMWindowcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMWindow.cpp (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMWindow.cpp        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/page/DOMWindow.cpp        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -657,7 +657,7 @@
</span><span class="cx"> if (!isCurrentlyDisplayedInFrame())
</span><span class="cx"> return nullptr;
</span><span class="cx"> if (!m_history)
</span><del>- m_history = History::create(m_frame);
</del><ins>+ m_history = History::create(*m_frame);
</ins><span class="cx"> return m_history.get();
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorepageHistorycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/History.cpp (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/History.cpp        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/page/History.cpp        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -38,15 +38,13 @@
</span><span class="cx"> #include "Page.h"
</span><span class="cx"> #include "ScriptController.h"
</span><span class="cx"> #include "SecurityOrigin.h"
</span><del>-#include "SerializedScriptValue.h"
</del><span class="cx"> #include <wtf/CheckedArithmetic.h>
</span><span class="cx"> #include <wtf/MainThread.h>
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-History::History(Frame* frame)
- : DOMWindowProperty(frame)
- , m_lastStateObjectRequested(nullptr)
</del><ins>+History::History(Frame& frame)
+ : DOMWindowProperty(&frame)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -54,26 +52,26 @@
</span><span class="cx"> {
</span><span class="cx"> if (!m_frame)
</span><span class="cx"> return 0;
</span><del>- if (!m_frame->page())
</del><ins>+ auto* page = m_frame->page();
+ if (!page)
</ins><span class="cx"> return 0;
</span><del>- return m_frame->page()->backForward().count();
</del><ins>+ return page->backForward().count();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-PassRefPtr<SerializedScriptValue> History::state()
</del><ins>+SerializedScriptValue* History::state()
</ins><span class="cx"> {
</span><span class="cx"> m_lastStateObjectRequested = stateInternal();
</span><del>- return m_lastStateObjectRequested;
</del><ins>+ return m_lastStateObjectRequested.get();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-PassRefPtr<SerializedScriptValue> History::stateInternal() const
</del><ins>+SerializedScriptValue* History::stateInternal() const
</ins><span class="cx"> {
</span><span class="cx"> if (!m_frame)
</span><del>- return 0;
-
- if (HistoryItem* historyItem = m_frame->loader().history().currentItem())
- return historyItem->stateObject();
-
- return 0;
</del><ins>+ return nullptr;
+ auto* historyItem = m_frame->loader().history().currentItem();
+ if (!historyItem)
+ return nullptr;
+ return historyItem->stateObject();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool History::stateChanged() const
</span><span class="lines">@@ -83,7 +81,7 @@
</span><span class="cx">
</span><span class="cx"> bool History::isSameAsCurrentState(SerializedScriptValue* state) const
</span><span class="cx"> {
</span><del>- return state == stateInternal().get();
</del><ins>+ return state == stateInternal();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void History::back()
</span><span class="lines">@@ -136,29 +134,24 @@
</span><span class="cx"> return URL(baseURL, urlString);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void History::stateObjectAdded(PassRefPtr<SerializedScriptValue> data, const String& title, const String& urlString, StateObjectType stateObjectType, ExceptionCodeWithMessage& ec)
</del><ins>+ExceptionOr<void> History::stateObjectAdded(RefPtr<SerializedScriptValue>&& data, const String& title, const String& urlString, StateObjectType stateObjectType)
</ins><span class="cx"> {
</span><del>- // Each unique main-frame document is only allowed to send 64mb of state object payload to the UI client/process.
</del><ins>+ // Each unique main-frame document is only allowed to send 64MB of state object payload to the UI client/process.
</ins><span class="cx"> static uint32_t totalStateObjectPayloadLimit = 0x4000000;
</span><span class="cx"> static double stateObjectTimeSpan = 30.0;
</span><span class="cx"> static unsigned perStateObjectTimeSpanLimit = 100;
</span><span class="cx">
</span><span class="cx"> if (!m_frame || !m_frame->page())
</span><del>- return;
</del><ins>+ return { };
</ins><span class="cx">
</span><span class="cx"> URL fullURL = urlForState(urlString);
</span><del>- if (!fullURL.isValid() || !m_frame->document()->securityOrigin()->canRequest(fullURL)) {
- ec.code = SECURITY_ERR;
- return;
- }
</del><ins>+ if (!fullURL.isValid() || !m_frame->document()->securityOrigin()->canRequest(fullURL))
+ return Exception { SECURITY_ERR };
</ins><span class="cx">
</span><span class="cx"> if (fullURL.hasUsername() || fullURL.hasPassword()) {
</span><del>- ec.code = SECURITY_ERR;
</del><span class="cx"> if (stateObjectType == StateObjectType::Replace)
</span><del>- ec.message = makeString("Attempt to use history.replaceState() to change session history URL to ", fullURL.string(), " is insecure; Username/passwords aren't allowed in state object URLs");
- else
- ec.message = makeString("Attempt to use history.pushState() to add URL ", fullURL.string(), " to session history is insecure; Username/passwords aren't allowed in state object URLs");
- return;
</del><ins>+ return Exception { SECURITY_ERR, "Attempt to use history.replaceState() to change session history URL to " + fullURL.string() + " is insecure; Username/passwords aren't allowed in state object URLs" };
+ return Exception { SECURITY_ERR, "Attempt to use history.pushState() to add URL " + fullURL.string() + " to session history is insecure; Username/passwords aren't allowed in state object URLs" };
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Document* mainDocument = m_frame->page()->mainFrame().document();
</span><span class="lines">@@ -169,7 +162,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (!mainHistory)
</span><del>- return;
</del><ins>+ return { };
</ins><span class="cx">
</span><span class="cx"> double currentTimestamp = currentTime();
</span><span class="cx"> if (currentTimestamp - mainHistory->m_currentStateObjectTimeSpanStart > stateObjectTimeSpan) {
</span><span class="lines">@@ -178,12 +171,9 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (mainHistory->m_currentStateObjectTimeSpanObjectsAdded >= perStateObjectTimeSpanLimit) {
</span><del>- ec.code = SECURITY_ERR;
</del><span class="cx"> if (stateObjectType == StateObjectType::Replace)
</span><del>- ec.message = String::format("Attempt to use history.replaceState() more than %u times per %f seconds", perStateObjectTimeSpanLimit, stateObjectTimeSpan);
- else
- ec.message = String::format("Attempt to use history.pushState() more than %u times per %f seconds", perStateObjectTimeSpanLimit, stateObjectTimeSpan);
- return;
</del><ins>+ return Exception { SECURITY_ERR, String::format("Attempt to use history.replaceState() more than %u times per %f seconds", perStateObjectTimeSpanLimit, stateObjectTimeSpan) };
+ return Exception { SECURITY_ERR, String::format("Attempt to use history.pushState() more than %u times per %f seconds", perStateObjectTimeSpanLimit, stateObjectTimeSpan) };
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Checked<unsigned> titleSize = title.length();
</span><span class="lines">@@ -203,12 +193,9 @@
</span><span class="cx"> newTotalUsage += payloadSize;
</span><span class="cx">
</span><span class="cx"> if (newTotalUsage > totalStateObjectPayloadLimit) {
</span><del>- ec.code = QUOTA_EXCEEDED_ERR;
</del><span class="cx"> if (stateObjectType == StateObjectType::Replace)
</span><del>- ec.message = ASCIILiteral("Attempt to store more data than allowed using history.replaceState()");
- else
- ec.message = ASCIILiteral("Attempt to store more data than allowed using history.pushState()");
- return;
</del><ins>+ return Exception { QUOTA_EXCEEDED_ERR, ASCIILiteral("Attempt to store more data than allowed using history.replaceState()") };
+ return Exception { QUOTA_EXCEEDED_ERR, ASCIILiteral("Attempt to store more data than allowed using history.pushState()") };
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> m_mostRecentStateObjectUsage = payloadSize.unsafeGet();
</span><span class="lines">@@ -226,6 +213,8 @@
</span><span class="cx"> m_frame->loader().history().replaceState(data, title, fullURL.string());
</span><span class="cx"> m_frame->loader().client().dispatchDidReplaceStateWithinPage();
</span><span class="cx"> }
</span><ins>+
+ return { };
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorepageHistoryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/History.h (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/History.h        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/page/History.h        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -23,30 +23,25 @@
</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 History_h
-#define History_h
</del><ins>+#pragma once
</ins><span class="cx">
</span><span class="cx"> #include "DOMWindowProperty.h"
</span><ins>+#include "ExceptionOr.h"
</ins><span class="cx"> #include "ScriptWrappable.h"
</span><span class="cx"> #include "SerializedScriptValue.h"
</span><del>-#include "URL.h"
-#include <wtf/Forward.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
</del><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> class Document;
</span><span class="cx"> class Frame;
</span><del>-struct ExceptionCodeWithMessage;
-typedef int ExceptionCode;
</del><ins>+class URL;
</ins><span class="cx">
</span><del>-class History : public ScriptWrappable, public RefCounted<History>, public DOMWindowProperty {
</del><ins>+class History final : public ScriptWrappable, public RefCounted<History>, public DOMWindowProperty {
</ins><span class="cx"> public:
</span><del>- static Ref<History> create(Frame* frame) { return adoptRef(*new History(frame)); }
</del><ins>+ static Ref<History> create(Frame& frame) { return adoptRef(*new History(frame)); }
</ins><span class="cx">
</span><span class="cx"> unsigned length() const;
</span><del>- PassRefPtr<SerializedScriptValue> state();
</del><ins>+ SerializedScriptValue* state();
</ins><span class="cx"> void back();
</span><span class="cx"> void forward();
</span><span class="cx"> void go(int);
</span><span class="lines">@@ -58,18 +53,15 @@
</span><span class="cx"> bool stateChanged() const;
</span><span class="cx"> bool isSameAsCurrentState(SerializedScriptValue*) const;
</span><span class="cx">
</span><del>- enum class StateObjectType {
- Push,
- Replace
- };
- void stateObjectAdded(PassRefPtr<SerializedScriptValue>, const String& title, const String& url, StateObjectType, ExceptionCodeWithMessage&);
</del><ins>+ enum class StateObjectType { Push, Replace };
+ ExceptionOr<void> stateObjectAdded(RefPtr<SerializedScriptValue>&&, const String& title, const String& url, StateObjectType);
</ins><span class="cx">
</span><span class="cx"> private:
</span><del>- explicit History(Frame*);
</del><ins>+ explicit History(Frame&);
</ins><span class="cx">
</span><span class="cx"> URL urlForState(const String& url);
</span><span class="cx">
</span><del>- PassRefPtr<SerializedScriptValue> stateInternal() const;
</del><ins>+ SerializedScriptValue* stateInternal() const;
</ins><span class="cx">
</span><span class="cx"> RefPtr<SerializedScriptValue> m_lastStateObjectRequested;
</span><span class="cx">
</span><span class="lines">@@ -84,5 +76,3 @@
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><del>-
-#endif // History_h
</del></span></pre></div>
<a id="trunkSourceWebCorepageHistoryidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/History.idl (206975 => 206976)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/History.idl        2016-10-10 02:03:35 UTC (rev 206975)
+++ trunk/Source/WebCore/page/History.idl        2016-10-10 02:13:28 UTC (rev 206976)
</span><span class="lines">@@ -33,6 +33,6 @@
</span><span class="cx"> [CallWith=Document, ForwardDeclareInHeader] void forward();
</span><span class="cx"> [CallWith=Document, ForwardDeclareInHeader] void go(optional long distance = 0);
</span><span class="cx">
</span><del>- [Custom, MayThrowLegacyException] void pushState(any data, DOMString title, optional USVString? url = null);
- [Custom, MayThrowLegacyException] void replaceState(any data, DOMString title, optional USVString? url = null);
</del><ins>+ [Custom, MayThrowException] void pushState(any data, DOMString title, optional USVString? url = null);
+ [Custom, MayThrowException] void replaceState(any data, DOMString title, optional USVString? url = null);
</ins><span class="cx"> };
</span></span></pre>
</div>
</div>
</body>
</html>