<!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>[210275] 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/210275">210275</a></dd>
<dt>Author</dt> <dd>weinig@apple.com</dd>
<dt>Date</dt> <dd>2017-01-04 09:48:58 -0800 (Wed, 04 Jan 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Remove final custom binding from IDBRequest
https://bugs.webkit.org/show_bug.cgi?id=166671

Reviewed by Alex Christensen.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
Remove JSIDBRequestCustom.cpp

* bindings/js/JSIDBRequestCustom.cpp: Removed.

* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::IDBRequest):
(WebCore::IDBRequest::~IDBRequest):
(WebCore::IDBRequest::result):
(WebCore::IDBRequest::setSource):
(WebCore::IDBRequest::sourceObjectStoreIdentifier):
(WebCore::IDBRequest::sourceIndexIdentifier):
(WebCore::IDBRequest::requestedIndexRecordType):
(WebCore::IDBRequest::setResult):
(WebCore::IDBRequest::setResultToStructuredClone):
(WebCore::IDBRequest::setResultToUndefined):
(WebCore::IDBRequest::resultCursor):
(WebCore::IDBRequest::willIterateCursor):
(WebCore::IDBRequest::didOpenOrIterateCursor):
(WebCore::IDBRequest::source): Deleted.
(WebCore::IDBRequest::clearResult): Deleted.
* Modules/indexeddb/IDBRequest.h:
(WebCore::IDBRequest::source):
(WebCore::IDBRequest::cursorResult): Deleted.
(WebCore::IDBRequest::databaseResult): Deleted.
(WebCore::IDBRequest::scriptResult): Deleted.
Replace multiple member variables with Variants for source and result. Add a result
member function that properly sets an exception if not &quot;done&quot;.

* Modules/indexeddb/IDBRequest.idl:
Remove CustomGetter annotation and add type.

* bindings/generic/IDLTypes.h:
(WebCore::IDLAny::nullValue):
(WebCore::IDLAny::isNullValue):
(WebCore::IDLAny::extractValueFromNullable):
* bindings/js/JSDOMConvert.h:
(WebCore::Converter&lt;IDLAny&gt;::convert):
Flesh out IDLAny to be implemented as a Strong&lt;Unknown&gt; when used in aggregate types,
but still work with JSValue when passing as a parameter.

* inspector/InspectorIndexedDBAgent.cpp:
Update for new return value of IDBRequest::result().</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</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="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorebindingsgenericIDLTypesh">trunk/Source/WebCore/bindings/generic/IDLTypes.h</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMConverth">trunk/Source/WebCore/bindings/js/JSDOMConvert.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorIndexedDBAgentcpp">trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorebindingsjsJSIDBRequestCustomcpp">trunk/Source/WebCore/bindings/js/JSIDBRequestCustom.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (210274 => 210275)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2017-01-04 13:59:44 UTC (rev 210274)
+++ trunk/Source/WebCore/CMakeLists.txt        2017-01-04 17:48:58 UTC (rev 210275)
</span><span class="lines">@@ -1148,7 +1148,6 @@
</span><span class="cx">     bindings/js/JSIDBCursorWithValueCustom.cpp
</span><span class="cx">     bindings/js/JSIDBIndexCustom.cpp
</span><span class="cx">     bindings/js/JSIDBObjectStoreCustom.cpp
</span><del>-    bindings/js/JSIDBRequestCustom.cpp
</del><span class="cx">     bindings/js/JSIDBTransactionCustom.cpp
</span><span class="cx">     bindings/js/JSImageDataCustom.cpp
</span><span class="cx">     bindings/js/JSInspectorFrontendHostCustom.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (210274 => 210275)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-01-04 13:59:44 UTC (rev 210274)
+++ trunk/Source/WebCore/ChangeLog        2017-01-04 17:48:58 UTC (rev 210275)
</span><span class="lines">@@ -1,3 +1,55 @@
</span><ins>+2017-01-03  Sam Weinig  &lt;sam@webkit.org&gt;
+
+        Remove final custom binding from IDBRequest
+        https://bugs.webkit.org/show_bug.cgi?id=166671
+
+        Reviewed by Alex Christensen.
+
+        * CMakeLists.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        Remove JSIDBRequestCustom.cpp
+
+        * bindings/js/JSIDBRequestCustom.cpp: Removed.
+
+        * Modules/indexeddb/IDBRequest.cpp:
+        (WebCore::IDBRequest::IDBRequest):
+        (WebCore::IDBRequest::~IDBRequest):
+        (WebCore::IDBRequest::result):
+        (WebCore::IDBRequest::setSource):
+        (WebCore::IDBRequest::sourceObjectStoreIdentifier):
+        (WebCore::IDBRequest::sourceIndexIdentifier):
+        (WebCore::IDBRequest::requestedIndexRecordType):
+        (WebCore::IDBRequest::setResult):
+        (WebCore::IDBRequest::setResultToStructuredClone):
+        (WebCore::IDBRequest::setResultToUndefined):
+        (WebCore::IDBRequest::resultCursor):
+        (WebCore::IDBRequest::willIterateCursor):
+        (WebCore::IDBRequest::didOpenOrIterateCursor):
+        (WebCore::IDBRequest::source): Deleted.
+        (WebCore::IDBRequest::clearResult): Deleted.
+        * Modules/indexeddb/IDBRequest.h:
+        (WebCore::IDBRequest::source):
+        (WebCore::IDBRequest::cursorResult): Deleted.
+        (WebCore::IDBRequest::databaseResult): Deleted.
+        (WebCore::IDBRequest::scriptResult): Deleted.
+        Replace multiple member variables with Variants for source and result. Add a result
+        member function that properly sets an exception if not &quot;done&quot;.
+
+        * Modules/indexeddb/IDBRequest.idl:
+        Remove CustomGetter annotation and add type.
+
+        * bindings/generic/IDLTypes.h:
+        (WebCore::IDLAny::nullValue):
+        (WebCore::IDLAny::isNullValue):
+        (WebCore::IDLAny::extractValueFromNullable):
+        * bindings/js/JSDOMConvert.h:
+        (WebCore::Converter&lt;IDLAny&gt;::convert):
+        Flesh out IDLAny to be implemented as a Strong&lt;Unknown&gt; when used in aggregate types,
+        but still work with JSValue when passing as a parameter.
+
+        * inspector/InspectorIndexedDBAgent.cpp:
+        Update for new return value of IDBRequest::result().
+
</ins><span class="cx"> 2017-01-04  Tim Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Provide a setting for clients to always prefer low-power WebGL
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp (210274 => 210275)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp        2017-01-04 13:59:44 UTC (rev 210274)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp        2017-01-04 17:48:58 UTC (rev 210275)
</span><span class="lines">@@ -91,7 +91,7 @@
</span><span class="cx">     : IDBActiveDOMObject(&amp;context)
</span><span class="cx">     , m_transaction(&amp;transaction)
</span><span class="cx">     , m_resourceIdentifier(transaction.connectionProxy())
</span><del>-    , m_objectStoreSource(&amp;objectStore)
</del><ins>+    , m_source(&amp;objectStore)
</ins><span class="cx">     , m_connectionProxy(transaction.database().connectionProxy())
</span><span class="cx"> {
</span><span class="cx">     suspendIfNeeded();
</span><span class="lines">@@ -107,8 +107,7 @@
</span><span class="cx">     suspendIfNeeded();
</span><span class="cx"> 
</span><span class="cx">     WTF::switchOn(cursor.source(),
</span><del>-        [this] (const RefPtr&lt;IDBIndex&gt;&amp; index) { this-&gt;m_indexSource = index; },
-        [this] (const RefPtr&lt;IDBObjectStore&gt;&amp; objectStore) { this-&gt;m_objectStoreSource = objectStore; }
</del><ins>+        [this] (const auto&amp; value) { this-&gt;m_source = IDBRequest::Source { value }; }
</ins><span class="cx">     );
</span><span class="cx"> 
</span><span class="cx">     cursor.setRequest(*this);
</span><span class="lines">@@ -118,7 +117,7 @@
</span><span class="cx">     : IDBActiveDOMObject(&amp;context)
</span><span class="cx">     , m_transaction(&amp;transaction)
</span><span class="cx">     , m_resourceIdentifier(transaction.connectionProxy())
</span><del>-    , m_indexSource(&amp;index)
</del><ins>+    , m_source(&amp;index)
</ins><span class="cx">     , m_connectionProxy(transaction.database().connectionProxy())
</span><span class="cx"> {
</span><span class="cx">     suspendIfNeeded();
</span><span class="lines">@@ -128,7 +127,7 @@
</span><span class="cx">     : IDBActiveDOMObject(&amp;context)
</span><span class="cx">     , m_transaction(&amp;transaction)
</span><span class="cx">     , m_resourceIdentifier(transaction.connectionProxy())
</span><del>-    , m_objectStoreSource(&amp;objectStore)
</del><ins>+    , m_source(&amp;objectStore)
</ins><span class="cx">     , m_requestedObjectStoreRecordType(type)
</span><span class="cx">     , m_connectionProxy(transaction.database().connectionProxy())
</span><span class="cx"> {
</span><span class="lines">@@ -145,10 +144,22 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(currentThread() == originThreadID());
</span><span class="cx"> 
</span><del>-    if (m_cursorResult)
-        m_cursorResult-&gt;clearRequest();
</del><ins>+    if (m_result) {
+        WTF::switchOn(m_result.value(),
+            [] (RefPtr&lt;IDBCursor&gt;&amp; cursor) { cursor-&gt;clearRequest(); },
+            [] (const auto&amp;) { }
+        );
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+ExceptionOr&lt;std::optional&lt;IDBRequest::Result&gt;&gt; IDBRequest::result() const
+{
+    if (!isDone())
+        return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral(&quot;Failed to read the 'result' property from 'IDBRequest': The request has not finished.&quot;) };
+
+    return std::optional&lt;IDBRequest::Result&gt; { m_result };
+}
+
</ins><span class="cx"> ExceptionOr&lt;DOMError*&gt; IDBRequest::error() const
</span><span class="cx"> {
</span><span class="cx">     ASSERT(currentThread() == originThreadID());
</span><span class="lines">@@ -159,29 +170,15 @@
</span><span class="cx">     return m_domError.get();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-std::optional&lt;IDBRequest::Source&gt; IDBRequest::source() const
-{
-    if (m_cursorSource)
-        return Source { m_cursorSource };
-    if (m_indexSource)
-        return Source { m_indexSource };
-    if (m_objectStoreSource)
-        return Source { m_objectStoreSource };
-
-    return std::nullopt;
-}
-
</del><span class="cx"> void IDBRequest::setSource(IDBCursor&amp; cursor)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(currentThread() == originThreadID());
</span><span class="cx">     ASSERT(!m_cursorRequestNotifier);
</span><span class="cx"> 
</span><del>-    m_objectStoreSource = nullptr;
-    m_indexSource = nullptr;
-    m_cursorSource = &amp;cursor;
</del><ins>+    m_source = Source { &amp;cursor };
</ins><span class="cx">     m_cursorRequestNotifier = std::make_unique&lt;ScopeGuard&gt;([this]() {
</span><del>-        ASSERT(m_cursorSource);
-        m_cursorSource-&gt;decrementOutstandingRequestCount();
</del><ins>+        ASSERT(WTF::holds_alternative&lt;RefPtr&lt;IDBCursor&gt;&gt;(m_source.value()));
+        WTF::get&lt;RefPtr&lt;IDBCursor&gt;&gt;(m_source.value())-&gt;decrementOutstandingRequestCount();
</ins><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -205,11 +202,14 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(currentThread() == originThreadID());
</span><span class="cx"> 
</span><del>-    if (m_objectStoreSource)
-        return m_objectStoreSource-&gt;info().identifier();
-    if (m_indexSource)
-        return m_indexSource-&gt;info().objectStoreIdentifier();
-    return 0;
</del><ins>+    if (!m_source)
+        return 0;
+
+    return WTF::switchOn(m_source.value(),
+        [] (const RefPtr&lt;IDBObjectStore&gt;&amp; objectStore) { return objectStore-&gt;info().identifier(); },
+        [] (const RefPtr&lt;IDBIndex&gt;&amp; index) { return index-&gt;info().objectStoreIdentifier(); },
+        [] (const RefPtr&lt;IDBCursor&gt;&amp;) { return 0; }
+    );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> uint64_t IDBRequest::sourceIndexIdentifier() const
</span><span class="lines">@@ -216,9 +216,14 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(currentThread() == originThreadID());
</span><span class="cx"> 
</span><del>-    if (!m_indexSource)
</del><ins>+    if (!m_source)
</ins><span class="cx">         return 0;
</span><del>-    return m_indexSource-&gt;info().identifier();
</del><ins>+
+    return WTF::switchOn(m_source.value(),
+        [] (const RefPtr&lt;IDBObjectStore&gt;&amp;) -&gt; uint64_t { return 0; },
+        [] (const RefPtr&lt;IDBIndex&gt;&amp; index) -&gt; uint64_t { return index-&gt;info().identifier(); },
+        [] (const RefPtr&lt;IDBCursor&gt;&amp;) -&gt; uint64_t { return 0; }
+    );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> IndexedDB::ObjectStoreRecordType IDBRequest::requestedObjectStoreRecordType() const
</span><span class="lines">@@ -231,7 +236,8 @@
</span><span class="cx"> IndexedDB::IndexRecordType IDBRequest::requestedIndexRecordType() const
</span><span class="cx"> {
</span><span class="cx">     ASSERT(currentThread() == originThreadID());
</span><del>-    ASSERT(m_indexSource);
</del><ins>+    ASSERT(m_source);
+    ASSERT(WTF::holds_alternative&lt;RefPtr&lt;IDBIndex&gt;&gt;(m_source.value()));
</ins><span class="cx"> 
</span><span class="cx">     return m_requestedIndexRecordType;
</span><span class="cx"> }
</span><span class="lines">@@ -362,8 +368,7 @@
</span><span class="cx">     if (!exec)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    clearResult();
-    m_scriptResult = { context-&gt;vm(), idbKeyDataToScriptValue(*exec, keyData) };
</del><ins>+    m_result = Result { JSC::Strong&lt;JSC::Unknown&gt; { context-&gt;vm(), idbKeyDataToScriptValue(*exec, keyData) } };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void IDBRequest::setResult(const Vector&lt;IDBKeyData&gt;&amp; keyDatas)
</span><span class="lines">@@ -378,10 +383,9 @@
</span><span class="cx">     if (!state)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    clearResult();
</del><span class="cx"> 
</span><span class="cx">     Locker&lt;JSLock&gt; locker(context-&gt;vm().apiLock());
</span><del>-    m_scriptResult = { context-&gt;vm(), toJS(state, jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject()), keyDatas) };
</del><ins>+    m_result = Result { JSC::Strong&lt;JSC::Unknown&gt; { context-&gt;vm(), toJS(state, jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject()), keyDatas) } };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void IDBRequest::setResult(const Vector&lt;IDBValue&gt;&amp; values)
</span><span class="lines">@@ -396,10 +400,8 @@
</span><span class="cx">     if (!exec)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    clearResult();
-
</del><span class="cx">     Locker&lt;JSLock&gt; locker(context-&gt;vm().apiLock());
</span><del>-    m_scriptResult = { context-&gt;vm(), toJS(exec, jsCast&lt;JSDOMGlobalObject*&gt;(exec-&gt;lexicalGlobalObject()), values) };
</del><ins>+    m_result = Result { JSC::Strong&lt;JSC::Unknown&gt; { context-&gt;vm(), toJS(exec, jsCast&lt;JSDOMGlobalObject*&gt;(exec-&gt;lexicalGlobalObject()), values) } };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void IDBRequest::setResult(uint64_t number)
</span><span class="lines">@@ -410,8 +412,7 @@
</span><span class="cx">     if (!context)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    clearResult();
-    m_scriptResult = { context-&gt;vm(), JSC::jsNumber(number) };
</del><ins>+    m_result = Result { JSC::Strong&lt;JSC::Unknown&gt; { context-&gt;vm(), JSC::jsNumber(number) } };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void IDBRequest::setResultToStructuredClone(const IDBValue&amp; value)
</span><span class="lines">@@ -428,19 +429,9 @@
</span><span class="cx">     if (!exec)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    clearResult();
-    m_scriptResult = { context-&gt;vm(), deserializeIDBValueToJSValue(*exec, value) };
</del><ins>+    m_result = Result { JSC::Strong&lt;JSC::Unknown&gt; { context-&gt;vm(), deserializeIDBValueToJSValue(*exec, value) } };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void IDBRequest::clearResult()
-{
-    ASSERT(currentThread() == originThreadID());
-
-    m_scriptResult = { };
-    m_cursorResult = nullptr;
-    m_databaseResult = nullptr;
-}
-
</del><span class="cx"> void IDBRequest::setResultToUndefined()
</span><span class="cx"> {
</span><span class="cx">     ASSERT(currentThread() == originThreadID());
</span><span class="lines">@@ -449,8 +440,7 @@
</span><span class="cx">     if (!context)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    clearResult();
-    m_scriptResult = { context-&gt;vm(), JSC::jsUndefined() };
</del><ins>+    m_result = Result { JSC::Strong&lt;JSC::Unknown&gt; { context-&gt;vm(), JSC::jsUndefined() } };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> IDBCursor* IDBRequest::resultCursor()
</span><span class="lines">@@ -457,7 +447,13 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(currentThread() == originThreadID());
</span><span class="cx"> 
</span><del>-    return m_cursorResult.get();
</del><ins>+    if (!m_result)
+        return nullptr;
+
+    return WTF::switchOn(m_result.value(),
+        [] (const RefPtr&lt;IDBCursor&gt;&amp; cursor) -&gt; IDBCursor* { return cursor.get(); },
+        [] (const auto&amp;) -&gt; IDBCursor* { return nullptr; }
+    );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void IDBRequest::willIterateCursor(IDBCursor&amp; cursor)
</span><span class="lines">@@ -472,7 +468,7 @@
</span><span class="cx"> 
</span><span class="cx">     m_pendingCursor = &amp;cursor;
</span><span class="cx">     m_hasPendingActivity = true;
</span><del>-    clearResult();
</del><ins>+    m_result = std::nullopt;
</ins><span class="cx">     m_readyState = ReadyState::Pending;
</span><span class="cx">     m_domError = nullptr;
</span><span class="cx">     m_idbError = { };
</span><span class="lines">@@ -487,12 +483,12 @@
</span><span class="cx">     ASSERT(currentThread() == originThreadID());
</span><span class="cx">     ASSERT(m_pendingCursor);
</span><span class="cx"> 
</span><del>-    clearResult();
</del><ins>+    m_result = std::nullopt;
</ins><span class="cx"> 
</span><span class="cx">     if (resultData.type() == IDBResultType::IterateCursorSuccess || resultData.type() == IDBResultType::OpenCursorSuccess) {
</span><span class="cx">         m_pendingCursor-&gt;setGetResult(*this, resultData.getResult());
</span><span class="cx">         if (resultData.getResult().isDefined())
</span><del>-            m_cursorResult = m_pendingCursor;
</del><ins>+            m_result = Result { m_pendingCursor };
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     m_cursorRequestNotifier = nullptr;
</span><span class="lines">@@ -537,8 +533,7 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(currentThread() == originThreadID());
</span><span class="cx"> 
</span><del>-    clearResult();
-    m_databaseResult = WTFMove(database);
</del><ins>+    m_result = Result { RefPtr&lt;IDBDatabase&gt; { WTFMove(database) } };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBRequesth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h (210274 => 210275)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h        2017-01-04 13:59:44 UTC (rev 210274)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h        2017-01-04 17:48:58 UTC (rev 210275)
</span><span class="lines">@@ -67,12 +67,11 @@
</span><span class="cx"> 
</span><span class="cx">     virtual ~IDBRequest();
</span><span class="cx"> 
</span><del>-    IDBCursor* cursorResult() const { return m_cursorResult.get(); }
-    IDBDatabase* databaseResult() const { return m_databaseResult.get(); }
-    JSC::JSValue scriptResult() const { return m_scriptResult.get(); }
</del><ins>+    using Result = Variant&lt;RefPtr&lt;IDBCursor&gt;, RefPtr&lt;IDBDatabase&gt;, JSC::Strong&lt;JSC::Unknown&gt;&gt;;
+    ExceptionOr&lt;std::optional&lt;Result&gt;&gt; result() const;
</ins><span class="cx"> 
</span><span class="cx">     using Source = Variant&lt;RefPtr&lt;IDBObjectStore&gt;, RefPtr&lt;IDBIndex&gt;, RefPtr&lt;IDBCursor&gt;&gt;;
</span><del>-    std::optional&lt;Source&gt; source() const;
</del><ins>+    const std::optional&lt;Source&gt;&amp; source() const { return m_source; }
</ins><span class="cx"> 
</span><span class="cx">     ExceptionOr&lt;DOMError*&gt; error() const;
</span><span class="cx"> 
</span><span class="lines">@@ -141,8 +140,6 @@
</span><span class="cx">     IDBRequest(ScriptExecutionContext&amp;, IDBObjectStore&amp;, IndexedDB::ObjectStoreRecordType, IDBTransaction&amp;);
</span><span class="cx">     IDBRequest(ScriptExecutionContext&amp;, IDBIndex&amp;, IndexedDB::IndexRecordType, IDBTransaction&amp;);
</span><span class="cx"> 
</span><del>-    void clearResult();
-
</del><span class="cx">     EventTargetInterface eventTargetInterface() const override;
</span><span class="cx"> 
</span><span class="cx">     const char* activeDOMObjectName() const final;
</span><span class="lines">@@ -161,18 +158,11 @@
</span><span class="cx"> 
</span><span class="cx">     IDBCursor* resultCursor();
</span><span class="cx"> 
</span><del>-    // Could consider storing these three in a union or union-like class instead.
-    JSC::Strong&lt;JSC::Unknown&gt; m_scriptResult;
-    RefPtr&lt;IDBCursor&gt; m_cursorResult;
-    RefPtr&lt;IDBDatabase&gt; m_databaseResult;
-
</del><span class="cx">     IDBError m_idbError;
</span><span class="cx">     IDBResourceIdentifier m_resourceIdentifier;
</span><span class="cx"> 
</span><del>-    // Could consider storing these three in a union or union-like class instead.
-    RefPtr&lt;IDBObjectStore&gt; m_objectStoreSource;
-    RefPtr&lt;IDBIndex&gt; m_indexSource;
-    RefPtr&lt;IDBCursor&gt; m_cursorSource;
</del><ins>+    std::optional&lt;Result&gt; m_result;
+    std::optional&lt;Source&gt; m_source;
</ins><span class="cx"> 
</span><span class="cx">     bool m_hasPendingActivity { true };
</span><span class="cx">     IndexedDB::ObjectStoreRecordType m_requestedObjectStoreRecordType { IndexedDB::ObjectStoreRecordType::ValueOnly };
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBRequestidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequest.idl (210274 => 210275)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBRequest.idl        2017-01-04 13:59:44 UTC (rev 210274)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequest.idl        2017-01-04 17:48:58 UTC (rev 210275)
</span><span class="lines">@@ -34,7 +34,7 @@
</span><span class="cx">     GenerateIsReachable=Impl,
</span><span class="cx">     SkipVTableValidation,
</span><span class="cx"> ] interface IDBRequest : EventTarget {
</span><del>-    [CustomGetter, GetterMayThrowException] readonly attribute any result;
</del><ins>+    [GetterMayThrowException] readonly attribute (IDBCursor or IDBDatabase or any)? result;
</ins><span class="cx">     [GetterMayThrowException] readonly attribute DOMError? error;
</span><span class="cx">     readonly attribute (IDBObjectStore or IDBIndex or IDBCursor)? source;
</span><span class="cx">     readonly attribute IDBTransaction transaction;
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (210274 => 210275)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2017-01-04 13:59:44 UTC (rev 210274)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2017-01-04 17:48:58 UTC (rev 210275)
</span><span class="lines">@@ -2898,7 +2898,6 @@
</span><span class="cx">                 7CD0BA051B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CD0BA031B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.h */; };
</span><span class="cx">                 7CD494CC1A86EB1D000A87EC /* RenderAttachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CD494CA1A86EB1D000A87EC /* RenderAttachment.cpp */; };
</span><span class="cx">                 7CD494CD1A86EB1D000A87EC /* RenderAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CD494CB1A86EB1D000A87EC /* RenderAttachment.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-                7CD686561E0E26D300E97AA7 /* JSIDBRequestCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CD686551E0E26D300E97AA7 /* JSIDBRequestCustom.cpp */; };
</del><span class="cx">                 7CE58D4A1DD64A5B00128552 /* SVGPoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D491DD64A5B00128552 /* SVGPoint.h */; };
</span><span class="cx">                 7CE58D4E1DD694FE00128552 /* SVGRectTraits.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D4D1DD694FE00128552 /* SVGRectTraits.h */; };
</span><span class="cx">                 7CE58D501DD69A1E00128552 /* SVGNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE58D4F1DD69A1E00128552 /* SVGNumber.h */; };
</span><span class="lines">@@ -10405,7 +10404,6 @@
</span><span class="cx">                 7CD0BA031B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActiveDOMCallbackMicrotask.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7CD494CA1A86EB1D000A87EC /* RenderAttachment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderAttachment.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7CD494CB1A86EB1D000A87EC /* RenderAttachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderAttachment.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                7CD686551E0E26D300E97AA7 /* JSIDBRequestCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBRequestCustom.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 7CE58D491DD64A5B00128552 /* SVGPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPoint.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7CE58D4D1DD694FE00128552 /* SVGRectTraits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGRectTraits.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7CE58D4F1DD69A1E00128552 /* SVGNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGNumber.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -22133,7 +22131,6 @@
</span><span class="cx">                                 BC17F9650B64EBB8004A65CB /* JSHTMLSelectElementCustom.cpp */,
</span><span class="cx">                                 AB4CB4EA0B8BDA3D009F40B0 /* JSHTMLSelectElementCustom.h */,
</span><span class="cx">                                 D6F7960C166FFECE0076DD18 /* JSHTMLTemplateElementCustom.cpp */,
</span><del>-                                7CD686551E0E26D300E97AA7 /* JSIDBRequestCustom.cpp */,
</del><span class="cx">                                 7A74ECBC101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp */,
</span><span class="cx">                                 BCE1C43F0D9830F4003B02F2 /* JSLocationCustom.cpp */,
</span><span class="cx">                                 2D9BF7481DBFDDF8007A7D99 /* JSMediaKeySessionCustom.cpp */,
</span><span class="lines">@@ -31741,7 +31738,6 @@
</span><span class="cx">                                 49C7B9D91042D32F0009D447 /* WebGLRenderbuffer.cpp in Sources */,
</span><span class="cx">                                 49C7B9DF1042D32F0009D447 /* WebGLRenderingContext.cpp in Sources */,
</span><span class="cx">                                 D3F3D3691A69B7B00059FC2B /* WebGLRenderingContextBase.cpp in Sources */,
</span><del>-                                7CD686561E0E26D300E97AA7 /* JSIDBRequestCustom.cpp in Sources */,
</del><span class="cx">                                 6F995A211A7078B100A735F4 /* WebGLSampler.cpp in Sources */,
</span><span class="cx">                                 49C7B9E21042D32F0009D447 /* WebGLShader.cpp in Sources */,
</span><span class="cx">                                 A08CF154152B77B3009C5775 /* WebGLShaderPrecisionFormat.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsgenericIDLTypesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/generic/IDLTypes.h (210274 => 210275)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/generic/IDLTypes.h        2017-01-04 13:59:44 UTC (rev 210274)
+++ trunk/Source/WebCore/bindings/generic/IDLTypes.h        2017-01-04 17:48:58 UTC (rev 210275)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx"> 
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><ins>+#include &lt;heap/HandleTypes.h&gt;
</ins><span class="cx"> #include &lt;wtf/Brigand.h&gt;
</span><span class="cx"> #include &lt;wtf/HashMap.h&gt;
</span><span class="cx"> #include &lt;wtf/StdLibExtras.h&gt;
</span><span class="lines">@@ -59,8 +60,15 @@
</span><span class="cx"> // IDLNull is a special type for use as a subtype in an IDLUnion that is nullable.
</span><span class="cx"> struct IDLNull : IDLType&lt;std::nullptr_t&gt; { };
</span><span class="cx"> 
</span><del>-struct IDLAny : IDLType&lt;JSC::JSValue&gt; { };
</del><ins>+struct IDLAny : IDLType&lt;JSC::Strong&lt;JSC::Unknown&gt;&gt; {
+    using ParameterType = JSC::JSValue;
</ins><span class="cx"> 
</span><ins>+    using NullableType = JSC::Strong&lt;JSC::Unknown&gt;;
+    static inline std::nullptr_t nullValue() { return nullptr; }
+    template&lt;typename U&gt; static inline bool isNullValue(U&amp;&amp; value) { return !value; }
+    template&lt;typename U&gt; static inline U&amp;&amp; extractValueFromNullable(U&amp;&amp; value) { return std::forward&lt;U&gt;(value); }
+};
+
</ins><span class="cx"> struct IDLBoolean : IDLType&lt;bool&gt; { };
</span><span class="cx"> 
</span><span class="cx"> template&lt;typename NumericType&gt; struct IDLNumber : IDLType&lt;NumericType&gt; { };
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMConverth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMConvert.h (210274 => 210275)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMConvert.h        2017-01-04 13:59:44 UTC (rev 210274)
+++ trunk/Source/WebCore/bindings/js/JSDOMConvert.h        2017-01-04 17:48:58 UTC (rev 210275)
</span><span class="lines">@@ -214,10 +214,17 @@
</span><span class="cx"> // MARK: Any type
</span><span class="cx"> 
</span><span class="cx"> template&lt;&gt; struct Converter&lt;IDLAny&gt; : DefaultConverter&lt;IDLAny&gt; {
</span><ins>+    using ReturnType = JSC::JSValue;
+    
</ins><span class="cx">     static JSC::JSValue convert(JSC::ExecState&amp;, JSC::JSValue value)
</span><span class="cx">     {
</span><span class="cx">         return value;
</span><span class="cx">     }
</span><ins>+
+    static JSC::JSValue convert(const JSC::Strong&lt;JSC::Unknown&gt;&amp; value)
+    {
+        return value.get();
+    }
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> template&lt;&gt; struct JSConverter&lt;IDLAny&gt; {
</span><span class="lines">@@ -251,6 +258,11 @@
</span><span class="cx">     struct NullableConversionType&lt;IDLInterface&lt;T&gt;&gt; {
</span><span class="cx">         using Type = typename Converter&lt;IDLInterface&lt;T&gt;&gt;::ReturnType;
</span><span class="cx">     };
</span><ins>+
+    template&lt;&gt;
+    struct NullableConversionType&lt;IDLAny&gt; {
+        using Type = typename Converter&lt;IDLAny&gt;::ReturnType;
+    };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template&lt;typename T&gt; struct Converter&lt;IDLNullable&lt;T&gt;&gt; : DefaultConverter&lt;IDLNullable&lt;T&gt;&gt; {
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSIDBRequestCustomcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/bindings/js/JSIDBRequestCustom.cpp (210274 => 210275)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSIDBRequestCustom.cpp        2017-01-04 13:59:44 UTC (rev 210274)
+++ trunk/Source/WebCore/bindings/js/JSIDBRequestCustom.cpp        2017-01-04 17:48:58 UTC (rev 210275)
</span><span class="lines">@@ -1,62 +0,0 @@
</span><del>-/*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include &quot;config.h&quot;
-#include &quot;JSIDBRequest.h&quot;
-
-#if ENABLE(INDEXED_DATABASE)
-
-#include &quot;JSIDBCursor.h&quot;
-#include &quot;JSIDBDatabase.h&quot;
-#include &quot;JSIDBIndex.h&quot;
-#include &quot;JSIDBObjectStore.h&quot;
-
-using namespace JSC;
-
-namespace WebCore {
-
-JSValue JSIDBRequest::result(ExecState&amp; state) const
-{
-    auto&amp; request = wrapped();
-
-    if (!request.isDone()) {
-        auto&amp; vm = state.vm();
-        auto scope = DECLARE_THROW_SCOPE(vm);
-        propagateException(state, scope, Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral(&quot;Failed to read the 'result' property from 'IDBRequest': The request has not finished.&quot;) });
-        return { };
-    }
-
-    if (auto* cursor = request.cursorResult())
-        return toJS(&amp;state, globalObject(), *cursor);
-    if (auto* database = request.databaseResult())
-        return toJS(&amp;state, globalObject(), *database);
-    if (auto result = request.scriptResult())
-        return result;
-    return jsNull();
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(INDEXED_DATABASE)
</del></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorIndexedDBAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp (210274 => 210275)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp        2017-01-04 13:59:44 UTC (rev 210274)
+++ trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp        2017-01-04 17:48:58 UTC (rev 210275)
</span><span class="lines">@@ -123,17 +123,20 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         auto&amp; request = static_cast&lt;IDBOpenDBRequest&amp;&gt;(*event-&gt;target());
</span><del>-        if (!request.isDone()) {
</del><ins>+
+        auto result = request.result();
+        if (result.hasException()) {
</ins><span class="cx">             m_executableWithDatabase-&gt;requestCallback().sendFailure(&quot;Could not get result in callback.&quot;);
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        auto databaseResult = request.databaseResult();
-        if (!databaseResult) {
</del><ins>+        auto resultValue = result.releaseReturnValue();
+        if (!resultValue || !WTF::holds_alternative&lt;RefPtr&lt;IDBDatabase&gt;&gt;(resultValue.value())) {
</ins><span class="cx">             m_executableWithDatabase-&gt;requestCallback().sendFailure(&quot;Unexpected result type.&quot;);
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        auto databaseResult = WTF::get&lt;RefPtr&lt;IDBDatabase&gt;&gt;(resultValue.value());
</ins><span class="cx">         m_executableWithDatabase-&gt;execute(*databaseResult);
</span><span class="cx">         databaseResult-&gt;close();
</span><span class="cx">     }
</span><span class="lines">@@ -362,26 +365,23 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         auto&amp; request = static_cast&lt;IDBRequest&amp;&gt;(*event-&gt;target());
</span><del>-        if (!request.isDone()) {
</del><ins>+
+        auto result = request.result();
+        if (result.hasException()) {
</ins><span class="cx">             m_requestCallback-&gt;sendFailure(&quot;Could not get result in callback.&quot;);
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">         
</span><del>-        if (request.scriptResult()) {
</del><ins>+        auto resultValue = result.releaseReturnValue();
+        if (!resultValue || !WTF::holds_alternative&lt;RefPtr&lt;IDBCursor&gt;&gt;(resultValue.value())) {
</ins><span class="cx">             end(false);
</span><span class="cx">             return;
</span><span class="cx">         }
</span><del>-        
-        auto* cursorResult = request.cursorResult();
-        if (!cursorResult) {
-            end(false);
-            return;
-        }
</del><span class="cx"> 
</span><del>-        auto&amp; cursor = *cursorResult;
</del><ins>+        auto cursor = WTF::get&lt;RefPtr&lt;IDBCursor&gt;&gt;(resultValue.value());
</ins><span class="cx"> 
</span><span class="cx">         if (m_skipCount) {
</span><del>-            if (cursor.advance(m_skipCount).hasException())
</del><ins>+            if (cursor-&gt;advance(m_skipCount).hasException())
</ins><span class="cx">                 m_requestCallback-&gt;sendFailure(&quot;Could not advance cursor.&quot;);
</span><span class="cx">             m_skipCount = 0;
</span><span class="cx">             return;
</span><span class="lines">@@ -393,7 +393,7 @@
</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>-        if (cursor.continueFunction(nullptr).hasException()) {
</del><ins>+        if (cursor-&gt;continueFunction(nullptr).hasException()) {
</ins><span class="cx">             m_requestCallback-&gt;sendFailure(&quot;Could not continue cursor.&quot;);
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="lines">@@ -403,9 +403,9 @@
</span><span class="cx">             return;
</span><span class="cx"> 
</span><span class="cx">         auto dataEntry = DataEntry::create()
</span><del>-            .setKey(m_injectedScript.wrapObject(cursor.key(), String(), true))
-            .setPrimaryKey(m_injectedScript.wrapObject(cursor.primaryKey(), String(), true))
-            .setValue(m_injectedScript.wrapObject(cursor.value(), String(), true))
</del><ins>+            .setKey(m_injectedScript.wrapObject(cursor-&gt;key(), String(), true))
+            .setPrimaryKey(m_injectedScript.wrapObject(cursor-&gt;primaryKey(), String(), true))
+            .setValue(m_injectedScript.wrapObject(cursor-&gt;value(), String(), true))
</ins><span class="cx">             .release();
</span><span class="cx">         m_result-&gt;addItem(WTFMove(dataEntry));
</span><span class="cx">     }
</span></span></pre>
</div>
</div>

</body>
</html>