<!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>[206960] trunk</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/206960">206960</a></dd>
<dt>Author</dt> <dd>darin@apple.com</dd>
<dt>Date</dt> <dd>2016-10-08 16:01:27 -0700 (Sat, 08 Oct 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Next step on moving to modern way to return DOM exceptions
https://bugs.webkit.org/show_bug.cgi?id=163016

Reviewed by Ryosuke Niwa.

Source/WebCore:

* Modules/fetch/FetchRequest.idl:
Added MayThrowException to initializeWith since it throws an exception.

* bindings/js/JSCallbackData.cpp:
(WebCore::JSCallbackData::invokeCallback):
* bindings/js/JSCustomElementInterface.cpp:
(WebCore::JSCustomElementInterface::invokeCallback):
* bindings/js/JSCustomSQLStatementErrorCallback.cpp:
(WebCore::JSSQLStatementErrorCallback::handleEvent):
* bindings/js/JSCustomXPathNSResolver.cpp:
(WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
* bindings/js/JSDOMBinding.cpp:
(WebCore::reportException):
(WebCore::reportCurrentException):
* bindings/js/JSErrorHandler.cpp:
(WebCore::JSErrorHandler::handleEvent):
* bindings/js/JSEventListener.cpp:
(WebCore::JSEventListener::handleEvent):
* bindings/js/JSMutationCallback.cpp:
(WebCore::JSMutationCallback::call):
* bindings/js/JSNodeFilterCustom.cpp:
(WebCore::JSNodeFilter::acceptNode):
* bindings/js/ScheduledAction.cpp:
(WebCore::ScheduledAction::executeFunctionInContext):
* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::evaluateInWorld):
* bindings/js/WorkerScriptController.cpp:
(WebCore::WorkerScriptController::evaluate):
* inspector/PageScriptDebugServer.cpp:
(WebCore::PageScriptDebugServer::reportException):
Use JSC::Exception explicitly to avoid ambiguity with WebCore::Exception,
or in some cases use auto instead.

* bindings/js/JSDOMBinding.cpp:
(WebCore::hasUnpairedSurrogate): Factored this inline function out of valueToUSVString
for clarity.
(WebCore::createDOMException): Removed unused TRY_TO_CREATE_EXCEPTION macro.
(WebCore::propagateExceptionSlowPath): Added.
(WebCore::propagateException): Added.
(WebCore::setDOMException): Removed overload that takes an exception code and message
string separately; no longer needed.

* bindings/js/JSDOMBinding.h: Include the ExceptionOr header
rather than forward declaring. Added more of the ExceptionOr handling
functions; some just declared and not yet defined. Updated for changes
to ExceptionOr interface. Removed the createDOMException function that takes
only an exception code; not needed outside JSDOMBinding.cpp.

* bindings/js/JSXMLHttpRequestCustom.cpp:
(WebCore::JSXMLHttpRequest::send): Rewrote this to use ExceptionOr instead
of ExceptionCode. Added some FIXMEs as well.
(WebCore::JSXMLHttpRequest::responseText): Ditto.
(WebCore::JSXMLHttpRequest::retrieveResponse): Ditto.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation): Fixed if statements to follow WebKit coding style
rather than using extra braces. Added call to propagateException for SetterMayThrowException.
(GenerateSerializerFunction): Fixed if statements as above.
(GenerateParametersCheck): Ditto. Also added call to propagateException for functions with
void return type and MayThrowException.
(GenerateReturnParameters): Tweaked coding style a bit.
(addIterableProperties): Fixed if statements as above.
(NativeToJSValue): Added code to handle various cases of GetterMayThrowException
and MayThrowException.
(GenerateConstructorDefinition): Used encodedJSValue() instead of
JSValue::encode(JSValue()), a longer way to say the same thing.

* bindings/scripts/IDLAttributes.txt: Added GetterMayThrowException,
MayThrowException, and SetterMayThrowException.

* bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
* bindings/scripts/test/JS/JSTestEventConstructor.cpp:
* bindings/scripts/test/JS/JSTestException.cpp:
* bindings/scripts/test/JS/JSTestGlobalObject.cpp:
* bindings/scripts/test/JS/JSTestInterface.cpp:
* bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
* bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
* bindings/scripts/test/JS/JSTestNode.cpp:
* bindings/scripts/test/JS/JSTestNondeterministic.cpp:
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
* bindings/scripts/test/JS/JSattribute.cpp:
Regenerated results.

* bindings/scripts/test/TestObj.idl: Added some test cases.

* dom/DOMImplementation.cpp:
(WebCore::DOMImplementation::createDocumentType): Tweaked formatting.
(WebCore::DOMImplementation::createDocument): Ditto.

* dom/DOMImplementation.idl: Added MayThrowException to two functions since
I am abandoning, for now, the ability to throw exceptions without any extended
attribute in the IDL file. This feature may return at some point if we figure
out a way to do it for functions without return values as well as functions with.

* dom/Document.cpp:
(WebCore::Document::exitPointerLock): Rewrote to streamline logic.
(WebCore::Document::pointerLockElement): Ditto.
(WebCore::Document::inputCursor): Added. No need for this to be inlined.
(WebCore::Document::setInputCursor): Changed to take Ref&amp;&amp;.
(WebCore::Document::getSelection): Added. Moved here from TreeScope.

* dom/Document.h: Updated for above changes.

* dom/Document.idl: Tweaked formatting.

* dom/Exception.h: Merged the two constructors into one with a default
argument value, which should be equally efficient. Added releaseMessage function.
Added assertion that this is only created for actual exceptions with non-zero
ExceptionCode. Unlike ExceptionCode, which has a value of 0 which means no
exception, we do not create an Exception if there is no exception.

* dom/ExceptionOr.h: Renamed takeReturnValue to releaseReturnValue. Replaced
exceptionCode and exceptionMessage with releaseException. Added ExceptionOr&lt;void&gt;
specialization.

* dom/TreeScope.cpp:
(WebCore::TreeScope::~TreeScope): Removed code dealing with
m_selection, which is now in Document.
(WebCore::TreeScope::getSelection): Deleted.

* dom/TreeScope.h: Removed DOMSelection.

* page/DOMSelection.cpp:
(WebCore::selectionShadowAncestor): Changed to take a reference rather than
a guaranteed-non-null pointer.
(WebCore::DOMSelection::DOMSelection): Changed to take a Frame&amp; instead of
of a TreeScope*.
(WebCore::DOMSelection::clearTreeScope): Deleted.
(WebCore::DOMSelection::isCollapsed): Updated call to selectionShadowAncestor.
(WebCore::DOMSelection::type): Took out obsolete uneeeded comment. Got rid
of case where this returns a null string. Use ASCIILiteral.
(WebCore::DOMSelection::rangeCount): Streamlined code.
(WebCore::DOMSelection::collapse): Removed redundant check of m_frame for
null which is already handled by the isValidForPosition function.
Removed non-helpful FIXME.
(WebCore::DOMSelection::collapseToEnd): Changed to use ExceptionOr instead of
ExceptionCode.
(WebCore::DOMSelection::collapseToStart): Ditto.
(WebCore::DOMSelection::setBaseAndExtent): Removed redundant check of m_frame
for null which is already handled by the isValidForPosition function. Removed
non-helpful FIXME.
(WebCore::DOMSelection::setPosition): Ditto.
(WebCore::DOMSelection::extend): Changed to use ExceptionOr instead of
ExceptionCode.
(WebCore::DOMSelection::getRangeAt): Ditto.
(WebCore::DOMSelection::isValidForPosition): Changed to return false when
m_frame is null rather than asserting is is non-null and having every caller
check m_frame before calling this.

* page/DOMSelection.h: Use #pragma once. Fix indentation. Removed unneeded
comments. Use ExceptionOr rather than ExceptionCode.

* page/DOMSelection.idl: Move from MayThrowLegacyException to MayThrowException.

* page/DOMWindow.cpp:
(WebCore::DOMWindow::resetDOMWindowProperties): Sorted properties alphabetically
to make it more obvious if any are accidentally omitted or listed twice.
(WebCore::DOMWindow::getSelection): Changed ownership so that the window owns
the selection like all the other objects, rather than having it be owned by the
document instead.

* page/DOMWindow.h: Added m_selection, sorted all the other related properties
alphabetically so it's easy to compare the list here with elsewhere.

* replay/ReplayController.cpp:
(WebCore::ReplayController::frameNavigated): Updated to call setInputCursor
with a reference rather than a pointer.

* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::responseText): Use ExceptionOr rather than ExceptionCode.
(WebCore::XMLHttpRequest::responseXML): Ditto.
(WebCore::XMLHttpRequest::setTimeout): Ditto.
(WebCore::XMLHttpRequest::setResponseType): Ditto.
(WebCore::XMLHttpRequest::setWithCredentials): Ditto.
(WebCore::XMLHttpRequest::open): Ditto.
(WebCore::XMLHttpRequest::prepareToSend): Changed to return an
Optional&lt;ExceptionOr&gt; to reflect the three different states: an exception,
a value to return without sending, or &quot;continue with the send algorithm&quot;.
The old code did this with a boolean plus an exception code. This sounds
confusing but is easy to read at the call sites, so probably OK to keep.
(WebCore::XMLHttpRequest::send): Use ExceptionOr rather than ExceptionCode.
(WebCore::XMLHttpRequest::sendBytesData): Ditto.
(WebCore::XMLHttpRequest::createRequest): Ditto.
(WebCore::XMLHttpRequest::overrideMimeType): Ditto.
(WebCore::XMLHttpRequest::setRequestHeader): Ditto.

* xml/XMLHttpRequest.h: Updated for changes above.

* xml/XMLHttpRequest.idl: Sorted interface extended attributes alphabetically.
Changed from MayThrowLegacyException to MayThrowException.

Source/WebKit/mac:

* DOM/DOMDOMImplementation.mm:
(-[DOMImplementation createDocumentType:publicId:systemId:]): Updated for
name change from takeReturnValue to releaseReturnValue.
(-[DOMImplementation createDocument:qualifiedName:doctype:]): Ditto.

Source/WebKit2:

* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMImplementation.cpp:
(webkit_dom_dom_implementation_create_document_type): Updated for name change
from takeReturnValue to releaseReturnValue.
(webkit_dom_dom_implementation_create_document): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMSelection.cpp:
(webkit_dom_dom_selection_collapse_to_end): Use ExceptionOr instead of ExceptionCode.
(webkit_dom_dom_selection_collapse_to_start): Ditto.
(webkit_dom_dom_selection_extend): Ditto.
(webkit_dom_dom_selection_get_range_at): Ditto.

Tools:

* Scripts/do-webcore-rename: Add proposed name change of setDOMException
to propagateException, since this function is primarily used to take an
exception already effectively &quot;thrown&quot; by setting an ExceptionCode out
argument and propagate it into the JavaScript engine's exception machinery.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesfetchFetchRequestidl">trunk/Source/WebCore/Modules/fetch/FetchRequest.idl</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSCallbackDatacpp">trunk/Source/WebCore/bindings/js/JSCallbackData.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSCustomElementInterfacecpp">trunk/Source/WebCore/bindings/js/JSCustomElementInterface.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSCustomSQLStatementErrorCallbackcpp">trunk/Source/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSCustomXPathNSResolvercpp">trunk/Source/WebCore/bindings/js/JSCustomXPathNSResolver.cpp</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="#trunkSourceWebCorebindingsjsJSErrorHandlercpp">trunk/Source/WebCore/bindings/js/JSErrorHandler.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSEventListenercpp">trunk/Source/WebCore/bindings/js/JSEventListener.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSMutationCallbackcpp">trunk/Source/WebCore/bindings/js/JSMutationCallback.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSNodeFilterCustomcpp">trunk/Source/WebCore/bindings/js/JSNodeFilterCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSXMLHttpRequestCustomcpp">trunk/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsScheduledActioncpp">trunk/Source/WebCore/bindings/js/ScheduledAction.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsScriptControllercpp">trunk/Source/WebCore/bindings/js/ScriptController.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsWorkerScriptControllercpp">trunk/Source/WebCore/bindings/js/WorkerScriptController.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="#trunkSourceWebCorebindingsscriptstestJSJSTestGlobalObjectcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestInterfacecpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestJSBuiltinConstructorcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestNamedConstructorcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestNodecpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestNondeterministiccpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNondeterministic.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestSerializedScriptValueInterfacecpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestTypedefscpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestTestObjidl">trunk/Source/WebCore/bindings/scripts/test/TestObj.idl</a></li>
<li><a href="#trunkSourceWebCoredomDOMImplementationcpp">trunk/Source/WebCore/dom/DOMImplementation.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDOMImplementationidl">trunk/Source/WebCore/dom/DOMImplementation.idl</a></li>
<li><a href="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumenth">trunk/Source/WebCore/dom/Document.h</a></li>
<li><a href="#trunkSourceWebCoredomDocumentidl">trunk/Source/WebCore/dom/Document.idl</a></li>
<li><a href="#trunkSourceWebCoredomExceptionh">trunk/Source/WebCore/dom/Exception.h</a></li>
<li><a href="#trunkSourceWebCoredomExceptionOrh">trunk/Source/WebCore/dom/ExceptionOr.h</a></li>
<li><a href="#trunkSourceWebCoredomTreeScopecpp">trunk/Source/WebCore/dom/TreeScope.cpp</a></li>
<li><a href="#trunkSourceWebCoredomTreeScopeh">trunk/Source/WebCore/dom/TreeScope.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorPageScriptDebugServercpp">trunk/Source/WebCore/inspector/PageScriptDebugServer.cpp</a></li>
<li><a href="#trunkSourceWebCorepageDOMSelectioncpp">trunk/Source/WebCore/page/DOMSelection.cpp</a></li>
<li><a href="#trunkSourceWebCorepageDOMSelectionh">trunk/Source/WebCore/page/DOMSelection.h</a></li>
<li><a href="#trunkSourceWebCorepageDOMSelectionidl">trunk/Source/WebCore/page/DOMSelection.idl</a></li>
<li><a href="#trunkSourceWebCorepageDOMWindowcpp">trunk/Source/WebCore/page/DOMWindow.cpp</a></li>
<li><a href="#trunkSourceWebCorepageDOMWindowh">trunk/Source/WebCore/page/DOMWindow.h</a></li>
<li><a href="#trunkSourceWebCorereplayReplayControllercpp">trunk/Source/WebCore/replay/ReplayController.cpp</a></li>
<li><a href="#trunkSourceWebCorexmlXMLHttpRequestcpp">trunk/Source/WebCore/xml/XMLHttpRequest.cpp</a></li>
<li><a href="#trunkSourceWebCorexmlXMLHttpRequesth">trunk/Source/WebCore/xml/XMLHttpRequest.h</a></li>
<li><a href="#trunkSourceWebCorexmlXMLHttpRequestidl">trunk/Source/WebCore/xml/XMLHttpRequest.idl</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacDOMDOMDOMImplementationmm">trunk/Source/WebKit/mac/DOM/DOMDOMImplementation.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMWebKitDOMDOMImplementationcpp">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMImplementation.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMWebKitDOMDOMSelectioncpp">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMSelection.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptsdowebcorerename">trunk/Tools/Scripts/do-webcore-rename</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/ChangeLog        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -1,3 +1,203 @@
</span><ins>+2016-10-06  Darin Adler  &lt;darin@apple.com&gt;
+
+        Next step on moving to modern way to return DOM exceptions
+        https://bugs.webkit.org/show_bug.cgi?id=163016
+
+        Reviewed by Ryosuke Niwa.
+
+        * Modules/fetch/FetchRequest.idl:
+        Added MayThrowException to initializeWith since it throws an exception.
+
+        * bindings/js/JSCallbackData.cpp:
+        (WebCore::JSCallbackData::invokeCallback):
+        * bindings/js/JSCustomElementInterface.cpp:
+        (WebCore::JSCustomElementInterface::invokeCallback):
+        * bindings/js/JSCustomSQLStatementErrorCallback.cpp:
+        (WebCore::JSSQLStatementErrorCallback::handleEvent):
+        * bindings/js/JSCustomXPathNSResolver.cpp:
+        (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
+        * bindings/js/JSDOMBinding.cpp:
+        (WebCore::reportException):
+        (WebCore::reportCurrentException):
+        * bindings/js/JSErrorHandler.cpp:
+        (WebCore::JSErrorHandler::handleEvent):
+        * bindings/js/JSEventListener.cpp:
+        (WebCore::JSEventListener::handleEvent):
+        * bindings/js/JSMutationCallback.cpp:
+        (WebCore::JSMutationCallback::call):
+        * bindings/js/JSNodeFilterCustom.cpp:
+        (WebCore::JSNodeFilter::acceptNode):
+        * bindings/js/ScheduledAction.cpp:
+        (WebCore::ScheduledAction::executeFunctionInContext):
+        * bindings/js/ScriptController.cpp:
+        (WebCore::ScriptController::evaluateInWorld):
+        * bindings/js/WorkerScriptController.cpp:
+        (WebCore::WorkerScriptController::evaluate):
+        * inspector/PageScriptDebugServer.cpp:
+        (WebCore::PageScriptDebugServer::reportException):
+        Use JSC::Exception explicitly to avoid ambiguity with WebCore::Exception,
+        or in some cases use auto instead.
+
+        * bindings/js/JSDOMBinding.cpp:
+        (WebCore::hasUnpairedSurrogate): Factored this inline function out of valueToUSVString
+        for clarity.
+        (WebCore::createDOMException): Removed unused TRY_TO_CREATE_EXCEPTION macro.
+        (WebCore::propagateExceptionSlowPath): Added.
+        (WebCore::propagateException): Added.
+        (WebCore::setDOMException): Removed overload that takes an exception code and message
+        string separately; no longer needed.
+
+        * bindings/js/JSDOMBinding.h: Include the ExceptionOr header
+        rather than forward declaring. Added more of the ExceptionOr handling
+        functions; some just declared and not yet defined. Updated for changes
+        to ExceptionOr interface. Removed the createDOMException function that takes
+        only an exception code; not needed outside JSDOMBinding.cpp.
+
+        * bindings/js/JSXMLHttpRequestCustom.cpp:
+        (WebCore::JSXMLHttpRequest::send): Rewrote this to use ExceptionOr instead
+        of ExceptionCode. Added some FIXMEs as well.
+        (WebCore::JSXMLHttpRequest::responseText): Ditto.
+        (WebCore::JSXMLHttpRequest::retrieveResponse): Ditto.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateImplementation): Fixed if statements to follow WebKit coding style
+        rather than using extra braces. Added call to propagateException for SetterMayThrowException.
+        (GenerateSerializerFunction): Fixed if statements as above.
+        (GenerateParametersCheck): Ditto. Also added call to propagateException for functions with
+        void return type and MayThrowException.
+        (GenerateReturnParameters): Tweaked coding style a bit.
+        (addIterableProperties): Fixed if statements as above.
+        (NativeToJSValue): Added code to handle various cases of GetterMayThrowException
+        and MayThrowException.
+        (GenerateConstructorDefinition): Used encodedJSValue() instead of
+        JSValue::encode(JSValue()), a longer way to say the same thing.
+
+        * bindings/scripts/IDLAttributes.txt: Added GetterMayThrowException,
+        MayThrowException, and SetterMayThrowException.
+
+        * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
+        * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
+        * bindings/scripts/test/JS/JSTestException.cpp:
+        * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
+        * bindings/scripts/test/JS/JSTestInterface.cpp:
+        * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
+        * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
+        * bindings/scripts/test/JS/JSTestNode.cpp:
+        * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
+        * bindings/scripts/test/JS/JSTestTypedefs.cpp:
+        * bindings/scripts/test/JS/JSattribute.cpp:
+        Regenerated results.
+
+        * bindings/scripts/test/TestObj.idl: Added some test cases.
+
+        * dom/DOMImplementation.cpp:
+        (WebCore::DOMImplementation::createDocumentType): Tweaked formatting.
+        (WebCore::DOMImplementation::createDocument): Ditto.
+
+        * dom/DOMImplementation.idl: Added MayThrowException to two functions since
+        I am abandoning, for now, the ability to throw exceptions without any extended
+        attribute in the IDL file. This feature may return at some point if we figure
+        out a way to do it for functions without return values as well as functions with.
+
+        * dom/Document.cpp:
+        (WebCore::Document::exitPointerLock): Rewrote to streamline logic.
+        (WebCore::Document::pointerLockElement): Ditto.
+        (WebCore::Document::inputCursor): Added. No need for this to be inlined.
+        (WebCore::Document::setInputCursor): Changed to take Ref&amp;&amp;.
+        (WebCore::Document::getSelection): Added. Moved here from TreeScope.
+
+        * dom/Document.h: Updated for above changes.
+
+        * dom/Document.idl: Tweaked formatting.
+
+        * dom/Exception.h: Merged the two constructors into one with a default
+        argument value, which should be equally efficient. Added releaseMessage function.
+        Added assertion that this is only created for actual exceptions with non-zero
+        ExceptionCode. Unlike ExceptionCode, which has a value of 0 which means no
+        exception, we do not create an Exception if there is no exception.
+
+        * dom/ExceptionOr.h: Renamed takeReturnValue to releaseReturnValue. Replaced
+        exceptionCode and exceptionMessage with releaseException. Added ExceptionOr&lt;void&gt;
+        specialization.
+
+        * dom/TreeScope.cpp:
+        (WebCore::TreeScope::~TreeScope): Removed code dealing with
+        m_selection, which is now in Document.
+        (WebCore::TreeScope::getSelection): Deleted.
+
+        * dom/TreeScope.h: Removed DOMSelection.
+
+        * page/DOMSelection.cpp:
+        (WebCore::selectionShadowAncestor): Changed to take a reference rather than
+        a guaranteed-non-null pointer.
+        (WebCore::DOMSelection::DOMSelection): Changed to take a Frame&amp; instead of
+        of a TreeScope*.
+        (WebCore::DOMSelection::clearTreeScope): Deleted.
+        (WebCore::DOMSelection::isCollapsed): Updated call to selectionShadowAncestor.
+        (WebCore::DOMSelection::type): Took out obsolete uneeeded comment. Got rid
+        of case where this returns a null string. Use ASCIILiteral.
+        (WebCore::DOMSelection::rangeCount): Streamlined code.
+        (WebCore::DOMSelection::collapse): Removed redundant check of m_frame for
+        null which is already handled by the isValidForPosition function.
+        Removed non-helpful FIXME.
+        (WebCore::DOMSelection::collapseToEnd): Changed to use ExceptionOr instead of
+        ExceptionCode.
+        (WebCore::DOMSelection::collapseToStart): Ditto.
+        (WebCore::DOMSelection::setBaseAndExtent): Removed redundant check of m_frame
+        for null which is already handled by the isValidForPosition function. Removed
+        non-helpful FIXME.
+        (WebCore::DOMSelection::setPosition): Ditto.
+        (WebCore::DOMSelection::extend): Changed to use ExceptionOr instead of
+        ExceptionCode.
+        (WebCore::DOMSelection::getRangeAt): Ditto.
+        (WebCore::DOMSelection::isValidForPosition): Changed to return false when
+        m_frame is null rather than asserting is is non-null and having every caller
+        check m_frame before calling this.
+
+        * page/DOMSelection.h: Use #pragma once. Fix indentation. Removed unneeded
+        comments. Use ExceptionOr rather than ExceptionCode.
+
+        * page/DOMSelection.idl: Move from MayThrowLegacyException to MayThrowException.
+
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::resetDOMWindowProperties): Sorted properties alphabetically
+        to make it more obvious if any are accidentally omitted or listed twice.
+        (WebCore::DOMWindow::getSelection): Changed ownership so that the window owns
+        the selection like all the other objects, rather than having it be owned by the
+        document instead.
+
+        * page/DOMWindow.h: Added m_selection, sorted all the other related properties
+        alphabetically so it's easy to compare the list here with elsewhere.
+
+        * replay/ReplayController.cpp:
+        (WebCore::ReplayController::frameNavigated): Updated to call setInputCursor
+        with a reference rather than a pointer.
+
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::responseText): Use ExceptionOr rather than ExceptionCode.
+        (WebCore::XMLHttpRequest::responseXML): Ditto.
+        (WebCore::XMLHttpRequest::setTimeout): Ditto.
+        (WebCore::XMLHttpRequest::setResponseType): Ditto.
+        (WebCore::XMLHttpRequest::setWithCredentials): Ditto.
+        (WebCore::XMLHttpRequest::open): Ditto.
+        (WebCore::XMLHttpRequest::prepareToSend): Changed to return an
+        Optional&lt;ExceptionOr&gt; to reflect the three different states: an exception,
+        a value to return without sending, or &quot;continue with the send algorithm&quot;.
+        The old code did this with a boolean plus an exception code. This sounds
+        confusing but is easy to read at the call sites, so probably OK to keep.
+        (WebCore::XMLHttpRequest::send): Use ExceptionOr rather than ExceptionCode.
+        (WebCore::XMLHttpRequest::sendBytesData): Ditto.
+        (WebCore::XMLHttpRequest::createRequest): Ditto.
+        (WebCore::XMLHttpRequest::overrideMimeType): Ditto.
+        (WebCore::XMLHttpRequest::setRequestHeader): Ditto.
+
+        * xml/XMLHttpRequest.h: Updated for changes above.
+
+        * xml/XMLHttpRequest.idl: Sorted interface extended attributes alphabetically.
+        Changed from MayThrowLegacyException to MayThrowException.
+
</ins><span class="cx"> 2016-10-06  Sam Weinig  &lt;sam@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Autogenerate passing union types as part of a functions variadic arguments
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchRequestidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchRequest.idl (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchRequest.idl        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/Modules/fetch/FetchRequest.idl        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -62,8 +62,8 @@
</span><span class="cx"> 
</span><span class="cx">     [NewObject, CallWith=ScriptExecutionContext, MayThrowLegacyException] FetchRequest clone();
</span><span class="cx"> 
</span><del>-    [PrivateIdentifier, NewObject] FetchHeaders initializeWith(FetchRequest input, Dictionary init);
-    [PrivateIdentifier, NewObject] FetchHeaders initializeWith(DOMString input, Dictionary init);
-    [PrivateIdentifier, MayThrowLegacyException, CallWith=ScriptState] void setBody(any body, FetchRequest? request);
</del><ins>+    [MayThrowException, NewObject, PrivateIdentifier] FetchHeaders initializeWith(FetchRequest input, Dictionary init);
+    [MayThrowException, NewObject, PrivateIdentifier] FetchHeaders initializeWith(DOMString input, Dictionary init);
+    [CallWith=ScriptState, MayThrowLegacyException, PrivateIdentifier] void setBody(any body, FetchRequest? request);
</ins><span class="cx"> };
</span><span class="cx"> FetchRequest implements FetchBody;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSCallbackDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSCallbackData.cpp (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSCallbackData.cpp        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/bindings/js/JSCallbackData.cpp        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx">     
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-JSValue JSCallbackData::invokeCallback(JSObject* callback, MarkedArgumentBuffer&amp; args, CallbackType method, PropertyName functionName, NakedPtr&lt;Exception&gt;&amp; returnedException)
</del><ins>+JSValue JSCallbackData::invokeCallback(JSObject* callback, MarkedArgumentBuffer&amp; args, CallbackType method, PropertyName functionName, NakedPtr&lt;JSC::Exception&gt;&amp; returnedException)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(callback);
</span><span class="cx"> 
</span><span class="lines">@@ -57,7 +57,7 @@
</span><span class="cx">     }
</span><span class="cx">     if (callType == CallType::None) {
</span><span class="cx">         if (method == CallbackType::Function) {
</span><del>-            returnedException = Exception::create(exec-&gt;vm(), createTypeError(exec));
</del><ins>+            returnedException = JSC::Exception::create(exec-&gt;vm(), createTypeError(exec));
</ins><span class="cx">             return JSValue();
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -65,7 +65,7 @@
</span><span class="cx">         function = callback-&gt;get(exec, functionName);
</span><span class="cx">         callType = getCallData(function, callData);
</span><span class="cx">         if (callType == CallType::None) {
</span><del>-            returnedException = Exception::create(exec-&gt;vm(), createTypeError(exec));
</del><ins>+            returnedException = JSC::Exception::create(exec-&gt;vm(), createTypeError(exec));
</ins><span class="cx">             return JSValue();
</span><span class="cx">         }
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSCustomElementInterfacecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSCustomElementInterface.cpp (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSCustomElementInterface.cpp        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/bindings/js/JSCustomElementInterface.cpp        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -234,7 +234,7 @@
</span><span class="cx"> 
</span><span class="cx">     InspectorInstrumentationCookie cookie = JSMainThreadExecState::instrumentFunctionCall(context, callType, callData);
</span><span class="cx"> 
</span><del>-    NakedPtr&lt;Exception&gt; exception;
</del><ins>+    NakedPtr&lt;JSC::Exception&gt; exception;
</ins><span class="cx">     JSMainThreadExecState::call(state, callback, callType, callData, jsElement, args, exception);
</span><span class="cx"> 
</span><span class="cx">     InspectorInstrumentation::didCallFunction(cookie, context);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSCustomSQLStatementErrorCallbackcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -54,7 +54,7 @@
</span><span class="cx">     args.append(toJS(exec, m_data-&gt;globalObject(), transaction));
</span><span class="cx">     args.append(toJS(exec, m_data-&gt;globalObject(), error));
</span><span class="cx"> 
</span><del>-    NakedPtr&lt;Exception&gt; returnedException;
</del><ins>+    NakedPtr&lt;JSC::Exception&gt; returnedException;
</ins><span class="cx">     JSValue result = m_data-&gt;invokeCallback(args, JSCallbackData::CallbackType::Function, Identifier(), returnedException);
</span><span class="cx">     if (returnedException) {
</span><span class="cx">         reportException(exec, returnedException);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSCustomXPathNSResolvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSCustomXPathNSResolver.cpp (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSCustomXPathNSResolver.cpp        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/bindings/js/JSCustomXPathNSResolver.cpp        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -91,7 +91,7 @@
</span><span class="cx">     MarkedArgumentBuffer args;
</span><span class="cx">     args.append(jsStringWithCache(exec, prefix));
</span><span class="cx"> 
</span><del>-    NakedPtr&lt;Exception&gt; exception;
</del><ins>+    NakedPtr&lt;JSC::Exception&gt; exception;
</ins><span class="cx">     JSValue retval = JSMainThreadExecState::call(exec, function, callType, callData, m_customResolver.get(), args, exception);
</span><span class="cx"> 
</span><span class="cx">     String result;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMBindingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -117,6 +117,18 @@
</span><span class="cx">     return value.toString(exec)-&gt;value(exec);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static inline bool hasUnpairedSurrogate(StringView string)
+{
+    // Fast path for 8-bit strings; they can't have any surrogates.
+    if (string.is8Bit())
+        return false;
+    for (auto codePoint : string.codePoints()) {
+        if (U_IS_SURROGATE(codePoint))
+            return true;
+    }
+    return false;
+}
+
</ins><span class="cx"> String valueToUSVString(ExecState* exec, JSValue value)
</span><span class="cx"> {
</span><span class="cx">     VM&amp; vm = exec-&gt;vm();
</span><span class="lines">@@ -124,27 +136,16 @@
</span><span class="cx"> 
</span><span class="cx">     String string = value.toWTFString(exec);
</span><span class="cx">     RETURN_IF_EXCEPTION(scope, { });
</span><del>-    StringView view { string };
</del><span class="cx"> 
</span><del>-    // Fast path for 8-bit strings, since they can't have any surrogates.
-    if (view.is8Bit())
-        return string;
-
</del><span class="cx">     // Fast path for the case where there are no unpaired surrogates.
</span><del>-    bool foundUnpairedSurrogate = false;
-    for (auto codePoint : view.codePoints()) {
-        if (U_IS_SURROGATE(codePoint)) {
-            foundUnpairedSurrogate = true;
-            break;
-        }
-    }
-    if (!foundUnpairedSurrogate)
</del><ins>+    if (!hasUnpairedSurrogate(string))
</ins><span class="cx">         return string;
</span><span class="cx"> 
</span><span class="cx">     // Slow path: http://heycam.github.io/webidl/#dfn-obtain-unicode
</span><span class="cx">     // Replaces unpaired surrogates with the replacement character.
</span><span class="cx">     StringBuilder result;
</span><del>-    result.reserveCapacity(view.length());
</del><ins>+    result.reserveCapacity(string.length());
+    StringView view { string };
</ins><span class="cx">     for (auto codePoint : view.codePoints()) {
</span><span class="cx">         if (U_IS_SURROGATE(codePoint))
</span><span class="cx">             result.append(replacementCharacter);
</span><span class="lines">@@ -190,17 +191,17 @@
</span><span class="cx"> {
</span><span class="cx">     VM&amp; vm = exec-&gt;vm();
</span><span class="cx">     RELEASE_ASSERT(vm.currentThreadIsHoldingAPILock());
</span><del>-    Exception* exception = jsDynamicCast&lt;Exception*&gt;(exceptionValue);
</del><ins>+    auto* exception = jsDynamicCast&lt;JSC::Exception*&gt;(exceptionValue);
</ins><span class="cx">     if (!exception) {
</span><span class="cx">         exception = vm.lastException();
</span><span class="cx">         if (!exception)
</span><del>-            exception = Exception::create(exec-&gt;vm(), exceptionValue, Exception::DoNotCaptureStack);
</del><ins>+            exception = JSC::Exception::create(exec-&gt;vm(), exceptionValue, JSC::Exception::DoNotCaptureStack);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     reportException(exec, exception, cachedScript);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void reportException(ExecState* exec, Exception* exception, CachedScript* cachedScript, ExceptionDetails* exceptionDetails)
</del><ins>+void reportException(ExecState* exec, JSC::Exception* exception, CachedScript* cachedScript, ExceptionDetails* exceptionDetails)
</ins><span class="cx"> {
</span><span class="cx">     VM&amp; vm = exec-&gt;vm();
</span><span class="cx">     auto scope = DECLARE_CATCH_SCOPE(vm);
</span><span class="lines">@@ -263,17 +264,12 @@
</span><span class="cx"> {
</span><span class="cx">     VM&amp; vm = exec-&gt;vm();
</span><span class="cx">     auto scope = DECLARE_CATCH_SCOPE(vm);
</span><del>-    Exception* exception = scope.exception();
</del><ins>+    auto* exception = scope.exception();
</ins><span class="cx">     scope.clearException();
</span><span class="cx">     reportException(exec, exception);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#define TRY_TO_CREATE_EXCEPTION(interfaceName) \
-    case interfaceName##Type: \
-        errorObject = toJS(exec, globalObject, interfaceName::create(description)); \
-        break;
-
-static JSValue createDOMException(ExecState* exec, ExceptionCode ec, const String* message)
</del><ins>+static JSValue createDOMException(ExecState* exec, ExceptionCode ec, const String* message = nullptr)
</ins><span class="cx"> {
</span><span class="cx">     if (!ec)
</span><span class="cx">         return jsUndefined();
</span><span class="lines">@@ -338,11 +334,6 @@
</span><span class="cx">     return createDOMException(exec, ec, &amp;message);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-JSValue createDOMException(ExecState* exec, ExceptionCode ec)
-{
-    return createDOMException(exec, ec, nullptr);
-}
-
</del><span class="cx"> ALWAYS_INLINE static void throwDOMException(ExecState* exec, ThrowScope&amp; throwScope, ExceptionCode ec)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(ec &amp;&amp; !throwScope.exception());
</span><span class="lines">@@ -355,6 +346,19 @@
</span><span class="cx">     throwException(exec, throwScope, createDOMException(exec, ec.code, ec.message));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void propagateExceptionSlowPath(JSC::ExecState&amp; state, JSC::ThrowScope&amp; throwScope, Exception&amp;&amp; exception)
+{
+    ASSERT(!throwScope.exception());
+    throwException(&amp;state, throwScope, createDOMException(&amp;state, exception.code(), exception.releaseMessage()));
+}
+
+void propagateException(JSC::ExecState&amp; state, Exception&amp;&amp; exception)
+{
+    auto throwScope = DECLARE_THROW_SCOPE(state.vm());
+    if (!throwScope.exception())
+        propagateExceptionSlowPath(state, throwScope, WTFMove(exception));
+}
+
</ins><span class="cx"> void setDOMExceptionSlow(ExecState* exec, ThrowScope&amp; throwScope, ExceptionCode ec)
</span><span class="cx"> {
</span><span class="cx">     throwDOMException(exec, throwScope, ec);
</span><span class="lines">@@ -376,17 +380,6 @@
</span><span class="cx">     throwDOMException(exec, scope, ec);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void setDOMException(ExecState* exec, ExceptionCode ec, const String&amp; message)
-{
-    VM&amp; vm = exec-&gt;vm();
-    auto scope = DECLARE_THROW_SCOPE(vm);
-
-    if (!ec || scope.exception())
-        return;
-
-    throwException(exec, scope, createDOMException(exec, ec, message));
-}
-
</del><span class="cx"> void setDOMException(ExecState* exec, const ExceptionCodeWithMessage&amp; ec)
</span><span class="cx"> {
</span><span class="cx">     VM&amp; vm = exec-&gt;vm();
</span><span class="lines">@@ -398,8 +391,6 @@
</span><span class="cx">     throwDOMException(exec, scope, ec);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#undef TRY_TO_CREATE_EXCEPTION
-
</del><span class="cx"> bool hasIteratorMethod(JSC::ExecState&amp; state, JSC::JSValue value)
</span><span class="cx"> {
</span><span class="cx">     auto&amp; vm = state.vm();
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMBindingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.h (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMBinding.h        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.h        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;DOMWrapperWorld.h&quot;
</span><span class="cx"> #include &quot;ExceptionCode.h&quot;
</span><ins>+#include &quot;ExceptionOr.h&quot;
</ins><span class="cx"> #include &quot;JSDOMGlobalObject.h&quot;
</span><span class="cx"> #include &quot;JSDOMWrapper.h&quot;
</span><span class="cx"> #include &quot;ScriptWrappable.h&quot;
</span><span class="lines">@@ -70,10 +71,6 @@
</span><span class="cx"> class URL;
</span><span class="cx"> class Node;
</span><span class="cx"> 
</span><del>-template&lt;typename&gt; class ExceptionOr;
-
-using ExceptionCode = int;
-
</del><span class="cx"> struct ExceptionDetails {
</span><span class="cx">     String message;
</span><span class="cx">     int lineNumber { 0 };
</span><span class="lines">@@ -182,34 +179,23 @@
</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><del>-JSC::JSValue createDOMException(JSC::ExecState*, ExceptionCode);
</del><span class="cx"> JSC::JSValue createDOMException(JSC::ExecState*, ExceptionCode, const String&amp;);
</span><span class="cx"> 
</span><del>-// Convert a DOM implementation exception code into a JavaScript exception in the execution state.
</del><ins>+// Convert a DOM implementation exception into a JavaScript exception in the execution state.
+void propagateException(JSC::ExecState&amp;, JSC::ThrowScope&amp;, Exception&amp;&amp;);
+void setDOMException(JSC::ExecState*, JSC::ThrowScope&amp;, ExceptionCode);
+void setDOMException(JSC::ExecState*, JSC::ThrowScope&amp;, const ExceptionCodeWithMessage&amp;);
+
+// Slower versions of the above for use when the caller doesn't have a ThrowScope.
+void propagateException(JSC::ExecState&amp;, Exception&amp;&amp;);
</ins><span class="cx"> WEBCORE_EXPORT void setDOMException(JSC::ExecState*, ExceptionCode);
</span><del>-void setDOMException(JSC::ExecState*, ExceptionCode, const String&amp;);
</del><span class="cx"> void setDOMException(JSC::ExecState*, const ExceptionCodeWithMessage&amp;);
</span><span class="cx"> 
</span><ins>+// Implementation details of the above.
</ins><span class="cx"> WEBCORE_EXPORT void setDOMExceptionSlow(JSC::ExecState*, JSC::ThrowScope&amp;, ExceptionCode);
</span><span class="cx"> void setDOMExceptionSlow(JSC::ExecState*, JSC::ThrowScope&amp;, const ExceptionCodeWithMessage&amp;);
</span><ins>+void propagateExceptionSlowPath(JSC::ExecState&amp;, JSC::ThrowScope&amp;, Exception&amp;&amp;);
</ins><span class="cx"> 
</span><del>-ALWAYS_INLINE void setDOMException(JSC::ExecState* exec, JSC::ThrowScope&amp; throwScope, const ExceptionCodeWithMessage&amp; message)
-{
-    if (LIKELY(!message.code || throwScope.exception()))
-        return;
-    setDOMExceptionSlow(exec, throwScope, message);
-}
-
-ALWAYS_INLINE void setDOMException(JSC::ExecState* exec, JSC::ThrowScope&amp; throwScope, ExceptionCode ec)
-{
-    if (LIKELY(!ec || throwScope.exception()))
-        return;
-    setDOMExceptionSlow(exec, throwScope, ec);
-}
-
-template&lt;typename T&gt; inline JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, ExceptionOr&lt;T&gt;&amp;&amp;);
-template&lt;typename T&gt; inline JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject*, ExceptionOr&lt;T&gt;&amp;&amp;);
-
</del><span class="cx"> JSC::JSValue jsString(JSC::ExecState*, const URL&amp;); // empty if the URL is null
</span><span class="cx"> 
</span><span class="cx"> JSC::JSValue jsStringOrNull(JSC::ExecState*, const String&amp;); // null if the string is null
</span><span class="lines">@@ -365,6 +351,18 @@
</span><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+// ExceptionOr handling.
+void propagateException(JSC::ExecState&amp;, JSC::ThrowScope&amp;, ExceptionOr&lt;void&gt;&amp;&amp;);
+template&lt;typename T&gt; JSC::JSValue toJS(JSC::ExecState&amp;, JSDOMGlobalObject&amp;, JSC::ThrowScope&amp;, ExceptionOr&lt;T&gt;&amp;&amp;);
+JSC::JSValue toJSBoolean(JSC::ExecState&amp;, JSC::ThrowScope&amp;, ExceptionOr&lt;bool&gt;&amp;&amp;);
+JSC::JSValue toJSDate(JSC::ExecState&amp;, JSC::ThrowScope&amp;, ExceptionOr&lt;double&gt;&amp;&amp;);
+JSC::JSValue toJSNullableDate(JSC::ExecState&amp;, JSC::ThrowScope&amp;, ExceptionOr&lt;Optional&lt;double&gt;&gt;&amp;&amp;);
+JSC::JSValue toJSNullableString(JSC::ExecState&amp;, JSC::ThrowScope&amp;, ExceptionOr&lt;String&gt;&amp;&amp;);
+template&lt;typename T&gt; JSC::JSValue toJSNewlyCreated(JSC::ExecState&amp;, JSDOMGlobalObject&amp;, JSC::ThrowScope&amp;, ExceptionOr&lt;T&gt;&amp;&amp; value);
+template&lt;typename T&gt; JSC::JSValue toJSNumber(JSC::ExecState&amp;, JSDOMGlobalObject&amp;, JSC::ThrowScope&amp;, ExceptionOr&lt;T&gt;&amp;&amp; value);
+template&lt;typename T&gt; JSC::JSValue toJSNullableNumber(JSC::ExecState&amp;, JSDOMGlobalObject&amp;, JSC::ThrowScope&amp;, ExceptionOr&lt;T&gt;&amp;&amp; value);
+JSC::JSValue toJSString(JSC::ExecState&amp;, JSC::ThrowScope&amp;, ExceptionOr&lt;String&gt;&amp;&amp;);
+
</ins><span class="cx"> // Inline functions and template definitions.
</span><span class="cx"> 
</span><span class="cx"> inline JSC::Structure* DOMConstructorObject::createStructure(JSC::VM&amp; vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
</span><span class="lines">@@ -886,23 +884,49 @@
</span><span class="cx">     return optionalNumber ? JSC::jsNumber(optionalNumber.value()) : JSC::jsNull();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-template&lt;typename T&gt; inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, ExceptionOr&lt;T&gt;&amp;&amp; value)
</del><ins>+ALWAYS_INLINE void propagateException(JSC::ExecState&amp; state, JSC::ThrowScope&amp; throwScope, Exception&amp;&amp; exception)
</ins><span class="cx"> {
</span><ins>+    if (throwScope.exception())
+        return;
+    propagateExceptionSlowPath(state, throwScope, WTFMove(exception));
+}
+
+ALWAYS_INLINE void setDOMException(JSC::ExecState* exec, JSC::ThrowScope&amp; throwScope, ExceptionCode ec)
+{
+    if (LIKELY(!ec || throwScope.exception()))
+        return;
+    setDOMExceptionSlow(exec, throwScope, ec);
+}
+
+ALWAYS_INLINE void setDOMException(JSC::ExecState* exec, JSC::ThrowScope&amp; throwScope, const ExceptionCodeWithMessage&amp; exception)
+{
+    if (LIKELY(!exception.code || throwScope.exception()))
+        return;
+    setDOMExceptionSlow(exec, throwScope, exception);
+}
+
+inline void propagateException(JSC::ExecState&amp; state, JSC::ThrowScope&amp; throwScope, ExceptionOr&lt;void&gt;&amp;&amp; value)
+{
+    if (UNLIKELY(value.hasException()))
+        propagateException(state, throwScope, value.releaseException());
+}
+
+template&lt;typename T&gt; inline JSC::JSValue toJS(JSC::ExecState&amp; state, JSDOMGlobalObject&amp; globalObject, JSC::ThrowScope&amp; throwScope, ExceptionOr&lt;T&gt;&amp;&amp; value)
+{
</ins><span class="cx">     if (UNLIKELY(value.hasException())) {
</span><del>-        setDOMException(state, value.exceptionCode(), value.exceptionMessage());
-        return JSC::jsUndefined();
</del><ins>+        propagateException(state, throwScope, value.releaseException());
+        return { };
</ins><span class="cx">     }
</span><del>-    return toJS(state, globalObject, value.takeReturnValue());
</del><ins>+    return toJS(&amp;state, &amp;globalObject, value.releaseReturnValue());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-template&lt;typename T&gt; inline JSC::JSValue toJSNewlyCreated(JSC::ExecState* state, JSDOMGlobalObject* globalObject, ExceptionOr&lt;T&gt;&amp;&amp; value)
</del><ins>+template&lt;typename T&gt; inline JSC::JSValue toJSNewlyCreated(JSC::ExecState&amp; state, JSDOMGlobalObject&amp; globalObject, JSC::ThrowScope&amp; throwScope, ExceptionOr&lt;T&gt;&amp;&amp; value)
</ins><span class="cx"> {
</span><del>-    // FIXME: It's really annoying to have two of these functions. Should find a way to combine toJS and toJSNewlyCreated.
</del><span class="cx">     if (UNLIKELY(value.hasException())) {
</span><del>-        setDOMException(state, value.exceptionCode(), value.exceptionMessage());
-        return JSC::jsUndefined();
</del><ins>+        propagateException(state, throwScope, value.releaseException());
+        return { };
</ins><span class="cx">     }
</span><del>-    return toJSNewlyCreated(state, globalObject, value.takeReturnValue());
</del><ins>+    return toJSNewlyCreated(&amp;state, &amp;globalObject, value.releaseReturnValue());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSErrorHandlercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSErrorHandler.cpp (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSErrorHandler.cpp        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/bindings/js/JSErrorHandler.cpp        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -101,7 +101,7 @@
</span><span class="cx"> 
</span><span class="cx">         InspectorInstrumentationCookie cookie = JSMainThreadExecState::instrumentFunctionCall(scriptExecutionContext, callType, callData);
</span><span class="cx"> 
</span><del>-        NakedPtr&lt;Exception&gt; exception;
</del><ins>+        NakedPtr&lt;JSC::Exception&gt; exception;
</ins><span class="cx">         JSValue returnValue = scriptExecutionContext-&gt;isDocument()
</span><span class="cx">             ? JSMainThreadExecState::profiledCall(exec, JSC::ProfilingReason::Other, jsFunction, callType, callData, globalObject, args, exception)
</span><span class="cx">             : JSC::profiledCall(exec, JSC::ProfilingReason::Other, jsFunction, callType, callData, globalObject, args, exception);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSEventListenercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSEventListener.cpp (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSEventListener.cpp        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/bindings/js/JSEventListener.cpp        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -115,7 +115,7 @@
</span><span class="cx">     if (callType == CallType::None) {
</span><span class="cx">         handleEventFunction = jsFunction-&gt;get(exec, Identifier::fromString(exec, &quot;handleEvent&quot;));
</span><span class="cx">         if (UNLIKELY(scope.exception())) {
</span><del>-            Exception* exception = scope.exception();
</del><ins>+            auto* exception = scope.exception();
</ins><span class="cx">             scope.clearException();
</span><span class="cx"> 
</span><span class="cx">             event-&gt;target()-&gt;uncaughtExceptionInEventHandler();
</span><span class="lines">@@ -139,7 +139,7 @@
</span><span class="cx">         InspectorInstrumentationCookie cookie = JSMainThreadExecState::instrumentFunctionCall(scriptExecutionContext, callType, callData);
</span><span class="cx"> 
</span><span class="cx">         JSValue thisValue = handleEventFunction == jsFunction ? toJS(exec, globalObject, event-&gt;currentTarget()) : jsFunction;
</span><del>-        NakedPtr&lt;Exception&gt; exception;
</del><ins>+        NakedPtr&lt;JSC::Exception&gt; exception;
</ins><span class="cx">         JSValue retval = scriptExecutionContext-&gt;isDocument()
</span><span class="cx">             ? JSMainThreadExecState::profiledCall(exec, JSC::ProfilingReason::Other, handleEventFunction, callType, callData, thisValue, args, exception)
</span><span class="cx">             : JSC::profiledCall(exec, JSC::ProfilingReason::Other, handleEventFunction, callType, callData, thisValue, args, exception);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSMutationCallbackcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSMutationCallback.cpp (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSMutationCallback.cpp        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/bindings/js/JSMutationCallback.cpp        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -87,7 +87,7 @@
</span><span class="cx"> 
</span><span class="cx">     InspectorInstrumentationCookie cookie = JSMainThreadExecState::instrumentFunctionCall(context, callType, callData);
</span><span class="cx"> 
</span><del>-    NakedPtr&lt;Exception&gt; exception;
</del><ins>+    NakedPtr&lt;JSC::Exception&gt; exception;
</ins><span class="cx">     JSMainThreadExecState::profiledCall(exec, JSC::ProfilingReason::Other, callback, callType, callData, jsObserver, args, exception);
</span><span class="cx"> 
</span><span class="cx">     InspectorInstrumentation::didCallFunction(cookie, context);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSNodeFilterCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSNodeFilterCustom.cpp (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSNodeFilterCustom.cpp        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/bindings/js/JSNodeFilterCustom.cpp        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -51,7 +51,7 @@
</span><span class="cx">     args.append(toJS(state, m_data-&gt;globalObject(), node));
</span><span class="cx">     RETURN_IF_EXCEPTION(scope, NodeFilter::FILTER_REJECT);
</span><span class="cx"> 
</span><del>-    NakedPtr&lt;Exception&gt; returnedException;
</del><ins>+    NakedPtr&lt;JSC::Exception&gt; returnedException;
</ins><span class="cx">     JSValue value = m_data-&gt;invokeCallback(args, JSCallbackData::CallbackType::FunctionOrObject, Identifier::fromString(state, &quot;acceptNode&quot;), returnedException);
</span><span class="cx">     ASSERT(!scope.exception() || returnedException);
</span><span class="cx">     if (returnedException) {
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSXMLHttpRequestCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -105,44 +105,52 @@
</span><span class="cx"> {
</span><span class="cx">     InspectorInstrumentation::willSendXMLHttpRequest(wrapped().scriptExecutionContext(), wrapped().url());
</span><span class="cx"> 
</span><del>-    ExceptionCode ec = 0;
-    JSValue val = state.argument(0);
-    if (val.isUndefinedOrNull())
-        wrapped().send(ec);
-    else if (val.inherits(JSDocument::info()))
-        wrapped().send(JSDocument::toWrapped(val), ec);
-    else if (val.inherits(JSBlob::info()))
-        wrapped().send(JSBlob::toWrapped(val), ec);
-    else if (val.inherits(JSDOMFormData::info()))
-        wrapped().send(JSDOMFormData::toWrapped(val), ec);
-    else if (val.inherits(JSArrayBuffer::info()))
-        wrapped().send(toArrayBuffer(val), ec);
-    else if (val.inherits(JSArrayBufferView::info())) {
-        RefPtr&lt;ArrayBufferView&gt; view = toArrayBufferView(val);
-        wrapped().send(view.get(), ec);
-    } else
-        wrapped().send(val.toString(&amp;state)-&gt;value(&amp;state), ec);
</del><ins>+    JSValue value = state.argument(0);
+    ExceptionOr&lt;void&gt; result;
+    if (value.isUndefinedOrNull())
+        result = wrapped().send();
+    else if (value.inherits(JSDocument::info()))
+        result = wrapped().send(*JSDocument::toWrapped(value));
+    else if (value.inherits(JSBlob::info()))
+        result = wrapped().send(*JSBlob::toWrapped(value));
+    else if (value.inherits(JSDOMFormData::info()))
+        result = wrapped().send(*JSDOMFormData::toWrapped(value));
+    else if (value.inherits(JSArrayBuffer::info()))
+        result = wrapped().send(*toArrayBuffer(value));
+    else if (value.inherits(JSArrayBufferView::info()))
+        result = wrapped().send(*toArrayBufferView(value).get());
+    else {
+        // FIXME: If toString raises an exception, should we exit before calling willSendXMLHttpRequest?
+        // FIXME: If toString raises an exception, should we exit before calling send?
+        result = wrapped().send(value.toString(&amp;state)-&gt;value(&amp;state));
+    }
</ins><span class="cx"> 
</span><del>-    // FIXME: This should probably use ShadowChicken so that we get the right frame even when it did
-    // a tail call.
</del><ins>+    // FIXME: This should probably use ShadowChicken so that we get the right frame even when it did a tail call.
</ins><span class="cx">     // https://bugs.webkit.org/show_bug.cgi?id=155688
</span><span class="cx">     SendFunctor functor;
</span><span class="cx">     state.iterate(functor);
</span><span class="cx">     wrapped().setLastSendLineAndColumnNumber(functor.line(), functor.column());
</span><span class="cx">     wrapped().setLastSendURL(functor.url());
</span><del>-    setDOMException(&amp;state, ec);
</del><ins>+
+    // FIXME: Is it correct to do this only after the paragraph code of code just above, or should we exit earlier?
+    if (UNLIKELY(result.hasException())) {
+        propagateException(state, result.releaseException());
+        return { };
+    }
+
</ins><span class="cx">     return jsUndefined();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> JSValue JSXMLHttpRequest::responseText(ExecState&amp; state) const
</span><span class="cx"> {
</span><del>-    ExceptionCode ec = 0;
-    String text = wrapped().responseText(ec);
-    if (ec) {
-        setDOMException(&amp;state, ec);
-        return jsUndefined();
</del><ins>+    auto result = wrapped().responseText();
+
+    if (UNLIKELY(result.hasException())) {
+        propagateException(state, result.releaseException());
+        return { };
</ins><span class="cx">     }
</span><del>-    return jsOwnedStringOrNull(&amp;state, text);
</del><ins>+
+    return jsOwnedStringOrNull(&amp;state, result.releaseReturnValue());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> JSValue JSXMLHttpRequest::retrieveResponse(ExecState&amp; state)
</span><span class="lines">@@ -174,12 +182,12 @@
</span><span class="cx">         break;
</span><span class="cx"> 
</span><span class="cx">     case XMLHttpRequest::ResponseType::Document: {
</span><del>-        ExceptionCode ec = 0;
-        auto document = wrapped().responseXML(ec);
-        ASSERT(!ec);
-        value = toJS(&amp;state, globalObject(), document);
</del><ins>+        auto document = wrapped().responseXML();
+        ASSERT(!document.hasException());
+        value = toJS(&amp;state, globalObject(), document.releaseReturnValue());
</ins><span class="cx">         break;
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     case XMLHttpRequest::ResponseType::Blob:
</span><span class="cx">         value = toJSNewlyCreated(&amp;state, globalObject(), wrapped().createResponseBlob());
</span><span class="cx">         break;
</span><span class="lines">@@ -188,6 +196,7 @@
</span><span class="cx">         value = toJS(&amp;state, globalObject(), wrapped().createResponseArrayBuffer());
</span><span class="cx">         break;
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     wrapped().didCacheResponse();
</span><span class="cx">     return value;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsScheduledActioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/ScheduledAction.cpp (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/ScheduledAction.cpp        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/bindings/js/ScheduledAction.cpp        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -101,7 +101,7 @@
</span><span class="cx"> 
</span><span class="cx">     InspectorInstrumentationCookie cookie = JSMainThreadExecState::instrumentFunctionCall(&amp;context, callType, callData);
</span><span class="cx"> 
</span><del>-    NakedPtr&lt;Exception&gt; exception;
</del><ins>+    NakedPtr&lt;JSC::Exception&gt; exception;
</ins><span class="cx">     if (is&lt;Document&gt;(context))
</span><span class="cx">         JSMainThreadExecState::profiledCall(exec, JSC::ProfilingReason::Other, m_function.get(), callType, callData, thisValue, args, exception);
</span><span class="cx">     else
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsScriptControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/ScriptController.cpp (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/ScriptController.cpp        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/bindings/js/ScriptController.cpp        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -159,7 +159,7 @@
</span><span class="cx"> 
</span><span class="cx">     InspectorInstrumentationCookie cookie = InspectorInstrumentation::willEvaluateScript(m_frame, sourceURL, sourceCode.startLine());
</span><span class="cx"> 
</span><del>-    NakedPtr&lt;Exception&gt; evaluationException;
</del><ins>+    NakedPtr&lt;JSC::Exception&gt; evaluationException;
</ins><span class="cx">     JSValue returnValue = JSMainThreadExecState::profiledEvaluate(exec, JSC::ProfilingReason::Other, jsSourceCode, shell, evaluationException);
</span><span class="cx"> 
</span><span class="cx">     InspectorInstrumentation::didEvaluateScript(cookie, m_frame);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsWorkerScriptControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/WorkerScriptController.cpp (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/WorkerScriptController.cpp        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/bindings/js/WorkerScriptController.cpp        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -109,7 +109,7 @@
</span><span class="cx">     if (isExecutionForbidden())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    NakedPtr&lt;Exception&gt; exception;
</del><ins>+    NakedPtr&lt;JSC::Exception&gt; exception;
</ins><span class="cx">     evaluate(sourceCode, exception);
</span><span class="cx">     if (exception) {
</span><span class="cx">         JSLockHolder lock(vm());
</span><span class="lines">@@ -142,7 +142,7 @@
</span><span class="cx">         String sourceURL = sourceCode.url().string();
</span><span class="cx">         Deprecated::ScriptValue error;
</span><span class="cx">         if (m_workerGlobalScope-&gt;sanitizeScriptError(errorMessage, lineNumber, columnNumber, sourceURL, error, sourceCode.cachedScript()))
</span><del>-            returnedException = Exception::create(vm, createError(exec, errorMessage.impl()));
</del><ins>+            returnedException = JSC::Exception::create(vm, createError(exec, errorMessage.impl()));
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -2330,9 +2330,7 @@
</span><span class="cx"> sub GetIndexedGetterExpression
</span><span class="cx"> {
</span><span class="cx">     my $indexedGetterFunction = shift;
</span><del>-    if ($indexedGetterFunction-&gt;signature-&gt;type eq &quot;DOMString&quot;) {
-        return &quot;jsStringOrUndefined(state, thisObject-&gt;wrapped().item(index))&quot;;
-    }
</del><ins>+    return &quot;jsStringOrUndefined(state, thisObject-&gt;wrapped().item(index))&quot; if $indexedGetterFunction-&gt;signature-&gt;type eq &quot;DOMString&quot;;
</ins><span class="cx">     return &quot;toJS(state, thisObject-&gt;globalObject(), thisObject-&gt;wrapped().item(index))&quot;;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -3229,13 +3227,12 @@
</span><span class="cx">                 } else {
</span><span class="cx">                     push(@implContent, &quot;    ${className}* castedThis = &quot; . GetCastingHelperForThisObject($interface) . &quot;(JSValue::decode(thisValue));\n&quot;);
</span><span class="cx">                 }
</span><del>-                push(@implContent, &quot;    if (UNLIKELY(!castedThis)) {\n&quot;);
</del><ins>+                push(@implContent, &quot;    if (UNLIKELY(!castedThis))\n&quot;);
</ins><span class="cx">                 if ($attribute-&gt;signature-&gt;extendedAttributes-&gt;{LenientThis}) {
</span><span class="cx">                     push(@implContent, &quot;        return false;\n&quot;);
</span><span class="cx">                 } else {
</span><span class="cx">                     push(@implContent, &quot;        return throwSetterTypeError(*state, throwScope, \&quot;$visibleInterfaceName\&quot;, \&quot;$name\&quot;);\n&quot;);
</span><span class="cx">                 }
</span><del>-                push(@implContent, &quot;    }\n&quot;);
</del><span class="cx">             }
</span><span class="cx">             if ($interface-&gt;extendedAttributes-&gt;{CheckSecurity} &amp;&amp; !$attribute-&gt;signature-&gt;extendedAttributes-&gt;{DoNotCheckSecurity} &amp;&amp; !$attribute-&gt;signature-&gt;extendedAttributes-&gt;{DoNotCheckSecurityOnSetter}) {
</span><span class="cx">                 if ($interfaceName eq &quot;DOMWindow&quot;) {
</span><span class="lines">@@ -3371,6 +3368,7 @@
</span><span class="cx">                     push(@implContent, &quot;    return true;\n&quot;);
</span><span class="cx">                 } else {
</span><span class="cx">                     my ($functionName, @arguments) = $codeGenerator-&gt;SetterExpression(\%implIncludes, $interfaceName, $attribute);
</span><ins>+
</ins><span class="cx">                     if ($codeGenerator-&gt;IsTypedArrayType($type) and not $type eq &quot;ArrayBuffer&quot;) {
</span><span class="cx">                         push(@arguments, &quot;nativeValue.get()&quot;);
</span><span class="cx">                     } elsif ($codeGenerator-&gt;IsEnumType($type)) {
</span><span class="lines">@@ -3393,7 +3391,11 @@
</span><span class="cx">                     unshift(@arguments, GenerateCallWith($attribute-&gt;signature-&gt;extendedAttributes-&gt;{CallWith}, \@implContent, &quot;false&quot;));
</span><span class="cx"> 
</span><span class="cx">                     push(@arguments, &quot;ec&quot;) if $setterMayThrowLegacyException;
</span><del>-                    push(@implContent, &quot;    ${functionName}(&quot; . join(&quot;, &quot;, @arguments) . &quot;);\n&quot;);
</del><ins>+
+                    my $functionString = &quot;$functionName(&quot; . join(&quot;, &quot;, @arguments) . &quot;)&quot;;
+                    $functionString = &quot;propagateException(*state, throwScope, $functionString)&quot; if $attribute-&gt;signature-&gt;extendedAttributes-&gt;{SetterMayThrowException};
+
+                    push(@implContent, &quot;    $functionString;\n&quot;);
</ins><span class="cx">                     push(@implContent, &quot;    setDOMException(state, throwScope, ec);\n&quot;) if $setterMayThrowLegacyException;
</span><span class="cx">                     push(@implContent, &quot;    return true;\n&quot;);
</span><span class="cx">                 }
</span><span class="lines">@@ -3833,9 +3835,8 @@
</span><span class="cx">     push(@implContent, &quot;    auto castedThis = jsDynamicCast&lt;JS$interfaceName*&gt;(thisValue);\n&quot;);
</span><span class="cx">     push(@implContent, &quot;    VM&amp; vm = state-&gt;vm();\n&quot;);
</span><span class="cx">     push(@implContent, &quot;    auto throwScope = DECLARE_THROW_SCOPE(vm);\n&quot;);
</span><del>-    push(@implContent, &quot;    if (UNLIKELY(!castedThis)){\n&quot;);
</del><ins>+    push(@implContent, &quot;    if (UNLIKELY(!castedThis))\n&quot;);
</ins><span class="cx">     push(@implContent, &quot;        return throwThisTypeError(*state, throwScope, \&quot;$interfaceName\&quot;, \&quot;$serializerFunctionName\&quot;);\n&quot;);
</span><del>-    push(@implContent, &quot;    }\n&quot;);
</del><span class="cx">     push(@implContent, &quot;    ASSERT_GC_OBJECT_INHERITS(castedThis, ${className}::info());\n\n&quot;) unless $interfaceName eq &quot;EventTarget&quot;;
</span><span class="cx">     push(@implContent, &quot;    auto* result = constructEmptyObject(state);\n&quot;);
</span><span class="cx">     foreach my $attribute (@{$interface-&gt;attributes}) {
</span><span class="lines">@@ -4129,9 +4130,9 @@
</span><span class="cx">                 if (!defined $parameter-&gt;default) {
</span><span class="cx">                     push(@$outputArray, &quot;    if (!${name}Value.isUndefined()) {\n&quot;);
</span><span class="cx">                 } else {
</span><del>-                    push(@$outputArray, &quot;    if (${name}Value.isUndefined()) {\n&quot;);
</del><ins>+                    push(@$outputArray, &quot;    if (${name}Value.isUndefined())\n&quot;);
</ins><span class="cx">                     push(@$outputArray, &quot;        $name = &quot; . GenerateDefaultValue($interface, $parameter) . &quot;;\n&quot;);
</span><del>-                    push(@$outputArray, &quot;    } else {\n&quot;);
</del><ins>+                    push(@$outputArray, &quot;    else {\n&quot;);
</ins><span class="cx">                 }
</span><span class="cx">                 $indent = &quot;    &quot;;
</span><span class="cx">             }
</span><span class="lines">@@ -4222,18 +4223,18 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     push @arguments, GenerateReturnParameters($function);
</span><ins>+    my $functionString = &quot;$functionName(&quot; . join(&quot;, &quot;, @arguments) . &quot;)&quot;;
+    $functionString = &quot;propagateException(*state, throwScope, $functionString)&quot; if $function-&gt;signature-&gt;type &amp;&amp; $function-&gt;signature-&gt;type eq &quot;void&quot; &amp;&amp; $function-&gt;signature-&gt;extendedAttributes-&gt;{MayThrowException};
</ins><span class="cx"> 
</span><del>-    return (&quot;$functionName(&quot; . join(&quot;, &quot;, @arguments) . &quot;)&quot;, scalar @arguments);
</del><ins>+    return ($functionString, scalar @arguments);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> sub GenerateReturnParameters
</span><span class="cx"> {
</span><span class="cx">     my $function = shift;
</span><ins>+
</ins><span class="cx">     my @arguments;
</span><del>-
-    if (IsReturningPromise($function)) {
-        push(@arguments, &quot;WTFMove(promise)&quot;);
-    }
</del><ins>+    push(@arguments, &quot;WTFMove(promise)&quot;) if IsReturningPromise($function);
</ins><span class="cx">     push(@arguments, &quot;ec&quot;) if $function-&gt;signature-&gt;extendedAttributes-&gt;{MayThrowLegacyException} || $function-&gt;signature-&gt;extendedAttributes-&gt;{MayThrowLegacyExceptionWithMessage};
</span><span class="cx">     return @arguments;
</span><span class="cx"> }
</span><span class="lines">@@ -4592,6 +4593,7 @@
</span><span class="cx">         } else {
</span><span class="cx">             push(@implContent, $indent . &quot;JSValue result = &quot; . NativeToJSValue($function-&gt;signature, 1, $interface, $functionString, $thisObject) . &quot;;\n&quot;);
</span><span class="cx">         }
</span><ins>+
</ins><span class="cx">         push(@implContent, &quot;\n&quot; . $indent . &quot;setDOMException(state, throwScope, ec);\n&quot;) if $mayThrowLegacyException;
</span><span class="cx"> 
</span><span class="cx">         if ($codeGenerator-&gt;ExtendedAttributeContains($function-&gt;signature-&gt;extendedAttributes-&gt;{CallWith}, &quot;ScriptState&quot;)) {
</span><span class="lines">@@ -4680,7 +4682,7 @@
</span><span class="cx">     if ($interface-&gt;iterable-&gt;extendedAttributes-&gt;{EnabledAtRuntime}) {
</span><span class="cx">         AddToImplIncludes(&quot;RuntimeEnabledFeatures.h&quot;);
</span><span class="cx">         my $enable_function = GetRuntimeEnableFunctionName($interface-&gt;iterable);
</span><del>-        push(@implContent, &quot;    if (${enable_function}()) {\n    &quot;);
</del><ins>+        push(@implContent, &quot;    if (${enable_function}())\n    &quot;);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (IsKeyValueIterableInterface($interface)) {
</span><span class="lines">@@ -4689,11 +4691,6 @@
</span><span class="cx">     } else {
</span><span class="cx">         push(@implContent, &quot;    addValueIterableMethods(*globalObject(), *this);\n&quot;);
</span><span class="cx">     }
</span><del>-
-    if ($interface-&gt;iterable-&gt;extendedAttributes-&gt;{EnabledAtRuntime}) {
-        push(@implContent, &quot;    }\n&quot;);
-    }
-
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> sub GetNativeTypeFromSignature
</span><span class="lines">@@ -4928,25 +4925,29 @@
</span><span class="cx"> 
</span><span class="cx">     my $conditional = $signature-&gt;extendedAttributes-&gt;{Conditional};
</span><span class="cx">     my $type = $signature-&gt;type;
</span><ins>+    my $isNullable = $signature-&gt;isNullable;
+    my $mayThrowException = $signature-&gt;extendedAttributes-&gt;{GetterMayThrowException} || $signature-&gt;extendedAttributes-&gt;{MayThrowException};
</ins><span class="cx"> 
</span><span class="cx">     my $globalObject = $thisValue ? &quot;$thisValue-&gt;globalObject()&quot; : &quot;jsCast&lt;JSDOMGlobalObject*&gt;(state-&gt;lexicalGlobalObject())&quot;;
</span><span class="cx"> 
</span><ins>+    return &quot;toJSBoolean(*state, throwScope, $value)&quot; if $type eq &quot;boolean&quot; &amp;&amp; $mayThrowException;
</ins><span class="cx">     return &quot;jsBoolean($value)&quot; if $type eq &quot;boolean&quot;;
</span><ins>+    return &quot;toJSNullableDate(*state, throwScope, $value)&quot; if $type eq &quot;Date&quot; &amp;&amp; $isNullable &amp;&amp; $mayThrowException;
+    return &quot;jsDateOrNull(state, $value)&quot; if $type eq &quot;Date&quot; &amp;&amp; $isNullable;
+    return &quot;toJSDate(*state, throwScope, $value)&quot; if $type eq &quot;Date&quot; &amp;&amp; $mayThrowException;
+    return &quot;jsDate(state, $value)&quot; if $type eq &quot;Date&quot;;
</ins><span class="cx"> 
</span><del>-    if ($type eq &quot;Date&quot;) {
-        return &quot;jsDateOrNull(state, $value)&quot; if $signature-&gt;isNullable;
-        return &quot;jsDate(state, $value)&quot;;
-    }
-
</del><span class="cx">     if ($codeGenerator-&gt;IsNumericType($type) or $type eq &quot;DOMTimeStamp&quot;) {
</span><span class="cx">         # We could instead overload a function to work with optional as well as non-optional numbers, but this
</span><span class="cx">         # is slightly better because it guarantees we will fail to compile if the IDL file doesn't match the C++.
</span><del>-        my $function = $signature-&gt;isNullable ? &quot;toNullableJSNumber&quot; : &quot;jsNumber&quot;;
</del><span class="cx">         if ($signature-&gt;extendedAttributes-&gt;{Reflect} and ($type eq &quot;unsigned long&quot; or $type eq &quot;unsigned short&quot;)) {
</span><span class="cx">             $value =~ s/getUnsignedIntegralAttribute/getIntegralAttribute/g;
</span><span class="cx">             $value = &quot;std::max(0, $value)&quot;;
</span><span class="cx">         }
</span><del>-        return &quot;$function($value)&quot;;
</del><ins>+        return &quot;toJSNullableNumber(*state, throwScope, $value)&quot; if $isNullable &amp;&amp; $mayThrowException;
+        return &quot;toNullableJSNumber($value)&quot; if $isNullable;
+        return &quot;toJSNumber(*state, throwScope, $value)&quot; if $mayThrowException;
+        return &quot;jsNumber($value)&quot;;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if ($codeGenerator-&gt;IsEnumType($type)) {
</span><span class="lines">@@ -4956,7 +4957,7 @@
</span><span class="cx"> 
</span><span class="cx">     if ($codeGenerator-&gt;IsStringType($type)) {
</span><span class="cx">         AddToImplIncludes(&quot;URL.h&quot;, $conditional);
</span><del>-        return &quot;jsStringOrNull(state, $value)&quot; if $signature-&gt;isNullable;
</del><ins>+        return &quot;jsStringOrNull(state, $value)&quot; if $isNullable;
</ins><span class="cx">         AddToImplIncludes(&quot;&lt;runtime/JSString.h&gt;&quot;, $conditional);
</span><span class="cx">         return &quot;jsStringWithCache(state, $value)&quot;;
</span><span class="cx">     }
</span><span class="lines">@@ -4963,10 +4964,7 @@
</span><span class="cx"> 
</span><span class="cx">     if ($codeGenerator-&gt;IsSequenceOrFrozenArrayType($type)) {
</span><span class="cx">         my $innerType = $codeGenerator-&gt;GetSequenceOrFrozenArrayInnerType($type);
</span><del>-        if ($codeGenerator-&gt;IsRefPtrType($innerType)) {
-            AddToImplIncludes(&quot;JS${innerType}.h&quot;, $conditional);
-        }
-
</del><ins>+        AddToImplIncludes(&quot;JS${innerType}.h&quot;, $conditional) if $codeGenerator-&gt;IsRefPtrType($innerType);
</ins><span class="cx">         return &quot;jsArray(state, $globalObject, $value)&quot; if $codeGenerator-&gt;IsSequenceType($type);
</span><span class="cx">         return &quot;jsFrozenArray(state, $globalObject, $value)&quot; if $codeGenerator-&gt;IsFrozenArrayType($type);
</span><span class="cx">     }
</span><span class="lines">@@ -5024,8 +5022,13 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    my $function = $signature-&gt;extendedAttributes-&gt;{NewObject} ? &quot;toJSNewlyCreated&quot; : &quot;toJS&quot;;
-    return &quot;$function(state, $globalObject, $value)&quot;;
</del><ins>+    my $functionName = &quot;toJS&quot;;
+    $functionName = &quot;toJSNewlyCreated&quot; if $signature-&gt;extendedAttributes-&gt;{NewObject};
+
+    my $arguments = &quot;state, $globalObject, $value&quot;;
+    $arguments = &quot;*state, *$globalObject, throwScope, $value&quot; if $mayThrowException;
+
+    return &quot;$functionName($arguments)&quot;;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> sub ceilingToPowerOf2
</span><span class="lines">@@ -5568,7 +5571,7 @@
</span><span class="cx">             if ($interface-&gt;extendedAttributes-&gt;{ConstructorMayThrowLegacyException}) {
</span><span class="cx">                 push(@$outputArray, &quot;    if (UNLIKELY(ec)) {\n&quot;);
</span><span class="cx">                 push(@$outputArray, &quot;        setDOMException(state, throwScope, ec);\n&quot;);
</span><del>-                push(@$outputArray, &quot;        return JSValue::encode(JSValue());\n&quot;);
</del><ins>+                push(@$outputArray, &quot;        return encodedJSValue();\n&quot;);
</ins><span class="cx">                 push(@$outputArray, &quot;    }\n&quot;);
</span><span class="cx">             }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsIDLAttributestxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -68,6 +68,7 @@
</span><span class="cx"> Exposed=*
</span><span class="cx"> ForwardDeclareInHeader
</span><span class="cx"> GenerateIsReachable=|Impl|ImplWebGLRenderingContext|ImplDocument|ImplElementRoot|ImplFrame|ImplOwnerNodeRoot|ImplScriptExecutionContext
</span><ins>+GetterMayThrowException
</ins><span class="cx"> GetterMayThrowLegacyException
</span><span class="cx"> GetterMayThrowLegacyExceptionWithMessage
</span><span class="cx"> Immutable
</span><span class="lines">@@ -95,6 +96,7 @@
</span><span class="cx"> JSLegacyParent=*
</span><span class="cx"> LenientThis
</span><span class="cx"> MasqueradesAsUndefined
</span><ins>+MayThrowException
</ins><span class="cx"> MayThrowLegacyException
</span><span class="cx"> MayThrowLegacyExceptionWithMessage
</span><span class="cx"> NamedConstructor=*
</span><span class="lines">@@ -114,6 +116,7 @@
</span><span class="cx"> ReportExternalMemoryCost
</span><span class="cx"> RequiresExistingAtomicString
</span><span class="cx"> SetterCallWith=ScriptExecutionContext|ScriptState|ScriptArguments|CallStack|ActiveWindow|FirstWindow
</span><ins>+SetterMayThrowException
</ins><span class="cx"> SetterMayThrowLegacyException
</span><span class="cx"> SetterMayThrowLegacyExceptionWithMessage
</span><span class="cx"> SkipVTableValidation
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestGlobalObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -284,9 +284,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestGlobalObject* castedThis = jsDynamicCast&lt;JSTestGlobalObject*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestGlobalObject&quot;, &quot;regularAttribute&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = value.toWTFString(state);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -303,9 +302,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestGlobalObject* castedThis = jsDynamicCast&lt;JSTestGlobalObject*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestGlobalObject&quot;, &quot;publicAndPrivateAttribute&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = value.toWTFString(state);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -323,9 +321,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestGlobalObject* castedThis = jsDynamicCast&lt;JSTestGlobalObject*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestGlobalObject&quot;, &quot;publicAndPrivateConditionalAttribute&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = value.toWTFString(state);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -344,9 +341,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestGlobalObject* castedThis = jsDynamicCast&lt;JSTestGlobalObject*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestGlobalObject&quot;, &quot;enabledAtRuntimeAttribute&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = value.toWTFString(state);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestInterfacecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -240,7 +240,7 @@
</span><span class="cx">     auto object = TestInterface::create(*context, WTFMove(str1), WTFMove(str2), ec);
</span><span class="cx">     if (UNLIKELY(ec)) {
</span><span class="cx">         setDOMException(state, throwScope, ec);
</span><del>-        return JSValue::encode(JSValue());
</del><ins>+        return encodedJSValue();
</ins><span class="cx">     }
</span><span class="cx">     return JSValue::encode(toJSNewlyCreated(state, castedThis-&gt;globalObject(), WTFMove(object)));
</span><span class="cx"> }
</span><span class="lines">@@ -701,9 +701,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestInterface* castedThis = jsDynamicCast&lt;JSTestInterface*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestInterface&quot;, &quot;implementsStr2&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = value.toWTFString(state);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -722,9 +721,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestInterface* castedThis = jsDynamicCast&lt;JSTestInterface*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestInterface&quot;, &quot;implementsStr3&quot;);
</span><del>-    }
</del><span class="cx">     castedThis-&gt;setImplementsStr3(*state, value);
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="lines">@@ -740,9 +738,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestInterface* castedThis = jsDynamicCast&lt;JSTestInterface*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestInterface&quot;, &quot;implementsNode&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = JSNode::toWrapped(value);
</span><span class="cx">     if (UNLIKELY(!nativeValue)) {
</span><span class="lines">@@ -779,9 +776,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestInterface* castedThis = jsDynamicCast&lt;JSTestInterface*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestInterface&quot;, &quot;supplementalStr2&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = value.toWTFString(state);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -800,9 +796,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestInterface* castedThis = jsDynamicCast&lt;JSTestInterface*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestInterface&quot;, &quot;supplementalStr3&quot;);
</span><del>-    }
</del><span class="cx">     castedThis-&gt;setSupplementalStr3(*state, value);
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="lines">@@ -818,9 +813,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestInterface* castedThis = jsDynamicCast&lt;JSTestInterface*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestInterface&quot;, &quot;supplementalNode&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = JSNode::toWrapped(value);
</span><span class="cx">     if (UNLIKELY(!nativeValue)) {
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestJSBuiltinConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -197,9 +197,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestJSBuiltinConstructor* castedThis = jsDynamicCast&lt;JSTestJSBuiltinConstructor*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestJSBuiltinConstructor&quot;, &quot;testAttributeRWCustom&quot;);
</span><del>-    }
</del><span class="cx">     castedThis-&gt;setTestAttributeRWCustom(*state, value);
</span><span class="cx">     return true;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestNamedConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -99,7 +99,7 @@
</span><span class="cx">     auto object = TestNamedConstructor::createForJSConstructor(*castedThis-&gt;document(), WTFMove(str1), WTFMove(str2), WTFMove(str3), ec);
</span><span class="cx">     if (UNLIKELY(ec)) {
</span><span class="cx">         setDOMException(state, throwScope, ec);
</span><del>-        return JSValue::encode(JSValue());
</del><ins>+        return encodedJSValue();
</ins><span class="cx">     }
</span><span class="cx">     return JSValue::encode(toJSNewlyCreated(state, castedThis-&gt;globalObject(), WTFMove(object)));
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -146,9 +146,8 @@
</span><span class="cx">         VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);
</span><span class="cx">         JSObject::deleteProperty(this, globalObject()-&gt;globalExec(), propertyName);
</span><span class="cx">     }
</span><del>-    if (RuntimeEnabledFeatures::sharedFeatures().domIteratorEnabled()) {
</del><ins>+    if (RuntimeEnabledFeatures::sharedFeatures().domIteratorEnabled())
</ins><span class="cx">         putDirect(vm, vm.propertyNames-&gt;iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral(&quot;[Symbol.Iterator]&quot;), jsTestNodePrototypeFunctionSymbolIterator), DontEnum);
</span><del>-    }
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> const ClassInfo JSTestNode::s_info = { &quot;TestNode&quot;, &amp;Base::s_info, 0, CREATE_METHOD_TABLE(JSTestNode) };
</span><span class="lines">@@ -221,9 +220,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestNode* castedThis = jsDynamicCast&lt;JSTestNode*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestNode&quot;, &quot;name&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = value.toWTFString(state);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -301,9 +299,8 @@
</span><span class="cx">     auto castedThis = jsDynamicCast&lt;JSTestNode*&gt;(thisValue);
</span><span class="cx">     VM&amp; vm = state-&gt;vm();
</span><span class="cx">     auto throwScope = DECLARE_THROW_SCOPE(vm);
</span><del>-    if (UNLIKELY(!castedThis)){
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwThisTypeError(*state, throwScope, &quot;TestNode&quot;, &quot;toJSON&quot;);
</span><del>-    }
</del><span class="cx">     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestNode::info());
</span><span class="cx"> 
</span><span class="cx">     auto* result = constructEmptyObject(state);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestNondeterministiccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNondeterministic.cpp (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNondeterministic.cpp        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNondeterministic.cpp        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -364,9 +364,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestNondeterministic* castedThis = jsDynamicCast&lt;JSTestNondeterministic*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestNondeterministic&quot;, &quot;nondeterministicWriteableAttr&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = value.toWTFString(state);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -383,9 +382,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestNondeterministic* castedThis = jsDynamicCast&lt;JSTestNondeterministic*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestNondeterministic&quot;, &quot;nondeterministicExceptionAttr&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = value.toWTFString(state);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -402,9 +400,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestNondeterministic* castedThis = jsDynamicCast&lt;JSTestNondeterministic*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestNondeterministic&quot;, &quot;nondeterministicGetterExceptionAttr&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = value.toWTFString(state);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -421,9 +418,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestNondeterministic* castedThis = jsDynamicCast&lt;JSTestNondeterministic*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestNondeterministic&quot;, &quot;nondeterministicSetterExceptionAttr&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     ExceptionCode ec = 0;
</span><span class="cx">     auto nativeValue = value.toWTFString(state);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -894,6 +894,9 @@
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSerializedValue(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOptionsObject(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithException(JSC::ExecState*);
</span><ins>+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithExceptionReturningLong(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithExceptionReturningObject(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithLegacyException(JSC::ExecState*);
</ins><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithExceptionWithMessage(JSC::ExecState*);
</span><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="lines">@@ -1085,12 +1088,16 @@
</span><span class="cx"> #endif
</span><span class="cx"> JSC::EncodedJSValue jsTestObjTypedArrayAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
</span><span class="cx"> bool setJSTestObjTypedArrayAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
</span><del>-JSC::EncodedJSValue jsTestObjAttrWithGetterException(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
-bool setJSTestObjAttrWithGetterException(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
</del><ins>+JSC::EncodedJSValue jsTestObjAttributeWithGetterException(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
+bool setJSTestObjAttributeWithGetterException(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
+JSC::EncodedJSValue jsTestObjAttributeWithGetterLegacyException(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
+bool setJSTestObjAttributeWithGetterLegacyException(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
</ins><span class="cx"> JSC::EncodedJSValue jsTestObjAttrWithGetterExceptionWithMessage(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
</span><span class="cx"> bool setJSTestObjAttrWithGetterExceptionWithMessage(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
</span><del>-JSC::EncodedJSValue jsTestObjAttrWithSetterException(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
-bool setJSTestObjAttrWithSetterException(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
</del><ins>+JSC::EncodedJSValue jsTestObjAttributeWithSetterException(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
+bool setJSTestObjAttributeWithSetterException(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
+JSC::EncodedJSValue jsTestObjAttributeWithSetterLegacyException(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
+bool setJSTestObjAttributeWithSetterLegacyException(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
</ins><span class="cx"> JSC::EncodedJSValue jsTestObjAttrWithSetterExceptionWithMessage(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
</span><span class="cx"> bool setJSTestObjAttrWithSetterExceptionWithMessage(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
</span><span class="cx"> JSC::EncodedJSValue jsTestObjStringAttrWithGetterException(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
</span><span class="lines">@@ -1399,9 +1406,11 @@
</span><span class="cx">     { 0, 0, NoIntrinsic, { 0, 0 } },
</span><span class="cx"> #endif
</span><span class="cx">     { &quot;typedArrayAttr&quot;, CustomAccessor, NoIntrinsic, { (intptr_t)static_cast&lt;PropertySlot::GetValueFunc&gt;(jsTestObjTypedArrayAttr), (intptr_t) static_cast&lt;PutPropertySlot::PutValueFunc&gt;(setJSTestObjTypedArrayAttr) } },
</span><del>-    { &quot;attrWithGetterException&quot;, CustomAccessor, NoIntrinsic, { (intptr_t)static_cast&lt;PropertySlot::GetValueFunc&gt;(jsTestObjAttrWithGetterException), (intptr_t) static_cast&lt;PutPropertySlot::PutValueFunc&gt;(setJSTestObjAttrWithGetterException) } },
</del><ins>+    { &quot;attributeWithGetterException&quot;, CustomAccessor, NoIntrinsic, { (intptr_t)static_cast&lt;PropertySlot::GetValueFunc&gt;(jsTestObjAttributeWithGetterException), (intptr_t) static_cast&lt;PutPropertySlot::PutValueFunc&gt;(setJSTestObjAttributeWithGetterException) } },
+    { &quot;attributeWithGetterLegacyException&quot;, CustomAccessor, NoIntrinsic, { (intptr_t)static_cast&lt;PropertySlot::GetValueFunc&gt;(jsTestObjAttributeWithGetterLegacyException), (intptr_t) static_cast&lt;PutPropertySlot::PutValueFunc&gt;(setJSTestObjAttributeWithGetterLegacyException) } },
</ins><span class="cx">     { &quot;attrWithGetterExceptionWithMessage&quot;, CustomAccessor, NoIntrinsic, { (intptr_t)static_cast&lt;PropertySlot::GetValueFunc&gt;(jsTestObjAttrWithGetterExceptionWithMessage), (intptr_t) static_cast&lt;PutPropertySlot::PutValueFunc&gt;(setJSTestObjAttrWithGetterExceptionWithMessage) } },
</span><del>-    { &quot;attrWithSetterException&quot;, CustomAccessor, NoIntrinsic, { (intptr_t)static_cast&lt;PropertySlot::GetValueFunc&gt;(jsTestObjAttrWithSetterException), (intptr_t) static_cast&lt;PutPropertySlot::PutValueFunc&gt;(setJSTestObjAttrWithSetterException) } },
</del><ins>+    { &quot;attributeWithSetterException&quot;, CustomAccessor, NoIntrinsic, { (intptr_t)static_cast&lt;PropertySlot::GetValueFunc&gt;(jsTestObjAttributeWithSetterException), (intptr_t) static_cast&lt;PutPropertySlot::PutValueFunc&gt;(setJSTestObjAttributeWithSetterException) } },
+    { &quot;attributeWithSetterLegacyException&quot;, CustomAccessor, NoIntrinsic, { (intptr_t)static_cast&lt;PropertySlot::GetValueFunc&gt;(jsTestObjAttributeWithSetterLegacyException), (intptr_t) static_cast&lt;PutPropertySlot::PutValueFunc&gt;(setJSTestObjAttributeWithSetterLegacyException) } },
</ins><span class="cx">     { &quot;attrWithSetterExceptionWithMessage&quot;, CustomAccessor, NoIntrinsic, { (intptr_t)static_cast&lt;PropertySlot::GetValueFunc&gt;(jsTestObjAttrWithSetterExceptionWithMessage), (intptr_t) static_cast&lt;PutPropertySlot::PutValueFunc&gt;(setJSTestObjAttrWithSetterExceptionWithMessage) } },
</span><span class="cx">     { &quot;stringAttrWithGetterException&quot;, CustomAccessor, NoIntrinsic, { (intptr_t)static_cast&lt;PropertySlot::GetValueFunc&gt;(jsTestObjStringAttrWithGetterException), (intptr_t) static_cast&lt;PutPropertySlot::PutValueFunc&gt;(setJSTestObjStringAttrWithGetterException) } },
</span><span class="cx">     { &quot;stringAttrWithSetterException&quot;, CustomAccessor, NoIntrinsic, { (intptr_t)static_cast&lt;PropertySlot::GetValueFunc&gt;(jsTestObjStringAttrWithSetterException), (intptr_t) static_cast&lt;PutPropertySlot::PutValueFunc&gt;(setJSTestObjStringAttrWithSetterException) } },
</span><span class="lines">@@ -1495,6 +1504,9 @@
</span><span class="cx">     { &quot;serializedValue&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionSerializedValue), (intptr_t) (1) } },
</span><span class="cx">     { &quot;optionsObject&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionOptionsObject), (intptr_t) (1) } },
</span><span class="cx">     { &quot;methodWithException&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionMethodWithException), (intptr_t) (0) } },
</span><ins>+    { &quot;methodWithExceptionReturningLong&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionMethodWithExceptionReturningLong), (intptr_t) (0) } },
+    { &quot;methodWithExceptionReturningObject&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionMethodWithExceptionReturningObject), (intptr_t) (0) } },
+    { &quot;methodWithLegacyException&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionMethodWithLegacyException), (intptr_t) (0) } },
</ins><span class="cx">     { &quot;methodWithExceptionWithMessage&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionMethodWithExceptionWithMessage), (intptr_t) (0) } },
</span><span class="cx">     { &quot;customMethod&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionCustomMethod), (intptr_t) (0) } },
</span><span class="cx">     { &quot;customMethodWithArgs&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionCustomMethodWithArgs), (intptr_t) (3) } },
</span><span class="lines">@@ -1654,9 +1666,8 @@
</span><span class="cx">     JSVMClientData&amp; clientData = *static_cast&lt;JSVMClientData*&gt;(vm.clientData);
</span><span class="cx">     putDirect(vm, clientData.builtinNames().privateMethodPrivateName(), JSFunction::create(vm, globalObject(), 0, String(), jsTestObjPrototypeFunctionPrivateMethod), ReadOnly | DontEnum);
</span><span class="cx">     putDirect(vm, clientData.builtinNames().publicAndPrivateMethodPrivateName(), JSFunction::create(vm, globalObject(), 0, String(), jsTestObjPrototypeFunctionPublicAndPrivateMethod), ReadOnly | DontEnum);
</span><del>-    if (RuntimeEnabledFeatures::sharedFeatures().domIteratorEnabled()) {
</del><ins>+    if (RuntimeEnabledFeatures::sharedFeatures().domIteratorEnabled())
</ins><span class="cx">         addValueIterableMethods(*globalObject(), *this);
</span><del>-    }
</del><span class="cx">     JSObject&amp; unscopables = *constructEmptyObject(globalObject()-&gt;globalExec(), globalObject()-&gt;nullPrototypeObjectStructure());
</span><span class="cx">     unscopables.putDirect(vm, Identifier::fromString(&amp;vm, &quot;voidMethod&quot;), jsBoolean(true));
</span><span class="cx">     unscopables.putDirect(vm, Identifier::fromString(&amp;vm, &quot;shortAttr&quot;), jsBoolean(true));
</span><span class="lines">@@ -2375,20 +2386,36 @@
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline JSValue jsTestObjAttrWithGetterExceptionGetter(ExecState*, JSTestObj*, ThrowScope&amp; throwScope);
</del><ins>+static inline JSValue jsTestObjAttributeWithGetterExceptionGetter(ExecState*, JSTestObj*, ThrowScope&amp; throwScope);
</ins><span class="cx"> 
</span><del>-EncodedJSValue jsTestObjAttrWithGetterException(ExecState* state, EncodedJSValue thisValue, PropertyName)
</del><ins>+EncodedJSValue jsTestObjAttributeWithGetterException(ExecState* state, EncodedJSValue thisValue, PropertyName)
</ins><span class="cx"> {
</span><del>-    return BindingCaller&lt;JSTestObj&gt;::attribute&lt;jsTestObjAttrWithGetterExceptionGetter&gt;(state, thisValue, &quot;attrWithGetterException&quot;);
</del><ins>+    return BindingCaller&lt;JSTestObj&gt;::attribute&lt;jsTestObjAttributeWithGetterExceptionGetter&gt;(state, thisValue, &quot;attributeWithGetterException&quot;);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline JSValue jsTestObjAttrWithGetterExceptionGetter(ExecState* state, JSTestObj* thisObject, ThrowScope&amp; throwScope)
</del><ins>+static inline JSValue jsTestObjAttributeWithGetterExceptionGetter(ExecState* state, JSTestObj* thisObject, ThrowScope&amp; throwScope)
</ins><span class="cx"> {
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     UNUSED_PARAM(state);
</span><ins>+    auto&amp; impl = thisObject-&gt;wrapped();
+    JSValue result = toJSNumber(*state, throwScope, impl.attributeWithGetterException());
+    return result;
+}
+
+static inline JSValue jsTestObjAttributeWithGetterLegacyExceptionGetter(ExecState*, JSTestObj*, ThrowScope&amp; throwScope);
+
+EncodedJSValue jsTestObjAttributeWithGetterLegacyException(ExecState* state, EncodedJSValue thisValue, PropertyName)
+{
+    return BindingCaller&lt;JSTestObj&gt;::attribute&lt;jsTestObjAttributeWithGetterLegacyExceptionGetter&gt;(state, thisValue, &quot;attributeWithGetterLegacyException&quot;);
+}
+
+static inline JSValue jsTestObjAttributeWithGetterLegacyExceptionGetter(ExecState* state, JSTestObj* thisObject, ThrowScope&amp; throwScope)
+{
+    UNUSED_PARAM(throwScope);
+    UNUSED_PARAM(state);
</ins><span class="cx">     ExceptionCode ec = 0;
</span><span class="cx">     auto&amp; impl = thisObject-&gt;wrapped();
</span><del>-    JSValue result = jsNumber(impl.attrWithGetterException(ec));
</del><ins>+    JSValue result = jsNumber(impl.attributeWithGetterLegacyException(ec));
</ins><span class="cx">     setDOMException(state, throwScope, ec);
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="lines">@@ -2411,22 +2438,38 @@
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline JSValue jsTestObjAttrWithSetterExceptionGetter(ExecState*, JSTestObj*, ThrowScope&amp; throwScope);
</del><ins>+static inline JSValue jsTestObjAttributeWithSetterExceptionGetter(ExecState*, JSTestObj*, ThrowScope&amp; throwScope);
</ins><span class="cx"> 
</span><del>-EncodedJSValue jsTestObjAttrWithSetterException(ExecState* state, EncodedJSValue thisValue, PropertyName)
</del><ins>+EncodedJSValue jsTestObjAttributeWithSetterException(ExecState* state, EncodedJSValue thisValue, PropertyName)
</ins><span class="cx"> {
</span><del>-    return BindingCaller&lt;JSTestObj&gt;::attribute&lt;jsTestObjAttrWithSetterExceptionGetter&gt;(state, thisValue, &quot;attrWithSetterException&quot;);
</del><ins>+    return BindingCaller&lt;JSTestObj&gt;::attribute&lt;jsTestObjAttributeWithSetterExceptionGetter&gt;(state, thisValue, &quot;attributeWithSetterException&quot;);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline JSValue jsTestObjAttrWithSetterExceptionGetter(ExecState* state, JSTestObj* thisObject, ThrowScope&amp; throwScope)
</del><ins>+static inline JSValue jsTestObjAttributeWithSetterExceptionGetter(ExecState* state, JSTestObj* thisObject, ThrowScope&amp; throwScope)
</ins><span class="cx"> {
</span><span class="cx">     UNUSED_PARAM(throwScope);
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="cx">     auto&amp; impl = thisObject-&gt;wrapped();
</span><del>-    JSValue result = jsNumber(impl.attrWithSetterException());
</del><ins>+    JSValue result = jsNumber(impl.attributeWithSetterException());
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static inline JSValue jsTestObjAttributeWithSetterLegacyExceptionGetter(ExecState*, JSTestObj*, ThrowScope&amp; throwScope);
+
+EncodedJSValue jsTestObjAttributeWithSetterLegacyException(ExecState* state, EncodedJSValue thisValue, PropertyName)
+{
+    return BindingCaller&lt;JSTestObj&gt;::attribute&lt;jsTestObjAttributeWithSetterLegacyExceptionGetter&gt;(state, thisValue, &quot;attributeWithSetterLegacyException&quot;);
+}
+
+static inline JSValue jsTestObjAttributeWithSetterLegacyExceptionGetter(ExecState* state, JSTestObj* thisObject, ThrowScope&amp; throwScope)
+{
+    UNUSED_PARAM(throwScope);
+    UNUSED_PARAM(state);
+    auto&amp; impl = thisObject-&gt;wrapped();
+    JSValue result = jsNumber(impl.attributeWithSetterLegacyException());
+    return result;
+}
+
</ins><span class="cx"> static inline JSValue jsTestObjAttrWithSetterExceptionWithMessageGetter(ExecState*, JSTestObj*, ThrowScope&amp; throwScope);
</span><span class="cx"> 
</span><span class="cx"> EncodedJSValue jsTestObjAttrWithSetterExceptionWithMessage(ExecState* state, EncodedJSValue thisValue, PropertyName)
</span><span class="lines">@@ -3228,9 +3271,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;TestSubObjEnabledBySetting&quot;);
</span><del>-    }
</del><span class="cx">     // Shadowing a built-in constructor.
</span><span class="cx">     return castedThis-&gt;putDirect(state-&gt;vm(), Identifier::fromString(state, &quot;TestSubObjEnabledBySetting&quot;), value);
</span><span class="cx"> }
</span><span class="lines">@@ -3244,9 +3286,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;enumAttr&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = parse&lt;TestObj::EnumType&gt;(*state, value);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -3265,9 +3306,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;byteAttr&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = convert&lt;int8_t&gt;(*state, value, NormalConversion);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -3284,9 +3324,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;octetAttr&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = convert&lt;uint8_t&gt;(*state, value, NormalConversion);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -3303,9 +3342,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;shortAttr&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = convert&lt;int16_t&gt;(*state, value, NormalConversion);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -3322,9 +3360,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;clampedShortAttr&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = convert&lt;int16_t&gt;(*state, value, Clamp);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -3341,9 +3378,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;enforceRangeShortAttr&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = convert&lt;int16_t&gt;(*state, value, EnforceRange);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -3360,9 +3396,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;unsignedShortAttr&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = convert&lt;uint16_t&gt;(*state, value, NormalConversion);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -3379,9 +3414,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;longAttr&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = convert&lt;int32_t&gt;(*state, value, NormalConversion);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -3398,9 +3432,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;longLongAttr&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = convert&lt;int64_t&gt;(*state, value, NormalConversion);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -3417,9 +3450,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;unsignedLongLongAttr&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = convert&lt;uint64_t&gt;(*state, value, NormalConversion);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -3436,9 +3468,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;stringAttr&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = value.toWTFString(state);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -3455,9 +3486,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;usvstringAttr&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = valueToUSVString(state, value);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -3474,9 +3504,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;testObjAttr&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = JSTestObj::toWrapped(value);
</span><span class="cx">     if (UNLIKELY(!nativeValue)) {
</span><span class="lines">@@ -3496,9 +3525,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;testNullableObjAttr&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     TestObj* nativeValue = nullptr;
</span><span class="cx">     if (!value.isUndefinedOrNull()) {
</span><span class="lines">@@ -3521,9 +3549,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return false;
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = JSTestObj::toWrapped(value);
</span><span class="cx">     if (UNLIKELY(!nativeValue)) {
</span><span class="lines">@@ -3543,9 +3570,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;stringAttrTreatingNullAsEmptyString&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = valueToStringTreatingNullAsEmptyString(state, value);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -3562,9 +3588,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;usvstringAttrTreatingNullAsEmptyString&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = valueToUSVStringTreatingNullAsEmptyString(state, value);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -3581,9 +3606,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;implementationEnumAttr&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = parse&lt;AlternateEnumName&gt;(*state, value);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -3602,9 +3626,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;XMLObjAttr&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = JSTestObj::toWrapped(value);
</span><span class="cx">     if (UNLIKELY(!nativeValue)) {
</span><span class="lines">@@ -3624,9 +3647,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;create&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = value.toBoolean(state);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -3643,9 +3665,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;reflectedStringAttr&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = value.toWTFString(state);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -3662,9 +3683,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;reflectedUSVStringAttr&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = valueToUSVString(state, value);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -3681,9 +3701,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;reflectedIntegralAttr&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = convert&lt;int32_t&gt;(*state, value, NormalConversion);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -3700,9 +3719,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;reflectedUnsignedIntegralAttr&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = convert&lt;uint32_t&gt;(*state, value, NormalConversion);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -3719,9 +3737,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;reflectedBooleanAttr&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = value.toBoolean(state);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -3738,9 +3755,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;reflectedURLAttr&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = value.toWTFString(state);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -3757,9 +3773,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;reflectedUSVURLAttr&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = valueToUSVString(state, value);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -3776,9 +3791,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;reflectedStringAttr&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = value.toWTFString(state);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -3795,9 +3809,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;reflectedCustomIntegralAttr&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = convert&lt;int32_t&gt;(*state, value, NormalConversion);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -3814,9 +3827,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;reflectedCustomBooleanAttr&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = value.toBoolean(state);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -3833,9 +3845,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;reflectedCustomURLAttr&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = value.toWTFString(state);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -3853,9 +3864,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;enabledAtRuntimeAttribute&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = value.toWTFString(state);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -3873,9 +3883,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;typedArrayAttr&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = toFloat32Array(value);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -3888,7 +3897,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-bool setJSTestObjAttrWithGetterException(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
</del><ins>+bool setJSTestObjAttributeWithGetterException(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
</ins><span class="cx"> {
</span><span class="cx">     VM&amp; vm = state-&gt;vm();
</span><span class="cx">     auto throwScope = DECLARE_THROW_SCOPE(vm);
</span><span class="lines">@@ -3896,17 +3905,34 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
-        return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;attrWithGetterException&quot;);
-    }
</del><ins>+    if (UNLIKELY(!castedThis))
+        return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;attributeWithGetterException&quot;);
</ins><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = convert&lt;int32_t&gt;(*state, value, NormalConversion);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><del>-    impl.setAttrWithGetterException(WTFMove(nativeValue));
</del><ins>+    impl.setAttributeWithGetterException(WTFMove(nativeValue));
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+bool setJSTestObjAttributeWithGetterLegacyException(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
+{
+    VM&amp; vm = state-&gt;vm();
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    UNUSED_PARAM(throwScope);
+    JSValue value = JSValue::decode(encodedValue);
+    UNUSED_PARAM(thisValue);
+    JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
+    if (UNLIKELY(!castedThis))
+        return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;attributeWithGetterLegacyException&quot;);
+    auto&amp; impl = castedThis-&gt;wrapped();
+    auto nativeValue = convert&lt;int32_t&gt;(*state, value, NormalConversion);
+    RETURN_IF_EXCEPTION(throwScope, false);
+    impl.setAttributeWithGetterLegacyException(WTFMove(nativeValue));
+    return true;
+}
+
+
</ins><span class="cx"> bool setJSTestObjAttrWithGetterExceptionWithMessage(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
</span><span class="cx"> {
</span><span class="cx">     VM&amp; vm = state-&gt;vm();
</span><span class="lines">@@ -3915,9 +3941,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;attrWithGetterExceptionWithMessage&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = convert&lt;int32_t&gt;(*state, value, NormalConversion);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -3926,7 +3951,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-bool setJSTestObjAttrWithSetterException(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
</del><ins>+bool setJSTestObjAttributeWithSetterException(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
</ins><span class="cx"> {
</span><span class="cx">     VM&amp; vm = state-&gt;vm();
</span><span class="cx">     auto throwScope = DECLARE_THROW_SCOPE(vm);
</span><span class="lines">@@ -3934,14 +3959,31 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
-        return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;attrWithSetterException&quot;);
-    }
</del><ins>+    if (UNLIKELY(!castedThis))
+        return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;attributeWithSetterException&quot;);
</ins><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><ins>+    auto nativeValue = convert&lt;int32_t&gt;(*state, value, NormalConversion);
+    RETURN_IF_EXCEPTION(throwScope, false);
+    propagateException(*state, throwScope, impl.setAttributeWithSetterException(WTFMove(nativeValue)));
+    return true;
+}
+
+
+bool setJSTestObjAttributeWithSetterLegacyException(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
+{
+    VM&amp; vm = state-&gt;vm();
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    UNUSED_PARAM(throwScope);
+    JSValue value = JSValue::decode(encodedValue);
+    UNUSED_PARAM(thisValue);
+    JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
+    if (UNLIKELY(!castedThis))
+        return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;attributeWithSetterLegacyException&quot;);
+    auto&amp; impl = castedThis-&gt;wrapped();
</ins><span class="cx">     ExceptionCode ec = 0;
</span><span class="cx">     auto nativeValue = convert&lt;int32_t&gt;(*state, value, NormalConversion);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><del>-    impl.setAttrWithSetterException(WTFMove(nativeValue), ec);
</del><ins>+    impl.setAttributeWithSetterLegacyException(WTFMove(nativeValue), ec);
</ins><span class="cx">     setDOMException(state, throwScope, ec);
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="lines">@@ -3955,9 +3997,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;attrWithSetterExceptionWithMessage&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     ExceptionCodeWithMessage ec;
</span><span class="cx">     auto nativeValue = convert&lt;int32_t&gt;(*state, value, NormalConversion);
</span><span class="lines">@@ -3976,9 +4017,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;stringAttrWithGetterException&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = value.toWTFString(state);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -3995,9 +4035,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;stringAttrWithSetterException&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     ExceptionCode ec = 0;
</span><span class="cx">     auto nativeValue = value.toWTFString(state);
</span><span class="lines">@@ -4016,9 +4055,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;customAttr&quot;);
</span><del>-    }
</del><span class="cx">     castedThis-&gt;setCustomAttr(*state, value);
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="lines">@@ -4032,9 +4070,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;onfoo&quot;);
</span><del>-    }
</del><span class="cx">     setEventHandlerAttribute(*state, *castedThis, castedThis-&gt;wrapped(), eventNames().fooEvent, value);
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="lines">@@ -4048,9 +4085,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;onwebkitfoo&quot;);
</span><del>-    }
</del><span class="cx">     setEventHandlerAttribute(*state, *castedThis, castedThis-&gt;wrapped(), eventNames().fooEvent, value);
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="lines">@@ -4064,9 +4100,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;withScriptStateAttribute&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = convert&lt;int32_t&gt;(*state, value, NormalConversion);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -4083,9 +4118,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;withCallWithAndSetterCallWithAttribute&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = convert&lt;int32_t&gt;(*state, value, NormalConversion);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -4102,9 +4136,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;withScriptExecutionContextAttribute&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = JSTestObj::toWrapped(value);
</span><span class="cx">     if (UNLIKELY(!nativeValue)) {
</span><span class="lines">@@ -4127,9 +4160,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;withScriptStateAttributeRaises&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = JSTestObj::toWrapped(value);
</span><span class="cx">     if (UNLIKELY(!nativeValue)) {
</span><span class="lines">@@ -4149,9 +4181,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;withScriptExecutionContextAttributeRaises&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = JSTestObj::toWrapped(value);
</span><span class="cx">     if (UNLIKELY(!nativeValue)) {
</span><span class="lines">@@ -4174,9 +4205,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;withScriptExecutionContextAndScriptStateAttribute&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = JSTestObj::toWrapped(value);
</span><span class="cx">     if (UNLIKELY(!nativeValue)) {
</span><span class="lines">@@ -4199,9 +4229,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;withScriptExecutionContextAndScriptStateAttributeRaises&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = JSTestObj::toWrapped(value);
</span><span class="cx">     if (UNLIKELY(!nativeValue)) {
</span><span class="lines">@@ -4224,9 +4253,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;withScriptExecutionContextAndScriptStateWithSpacesAttribute&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = JSTestObj::toWrapped(value);
</span><span class="cx">     if (UNLIKELY(!nativeValue)) {
</span><span class="lines">@@ -4249,9 +4277,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;withScriptArgumentsAndCallStackAttribute&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = JSTestObj::toWrapped(value);
</span><span class="cx">     if (UNLIKELY(!nativeValue)) {
</span><span class="lines">@@ -4272,9 +4299,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;conditionalAttr1&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = convert&lt;int32_t&gt;(*state, value, NormalConversion);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -4293,9 +4319,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;conditionalAttr2&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = convert&lt;int32_t&gt;(*state, value, NormalConversion);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -4314,9 +4339,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;conditionalAttr3&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = convert&lt;int32_t&gt;(*state, value, NormalConversion);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -4335,9 +4359,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;conditionalAttr4&quot;);
</span><del>-    }
</del><span class="cx">     // Shadowing a built-in constructor.
</span><span class="cx">     return castedThis-&gt;putDirect(state-&gt;vm(), Identifier::fromString(state, &quot;conditionalAttr4&quot;), value);
</span><span class="cx"> }
</span><span class="lines">@@ -4353,9 +4376,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;conditionalAttr5&quot;);
</span><del>-    }
</del><span class="cx">     // Shadowing a built-in constructor.
</span><span class="cx">     return castedThis-&gt;putDirect(state-&gt;vm(), Identifier::fromString(state, &quot;conditionalAttr5&quot;), value);
</span><span class="cx"> }
</span><span class="lines">@@ -4371,9 +4393,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;conditionalAttr6&quot;);
</span><del>-    }
</del><span class="cx">     // Shadowing a built-in constructor.
</span><span class="cx">     return castedThis-&gt;putDirect(state-&gt;vm(), Identifier::fromString(state, &quot;conditionalAttr6&quot;), value);
</span><span class="cx"> }
</span><span class="lines">@@ -4388,9 +4409,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;anyAttribute&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = value;
</span><span class="cx">     impl.setAnyAttribute(WTFMove(nativeValue));
</span><span class="lines">@@ -4406,9 +4426,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;mutablePoint&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     SVGPropertyTearOff&lt;SVGPoint&gt;* nativeValue = nullptr;
</span><span class="cx">     if (!value.isUndefinedOrNull()) {
</span><span class="lines">@@ -4431,9 +4450,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;immutablePoint&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     SVGPropertyTearOff&lt;SVGPoint&gt;* nativeValue = nullptr;
</span><span class="cx">     if (!value.isUndefinedOrNull()) {
</span><span class="lines">@@ -4456,9 +4474,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;strawberry&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = convert&lt;int32_t&gt;(*state, value, NormalConversion);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -4475,9 +4492,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;id&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = convert&lt;int32_t&gt;(*state, value, NormalConversion);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -4494,9 +4510,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;replaceableAttribute&quot;);
</span><del>-    }
</del><span class="cx">     // Shadowing a built-in property.
</span><span class="cx">     return castedThis-&gt;putDirect(state-&gt;vm(), Identifier::fromString(state, &quot;replaceableAttribute&quot;), value);
</span><span class="cx"> }
</span><span class="lines">@@ -4510,9 +4525,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;nullableLongSettableAttribute&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = convert&lt;int32_t&gt;(*state, value, NormalConversion);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -4529,9 +4543,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;nullableStringSettableAttribute&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = valueToStringWithUndefinedOrNullCheck(state, value);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -4548,9 +4561,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;nullableUSVStringSettableAttribute&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = valueToUSVStringWithUndefinedOrNullCheck(state, value);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -4567,9 +4579,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;nullableStringValue&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = convert&lt;int32_t&gt;(*state, value, NormalConversion);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -4586,9 +4597,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;attributeWithReservedEnumType&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = parse&lt;TestObj::Optional&gt;(*state, value);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -4607,9 +4617,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;putForwardsAttribute&quot;);
</span><del>-    }
</del><span class="cx">     Ref&lt;TestNode&gt; forwardedImpl = castedThis-&gt;wrapped().putForwardsAttribute();
</span><span class="cx">     auto&amp; impl = forwardedImpl.get();
</span><span class="cx">     auto nativeValue = value.toWTFString(state);
</span><span class="lines">@@ -4627,9 +4636,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;putForwardsNullableAttribute&quot;);
</span><del>-    }
</del><span class="cx">     RefPtr&lt;TestNode&gt; forwardedImpl = castedThis-&gt;wrapped().putForwardsNullableAttribute();
</span><span class="cx">     if (!forwardedImpl)
</span><span class="cx">         return false;
</span><span class="lines">@@ -4649,9 +4657,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;stringifierAttribute&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = valueToUSVString(state, value);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -5092,9 +5099,9 @@
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto enumArgValue = state-&gt;argument(0);
</span><span class="cx">     TestObj::EnumType enumArg;
</span><del>-    if (enumArgValue.isUndefined()) {
</del><ins>+    if (enumArgValue.isUndefined())
</ins><span class="cx">         enumArg = TestObj::EnumType::EnumValue1;
</span><del>-    } else {
</del><ins>+    else {
</ins><span class="cx">         auto optionalValue = parse&lt;TestObj::EnumType&gt;(*state, enumArgValue);
</span><span class="cx">         RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><span class="cx">         if (UNLIKELY(!optionalValue))
</span><span class="lines">@@ -5236,8 +5243,53 @@
</span><span class="cx">         return throwThisTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;methodWithException&quot;);
</span><span class="cx">     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><ins>+    propagateException(*state, throwScope, impl.methodWithException());
+    return JSValue::encode(jsUndefined());
+}
+
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithExceptionReturningLong(ExecState* state)
+{
+    VM&amp; vm = state-&gt;vm();
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    UNUSED_PARAM(throwScope);
+    JSValue thisValue = state-&gt;thisValue();
+    auto castedThis = jsDynamicCast&lt;JSTestObj*&gt;(thisValue);
+    if (UNLIKELY(!castedThis))
+        return throwThisTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;methodWithExceptionReturningLong&quot;);
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+    auto&amp; impl = castedThis-&gt;wrapped();
+    JSValue result = toJSNumber(*state, throwScope, impl.methodWithExceptionReturningLong());
+    return JSValue::encode(result);
+}
+
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithExceptionReturningObject(ExecState* state)
+{
+    VM&amp; vm = state-&gt;vm();
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    UNUSED_PARAM(throwScope);
+    JSValue thisValue = state-&gt;thisValue();
+    auto castedThis = jsDynamicCast&lt;JSTestObj*&gt;(thisValue);
+    if (UNLIKELY(!castedThis))
+        return throwThisTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;methodWithExceptionReturningObject&quot;);
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+    auto&amp; impl = castedThis-&gt;wrapped();
+    JSValue result = toJS(*state, *castedThis-&gt;globalObject(), throwScope, impl.methodWithExceptionReturningObject());
+    return JSValue::encode(result);
+}
+
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithLegacyException(ExecState* state)
+{
+    VM&amp; vm = state-&gt;vm();
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    UNUSED_PARAM(throwScope);
+    JSValue thisValue = state-&gt;thisValue();
+    auto castedThis = jsDynamicCast&lt;JSTestObj*&gt;(thisValue);
+    if (UNLIKELY(!castedThis))
+        return throwThisTypeError(*state, throwScope, &quot;TestObject&quot;, &quot;methodWithLegacyException&quot;);
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+    auto&amp; impl = castedThis-&gt;wrapped();
</ins><span class="cx">     ExceptionCode ec = 0;
</span><del>-    impl.methodWithException(ec);
</del><ins>+    impl.methodWithLegacyException(ec);
</ins><span class="cx">     setDOMException(state, throwScope, ec);
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="lines">@@ -7596,9 +7648,8 @@
</span><span class="cx">     auto castedThis = jsDynamicCast&lt;JSTestObj*&gt;(thisValue);
</span><span class="cx">     VM&amp; vm = state-&gt;vm();
</span><span class="cx">     auto throwScope = DECLARE_THROW_SCOPE(vm);
</span><del>-    if (UNLIKELY(!castedThis)){
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwThisTypeError(*state, throwScope, &quot;TestObj&quot;, &quot;toJSON&quot;);
</span><del>-    }
</del><span class="cx">     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
</span><span class="cx"> 
</span><span class="cx">     auto* result = constructEmptyObject(state);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestSerializedScriptValueInterfacecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -255,9 +255,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestSerializedScriptValueInterface* castedThis = jsDynamicCast&lt;JSTestSerializedScriptValueInterface*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestSerializedScriptValueInterface&quot;, &quot;value&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = SerializedScriptValue::create(state, value, 0, 0);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -274,9 +273,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestSerializedScriptValueInterface* castedThis = jsDynamicCast&lt;JSTestSerializedScriptValueInterface*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestSerializedScriptValueInterface&quot;, &quot;cachedValue&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = SerializedScriptValue::create(state, value, 0, 0);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestTypedefscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -361,9 +361,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestTypedefs* castedThis = jsDynamicCast&lt;JSTestTypedefs*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestTypedefs&quot;, &quot;unsignedLongLongAttr&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = convert&lt;uint64_t&gt;(*state, value, NormalConversion);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -380,9 +379,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestTypedefs* castedThis = jsDynamicCast&lt;JSTestTypedefs*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestTypedefs&quot;, &quot;immutableSerializedScriptValue&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = SerializedScriptValue::create(state, value, 0, 0);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -399,9 +397,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestTypedefs* castedThis = jsDynamicCast&lt;JSTestTypedefs*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestTypedefs&quot;, &quot;attrWithGetterException&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = convert&lt;int32_t&gt;(*state, value, NormalConversion);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -418,9 +415,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestTypedefs* castedThis = jsDynamicCast&lt;JSTestTypedefs*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestTypedefs&quot;, &quot;attrWithSetterException&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     ExceptionCode ec = 0;
</span><span class="cx">     auto nativeValue = convert&lt;int32_t&gt;(*state, value, NormalConversion);
</span><span class="lines">@@ -439,9 +435,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestTypedefs* castedThis = jsDynamicCast&lt;JSTestTypedefs*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestTypedefs&quot;, &quot;stringAttrWithGetterException&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     auto nativeValue = value.toWTFString(state);
</span><span class="cx">     RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="lines">@@ -458,9 +453,8 @@
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span><span class="cx">     UNUSED_PARAM(thisValue);
</span><span class="cx">     JSTestTypedefs* castedThis = jsDynamicCast&lt;JSTestTypedefs*&gt;(JSValue::decode(thisValue));
</span><del>-    if (UNLIKELY(!castedThis)) {
</del><ins>+    if (UNLIKELY(!castedThis))
</ins><span class="cx">         return throwSetterTypeError(*state, throwScope, &quot;TestTypedefs&quot;, &quot;stringAttrWithSetterException&quot;);
</span><del>-    }
</del><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><span class="cx">     ExceptionCode ec = 0;
</span><span class="cx">     auto nativeValue = value.toWTFString(state);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestTestObjidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -115,14 +115,14 @@
</span><span class="cx">     [EnabledAtRuntime=DOMIterator] iterable&lt;DOMString&gt;;
</span><span class="cx"> 
</span><span class="cx">     // Methods
</span><del>-    [Unscopable] void    voidMethod();
-    void    voidMethodWithArgs(long longArg, DOMString strArg, TestObj objArg);
-    byte    byteMethod();
-    byte    byteMethodWithArgs(byte byteArg, DOMString strArg, TestObj objArg);
-    octet   octetMethod();
-    octet   octetMethodWithArgs(octet octetArg, DOMString strArg, TestObj objArg);
-    long    longMethod();
-    long    longMethodWithArgs(long longArg, DOMString strArg, TestObj objArg);
</del><ins>+    [Unscopable] void voidMethod();
+    void voidMethodWithArgs(long longArg, DOMString strArg, TestObj objArg);
+    byte byteMethod();
+    byte byteMethodWithArgs(byte byteArg, DOMString strArg, TestObj objArg);
+    octet octetMethod();
+    octet octetMethodWithArgs(octet octetArg, DOMString strArg, TestObj objArg);
+    long longMethod();
+    long longMethodWithArgs(long longArg, DOMString strArg, TestObj objArg);
</ins><span class="cx">     TestObj objMethod();
</span><span class="cx">     TestObj objMethodWithArgs(long longArg, DOMString strArg, TestObj objArg);
</span><span class="cx">     [Unforgeable] long unforgeableMethod();
</span><span class="lines">@@ -149,11 +149,16 @@
</span><span class="cx">     void optionsObject(Dictionary oo, optional Dictionary ooo);
</span><span class="cx"> 
</span><span class="cx">     // Exceptions
</span><del>-    [MayThrowLegacyException] void methodWithException();
</del><ins>+    [MayThrowException] void methodWithException();
+    [MayThrowException] long methodWithExceptionReturningLong();
+    [MayThrowException] TestObj methodWithExceptionReturningObject();
+    [MayThrowLegacyException] void methodWithLegacyException();
</ins><span class="cx">     [MayThrowLegacyExceptionWithMessage] void methodWithExceptionWithMessage();
</span><del>-    [GetterMayThrowLegacyException] attribute long attrWithGetterException;
</del><ins>+    [GetterMayThrowException] attribute long attributeWithGetterException;
+    [GetterMayThrowLegacyException] attribute long attributeWithGetterLegacyException;
</ins><span class="cx">     [GetterMayThrowLegacyExceptionWithMessage] attribute long attrWithGetterExceptionWithMessage;
</span><del>-    [SetterMayThrowLegacyException] attribute long attrWithSetterException;
</del><ins>+    [SetterMayThrowException] attribute long attributeWithSetterException;
+    [SetterMayThrowLegacyException] attribute long attributeWithSetterLegacyException;
</ins><span class="cx">     [SetterMayThrowLegacyExceptionWithMessage] attribute long attrWithSetterExceptionWithMessage;
</span><span class="cx">     [GetterMayThrowLegacyException] attribute DOMString stringAttrWithGetterException;
</span><span class="cx">     [SetterMayThrowLegacyException] attribute DOMString stringAttrWithSetterException;
</span></span></pre></div>
<a id="trunkSourceWebCoredomDOMImplementationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DOMImplementation.cpp (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/DOMImplementation.cpp        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/dom/DOMImplementation.cpp        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -97,7 +97,7 @@
</span><span class="cx">     String localName;
</span><span class="cx">     Document::parseQualifiedName(qualifiedName, prefix, localName, ec);
</span><span class="cx">     if (ec)
</span><del>-        return Exception(ec);
</del><ins>+        return Exception { ec };
</ins><span class="cx"> 
</span><span class="cx">     return DocumentType::create(m_document, qualifiedName, publicId, systemId);
</span><span class="cx"> }
</span><span class="lines">@@ -122,7 +122,7 @@
</span><span class="cx">         ExceptionCode ec = 0;
</span><span class="cx">         documentElement = document-&gt;createElementNS(namespaceURI, qualifiedName, ec);
</span><span class="cx">         if (ec)
</span><del>-            return Exception(ec);
</del><ins>+            return Exception { ec };
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (documentType)
</span></span></pre></div>
<a id="trunkSourceWebCoredomDOMImplementationidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DOMImplementation.idl (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/DOMImplementation.idl        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/dom/DOMImplementation.idl        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -23,8 +23,8 @@
</span><span class="cx">     GenerateIsReachable=ImplDocument,
</span><span class="cx">     ImplementationLacksVTable,
</span><span class="cx"> ] interface DOMImplementation {
</span><del>-    [NewObject] DocumentType createDocumentType(DOMString qualifiedName, DOMString publicId, DOMString systemId);
-    [NewObject] XMLDocument createDocument(DOMString? namespaceURI, [TreatNullAs=EmptyString] DOMString qualifiedName, optional DocumentType? doctype = null);
</del><ins>+    [NewObject, MayThrowException] DocumentType createDocumentType(DOMString qualifiedName, DOMString publicId, DOMString systemId);
+    [NewObject, MayThrowException] XMLDocument createDocument(DOMString? namespaceURI, [TreatNullAs=EmptyString] DOMString qualifiedName, optional DocumentType? doctype = null);
</ins><span class="cx">     [NewObject] HTMLDocument createHTMLDocument(optional DOMString title);
</span><span class="cx"> 
</span><span class="cx">     boolean hasFeature();
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/dom/Document.cpp        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -564,6 +564,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(FULLSCREEN_API)
</span><ins>+
</ins><span class="cx"> static bool isAttributeOnAllOwners(const WebCore::QualifiedName&amp; attribute, const WebCore::QualifiedName&amp; prefixedAttribute, const HTMLFrameOwnerElement* owner)
</span><span class="cx"> {
</span><span class="cx">     if (!owner)
</span><span class="lines">@@ -574,14 +575,14 @@
</span><span class="cx">     } while ((owner = owner-&gt;document().ownerElement()));
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> Ref&lt;Document&gt; Document::create(Document&amp; contextDocument)
</span><span class="cx"> {
</span><del>-    Ref&lt;Document&gt; document = adoptRef(*new Document(nullptr, URL()));
</del><ins>+    auto document = adoptRef(*new Document(nullptr, URL()));
</ins><span class="cx">     document-&gt;setContextDocument(contextDocument);
</span><span class="cx">     document-&gt;setSecurityOriginPolicy(contextDocument.securityOriginPolicy());
</span><del>-
</del><span class="cx">     return document;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -867,6 +868,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CUSTOM_ELEMENTS)
</span><ins>+
</ins><span class="cx"> static ALWAYS_INLINE RefPtr&lt;HTMLElement&gt; createUpgradeCandidateElement(Document&amp; document, const QualifiedName&amp; name)
</span><span class="cx"> {
</span><span class="cx">     if (!RuntimeEnabledFeatures::sharedFeatures().customElementsEnabled())
</span><span class="lines">@@ -879,17 +881,17 @@
</span><span class="cx">     element-&gt;setIsCustomElementUpgradeCandidate();
</span><span class="cx">     return WTFMove(element);
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> static RefPtr&lt;Element&gt; createHTMLElementWithNameValidation(Document&amp; document, const AtomicString&amp; localName, ExceptionCode&amp; ec)
</span><span class="cx"> {
</span><del>-    RefPtr&lt;HTMLElement&gt; element = HTMLElementFactory::createKnownElement(localName, document);
</del><ins>+    auto element = HTMLElementFactory::createKnownElement(localName, document);
</ins><span class="cx">     if (LIKELY(element))
</span><span class="cx">         return element;
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CUSTOM_ELEMENTS)
</span><del>-    auto* window = document.domWindow();
-    if (window) {
</del><ins>+    if (auto* window = document.domWindow()) {
</ins><span class="cx">         auto* registry = window-&gt;customElementRegistry();
</span><span class="cx">         if (UNLIKELY(registry)) {
</span><span class="cx">             if (auto* elementInterface = registry-&gt;findInterface(localName))
</span><span class="lines">@@ -1071,8 +1073,7 @@
</span><span class="cx"> static Ref&lt;HTMLElement&gt; createFallbackHTMLElement(Document&amp; document, const QualifiedName&amp; name)
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(CUSTOM_ELEMENTS)
</span><del>-    auto* window = document.domWindow();
-    if (window) {
</del><ins>+    if (auto* window = document.domWindow()) {
</ins><span class="cx">         auto* registry = window-&gt;customElementRegistry();
</span><span class="cx">         if (UNLIKELY(registry)) {
</span><span class="cx">             if (auto* elementInterface = registry-&gt;findInterface(name)) {
</span><span class="lines">@@ -1151,13 +1152,16 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CSS_GRID_LAYOUT)
</span><ins>+
</ins><span class="cx"> bool Document::isCSSGridLayoutEnabled() const
</span><span class="cx"> {
</span><span class="cx">     return RuntimeEnabledFeatures::sharedFeatures().isCSSGridLayoutEnabled();
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CSS_REGIONS)
</span><ins>+
</ins><span class="cx"> RefPtr&lt;DOMNamedFlowCollection&gt; Document::webkitGetNamedFlows()
</span><span class="cx"> {
</span><span class="cx">     if (!renderView())
</span><span class="lines">@@ -1167,6 +1171,7 @@
</span><span class="cx"> 
</span><span class="cx">     return namedFlows().createCSSOMSnapshot();
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> NamedFlowCollection&amp; Document::namedFlows()
</span><span class="lines">@@ -1665,8 +1670,8 @@
</span><span class="cx">     return pageVisibilityState() != PageVisibilityStateVisible;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(VIDEO)
</ins><span class="cx"> 
</span><del>-#if ENABLE(VIDEO)
</del><span class="cx"> void Document::registerForAllowsMediaDocumentInlinePlaybackChangedCallbacks(HTMLMediaElement&amp; element)
</span><span class="cx"> {
</span><span class="cx">     m_allowsMediaDocumentInlinePlaybackElements.add(&amp;element);
</span><span class="lines">@@ -1682,6 +1687,7 @@
</span><span class="cx">     for (auto* element : m_allowsMediaDocumentInlinePlaybackElements)
</span><span class="cx">         element-&gt;allowsMediaDocumentInlinePlaybackChanged();
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> String Document::nodeName() const
</span><span class="lines">@@ -2976,6 +2982,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><ins>+
</ins><span class="cx"> IDBClient::IDBConnectionProxy* Document::idbConnectionProxy()
</span><span class="cx"> {
</span><span class="cx">     if (!m_idbConnectionProxy) {
</span><span class="lines">@@ -2982,19 +2989,20 @@
</span><span class="cx">         Page* currentPage = page();
</span><span class="cx">         if (!currentPage)
</span><span class="cx">             return nullptr;
</span><del>-
</del><span class="cx">         m_idbConnectionProxy = &amp;currentPage-&gt;idbConnection().proxy();
</span><span class="cx">     }
</span><del>-
</del><span class="cx">     return m_idbConnectionProxy.get();
</span><span class="cx"> }
</span><del>-#endif // ENABLE(INDEXED_DATABASE)
</del><span class="cx"> 
</span><ins>+#endif
+
</ins><span class="cx"> #if ENABLE(WEB_SOCKETS)
</span><ins>+
</ins><span class="cx"> SocketProvider* Document::socketProvider()
</span><span class="cx"> {
</span><span class="cx">     return m_socketProvider.get();
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif
</span><span class="cx">     
</span><span class="cx"> bool Document::canNavigate(Frame* targetFrame)
</span><span class="lines">@@ -3596,6 +3604,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(DASHBOARD_SUPPORT)
</span><ins>+
</ins><span class="cx"> const Vector&lt;AnnotatedRegionValue&gt;&amp; Document::annotatedRegions() const
</span><span class="cx"> {
</span><span class="cx">     return m_annotatedRegions;
</span><span class="lines">@@ -3606,6 +3615,7 @@
</span><span class="cx">     m_annotatedRegions = regions;
</span><span class="cx">     setAnnotatedRegionsDirty(false);
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> bool Document::setFocusedElement(Element* element, FocusDirection direction, FocusRemovalEventsMode eventsMode)
</span><span class="lines">@@ -4366,7 +4376,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // http://www.whatwg.org/specs/web-apps/current-work/#dom-document-lastmodified
</span><del>-String Document::lastModified() const
</del><ins>+String Document::lastModified()
</ins><span class="cx"> {
</span><span class="cx">     using namespace std::chrono;
</span><span class="cx">     Optional&lt;system_clock::time_point&gt; dateTime;
</span><span class="lines">@@ -4379,11 +4389,11 @@
</span><span class="cx">     if (!dateTime) {
</span><span class="cx">         dateTime = system_clock::now();
</span><span class="cx"> #if ENABLE(WEB_REPLAY)
</span><del>-        InputCursor&amp; cursor = inputCursor();
</del><ins>+        auto&amp; cursor = inputCursor();
</ins><span class="cx">         if (cursor.isCapturing())
</span><span class="cx">             cursor.appendInput&lt;DocumentLastModifiedDate&gt;(duration_cast&lt;milliseconds&gt;(dateTime.value().time_since_epoch()).count());
</span><span class="cx">         else if (cursor.isReplaying()) {
</span><del>-            if (DocumentLastModifiedDate* input = cursor.fetchInput&lt;DocumentLastModifiedDate&gt;())
</del><ins>+            if (auto* input = cursor.fetchInput&lt;DocumentLastModifiedDate&gt;())
</ins><span class="cx">                 dateTime = system_clock::time_point(milliseconds(static_cast&lt;long long&gt;(input-&gt;fallbackValue())));
</span><span class="cx">         }
</span><span class="cx"> #endif
</span><span class="lines">@@ -4713,6 +4723,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><ins>+
</ins><span class="cx"> void Document::registerForCaptionPreferencesChangedCallbacks(Element* e)
</span><span class="cx"> {
</span><span class="cx">     if (page())
</span><span class="lines">@@ -4731,9 +4742,11 @@
</span><span class="cx">     for (auto* element : m_captionPreferencesChangedElements)
</span><span class="cx">         element-&gt;captionPreferencesChanged();
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(MEDIA_CONTROLS_SCRIPT)
</span><ins>+
</ins><span class="cx"> void Document::registerForPageScaleFactorChangedCallbacks(HTMLMediaElement* element)
</span><span class="cx"> {
</span><span class="cx">     m_pageScaleFactorChangedElements.add(element);
</span><span class="lines">@@ -4765,6 +4778,7 @@
</span><span class="cx">     for (auto* mediaElement : m_userInterfaceLayoutDirectionChangedElements)
</span><span class="cx">         mediaElement-&gt;userInterfaceLayoutDirectionChanged();
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> void Document::setShouldCreateRenderers(bool f)
</span><span class="lines">@@ -5074,7 +5088,9 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(TELEPHONE_NUMBER_DETECTION)
</span><del>-// FIXME: Find a better place for this functionality.
</del><ins>+
+// FIXME: Find a better place for this code.
+
</ins><span class="cx"> bool Document::isTelephoneNumberParsingEnabled() const
</span><span class="cx"> {
</span><span class="cx">     Settings* settings = this-&gt;settings();
</span><span class="lines">@@ -5090,6 +5106,7 @@
</span><span class="cx"> {
</span><span class="cx">     return m_isTelephoneNumberParsingAllowed;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> RefPtr&lt;XPathExpression&gt; Document::createExpression(const String&amp; expression, RefPtr&lt;XPathNSResolver&gt;&amp;&amp; resolver, ExceptionCode&amp; ec)
</span><span class="lines">@@ -5565,6 +5582,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(DEVICE_ORIENTATION) &amp;&amp; PLATFORM(IOS)
</span><ins>+
</ins><span class="cx"> DeviceMotionController* Document::deviceMotionController() const
</span><span class="cx"> {
</span><span class="cx">     return m_deviceMotionController.get();
</span><span class="lines">@@ -5574,9 +5592,11 @@
</span><span class="cx"> {
</span><span class="cx">     return m_deviceOrientationController.get();
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(FULLSCREEN_API)
</span><ins>+
</ins><span class="cx"> bool Document::fullScreenIsAllowedForElement(Element* element) const
</span><span class="cx"> {
</span><span class="cx">     ASSERT(element);
</span><span class="lines">@@ -6035,30 +6055,34 @@
</span><span class="cx">         target = doc;
</span><span class="cx">     m_fullScreenChangeEventTargetQueue.append(target);
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(POINTER_LOCK)
</span><ins>+
</ins><span class="cx"> void Document::exitPointerLock()
</span><span class="cx"> {
</span><del>-    if (!page())
</del><ins>+    Page* page = this&gt;page();
+    if (!page)
</ins><span class="cx">         return;
</span><del>-    if (Element* target = page()-&gt;pointerLockController().element()) {
</del><ins>+    if (auto* target = page-&gt;pointerLockController().element()) {
</ins><span class="cx">         if (&amp;target-&gt;document() != this)
</span><span class="cx">             return;
</span><span class="cx">     }
</span><del>-    page()-&gt;pointerLockController().requestPointerUnlock();
</del><ins>+    page-&gt;pointerLockController().requestPointerUnlock();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Element* Document::pointerLockElement() const
</span><span class="cx"> {
</span><del>-    if (!page() || page()-&gt;pointerLockController().lockPending())
</del><ins>+    Page* page = this&gt;page();
+    if (!page || page-&gt;pointerLockController().lockPending())
</ins><span class="cx">         return nullptr;
</span><del>-    if (Element* element = page()-&gt;pointerLockController().element()) {
-        if (&amp;element-&gt;document() == this)
-            return element;
-    }
-    return nullptr;
</del><ins>+    auto* element = page()-&gt;pointerLockController().element();
+    if (!element || &amp;element-&gt;document() != this)
+        return nullptr;
+    return element;
</ins><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> void Document::decrementLoadEventDelayCount()
</span><span class="lines">@@ -6083,6 +6107,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(REQUEST_ANIMATION_FRAME)
</span><ins>+
</ins><span class="cx"> int Document::requestAnimationFrame(PassRefPtr&lt;RequestAnimationFrameCallback&gt; callback)
</span><span class="cx"> {
</span><span class="cx">     if (!m_scriptedAnimationController) {
</span><span class="lines">@@ -6122,6 +6147,7 @@
</span><span class="cx">         m_scriptedAnimationController-&gt;clearDocumentPointer();
</span><span class="cx">     m_scriptedAnimationController = nullptr;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif
</span><span class="cx">     
</span><span class="cx"> void Document::sendWillRevealEdgeEventsIfNeeded(const IntPoint&amp; oldPosition, const IntPoint&amp; newPosition, const IntRect&amp; visibleRect, const IntSize&amp; contentsSize, Element* target)
</span><span class="lines">@@ -6195,8 +6221,8 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if !PLATFORM(IOS)
-#if ENABLE(TOUCH_EVENTS)
</del><ins>+#if ENABLE(TOUCH_EVENTS) &amp;&amp; !PLATFORM(IOS)
+
</ins><span class="cx"> RefPtr&lt;Touch&gt; Document::createTouch(DOMWindow* window, EventTarget* target, int identifier, int pageX, int pageY, int screenX, int screenY, int radiusX, int radiusY, float rotationAngle, float force, ExceptionCode&amp;) const
</span><span class="cx"> {
</span><span class="cx">     // FIXME: It's not clear from the documentation at
</span><span class="lines">@@ -6206,8 +6232,8 @@
</span><span class="cx">     Frame* frame = window ? window-&gt;frame() : this-&gt;frame();
</span><span class="cx">     return Touch::create(frame, target, identifier, screenX, screenY, pageX, pageY, radiusX, radiusY, rotationAngle, force);
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif
</span><del>-#endif // !PLATFORM(IOS)
</del><span class="cx"> 
</span><span class="cx"> void Document::wheelEventHandlersChanged()
</span><span class="cx"> {
</span><span class="lines">@@ -6446,6 +6472,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CSS_DEVICE_ADAPTATION)
</span><ins>+
</ins><span class="cx"> IntSize Document::initialViewportSize() const
</span><span class="cx"> {
</span><span class="cx">     if (!view())
</span><span class="lines">@@ -6452,6 +6479,7 @@
</span><span class="cx">         return IntSize();
</span><span class="cx">     return view()-&gt;initialViewportSize();
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> Element* eventTargetElementForDocument(Document* document)
</span><span class="lines">@@ -6759,6 +6787,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(SUBTLE_CRYPTO)
</span><ins>+
</ins><span class="cx"> bool Document::wrapCryptoKey(const Vector&lt;uint8_t&gt;&amp; key, Vector&lt;uint8_t&gt;&amp; wrappedKey)
</span><span class="cx"> {
</span><span class="cx">     Page* page = this-&gt;page();
</span><span class="lines">@@ -6774,6 +6803,7 @@
</span><span class="cx">         return false;
</span><span class="cx">     return page-&gt;chrome().client().unwrapCryptoKey(wrappedKey, key);
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif // ENABLE(SUBTLE_CRYPTO)
</span><span class="cx"> 
</span><span class="cx"> Element* Document::activeElement()
</span><span class="lines">@@ -6796,13 +6826,21 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(WEB_REPLAY)
</span><del>-void Document::setInputCursor(PassRefPtr&lt;InputCursor&gt; cursor)
</del><ins>+
+JSC::InputCursor&amp; Document::inputCursor()
</ins><span class="cx"> {
</span><ins>+    return m_inputCursor;
+}
+
+void Document::setInputCursor(Ref&lt;InputCursor&gt;&amp;&amp; cursor)
+{
</ins><span class="cx">     m_inputCursor = WTFMove(cursor);
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(WIRELESS_PLAYBACK_TARGET)
</span><ins>+
</ins><span class="cx"> static uint64_t nextPlaybackTargetClientContextId()
</span><span class="cx"> {
</span><span class="cx">     static uint64_t contextId = 0;
</span><span class="lines">@@ -6893,16 +6931,18 @@
</span><span class="cx"> 
</span><span class="cx">     it-&gt;value-&gt;setShouldPlayToPlaybackTarget(shouldPlay);
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif // ENABLE(WIRELESS_PLAYBACK_TARGET)
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(MEDIA_SESSION)
</span><ins>+
</ins><span class="cx"> MediaSession&amp; Document::defaultMediaSession()
</span><span class="cx"> {
</span><span class="cx">     if (!m_defaultMediaSession)
</span><span class="cx">         m_defaultMediaSession = MediaSession::create(*scriptExecutionContext());
</span><del>-
</del><span class="cx">     return *m_defaultMediaSession;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> ShouldOpenExternalURLsPolicy Document::shouldOpenExternalURLsPolicyToPropagate() const
</span><span class="lines">@@ -6962,4 +7002,9 @@
</span><span class="cx">         downcast&lt;HTMLHtmlElement&gt;(*documentElement).setDir(value);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+DOMSelection* Document::getSelection()
+{
+    return m_domWindow ? m_domWindow-&gt;getSelection() : nullptr;
+}
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.h (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.h        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/dom/Document.h        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -443,8 +443,8 @@
</span><span class="cx">     WEBCORE_EXPORT void setDocumentURI(const String&amp;);
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(WEB_REPLAY)
</span><del>-    JSC::InputCursor&amp; inputCursor() const { return *m_inputCursor; }
-    void setInputCursor(PassRefPtr&lt;JSC::InputCursor&gt;);
</del><ins>+    JSC::InputCursor&amp; inputCursor();
+    void setInputCursor(Ref&lt;JSC::InputCursor&gt;&amp;&amp;);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     void visibilityStateChanged();
</span><span class="lines">@@ -852,7 +852,7 @@
</span><span class="cx">     WEBCORE_EXPORT String domain() const;
</span><span class="cx">     void setDomain(const String&amp; newDomain, ExceptionCode&amp;);
</span><span class="cx"> 
</span><del>-    WEBCORE_EXPORT String lastModified() const;
</del><ins>+    WEBCORE_EXPORT String lastModified();
</ins><span class="cx"> 
</span><span class="cx">     // The cookieURL is used to query the cookie database for this document's
</span><span class="cx">     // cookies. For example, if the cookie URL is http://example.com, we'll
</span><span class="lines">@@ -1292,6 +1292,8 @@
</span><span class="cx">     using ContainerNode::setAttributeEventListener;
</span><span class="cx">     void setAttributeEventListener(const AtomicString&amp; eventType, const QualifiedName&amp; attributeName, const AtomicString&amp; value);
</span><span class="cx"> 
</span><ins>+    DOMSelection* getSelection();
+
</ins><span class="cx"> protected:
</span><span class="cx">     enum ConstructionFlags { Synthesized = 1, NonRenderedPlaceholder = 1 &lt;&lt; 1 };
</span><span class="cx">     Document(Frame*, const URL&amp;, unsigned = DefaultDocumentClass, unsigned constructionFlags = 0);
</span><span class="lines">@@ -1711,7 +1713,7 @@
</span><span class="cx">     Ref&lt;CSSFontSelector&gt; m_fontSelector;
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(WEB_REPLAY)
</span><del>-    RefPtr&lt;JSC::InputCursor&gt; m_inputCursor;
</del><ins>+    Ref&lt;JSC::InputCursor&gt; m_inputCursor;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     Timer m_didAssociateFormControlsTimer;
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.idl (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.idl        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/dom/Document.idl        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -32,7 +32,7 @@
</span><span class="cx">     readonly attribute Element? documentElement;
</span><span class="cx"> 
</span><span class="cx">     [NewObject, MayThrowLegacyException, ImplementedAs=createElementForBindings] Element createElement(DOMString tagName);
</span><del>-    [NewObject] DocumentFragment   createDocumentFragment();
</del><ins>+    [NewObject] DocumentFragment createDocumentFragment();
</ins><span class="cx"> 
</span><span class="cx">     [NewObject] Text createTextNode(DOMString data);
</span><span class="cx">     [NewObject] Comment createComment(DOMString data);
</span><span class="lines">@@ -63,12 +63,8 @@
</span><span class="cx"> 
</span><span class="cx">     [NewObject] Range createRange();
</span><span class="cx"> 
</span><del>-    [NewObject] NodeIterator createNodeIterator(Node root,
-        optional unsigned long whatToShow = 0xFFFFFFFF,
-        optional NodeFilter? filter = null);
-    [NewObject] TreeWalker createTreeWalker(Node root,
-        optional unsigned long whatToShow = 0xFFFFFFFF,
-        optional NodeFilter? filter = null);
</del><ins>+    [NewObject] NodeIterator createNodeIterator(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null);
+    [NewObject] TreeWalker createTreeWalker(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null);
</ins><span class="cx"> 
</span><span class="cx">     readonly attribute DOMWindow defaultView;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomExceptionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Exception.h (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Exception.h        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/dom/Exception.h        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -34,11 +34,11 @@
</span><span class="cx"> 
</span><span class="cx"> class Exception {
</span><span class="cx"> public:
</span><del>-    explicit Exception(ExceptionCode);
-    explicit Exception(ExceptionCode, const String&amp;);
</del><ins>+    explicit Exception(ExceptionCode, String&amp;&amp; = { });
</ins><span class="cx"> 
</span><span class="cx">     ExceptionCode code() const { return m_code; }
</span><span class="cx">     const String&amp; message() const { return m_message; }
</span><ins>+    String&amp;&amp; releaseMessage() { return WTFMove(m_message); }
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     ExceptionCode m_code;
</span><span class="lines">@@ -45,15 +45,11 @@
</span><span class="cx">     String m_message;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-inline Exception::Exception(ExceptionCode code)
</del><ins>+inline Exception::Exception(ExceptionCode code, String&amp;&amp; message)
</ins><span class="cx">     : m_code(code)
</span><ins>+    , m_message(WTFMove(message))
</ins><span class="cx"> {
</span><ins>+    ASSERT(code);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline Exception::Exception(ExceptionCode code, const String&amp; message)
-    : m_code(code)
-    , m_message(message)
-{
</del><span class="cx"> }
</span><del>-
-}
</del></span></pre></div>
<a id="trunkSourceWebCoredomExceptionOrh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ExceptionOr.h (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ExceptionOr.h        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/dom/ExceptionOr.h        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><span class="cx"> #include &quot;Exception.h&quot;
</span><ins>+#include &lt;wtf/Optional.h&gt;
</ins><span class="cx"> #include &lt;wtf/Variant.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -37,14 +38,25 @@
</span><span class="cx">     ExceptionOr(ReturnType&amp;&amp;);
</span><span class="cx"> 
</span><span class="cx">     bool hasException() const;
</span><del>-    ExceptionCode exceptionCode() const;
-    const String&amp; exceptionMessage() const;
-    ReturnType&amp;&amp; takeReturnValue();
</del><ins>+    Exception&amp;&amp; releaseException();
+    ReturnType&amp;&amp; releaseReturnValue();
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     std::experimental::variant&lt;Exception, ReturnType&gt; m_value;
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+template&lt;&gt; class ExceptionOr&lt;void&gt; {
+public:
+    ExceptionOr(Exception&amp;&amp;);
+    ExceptionOr() = default;
+
+    bool hasException() const;
+    Exception&amp;&amp; releaseException();
+
+private:
+    Optional&lt;Exception&gt; m_exception;
+};
+
</ins><span class="cx"> template&lt;typename ReturnType&gt; inline ExceptionOr&lt;ReturnType&gt;::ExceptionOr(Exception&amp;&amp; exception)
</span><span class="cx">     : m_value(WTFMove(exception))
</span><span class="cx"> {
</span><span class="lines">@@ -60,19 +72,29 @@
</span><span class="cx">     return std::experimental::holds_alternative&lt;Exception&gt;(m_value);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-template&lt;typename ReturnType&gt; inline ExceptionCode ExceptionOr&lt;ReturnType&gt;::exceptionCode() const
</del><ins>+template&lt;typename ReturnType&gt; inline Exception&amp;&amp; ExceptionOr&lt;ReturnType&gt;::releaseException()
</ins><span class="cx"> {
</span><del>-    return std::experimental::get&lt;Exception&gt;(m_value).code();
</del><ins>+    return std::experimental::get&lt;Exception&gt;(WTFMove(m_value));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-template&lt;typename ReturnType&gt; inline const String&amp; ExceptionOr&lt;ReturnType&gt;::exceptionMessage() const
</del><ins>+template&lt;typename ReturnType&gt; inline ReturnType&amp;&amp; ExceptionOr&lt;ReturnType&gt;::releaseReturnValue()
</ins><span class="cx"> {
</span><del>-    return std::experimental::get&lt;Exception&gt;(m_value).message();
</del><ins>+    return std::experimental::get&lt;ReturnType&gt;(WTFMove(m_value));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-template&lt;typename ReturnType&gt; inline ReturnType&amp;&amp; ExceptionOr&lt;ReturnType&gt;::takeReturnValue()
</del><ins>+inline ExceptionOr&lt;void&gt;::ExceptionOr(Exception&amp;&amp; exception)
+    : m_exception(WTFMove(exception))
</ins><span class="cx"> {
</span><del>-    return std::experimental::get&lt;ReturnType&gt;(WTFMove(m_value));
</del><span class="cx"> }
</span><span class="cx"> 
</span><ins>+inline bool ExceptionOr&lt;void&gt;::hasException() const
+{
+    return !!m_exception;
</ins><span class="cx"> }
</span><ins>+
+inline Exception&amp;&amp; ExceptionOr&lt;void&gt;::releaseException()
+{
+    return WTFMove(m_exception.value());
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoredomTreeScopecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/TreeScope.cpp (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/TreeScope.cpp        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/dom/TreeScope.cpp        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -27,7 +27,6 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;TreeScope.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;DOMSelection.h&quot;
</del><span class="cx"> #include &quot;DOMWindow.h&quot;
</span><span class="cx"> #include &quot;ElementIterator.h&quot;
</span><span class="cx"> #include &quot;FocusController.h&quot;
</span><span class="lines">@@ -49,7 +48,7 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> struct SameSizeAsTreeScope {
</span><del>-    void* pointers[9];
</del><ins>+    void* pointers[8];
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> COMPILE_ASSERT(sizeof(TreeScope) == sizeof(SameSizeAsTreeScope), treescope_should_stay_small);
</span><span class="lines">@@ -76,10 +75,6 @@
</span><span class="cx"> 
</span><span class="cx"> TreeScope::~TreeScope()
</span><span class="cx"> {
</span><del>-    if (m_selection) {
-        m_selection-&gt;clearTreeScope();
-        m_selection = nullptr;
-    }
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void TreeScope::destroyTreeScopeData()
</span><span class="lines">@@ -331,21 +326,6 @@
</span><span class="cx">     return downcast&lt;Element&gt;(node);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-DOMSelection* TreeScope::getSelection() const
-{
-    if (!m_rootNode.document().frame())
-        return nullptr;
-
-    if (m_selection)
-        return m_selection.get();
-
-    if (this != &amp;m_rootNode.document())
-        return m_rootNode.document().getSelection();
-
-    m_selection = DOMSelection::create(&amp;m_rootNode.document());
-    return m_selection.get();
-}
-
</del><span class="cx"> Element* TreeScope::findAnchor(const String&amp; name)
</span><span class="cx"> {
</span><span class="cx">     if (name.isEmpty())
</span></span></pre></div>
<a id="trunkSourceWebCoredomTreeScopeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/TreeScope.h (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/TreeScope.h        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/dom/TreeScope.h        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -35,7 +35,6 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class ContainerNode;
</span><del>-class DOMSelection;
</del><span class="cx"> class Document;
</span><span class="cx"> class Element;
</span><span class="cx"> class HTMLLabelElement;
</span><span class="lines">@@ -88,8 +87,6 @@
</span><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT Element* elementFromPoint(int x, int y);
</span><span class="cx"> 
</span><del>-    DOMSelection* getSelection() const;
-
</del><span class="cx">     // Find first anchor with the given name.
</span><span class="cx">     // First searches for an element with the given ID, but if that fails, then looks
</span><span class="cx">     // for an anchor with the given name. ID matching is always case sensitive, but
</span><span class="lines">@@ -129,8 +126,6 @@
</span><span class="cx">     std::unique_ptr&lt;DocumentOrderedMap&gt; m_labelsByForAttribute;
</span><span class="cx"> 
</span><span class="cx">     std::unique_ptr&lt;IdTargetObserverRegistry&gt; m_idTargetObserverRegistry;
</span><del>-
-    mutable RefPtr&lt;DOMSelection&gt; m_selection;
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> inline bool TreeScope::hasElementWithId(const AtomicStringImpl&amp; id) const
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorPageScriptDebugServercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/PageScriptDebugServer.cpp (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/PageScriptDebugServer.cpp        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/inspector/PageScriptDebugServer.cpp        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -123,7 +123,7 @@
</span><span class="cx">     return &amp;currentWorld(exec) != &amp;mainThreadNormalWorld();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void PageScriptDebugServer::reportException(ExecState* exec, Exception* exception) const
</del><ins>+void PageScriptDebugServer::reportException(ExecState* exec, JSC::Exception* exception) const
</ins><span class="cx"> {
</span><span class="cx">     WebCore::reportException(exec, exception);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMSelectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMSelection.cpp (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMSelection.cpp        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/page/DOMSelection.cpp        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -41,29 +41,22 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-static Node* selectionShadowAncestor(Frame* frame)
</del><ins>+static Node* selectionShadowAncestor(Frame&amp; frame)
</ins><span class="cx"> {
</span><del>-    Node* node = frame-&gt;selection().selection().base().anchorNode();
</del><ins>+    auto* node = frame.selection().selection().base().anchorNode();
</ins><span class="cx">     if (!node)
</span><del>-        return 0;
-
</del><ins>+        return nullptr;
</ins><span class="cx">     if (!node-&gt;isInShadowTree())
</span><del>-        return 0;
-
-    return frame-&gt;document()-&gt;ancestorInThisScope(node);
</del><ins>+        return nullptr;
+    // FIXME: Unclear on why this needs to be the possibly null frame.document() instead of the never null node-&gt;document().
+    return frame.document()-&gt;ancestorInThisScope(node);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-DOMSelection::DOMSelection(const TreeScope* treeScope)
-    : DOMWindowProperty(treeScope-&gt;rootNode().document().frame())
-    , m_treeScope(treeScope)
</del><ins>+DOMSelection::DOMSelection(Frame&amp; frame)
+    : DOMWindowProperty(&amp;frame)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DOMSelection::clearTreeScope()
-{
-    m_treeScope = nullptr;
-}
-
</del><span class="cx"> const VisibleSelection&amp; DOMSelection::visibleSelection() const
</span><span class="cx"> {
</span><span class="cx">     ASSERT(m_frame);
</span><span class="lines">@@ -72,13 +65,13 @@
</span><span class="cx"> 
</span><span class="cx"> static Position anchorPosition(const VisibleSelection&amp; selection)
</span><span class="cx"> {
</span><del>-    Position anchor = selection.isBaseFirst() ? selection.start() : selection.end();
</del><ins>+    auto anchor = selection.isBaseFirst() ? selection.start() : selection.end();
</ins><span class="cx">     return anchor.parentAnchoredEquivalent();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static Position focusPosition(const VisibleSelection&amp; selection)
</span><span class="cx"> {
</span><del>-    Position focus = selection.isBaseFirst() ? selection.end() : selection.start();
</del><ins>+    auto focus = selection.isBaseFirst() ? selection.end() : selection.start();
</ins><span class="cx">     return focus.parentAnchoredEquivalent();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -96,7 +89,6 @@
</span><span class="cx"> {
</span><span class="cx">     if (!m_frame)
</span><span class="cx">         return 0;
</span><del>-
</del><span class="cx">     return shadowAdjustedNode(anchorPosition(visibleSelection()));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -104,7 +96,6 @@
</span><span class="cx"> {
</span><span class="cx">     if (!m_frame)
</span><span class="cx">         return 0;
</span><del>-
</del><span class="cx">     return shadowAdjustedOffset(anchorPosition(visibleSelection()));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -111,8 +102,7 @@
</span><span class="cx"> Node* DOMSelection::focusNode() const
</span><span class="cx"> {
</span><span class="cx">     if (!m_frame)
</span><del>-        return 0;
-
</del><ins>+        return nullptr;
</ins><span class="cx">     return shadowAdjustedNode(focusPosition(visibleSelection()));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -120,7 +110,6 @@
</span><span class="cx"> {
</span><span class="cx">     if (!m_frame)
</span><span class="cx">         return 0;
</span><del>-
</del><span class="cx">     return shadowAdjustedOffset(focusPosition(visibleSelection()));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -128,7 +117,6 @@
</span><span class="cx"> {
</span><span class="cx">     if (!m_frame)
</span><span class="cx">         return 0;
</span><del>-
</del><span class="cx">     return shadowAdjustedNode(basePosition(visibleSelection()));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -136,7 +124,6 @@
</span><span class="cx"> {
</span><span class="cx">     if (!m_frame)
</span><span class="cx">         return 0;
</span><del>-
</del><span class="cx">     return shadowAdjustedOffset(basePosition(visibleSelection()));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -144,7 +131,6 @@
</span><span class="cx"> {
</span><span class="cx">     if (!m_frame)
</span><span class="cx">         return 0;
</span><del>-
</del><span class="cx">     return shadowAdjustedNode(extentPosition(visibleSelection()));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -152,13 +138,12 @@
</span><span class="cx"> {
</span><span class="cx">     if (!m_frame)
</span><span class="cx">         return 0;
</span><del>-
</del><span class="cx">     return shadowAdjustedOffset(extentPosition(visibleSelection()));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool DOMSelection::isCollapsed() const
</span><span class="cx"> {
</span><del>-    if (!m_frame || selectionShadowAncestor(m_frame))
</del><ins>+    if (!m_frame || selectionShadowAncestor(*m_frame))
</ins><span class="cx">         return true;
</span><span class="cx">     return !m_frame-&gt;selection().isRange();
</span><span class="cx"> }
</span><span class="lines">@@ -166,67 +151,47 @@
</span><span class="cx"> String DOMSelection::type() const
</span><span class="cx"> {
</span><span class="cx">     if (!m_frame)
</span><del>-        return String();
-
-    FrameSelection&amp; selection = m_frame-&gt;selection();
-
-    // This is a WebKit DOM extension, incompatible with an IE extension
-    // IE has this same attribute, but returns &quot;none&quot;, &quot;text&quot; and &quot;control&quot;
-    // http://msdn.microsoft.com/en-us/library/ms534692(VS.85).aspx
</del><ins>+        return ASCIILiteral(&quot;None&quot;);
+    auto&amp; selection = m_frame-&gt;selection();
</ins><span class="cx">     if (selection.isNone())
</span><del>-        return &quot;None&quot;;
</del><ins>+        return ASCIILiteral(&quot;None&quot;);
</ins><span class="cx">     if (selection.isCaret())
</span><del>-        return &quot;Caret&quot;;
-    return &quot;Range&quot;;
</del><ins>+        return ASCIILiteral(&quot;Caret&quot;);
+    return ASCIILiteral(&quot;Range&quot;);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> unsigned DOMSelection::rangeCount() const
</span><span class="cx"> {
</span><del>-    if (!m_frame)
-        return 0;
-    return m_frame-&gt;selection().isNone() ? 0 : 1;
</del><ins>+    return !m_frame || m_frame-&gt;selection().isNone() ? 0 : 1;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void DOMSelection::collapse(Node* node, unsigned offset)
</span><span class="cx"> {
</span><del>-    if (!m_frame)
-        return;
-
</del><span class="cx">     if (!isValidForPosition(node))
</span><span class="cx">         return;
</span><del>-
-    // FIXME: Eliminate legacy editing positions
</del><span class="cx">     m_frame-&gt;selection().moveTo(createLegacyEditingPosition(node, offset), DOWNSTREAM);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DOMSelection::collapseToEnd(ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; DOMSelection::collapseToEnd()
</ins><span class="cx"> {
</span><span class="cx">     if (!m_frame)
</span><del>-        return;
-
-    const VisibleSelection&amp; selection = m_frame-&gt;selection().selection();
-
-    if (selection.isNone()) {
-        ec = INVALID_STATE_ERR;
-        return;
-    }
-
-    m_frame-&gt;selection().moveTo(selection.end(), DOWNSTREAM);
</del><ins>+        return { };
+    auto&amp; selection = m_frame-&gt;selection();
+    if (selection.isNone())
+        return Exception { INVALID_STATE_ERR };
+    selection.moveTo(selection.selection().end(), DOWNSTREAM);
+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DOMSelection::collapseToStart(ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; DOMSelection::collapseToStart()
</ins><span class="cx"> {
</span><span class="cx">     if (!m_frame)
</span><del>-        return;
-
-    const VisibleSelection&amp; selection = m_frame-&gt;selection().selection();
-
-    if (selection.isNone()) {
-        ec = INVALID_STATE_ERR;
-        return;
-    }
-
-    m_frame-&gt;selection().moveTo(selection.start(), DOWNSTREAM);
</del><ins>+        return { };
+    auto&amp; selection = m_frame-&gt;selection();
+    if (selection.isNone())
+        return Exception { INVALID_STATE_ERR };
+    selection.moveTo(selection.selection().start(), DOWNSTREAM);
+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void DOMSelection::empty()
</span><span class="lines">@@ -238,25 +203,15 @@
</span><span class="cx"> 
</span><span class="cx"> void DOMSelection::setBaseAndExtent(Node* baseNode, unsigned baseOffset, Node* extentNode, unsigned extentOffset)
</span><span class="cx"> {
</span><del>-    if (!m_frame)
-        return;
-
</del><span class="cx">     if (!isValidForPosition(baseNode) || !isValidForPosition(extentNode))
</span><span class="cx">         return;
</span><del>-
-    // FIXME: Eliminate legacy editing positions
</del><span class="cx">     m_frame-&gt;selection().moveTo(createLegacyEditingPosition(baseNode, baseOffset), createLegacyEditingPosition(extentNode, extentOffset), DOWNSTREAM);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void DOMSelection::setPosition(Node* node, unsigned offset)
</span><span class="cx"> {
</span><del>-    if (!m_frame)
-        return;
-
</del><span class="cx">     if (!isValidForPosition(node))
</span><span class="cx">         return;
</span><del>-
-    // FIXME: Eliminate legacy editing positions
</del><span class="cx">     m_frame-&gt;selection().moveTo(createLegacyEditingPosition(node, offset), DOWNSTREAM);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -310,43 +265,33 @@
</span><span class="cx">     m_frame-&gt;selection().modify(alter, direction, granularity);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DOMSelection::extend(Node&amp; node, unsigned offset, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; DOMSelection::extend(Node&amp; node, unsigned offset)
</ins><span class="cx"> {
</span><span class="cx">     if (!m_frame)
</span><del>-        return;
-
-    if (offset &gt; (node.offsetInCharacters() ? caretMaxOffset(node) : node.countChildNodes())) {
-        ec = INDEX_SIZE_ERR;
-        return;
-    }
-
</del><ins>+        return { };
+    if (offset &gt; (node.offsetInCharacters() ? caretMaxOffset(node) : node.countChildNodes()))
+        return Exception { INDEX_SIZE_ERR };
</ins><span class="cx">     if (!isValidForPosition(&amp;node))
</span><del>-        return;
-
-    // FIXME: Eliminate legacy editing positions
</del><ins>+        return { };
</ins><span class="cx">     m_frame-&gt;selection().setExtent(createLegacyEditingPosition(&amp;node, offset), DOWNSTREAM);
</span><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;Range&gt; DOMSelection::getRangeAt(unsigned index, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;Ref&lt;Range&gt;&gt; DOMSelection::getRangeAt(unsigned index)
</ins><span class="cx"> {
</span><del>-    if (!m_frame)
-        return nullptr;
</del><ins>+    if (index &gt;= rangeCount())
+        return Exception { INDEX_SIZE_ERR };
</ins><span class="cx"> 
</span><del>-    if (index &gt;= rangeCount()) {
-        ec = INDEX_SIZE_ERR;
-        return nullptr;
-    }
-
-    // If you're hitting this, you've added broken multi-range selection support
</del><ins>+    // If you're hitting this, you've added broken multi-range selection support.
</ins><span class="cx">     ASSERT(rangeCount() == 1);
</span><span class="cx"> 
</span><del>-    if (Node* shadowAncestor = selectionShadowAncestor(m_frame)) {
-        ContainerNode* container = shadowAncestor-&gt;parentNodeGuaranteedHostFree();
</del><ins>+    if (auto* shadowAncestor = selectionShadowAncestor(*m_frame)) {
+        auto* container = shadowAncestor-&gt;parentNodeGuaranteedHostFree();
</ins><span class="cx">         unsigned offset = shadowAncestor-&gt;computeNodeIndex();
</span><span class="cx">         return Range::create(shadowAncestor-&gt;document(), container, offset, container, offset);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return m_frame-&gt;selection().selection().firstRange();
</del><ins>+    return m_frame-&gt;selection().selection().firstRange().releaseNonNull();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void DOMSelection::removeAllRanges()
</span><span class="lines">@@ -361,13 +306,13 @@
</span><span class="cx">     if (!m_frame)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    FrameSelection&amp; selection = m_frame-&gt;selection();
</del><ins>+    auto&amp; selection = m_frame-&gt;selection();
</ins><span class="cx">     if (selection.isNone()) {
</span><span class="cx">         selection.moveTo(&amp;range);
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    RefPtr&lt;Range&gt; normalizedRange = selection.selection().toNormalizedRange();
</del><ins>+    auto normalizedRange = selection.selection().toNormalizedRange();
</ins><span class="cx">     if (!normalizedRange)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -402,17 +347,15 @@
</span><span class="cx">     if (!m_frame)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    FrameSelection&amp; selection = m_frame-&gt;selection();
-
</del><ins>+    auto&amp; selection = m_frame-&gt;selection();
</ins><span class="cx">     if (selection.isNone())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    RefPtr&lt;Range&gt; selectedRange = selection.selection().toNormalizedRange();
</del><ins>+    auto selectedRange = selection.selection().toNormalizedRange();
</ins><span class="cx">     if (!selectedRange)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     selectedRange-&gt;deleteContents(ASSERT_NO_EXCEPTION);
</span><del>-
</del><span class="cx">     setBaseAndExtent(&amp;selectedRange-&gt;startContainer(), selectedRange-&gt;startOffset(), &amp;selectedRange-&gt;startContainer(), selectedRange-&gt;startOffset());
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -421,13 +364,12 @@
</span><span class="cx">     if (!m_frame)
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    FrameSelection&amp; selection = m_frame-&gt;selection();
-
</del><ins>+    auto&amp; selection = m_frame-&gt;selection();
</ins><span class="cx">     if (m_frame-&gt;document() != &amp;node.document() || selection.isNone())
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     Ref&lt;Node&gt; protectedNode(node);
</span><del>-    RefPtr&lt;Range&gt; selectedRange = selection.selection().toNormalizedRange();
</del><ins>+    auto selectedRange = selection.selection().toNormalizedRange();
</ins><span class="cx"> 
</span><span class="cx">     ContainerNode* parentNode = node.parentNode();
</span><span class="cx">     if (!parentNode || !parentNode-&gt;inDocument())
</span><span class="lines">@@ -460,7 +402,6 @@
</span><span class="cx"> {
</span><span class="cx">     if (!m_frame)
</span><span class="cx">         return String();
</span><del>-
</del><span class="cx">     return plainText(m_frame-&gt;selection().selection().toNormalizedRange().get());
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -467,13 +408,12 @@
</span><span class="cx"> Node* DOMSelection::shadowAdjustedNode(const Position&amp; position) const
</span><span class="cx"> {
</span><span class="cx">     if (position.isNull())
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx"> 
</span><del>-    Node* containerNode = position.containerNode();
-    Node* adjustedNode = m_treeScope-&gt;ancestorInThisScope(containerNode);
-
</del><ins>+    auto* containerNode = position.containerNode();
+    auto* adjustedNode = m_frame-&gt;document()-&gt;ancestorInThisScope(containerNode);
</ins><span class="cx">     if (!adjustedNode)
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx"> 
</span><span class="cx">     if (containerNode == adjustedNode)
</span><span class="cx">         return containerNode;
</span><span class="lines">@@ -486,9 +426,8 @@
</span><span class="cx">     if (position.isNull())
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span><del>-    Node* containerNode = position.containerNode();
-    Node* adjustedNode = m_treeScope-&gt;ancestorInThisScope(containerNode);
-
</del><ins>+    auto* containerNode = position.containerNode();
+    auto* adjustedNode = m_frame-&gt;document()-&gt;ancestorInThisScope(containerNode);
</ins><span class="cx">     if (!adjustedNode)
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span><span class="lines">@@ -500,7 +439,8 @@
</span><span class="cx"> 
</span><span class="cx"> bool DOMSelection::isValidForPosition(Node* node) const
</span><span class="cx"> {
</span><del>-    ASSERT(m_frame);
</del><ins>+    if (!m_frame)
+        return false;
</ins><span class="cx">     if (!node)
</span><span class="cx">         return true;
</span><span class="cx">     return &amp;node-&gt;document() == m_frame-&gt;document();
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMSelectionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMSelection.h (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMSelection.h        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/page/DOMSelection.h        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2007 Apple Inc.  All rights reserved.
- * Copyright (C) 2012 Google Inc.  All rights reserved.
</del><ins>+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -27,11 +27,10 @@
</span><span class="cx">  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><ins>+#pragma once
</ins><span class="cx"> 
</span><del>-#ifndef DOMSelection_h
-#define DOMSelection_h
-
</del><span class="cx"> #include &quot;DOMWindowProperty.h&quot;
</span><ins>+#include &quot;ExceptionOr.h&quot;
</ins><span class="cx"> #include &lt;wtf/Forward.h&gt;
</span><span class="cx"> #include &lt;wtf/RefCounted.h&gt;
</span><span class="cx"> #include &lt;wtf/RefPtr.h&gt;
</span><span class="lines">@@ -38,74 +37,58 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-    class Frame;
-    class Node;
-    class Position;
-    class Range;
-    class TreeScope;
-    class VisibleSelection;
</del><ins>+class Node;
+class Position;
+class Range;
+class VisibleSelection;
</ins><span class="cx"> 
</span><del>-    typedef int ExceptionCode;
</del><ins>+class DOMSelection : public RefCounted&lt;DOMSelection&gt;, public DOMWindowProperty {
+public:
+    static Ref&lt;DOMSelection&gt; create(Frame&amp; frame) { return adoptRef(*new DOMSelection(frame)); }
</ins><span class="cx"> 
</span><del>-    class DOMSelection : public RefCounted&lt;DOMSelection&gt;, public DOMWindowProperty {
-    public:
-        static Ref&lt;DOMSelection&gt; create(const TreeScope* treeScope) { return adoptRef(*new DOMSelection(treeScope)); }
</del><ins>+    Node* baseNode() const;
+    Node* extentNode() const;
+    unsigned baseOffset() const;
+    unsigned extentOffset() const;
+    String type() const;
+    void setBaseAndExtent(Node* baseNode, unsigned baseOffset, Node* extentNode, unsigned extentOffset);
+    void setPosition(Node*, unsigned offset);
+    void modify(const String&amp; alter, const String&amp; direction, const String&amp; granularity);
</ins><span class="cx"> 
</span><del>-        void clearTreeScope();
</del><ins>+    // The anchor and focus are the start and end of the selection, and
+    // reflect the direction in which the selection was made by the user.
+    // The base and extent are different, because they don't reflect expansion.
+    Node* anchorNode() const;
+    unsigned anchorOffset() const;
+    Node* focusNode() const;
+    unsigned focusOffset() const;
+    bool isCollapsed() const;
+    unsigned rangeCount() const;
+    void collapse(Node*, unsigned offset);
+    ExceptionOr&lt;void&gt; collapseToEnd();
+    ExceptionOr&lt;void&gt; collapseToStart();
+    ExceptionOr&lt;void&gt; extend(Node&amp;, unsigned offset);
+    ExceptionOr&lt;Ref&lt;Range&gt;&gt; getRangeAt(unsigned);
+    void removeAllRanges();
+    void addRange(Range&amp;);
+    void deleteFromDocument();
+    bool containsNode(Node&amp;, bool partlyContained) const;
+    void selectAllChildren(Node&amp;);
</ins><span class="cx"> 
</span><del>-        // Safari Selection Object API
-        // These methods return the valid equivalents of internal editing positions.
-        Node* baseNode() const;
-        Node* extentNode() const;
-        unsigned baseOffset() const;
-        unsigned extentOffset() const;
-        String type() const;
-        void setBaseAndExtent(Node* baseNode, unsigned baseOffset, Node* extentNode, unsigned extentOffset);
-        void setPosition(Node*, unsigned offset);
-        void modify(const String&amp; alter, const String&amp; direction, const String&amp; granularity);
</del><ins>+    String toString();
</ins><span class="cx"> 
</span><del>-        // Mozilla Selection Object API
-        // In Firefox, anchor/focus are the equal to the start/end of the selection,
-        // but reflect the direction in which the selection was made by the user.  That does
-        // not mean that they are base/extent, since the base/extent don't reflect
-        // expansion.
-        // These methods return the valid equivalents of internal editing positions.
-        Node* anchorNode() const;
-        unsigned anchorOffset() const;
-        Node* focusNode() const;
-        unsigned focusOffset() const;
-        bool isCollapsed() const;
-        unsigned rangeCount() const;
-        void collapse(Node*, unsigned offset);
-        void collapseToEnd(ExceptionCode&amp;);
-        void collapseToStart(ExceptionCode&amp;);
-        void extend(Node&amp;, unsigned offset, ExceptionCode&amp;);
-        RefPtr&lt;Range&gt; getRangeAt(unsigned, ExceptionCode&amp;);
-        void removeAllRanges();
-        void addRange(Range&amp;);
-        void deleteFromDocument();
-        bool containsNode(Node&amp;, bool partlyContained) const;
-        void selectAllChildren(Node&amp;);
</del><ins>+    void empty();
</ins><span class="cx"> 
</span><del>-        String toString();
</del><ins>+private:
+    explicit DOMSelection(Frame&amp;);
</ins><span class="cx"> 
</span><del>-        // Microsoft Selection Object API
-        void empty();
</del><ins>+    // Convenience method for accessors, caller must null-check m_frame.
+    const VisibleSelection&amp; visibleSelection() const;
</ins><span class="cx"> 
</span><del>-    private:
-        const TreeScope* m_treeScope;
</del><ins>+    Node* shadowAdjustedNode(const Position&amp;) const;
+    unsigned shadowAdjustedOffset(const Position&amp;) const;
</ins><span class="cx"> 
</span><del>-        explicit DOMSelection(const TreeScope*);
</del><ins>+    bool isValidForPosition(Node*) const;
+};
</ins><span class="cx"> 
</span><del>-        // Convenience method for accessors, does not NULL check m_frame.
-        const VisibleSelection&amp; visibleSelection() const;
-
-        Node* shadowAdjustedNode(const Position&amp;) const;
-        unsigned shadowAdjustedOffset(const Position&amp;) const;
-
-        bool isValidForPosition(Node*) const;
-    };
-
</del><span class="cx"> } // namespace WebCore
</span><del>-
-#endif // DOMSelection_h
</del></span></pre></div>
<a id="trunkSourceWebCorepageDOMSelectionidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMSelection.idl (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMSelection.idl        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/page/DOMSelection.idl        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2007 Apple Inc.  All rights reserved.
- * Copyright (C) 2009 Google Inc.  All rights reserved.
</del><ins>+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Google Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -41,16 +41,16 @@
</span><span class="cx">     readonly attribute unsigned long rangeCount;
</span><span class="cx"> 
</span><span class="cx">     void collapse(Node? node, optional unsigned long offset = 0);
</span><del>-    [MayThrowLegacyException] void collapseToEnd();
-    [MayThrowLegacyException] void collapseToStart();
</del><ins>+    [MayThrowException] void collapseToEnd();
+    [MayThrowException] void collapseToStart();
</ins><span class="cx"> 
</span><span class="cx">     void deleteFromDocument();
</span><span class="cx">     boolean containsNode(Node node, optional boolean allowPartial = false);
</span><span class="cx">     void selectAllChildren(Node node);
</span><span class="cx"> 
</span><del>-    [MayThrowLegacyException] void extend(Node node, optional unsigned long offset = 0);
</del><ins>+    [MayThrowException] void extend(Node node, optional unsigned long offset = 0);
</ins><span class="cx"> 
</span><del>-    [MayThrowLegacyException] Range getRangeAt(unsigned long index);
</del><ins>+    [MayThrowException] Range getRangeAt(unsigned long index);
</ins><span class="cx">     void removeAllRanges();
</span><span class="cx">     void addRange(Range range);
</span><span class="cx"> 
</span><span class="lines">@@ -66,14 +66,11 @@
</span><span class="cx">     // FIXME: The following operation should be implemented.
</span><span class="cx">     // void removeRange(Range range);
</span><span class="cx"> 
</span><del>-    // WebKit extensions.
-
</del><span class="cx">     // FIXME: Using &quot;undefined&quot; as default parameter value is wrong.
</span><span class="cx">     void modify(optional DOMString alter = &quot;undefined&quot;, optional DOMString direction = &quot;undefined&quot;, optional DOMString granularity = &quot;undefined&quot;);
</span><span class="cx"> 
</span><del>-    readonly attribute Node baseNode;
</del><ins>+    readonly attribute Node? baseNode;
</ins><span class="cx">     readonly attribute unsigned long baseOffset;
</span><del>-    readonly attribute Node extentNode;
</del><ins>+    readonly attribute Node? extentNode;
</ins><span class="cx">     readonly attribute unsigned long extentOffset;
</span><span class="cx"> };
</span><del>-
</del></span></pre></div>
<a id="trunkSourceWebCorepageDOMWindowcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMWindow.cpp (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMWindow.cpp        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/page/DOMWindow.cpp        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -597,24 +597,26 @@
</span><span class="cx"> {
</span><span class="cx">     m_properties.clear();
</span><span class="cx"> 
</span><del>-    m_screen = nullptr;
</del><ins>+    m_applicationCache = nullptr;
+    m_crypto = nullptr;
</ins><span class="cx">     m_history = nullptr;
</span><del>-    m_crypto = nullptr;
</del><ins>+    m_localStorage = nullptr;
+    m_location = nullptr;
</ins><span class="cx">     m_locationbar = nullptr;
</span><ins>+    m_media = nullptr;
</ins><span class="cx">     m_menubar = nullptr;
</span><ins>+    m_navigator = nullptr;
</ins><span class="cx">     m_personalbar = nullptr;
</span><ins>+    m_screen = nullptr;
</ins><span class="cx">     m_scrollbars = nullptr;
</span><ins>+    m_selection = nullptr;
+    m_sessionStorage = nullptr;
</ins><span class="cx">     m_statusbar = nullptr;
</span><span class="cx">     m_toolbar = nullptr;
</span><del>-    m_navigator = nullptr;
</del><ins>+
</ins><span class="cx"> #if ENABLE(WEB_TIMING)
</span><span class="cx">     m_performance = nullptr;
</span><span class="cx"> #endif
</span><del>-    m_location = nullptr;
-    m_media = nullptr;
-    m_sessionStorage = nullptr;
-    m_localStorage = nullptr;
-    m_applicationCache = nullptr;
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool DOMWindow::isCurrentlyDisplayedInFrame() const
</span><span class="lines">@@ -653,7 +655,7 @@
</span><span class="cx"> History* DOMWindow::history() const
</span><span class="cx"> {
</span><span class="cx">     if (!isCurrentlyDisplayedInFrame())
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx">     if (!m_history)
</span><span class="cx">         m_history = History::create(m_frame);
</span><span class="cx">     return m_history.get();
</span><span class="lines">@@ -964,10 +966,11 @@
</span><span class="cx"> 
</span><span class="cx"> DOMSelection* DOMWindow::getSelection()
</span><span class="cx"> {
</span><del>-    if (!isCurrentlyDisplayedInFrame() || !m_frame)
-        return 0;
-
-    return m_frame-&gt;document()-&gt;getSelection();
</del><ins>+    if (!isCurrentlyDisplayedInFrame())
+        return nullptr;
+    if (!m_selection)
+        m_selection = DOMSelection::create(*m_frame);
+    return m_selection.get();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Element* DOMWindow::frameElement() const
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMWindowh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMWindow.h (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMWindow.h        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/page/DOMWindow.h        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -141,8 +141,6 @@
</span><span class="cx">         static bool canShowModalDialog(const Frame*);
</span><span class="cx">         WEBCORE_EXPORT void setCanShowModalDialogOverride(bool);
</span><span class="cx"> 
</span><del>-        // DOM Level 0
-
</del><span class="cx">         Screen* screen() const;
</span><span class="cx">         History* history() const;
</span><span class="cx">         Crypto* crypto() const;
</span><span class="lines">@@ -380,18 +378,19 @@
</span><span class="cx"> 
</span><span class="cx">         HashSet&lt;DOMWindowProperty*&gt; m_properties;
</span><span class="cx"> 
</span><del>-        mutable RefPtr&lt;Screen&gt; m_screen;
</del><ins>+        mutable RefPtr&lt;Crypto&gt; m_crypto;
</ins><span class="cx">         mutable RefPtr&lt;History&gt; m_history;
</span><del>-        mutable RefPtr&lt;Crypto&gt;  m_crypto;
</del><span class="cx">         mutable RefPtr&lt;BarProp&gt; m_locationbar;
</span><ins>+        mutable RefPtr&lt;StyleMedia&gt; m_media;
</ins><span class="cx">         mutable RefPtr&lt;BarProp&gt; m_menubar;
</span><ins>+        mutable RefPtr&lt;Navigator&gt; m_navigator;
</ins><span class="cx">         mutable RefPtr&lt;BarProp&gt; m_personalbar;
</span><ins>+        mutable RefPtr&lt;Screen&gt; m_screen;
</ins><span class="cx">         mutable RefPtr&lt;BarProp&gt; m_scrollbars;
</span><ins>+        mutable RefPtr&lt;DOMSelection&gt; m_selection;
</ins><span class="cx">         mutable RefPtr&lt;BarProp&gt; m_statusbar;
</span><span class="cx">         mutable RefPtr&lt;BarProp&gt; m_toolbar;
</span><del>-        mutable RefPtr&lt;Navigator&gt; m_navigator;
</del><span class="cx">         mutable RefPtr&lt;Location&gt; m_location;
</span><del>-        mutable RefPtr&lt;StyleMedia&gt; m_media;
</del><span class="cx"> 
</span><span class="cx">         String m_status;
</span><span class="cx">         String m_defaultStatus;
</span></span></pre></div>
<a id="trunkSourceWebCorereplayReplayControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/replay/ReplayController.cpp (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/replay/ReplayController.cpp        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/replay/ReplayController.cpp        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -421,7 +421,7 @@
</span><span class="cx"> 
</span><span class="cx">     // We store the input cursor in both Document and JSDOMWindow, so that
</span><span class="cx">     // replay state is accessible from JavaScriptCore and script-free layout code.
</span><del>-    loader-&gt;frame()-&gt;document()-&gt;setInputCursor(m_activeCursor.get());
</del><ins>+    loader-&gt;frame()-&gt;document()-&gt;setInputCursor(*m_activeCursor);
</ins><span class="cx">     loader-&gt;frame()-&gt;script().globalObject(mainThreadNormalWorld())-&gt;setInputCursor(m_activeCursor.get());
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorexmlXMLHttpRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/xml/XMLHttpRequest.cpp (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/xml/XMLHttpRequest.cpp        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.cpp        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -157,12 +157,10 @@
</span><span class="cx">     return m_state;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-String XMLHttpRequest::responseText(ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;String&gt; XMLHttpRequest::responseText()
</ins><span class="cx"> {
</span><del>-    if (m_responseType != ResponseType::EmptyString &amp;&amp; m_responseType != ResponseType::Text) {
-        ec = INVALID_STATE_ERR;
-        return { };
-    }
</del><ins>+    if (m_responseType != ResponseType::EmptyString &amp;&amp; m_responseType != ResponseType::Text)
+        return Exception { INVALID_STATE_ERR };
</ins><span class="cx">     return responseTextIgnoringResponseType();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -173,12 +171,10 @@
</span><span class="cx">     m_responseBuilder.clear();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Document* XMLHttpRequest::responseXML(ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;Document*&gt; XMLHttpRequest::responseXML()
</ins><span class="cx"> {
</span><del>-    if (m_responseType != ResponseType::EmptyString &amp;&amp; m_responseType != ResponseType::Document) {
-        ec = INVALID_STATE_ERR;
-        return nullptr;
-    }
</del><ins>+    if (m_responseType != ResponseType::EmptyString &amp;&amp; m_responseType != ResponseType::Document)
+        return Exception { INVALID_STATE_ERR };
</ins><span class="cx"> 
</span><span class="cx">     if (!doneWithoutErrors())
</span><span class="cx">         return nullptr;
</span><span class="lines">@@ -239,30 +235,28 @@
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void XMLHttpRequest::setTimeout(unsigned timeout, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; XMLHttpRequest::setTimeout(unsigned timeout)
</ins><span class="cx"> {
</span><span class="cx">     if (scriptExecutionContext()-&gt;isDocument() &amp;&amp; !m_async) {
</span><span class="cx">         logConsoleError(scriptExecutionContext(), &quot;XMLHttpRequest.timeout cannot be set for synchronous HTTP(S) requests made from the window context.&quot;);
</span><del>-        ec = INVALID_ACCESS_ERR;
-        return;
</del><ins>+        return Exception { INVALID_ACCESS_ERR };
</ins><span class="cx">     }
</span><span class="cx">     m_timeoutMilliseconds = timeout;
</span><span class="cx">     if (!m_timeoutTimer.isActive())
</span><del>-        return;
</del><ins>+        return { };
</ins><span class="cx">     if (!m_timeoutMilliseconds) {
</span><span class="cx">         m_timeoutTimer.stop();
</span><del>-        return;
</del><ins>+        return { };
</ins><span class="cx">     }
</span><span class="cx">     std::chrono::duration&lt;double&gt; interval = std::chrono::milliseconds { m_timeoutMilliseconds } - (std::chrono::steady_clock::now() - m_sendingTime);
</span><span class="cx">     m_timeoutTimer.startOneShot(std::max(0.0, interval.count()));
</span><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void XMLHttpRequest::setResponseType(ResponseType type, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; XMLHttpRequest::setResponseType(ResponseType type)
</ins><span class="cx"> {
</span><del>-    if (m_state &gt;= LOADING) {
-        ec = INVALID_STATE_ERR;
-        return;
-    }
</del><ins>+    if (m_state &gt;= LOADING)
+        return Exception { INVALID_STATE_ERR };
</ins><span class="cx"> 
</span><span class="cx">     // Newer functionality is not available to synchronous requests in window contexts, as a spec-mandated
</span><span class="cx">     // attempt to discourage synchronous XHR use. responseType is one such piece of functionality.
</span><span class="lines">@@ -270,11 +264,11 @@
</span><span class="cx">     // such as file: and data: still make sense to allow.
</span><span class="cx">     if (!m_async &amp;&amp; scriptExecutionContext()-&gt;isDocument() &amp;&amp; m_url.protocolIsInHTTPFamily()) {
</span><span class="cx">         logConsoleError(scriptExecutionContext(), &quot;XMLHttpRequest.responseType cannot be changed for synchronous HTTP(S) requests made from the window context.&quot;);
</span><del>-        ec = INVALID_ACCESS_ERR;
-        return;
</del><ins>+        return Exception { INVALID_ACCESS_ERR };
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     m_responseType = type;
</span><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String XMLHttpRequest::responseURL() const
</span><span class="lines">@@ -323,14 +317,13 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void XMLHttpRequest::setWithCredentials(bool value, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; XMLHttpRequest::setWithCredentials(bool value)
</ins><span class="cx"> {
</span><del>-    if (m_state &gt; OPENED || m_sendFlag) {
-        ec = INVALID_STATE_ERR;
-        return;
-    }
</del><ins>+    if (m_state &gt; OPENED || m_sendFlag)
+        return Exception { INVALID_STATE_ERR };
</ins><span class="cx"> 
</span><span class="cx">     m_includeCredentials = value;
</span><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool XMLHttpRequest::isAllowedHTTPMethod(const String&amp; method)
</span><span class="lines">@@ -404,16 +397,16 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void XMLHttpRequest::open(const String&amp; method, const String&amp; url, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; XMLHttpRequest::open(const String&amp; method, const String&amp; url)
</ins><span class="cx"> {
</span><span class="cx">     // If the async argument is omitted, set async to true.
</span><del>-    return open(method, scriptExecutionContext()-&gt;completeURL(url), true, ec);
</del><ins>+    return open(method, scriptExecutionContext()-&gt;completeURL(url), true);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void XMLHttpRequest::open(const String&amp; method, const URL&amp; url, bool async, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; XMLHttpRequest::open(const String&amp; method, const URL&amp; url, bool async)
</ins><span class="cx"> {
</span><span class="cx">     if (!internalAbort())
</span><del>-        return;
</del><ins>+        return { };
</ins><span class="cx"> 
</span><span class="cx">     State previousState = m_state;
</span><span class="cx">     m_state = UNSENT;
</span><span class="lines">@@ -427,21 +420,16 @@
</span><span class="cx"> 
</span><span class="cx">     ASSERT(m_state == UNSENT);
</span><span class="cx"> 
</span><del>-    if (!isValidHTTPToken(method)) {
-        ec = SYNTAX_ERR;
-        return;
-    }
</del><ins>+    if (!isValidHTTPToken(method))
+        return Exception { SYNTAX_ERR };
</ins><span class="cx"> 
</span><del>-    if (!isAllowedHTTPMethod(method)) {
-        ec = SECURITY_ERR;
-        return;
-    }
</del><ins>+    if (!isAllowedHTTPMethod(method))
+        return Exception { SECURITY_ERR };
</ins><span class="cx"> 
</span><span class="cx">     if (!async &amp;&amp; scriptExecutionContext()-&gt;isDocument()) {
</span><span class="cx">         if (document()-&gt;settings() &amp;&amp; !document()-&gt;settings()-&gt;syncXHRInDocumentsEnabled()) {
</span><span class="cx">             logConsoleError(scriptExecutionContext(), &quot;Synchronous XMLHttpRequests are disabled for this page.&quot;);
</span><del>-            ec = INVALID_ACCESS_ERR;
-            return;
</del><ins>+            return Exception { INVALID_ACCESS_ERR };
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // Newer functionality is not available to synchronous requests in window contexts, as a spec-mandated
</span><span class="lines">@@ -450,15 +438,13 @@
</span><span class="cx">         // such as file: and data: still make sense to allow.
</span><span class="cx">         if (url.protocolIsInHTTPFamily() &amp;&amp; m_responseType != ResponseType::EmptyString) {
</span><span class="cx">             logConsoleError(scriptExecutionContext(), &quot;Synchronous HTTP(S) requests made from the window context cannot have XMLHttpRequest.responseType set.&quot;);
</span><del>-            ec = INVALID_ACCESS_ERR;
-            return;
</del><ins>+            return Exception { INVALID_ACCESS_ERR };
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // Similarly, timeouts are disabled for synchronous requests as well.
</span><span class="cx">         if (m_timeoutMilliseconds &gt; 0) {
</span><span class="cx">             logConsoleError(scriptExecutionContext(), &quot;Synchronous XMLHttpRequests must not have a timeout value set.&quot;);
</span><del>-            ec = INVALID_ACCESS_ERR;
-            return;
</del><ins>+            return Exception { INVALID_ACCESS_ERR };
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -477,9 +463,11 @@
</span><span class="cx">         changeState(OPENED);
</span><span class="cx">     else
</span><span class="cx">         m_state = OPENED;
</span><ins>+
+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void XMLHttpRequest::open(const String&amp; method, const String&amp; url, bool async, const String&amp; user, const String&amp; password, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; XMLHttpRequest::open(const String&amp; method, const String&amp; url, bool async, const String&amp; user, const String&amp; password)
</ins><span class="cx"> {
</span><span class="cx">     URL urlWithCredentials = scriptExecutionContext()-&gt;completeURL(url);
</span><span class="cx">     if (!user.isNull()) {
</span><span class="lines">@@ -488,49 +476,42 @@
</span><span class="cx">             urlWithCredentials.setPass(password);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    open(method, urlWithCredentials, async, ec);
</del><ins>+    return open(method, urlWithCredentials, async);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool XMLHttpRequest::initSend(ExceptionCode&amp; ec)
</del><ins>+Optional&lt;ExceptionOr&lt;void&gt;&gt; XMLHttpRequest::prepareToSend()
</ins><span class="cx"> {
</span><ins>+    // A return value other than Nullopt means we should not try to send, and we should return that value to the caller.
+    // Nullopt means we are ready to send and should continue with the send algorithm.
+
</ins><span class="cx">     if (!scriptExecutionContext())
</span><del>-        return false;
</del><ins>+        return ExceptionOr&lt;void&gt; { };
</ins><span class="cx"> 
</span><span class="cx">     auto&amp; context = *scriptExecutionContext();
</span><span class="cx"> 
</span><del>-    if (m_state != OPENED || m_sendFlag) {
-        ec = INVALID_STATE_ERR;
-        return false;
-    }
</del><ins>+    if (m_state != OPENED || m_sendFlag)
+        return ExceptionOr&lt;void&gt; { Exception { INVALID_STATE_ERR } };
</ins><span class="cx">     ASSERT(!m_loader);
</span><span class="cx"> 
</span><span class="cx">     // FIXME: Convert this to check the isolated world's Content Security Policy once webkit.org/b/104520 is solved.
</span><span class="cx">     if (!context.shouldBypassMainWorldContentSecurityPolicy() &amp;&amp; !context.contentSecurityPolicy()-&gt;allowConnectToSource(m_url)) {
</span><del>-        if (m_async) {
-            setPendingActivity(this);
-            m_timeoutTimer.stop();
-            m_networkErrorTimer.startOneShot(0);
-        } else
-            ec = NETWORK_ERR;
-        return false;
</del><ins>+        if (!m_async)
+            return ExceptionOr&lt;void&gt; { Exception { NETWORK_ERR } };
+        setPendingActivity(this);
+        m_timeoutTimer.stop();
+        m_networkErrorTimer.startOneShot(0);
+        return ExceptionOr&lt;void&gt; { };
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     m_error = false;
</span><del>-    return true;
</del><ins>+    return Nullopt;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void XMLHttpRequest::send(ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; XMLHttpRequest::send(Document&amp; document)
</ins><span class="cx"> {
</span><del>-    send(String(), ec);
-}
</del><ins>+    if (auto result = prepareToSend())
+        return WTFMove(result.value());
</ins><span class="cx"> 
</span><del>-void XMLHttpRequest::send(Document* document, ExceptionCode&amp; ec)
-{
-    ASSERT(document);
-
-    if (!initSend(ec))
-        return;
-
</del><span class="cx">     if (m_method != &quot;GET&quot; &amp;&amp; m_method != &quot;HEAD&quot; &amp;&amp; m_url.protocolIsInHTTPFamily()) {
</span><span class="cx">         if (!m_requestHeaders.contains(HTTPHeaderName::ContentType)) {
</span><span class="cx"> #if ENABLE(DASHBOARD_SUPPORT)
</span><span class="lines">@@ -539,25 +520,23 @@
</span><span class="cx">             else
</span><span class="cx"> #endif
</span><span class="cx">                 // FIXME: this should include the charset used for encoding.
</span><del>-                m_requestHeaders.set(HTTPHeaderName::ContentType, document-&gt;isHTMLDocument() ? ASCIILiteral(&quot;text/html;charset=UTF-8&quot;) : ASCIILiteral(&quot;application/xml;charset=UTF-8&quot;));
</del><ins>+                m_requestHeaders.set(HTTPHeaderName::ContentType, document.isHTMLDocument() ? ASCIILiteral(&quot;text/html;charset=UTF-8&quot;) : ASCIILiteral(&quot;application/xml;charset=UTF-8&quot;));
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // FIXME: According to XMLHttpRequest Level 2, this should use the Document.innerHTML algorithm
</span><span class="cx">         // from the HTML5 specification to serialize the document.
</span><del>-        String body = createMarkup(*document);
-
-        m_requestEntityBody = FormData::create(UTF8Encoding().encode(body, EntitiesForUnencodables));
</del><ins>+        m_requestEntityBody = FormData::create(UTF8Encoding().encode(createMarkup(document), EntitiesForUnencodables));
</ins><span class="cx">         if (m_upload)
</span><span class="cx">             m_requestEntityBody-&gt;setAlwaysStream(true);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    createRequest(ec);
</del><ins>+    return createRequest();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void XMLHttpRequest::send(const String&amp; body, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; XMLHttpRequest::send(const String&amp; body)
</ins><span class="cx"> {
</span><del>-    if (!initSend(ec))
-        return;
</del><ins>+    if (auto result = prepareToSend())
+        return WTFMove(result.value());
</ins><span class="cx"> 
</span><span class="cx">     if (!body.isNull() &amp;&amp; m_method != &quot;GET&quot; &amp;&amp; m_method != &quot;HEAD&quot; &amp;&amp; m_url.protocolIsInHTTPFamily()) {
</span><span class="cx">         String contentType = m_requestHeaders.get(HTTPHeaderName::ContentType);
</span><span class="lines">@@ -578,17 +557,17 @@
</span><span class="cx">             m_requestEntityBody-&gt;setAlwaysStream(true);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    createRequest(ec);
</del><ins>+    return createRequest();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void XMLHttpRequest::send(Blob* body, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; XMLHttpRequest::send(Blob&amp; body)
</ins><span class="cx"> {
</span><del>-    if (!initSend(ec))
-        return;
</del><ins>+    if (auto result = prepareToSend())
+        return WTFMove(result.value());
</ins><span class="cx"> 
</span><span class="cx">     if (m_method != &quot;GET&quot; &amp;&amp; m_method != &quot;HEAD&quot; &amp;&amp; m_url.protocolIsInHTTPFamily()) {
</span><span class="cx">         if (!m_requestHeaders.contains(HTTPHeaderName::ContentType)) {
</span><del>-            const String&amp; blobType = body-&gt;type();
</del><ins>+            const String&amp; blobType = body.type();
</ins><span class="cx">             if (!blobType.isEmpty() &amp;&amp; isValidContentType(blobType))
</span><span class="cx">                 m_requestHeaders.set(HTTPHeaderName::ContentType, blobType);
</span><span class="cx">             else {
</span><span class="lines">@@ -598,46 +577,43 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         m_requestEntityBody = FormData::create();
</span><del>-        m_requestEntityBody-&gt;appendBlob(body-&gt;url());
</del><ins>+        m_requestEntityBody-&gt;appendBlob(body.url());
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    createRequest(ec);
</del><ins>+    return createRequest();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void XMLHttpRequest::send(DOMFormData* body, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; XMLHttpRequest::send(DOMFormData&amp; body)
</ins><span class="cx"> {
</span><del>-    if (!initSend(ec))
-        return;
</del><ins>+    if (auto result = prepareToSend())
+        return WTFMove(result.value());
</ins><span class="cx"> 
</span><span class="cx">     if (m_method != &quot;GET&quot; &amp;&amp; m_method != &quot;HEAD&quot; &amp;&amp; m_url.protocolIsInHTTPFamily()) {
</span><del>-        m_requestEntityBody = FormData::createMultiPart(*(static_cast&lt;FormDataList*&gt;(body)), body-&gt;encoding(), document());
-
</del><ins>+        m_requestEntityBody = FormData::createMultiPart(body, body.encoding(), document());
</ins><span class="cx">         m_requestEntityBody-&gt;generateFiles(document());
</span><del>-
</del><span class="cx">         if (!m_requestHeaders.contains(HTTPHeaderName::ContentType))
</span><span class="cx">             m_requestHeaders.set(HTTPHeaderName::ContentType, makeString(&quot;multipart/form-data; boundary=&quot;, m_requestEntityBody-&gt;boundary().data()));
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    createRequest(ec);
</del><ins>+    return createRequest();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void XMLHttpRequest::send(ArrayBuffer* body, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; XMLHttpRequest::send(ArrayBuffer&amp; body)
</ins><span class="cx"> {
</span><del>-    String consoleMessage(&quot;ArrayBuffer is deprecated in XMLHttpRequest.send(). Use ArrayBufferView instead.&quot;);
</del><ins>+    ASCIILiteral consoleMessage(&quot;ArrayBuffer is deprecated in XMLHttpRequest.send(). Use ArrayBufferView instead.&quot;);
</ins><span class="cx">     scriptExecutionContext()-&gt;addConsoleMessage(MessageSource::JS, MessageLevel::Warning, consoleMessage);
</span><del>-
-    sendBytesData(body-&gt;data(), body-&gt;byteLength(), ec);
</del><ins>+    return sendBytesData(body.data(), body.byteLength());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void XMLHttpRequest::send(ArrayBufferView* body, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; XMLHttpRequest::send(ArrayBufferView&amp; body)
</ins><span class="cx"> {
</span><del>-    sendBytesData(body-&gt;baseAddress(), body-&gt;byteLength(), ec);
</del><ins>+    return sendBytesData(body.baseAddress(), body.byteLength());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void XMLHttpRequest::sendBytesData(const void* data, size_t length, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; XMLHttpRequest::sendBytesData(const void* data, size_t length)
</ins><span class="cx"> {
</span><del>-    if (!initSend(ec))
-        return;
</del><ins>+    if (auto result = prepareToSend())
+        return WTFMove(result.value());
</ins><span class="cx"> 
</span><span class="cx">     if (m_method != &quot;GET&quot; &amp;&amp; m_method != &quot;HEAD&quot; &amp;&amp; m_url.protocolIsInHTTPFamily()) {
</span><span class="cx">         m_requestEntityBody = FormData::create(data, length);
</span><span class="lines">@@ -645,16 +621,14 @@
</span><span class="cx">             m_requestEntityBody-&gt;setAlwaysStream(true);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    createRequest(ec);
</del><ins>+    return createRequest();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void XMLHttpRequest::createRequest(ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; XMLHttpRequest::createRequest()
</ins><span class="cx"> {
</span><span class="cx">     // Only GET request is supported for blob URL.
</span><del>-    if (!m_async &amp;&amp; m_url.protocolIsBlob() &amp;&amp; m_method != &quot;GET&quot;) {
-        ec = NETWORK_ERR;
-        return;
-    }
</del><ins>+    if (!m_async &amp;&amp; m_url.protocolIsBlob() &amp;&amp; m_method != &quot;GET&quot;)
+        return Exception { NETWORK_ERR };
</ins><span class="cx"> 
</span><span class="cx">     m_sendFlag = true;
</span><span class="cx"> 
</span><span class="lines">@@ -733,9 +707,11 @@
</span><span class="cx">         InspectorInstrumentation::didLoadXHRSynchronously(scriptExecutionContext());
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (!m_exceptionCode &amp;&amp; m_error)
-        m_exceptionCode = NETWORK_ERR;
-    ec = m_exceptionCode;
</del><ins>+    if (m_exceptionCode)
+        return Exception { m_exceptionCode };
+    if (m_error)
+        return Exception { NETWORK_ERR };
+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void XMLHttpRequest::abort()
</span><span class="lines">@@ -858,41 +834,37 @@
</span><span class="cx">     unsetPendingActivity(this);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void XMLHttpRequest::overrideMimeType(const String&amp; override, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; XMLHttpRequest::overrideMimeType(const String&amp; override)
</ins><span class="cx"> {
</span><del>-    if (m_state == LOADING || m_state == DONE) {
-        ec = INVALID_STATE_ERR;
-        return;
-    }
</del><ins>+    if (m_state == LOADING || m_state == DONE)
+        return Exception { INVALID_STATE_ERR };
</ins><span class="cx"> 
</span><span class="cx">     m_mimeTypeOverride = override;
</span><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void XMLHttpRequest::setRequestHeader(const String&amp; name, const String&amp; value, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; XMLHttpRequest::setRequestHeader(const String&amp; name, const String&amp; value)
</ins><span class="cx"> {
</span><span class="cx">     if (m_state != OPENED || m_sendFlag) {
</span><span class="cx"> #if ENABLE(DASHBOARD_SUPPORT)
</span><span class="cx">         if (usesDashboardBackwardCompatibilityMode())
</span><del>-            return;
</del><ins>+            return { };
</ins><span class="cx"> #endif
</span><del>-
-        ec = INVALID_STATE_ERR;
-        return;
</del><ins>+        return Exception { INVALID_STATE_ERR };
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     String normalizedValue = stripLeadingAndTrailingHTTPSpaces(value);
</span><del>-    if (!isValidHTTPToken(name) || !isValidHTTPHeaderValue(normalizedValue)) {
-        ec = SYNTAX_ERR;
-        return;
-    }
</del><ins>+    if (!isValidHTTPToken(name) || !isValidHTTPHeaderValue(normalizedValue))
+        return Exception { SYNTAX_ERR };
</ins><span class="cx"> 
</span><span class="cx">     // A privileged script (e.g. a Dashboard widget) can set any headers.
</span><span class="cx">     if (!securityOrigin()-&gt;canLoadLocalResources() &amp;&amp; !isAllowedHTTPHeader(name)) {
</span><span class="cx">         logConsoleError(scriptExecutionContext(), &quot;Refused to set unsafe header \&quot;&quot; + name + &quot;\&quot;&quot;);
</span><del>-        return;
</del><ins>+        return { };
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     m_requestHeaders.add(name, normalizedValue);
</span><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String XMLHttpRequest::getAllResponseHeaders() const
</span></span></pre></div>
<a id="trunkSourceWebCorexmlXMLHttpRequesth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/xml/XMLHttpRequest.h (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/xml/XMLHttpRequest.h        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.h        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -22,6 +22,7 @@
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><span class="cx"> #include &quot;ActiveDOMObject.h&quot;
</span><ins>+#include &quot;ExceptionOr.h&quot;
</ins><span class="cx"> #include &quot;FormData.h&quot;
</span><span class="cx"> #include &quot;ResourceResponse.h&quot;
</span><span class="cx"> #include &quot;ThreadableLoaderClient.h&quot;
</span><span class="lines">@@ -57,7 +58,7 @@
</span><span class="cx">         LOADING = 3,
</span><span class="cx">         DONE = 4
</span><span class="cx">     };
</span><del>-    
</del><ins>+
</ins><span class="cx">     virtual void didReachTimeout();
</span><span class="cx"> 
</span><span class="cx">     EventTargetInterface eventTargetInterface() const override { return XMLHttpRequestEventTargetInterfaceType; }
</span><span class="lines">@@ -68,35 +69,34 @@
</span><span class="cx">     int status() const;
</span><span class="cx">     State readyState() const;
</span><span class="cx">     bool withCredentials() const { return m_includeCredentials; }
</span><del>-    void setWithCredentials(bool, ExceptionCode&amp;);
-    void open(const String&amp; method, const String&amp; url, ExceptionCode&amp;);
-    void open(const String&amp; method, const URL&amp;, bool async, ExceptionCode&amp;);
-    void open(const String&amp; method, const String&amp;, bool async, const String&amp; user, const String&amp; password, ExceptionCode&amp;);
-    void send(ExceptionCode&amp;);
-    void send(Document*, ExceptionCode&amp;);
-    void send(const String&amp;, ExceptionCode&amp;);
-    void send(Blob*, ExceptionCode&amp;);
-    void send(DOMFormData*, ExceptionCode&amp;);
-    void send(JSC::ArrayBuffer*, ExceptionCode&amp;);
-    void send(JSC::ArrayBufferView*, ExceptionCode&amp;);
</del><ins>+    ExceptionOr&lt;void&gt; setWithCredentials(bool);
+    ExceptionOr&lt;void&gt; open(const String&amp; method, const String&amp; url);
+    ExceptionOr&lt;void&gt; open(const String&amp; method, const URL&amp;, bool async);
+    ExceptionOr&lt;void&gt; open(const String&amp; method, const String&amp;, bool async, const String&amp; user, const String&amp; password);
+    ExceptionOr&lt;void&gt; send(Document&amp;);
+    ExceptionOr&lt;void&gt; send(const String&amp; = { });
+    ExceptionOr&lt;void&gt; send(Blob&amp;);
+    ExceptionOr&lt;void&gt; send(DOMFormData&amp;);
+    ExceptionOr&lt;void&gt; send(JSC::ArrayBuffer&amp;);
+    ExceptionOr&lt;void&gt; send(JSC::ArrayBufferView&amp;);
</ins><span class="cx">     void abort();
</span><del>-    void setRequestHeader(const String&amp; name, const String&amp; value, ExceptionCode&amp;);
-    void overrideMimeType(const String&amp; override, ExceptionCode&amp;);
</del><ins>+    ExceptionOr&lt;void&gt; setRequestHeader(const String&amp; name, const String&amp; value);
+    ExceptionOr&lt;void&gt; overrideMimeType(const String&amp; override);
</ins><span class="cx">     bool doneWithoutErrors() const { return !m_error &amp;&amp; m_state == DONE; }
</span><span class="cx">     String getAllResponseHeaders() const;
</span><span class="cx">     String getResponseHeader(const String&amp; name) const;
</span><del>-    String responseText(ExceptionCode&amp;);
</del><ins>+    ExceptionOr&lt;String&gt; responseText();
</ins><span class="cx">     String responseTextIgnoringResponseType() const { return m_responseBuilder.toStringPreserveCapacity(); }
</span><span class="cx">     String responseMIMEType() const;
</span><span class="cx"> 
</span><span class="cx">     Document* optionalResponseXML() const { return m_responseDocument.get(); }
</span><del>-    Document* responseXML(ExceptionCode&amp;);
</del><ins>+    ExceptionOr&lt;Document*&gt; responseXML();
</ins><span class="cx"> 
</span><span class="cx">     Ref&lt;Blob&gt; createResponseBlob();
</span><span class="cx">     RefPtr&lt;JSC::ArrayBuffer&gt; createResponseArrayBuffer();
</span><span class="cx"> 
</span><span class="cx">     unsigned timeout() const { return m_timeoutMilliseconds; }
</span><del>-    void setTimeout(unsigned timeout, ExceptionCode&amp;);
</del><ins>+    ExceptionOr&lt;void&gt; setTimeout(unsigned);
</ins><span class="cx"> 
</span><span class="cx">     bool responseCacheIsValid() const { return m_responseCacheIsValid; }
</span><span class="cx">     void didCacheResponse();
</span><span class="lines">@@ -107,7 +107,7 @@
</span><span class="cx">     static bool isAllowedHTTPHeader(const String&amp;);
</span><span class="cx"> 
</span><span class="cx">     enum class ResponseType { EmptyString, Arraybuffer, Blob, Document, Json, Text };
</span><del>-    void setResponseType(ResponseType, ExceptionCode&amp;);
</del><ins>+    ExceptionOr&lt;void&gt; setResponseType(ResponseType);
</ins><span class="cx">     ResponseType responseType() const;
</span><span class="cx"> 
</span><span class="cx">     String responseURL() const;
</span><span class="lines">@@ -152,10 +152,10 @@
</span><span class="cx"> 
</span><span class="cx">     bool responseIsXML() const;
</span><span class="cx"> 
</span><del>-    bool initSend(ExceptionCode&amp;);
-    void sendBytesData(const void*, size_t, ExceptionCode&amp;);
</del><ins>+    Optional&lt;ExceptionOr&lt;void&gt;&gt; prepareToSend();
+    ExceptionOr&lt;void&gt; sendBytesData(const void*, size_t);
</ins><span class="cx"> 
</span><del>-    void changeState(State newState);
</del><ins>+    void changeState(State);
</ins><span class="cx">     void callReadyStateChangeListener();
</span><span class="cx">     void dropProtection();
</span><span class="cx"> 
</span><span class="lines">@@ -167,7 +167,7 @@
</span><span class="cx">     void clearResponseBuffers();
</span><span class="cx">     void clearRequest();
</span><span class="cx"> 
</span><del>-    void createRequest(ExceptionCode&amp;);
</del><ins>+    ExceptionOr&lt;void&gt; createRequest();
</ins><span class="cx"> 
</span><span class="cx">     void genericError();
</span><span class="cx">     void networkError();
</span></span></pre></div>
<a id="trunkSourceWebCorexmlXMLHttpRequestidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/xml/XMLHttpRequest.idl (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/xml/XMLHttpRequest.idl        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.idl        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2008, 2011 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2008-2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -36,16 +36,16 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> [
</span><del>-    Exposed=(Window,Worker),
</del><span class="cx">     ActiveDOMObject,
</span><span class="cx">     Constructor,
</span><span class="cx">     ConstructorCallWith=ScriptExecutionContext,
</span><ins>+    ExportMacro=WEBCORE_EXPORT,
+    Exposed=(Window,Worker),
</ins><span class="cx">     JSCustomMarkFunction,
</span><ins>+    JSGenerateToJSObject,
</ins><span class="cx">     JSGenerateToNativeObject,
</span><del>-    JSGenerateToJSObject,
-    ExportMacro=WEBCORE_EXPORT,
</del><ins>+    PrivateIdentifier,
</ins><span class="cx">     PublicIdentifier,
</span><del>-    PrivateIdentifier,
</del><span class="cx"> ] interface XMLHttpRequest : XMLHttpRequestEventTarget {
</span><span class="cx">     attribute EventHandler onreadystatechange;
</span><span class="cx"> 
</span><span class="lines">@@ -56,30 +56,29 @@
</span><span class="cx">     const unsigned short LOADING = 3;
</span><span class="cx">     const unsigned short DONE = 4;
</span><span class="cx"> 
</span><del>-    [SetterMayThrowLegacyException] attribute unsigned long timeout;
</del><ins>+    [SetterMayThrowException] attribute unsigned long timeout;
</ins><span class="cx">     readonly attribute unsigned short readyState;
</span><span class="cx"> 
</span><del>-    [SetterMayThrowLegacyException] attribute boolean withCredentials;
</del><ins>+    [SetterMayThrowException] attribute boolean withCredentials;
</ins><span class="cx"> 
</span><span class="cx">     // Use overloading rather than &quot;boolean async = true&quot; because legacy content prevents treating the 'async' argument being undefined identical from it being omitted.
</span><del>-    [MayThrowLegacyException] void open(DOMString method, DOMString url);
-    [MayThrowLegacyException] void open(DOMString method, DOMString url, boolean async, optional DOMString? user = null, optional DOMString? password = null);
</del><ins>+    [MayThrowException] void open(DOMString method, DOMString url);
+    [MayThrowException] void open(DOMString method, DOMString url, boolean async, optional DOMString? user = null, optional DOMString? password = null);
</ins><span class="cx"> 
</span><del>-    [MayThrowLegacyException] void setRequestHeader(DOMString header, DOMString value);
</del><ins>+    [MayThrowException] void setRequestHeader(DOMString header, DOMString value);
</ins><span class="cx"> 
</span><del>-    [Custom, MayThrowLegacyException] void send();
</del><ins>+    [Custom, MayThrowException] void send();
</ins><span class="cx"> 
</span><span class="cx">     void abort();
</span><span class="cx"> 
</span><span class="cx">     readonly attribute XMLHttpRequestUpload upload;
</span><span class="cx"> 
</span><del>-    // response
</del><span class="cx">     DOMString getAllResponseHeaders();
</span><span class="cx">     DOMString? getResponseHeader(DOMString header);
</span><del>-    [GetterMayThrowLegacyException, CustomGetter] readonly attribute DOMString? responseText;
-    [GetterMayThrowLegacyException] readonly attribute Document responseXML;
</del><ins>+    [GetterMayThrowException, CustomGetter] readonly attribute DOMString? responseText;
+    [GetterMayThrowException] readonly attribute Document responseXML;
</ins><span class="cx"> 
</span><del>-    [SetterMayThrowLegacyException] attribute XMLHttpRequestResponseType responseType;
</del><ins>+    [SetterMayThrowException] attribute XMLHttpRequestResponseType responseType;
</ins><span class="cx">     [JSBuiltin] readonly attribute Object response;
</span><span class="cx"> 
</span><span class="cx">     readonly attribute unsigned short status;
</span><span class="lines">@@ -89,6 +88,5 @@
</span><span class="cx">     [PrivateIdentifier] boolean responseCacheIsValid();
</span><span class="cx">     [PrivateIdentifier, Custom] any retrieveResponse();
</span><span class="cx"> 
</span><del>-    // Extension
-    [MayThrowLegacyException] void overrideMimeType(DOMString override);
</del><ins>+    [MayThrowException] void overrideMimeType(DOMString override);
</ins><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebKit/mac/ChangeLog        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2016-10-06  Darin Adler  &lt;darin@apple.com&gt;
+
+        Next step on moving to modern way to return DOM exceptions
+        https://bugs.webkit.org/show_bug.cgi?id=163016
+
+        Reviewed by Ryosuke Niwa.
+
+        * DOM/DOMDOMImplementation.mm:
+        (-[DOMImplementation createDocumentType:publicId:systemId:]): Updated for
+        name change from takeReturnValue to releaseReturnValue.
+        (-[DOMImplementation createDocument:qualifiedName:doctype:]): Ditto.
+
</ins><span class="cx"> 2016-10-07  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [WK1 Mac] Fix repaints of fixed-background elements in layer-backed WebViews
</span></span></pre></div>
<a id="trunkSourceWebKitmacDOMDOMDOMImplementationmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/DOM/DOMDOMImplementation.mm (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/DOM/DOMDOMImplementation.mm        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebKit/mac/DOM/DOMDOMImplementation.mm        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -66,9 +66,11 @@
</span><span class="cx"> {
</span><span class="cx">     WebCore::JSMainThreadNullState state;
</span><span class="cx">     auto result = unwrap(*self).createDocumentType(qualifiedName, publicId, systemId);
</span><del>-    if (result.hasException())
-        raiseDOMException(result.exceptionCode());
-    return kit(result.takeReturnValue().ptr());
</del><ins>+    if (result.hasException()) {
+        raiseDOMException(result.releaseException().code());
+        return nil;
+    }
+    return kit(result.releaseReturnValue().ptr());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (DOMDocument *)createDocument:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName doctype:(DOMDocumentType *)doctype
</span><span class="lines">@@ -75,9 +77,11 @@
</span><span class="cx"> {
</span><span class="cx">     WebCore::JSMainThreadNullState state;
</span><span class="cx">     auto result = unwrap(*self).createDocument(namespaceURI, qualifiedName, core(doctype));
</span><del>-    if (result.hasException())
-        raiseDOMException(result.exceptionCode());
-    return kit(result.takeReturnValue().ptr());
</del><ins>+    if (result.hasException()) {
+        raiseDOMException(result.releaseException().code());
+        return nil;
+    }
+    return kit(result.releaseReturnValue().ptr());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (DOMCSSStyleSheet *)createCSSStyleSheet:(NSString *)title media:(NSString *)media
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebKit2/ChangeLog        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2016-10-06  Darin Adler  &lt;darin@apple.com&gt;
+
+        Next step on moving to modern way to return DOM exceptions
+        https://bugs.webkit.org/show_bug.cgi?id=163016
+
+        Reviewed by Ryosuke Niwa.
+
+        * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMImplementation.cpp:
+        (webkit_dom_dom_implementation_create_document_type): Updated for name change
+        from takeReturnValue to releaseReturnValue.
+        (webkit_dom_dom_implementation_create_document): Ditto.
+        * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMSelection.cpp:
+        (webkit_dom_dom_selection_collapse_to_end): Use ExceptionOr instead of ExceptionCode.
+        (webkit_dom_dom_selection_collapse_to_start): Ditto.
+        (webkit_dom_dom_selection_extend): Ditto.
+        (webkit_dom_dom_selection_get_range_at): Ditto.
+
</ins><span class="cx"> 2016-10-08  Commit Queue  &lt;commit-queue@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r206950.
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMWebKitDOMDOMImplementationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMImplementation.cpp (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMImplementation.cpp        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMImplementation.cpp        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -130,10 +130,11 @@
</span><span class="cx">     WTF::String convertedSystemId = WTF::String::fromUTF8(systemId);
</span><span class="cx">     auto result = item-&gt;createDocumentType(convertedQualifiedName, convertedPublicId, convertedSystemId);
</span><span class="cx">     if (result.hasException()) {
</span><del>-        WebCore::ExceptionCodeDescription ecdesc(result.exceptionCode());
</del><ins>+        WebCore::ExceptionCodeDescription ecdesc(result.releaseException().code());
</ins><span class="cx">         g_set_error_literal(error, g_quark_from_string(&quot;WEBKIT_DOM&quot;), ecdesc.code, ecdesc.name);
</span><ins>+        return nullptr;
</ins><span class="cx">     }
</span><del>-    return WebKit::kit(result.takeReturnValue().ptr());
</del><ins>+    return WebKit::kit(result.releaseReturnValue().ptr());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebKitDOMDocument* webkit_dom_dom_implementation_create_document(WebKitDOMDOMImplementation* self, const gchar* namespaceURI, const gchar* qualifiedName, WebKitDOMDocumentType* doctype, GError** error)
</span><span class="lines">@@ -149,10 +150,11 @@
</span><span class="cx">     WebCore::DocumentType* convertedDoctype = WebKit::core(doctype);
</span><span class="cx">     auto result = item-&gt;createDocument(convertedNamespaceURI, convertedQualifiedName, convertedDoctype);
</span><span class="cx">     if (result.hasException()) {
</span><del>-        WebCore::ExceptionCodeDescription ecdesc(result.exceptionCode());
</del><ins>+        WebCore::ExceptionCodeDescription ecdesc(result.releaseException().code());
</ins><span class="cx">         g_set_error_literal(error, g_quark_from_string(&quot;WEBKIT_DOM&quot;), ecdesc.code, ecdesc.name);
</span><ins>+        return nullptr;
</ins><span class="cx">     }
</span><del>-    return WebKit::kit(result.takeReturnValue().ptr());
</del><ins>+    return WebKit::kit(result.releaseReturnValue().ptr());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebKitDOMCSSStyleSheet* webkit_dom_dom_implementation_create_css_style_sheet(WebKitDOMDOMImplementation* self, const gchar* title, const gchar* media, GError** error)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIgtkDOMWebKitDOMDOMSelectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMSelection.cpp (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMSelection.cpp        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMSelection.cpp        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -291,10 +291,9 @@
</span><span class="cx">     g_return_if_fail(WEBKIT_DOM_IS_DOM_SELECTION(self));
</span><span class="cx">     g_return_if_fail(!error || !*error);
</span><span class="cx">     WebCore::DOMSelection* item = WebKit::core(self);
</span><del>-    WebCore::ExceptionCode ec = 0;
-    item-&gt;collapseToEnd(ec);
-    if (ec) {
-        WebCore::ExceptionCodeDescription ecdesc(ec);
</del><ins>+    auto result = item-&gt;collapseToEnd();
+    if (result.hasException()) {
+        WebCore::ExceptionCodeDescription ecdesc(result.releaseException().code());
</ins><span class="cx">         g_set_error_literal(error, g_quark_from_string(&quot;WEBKIT_DOM&quot;), ecdesc.code, ecdesc.name);
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="lines">@@ -305,10 +304,9 @@
</span><span class="cx">     g_return_if_fail(WEBKIT_DOM_IS_DOM_SELECTION(self));
</span><span class="cx">     g_return_if_fail(!error || !*error);
</span><span class="cx">     WebCore::DOMSelection* item = WebKit::core(self);
</span><del>-    WebCore::ExceptionCode ec = 0;
-    item-&gt;collapseToStart(ec);
-    if (ec) {
-        WebCore::ExceptionCodeDescription ecdesc(ec);
</del><ins>+    auto result = item-&gt;collapseToStart();
+    if (result.hasException()) {
+        WebCore::ExceptionCodeDescription ecdesc(result.releaseException().code());
</ins><span class="cx">         g_set_error_literal(error, g_quark_from_string(&quot;WEBKIT_DOM&quot;), ecdesc.code, ecdesc.name);
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="lines">@@ -350,10 +348,9 @@
</span><span class="cx">     g_return_if_fail(!error || !*error);
</span><span class="cx">     WebCore::DOMSelection* item = WebKit::core(self);
</span><span class="cx">     WebCore::Node* convertedNode = WebKit::core(node);
</span><del>-    WebCore::ExceptionCode ec = 0;
-    item-&gt;extend(*convertedNode, offset, ec);
-    if (ec) {
-        WebCore::ExceptionCodeDescription ecdesc(ec);
</del><ins>+    auto result = item-&gt;extend(*convertedNode, offset);
+    if (result.hasException()) {
+        WebCore::ExceptionCodeDescription ecdesc(result.releaseException().code());
</ins><span class="cx">         g_set_error_literal(error, g_quark_from_string(&quot;WEBKIT_DOM&quot;), ecdesc.code, ecdesc.name);
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="lines">@@ -364,13 +361,13 @@
</span><span class="cx">     g_return_val_if_fail(WEBKIT_DOM_IS_DOM_SELECTION(self), 0);
</span><span class="cx">     g_return_val_if_fail(!error || !*error, 0);
</span><span class="cx">     WebCore::DOMSelection* item = WebKit::core(self);
</span><del>-    WebCore::ExceptionCode ec = 0;
-    RefPtr&lt;WebCore::Range&gt; gobjectResult = WTF::getPtr(item-&gt;getRangeAt(index, ec));
-    if (ec) {
-        WebCore::ExceptionCodeDescription ecdesc(ec);
</del><ins>+    auto result = item-&gt;getRangeAt(index);
+    if (result.hasException()) {
+        WebCore::ExceptionCodeDescription ecdesc(result.releaseException().code());
</ins><span class="cx">         g_set_error_literal(error, g_quark_from_string(&quot;WEBKIT_DOM&quot;), ecdesc.code, ecdesc.name);
</span><ins>+        return nullptr;
</ins><span class="cx">     }
</span><del>-    return WebKit::kit(gobjectResult.get());
</del><ins>+    return WebKit::kit(result.releaseReturnValue().ptr());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void webkit_dom_dom_selection_remove_all_ranges(WebKitDOMDOMSelection* self)
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Tools/ChangeLog        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2016-10-06  Darin Adler  &lt;darin@apple.com&gt;
+
+        Next step on moving to modern way to return DOM exceptions
+        https://bugs.webkit.org/show_bug.cgi?id=163016
+
+        Reviewed by Ryosuke Niwa.
+
+        * Scripts/do-webcore-rename: Add proposed name change of setDOMException
+        to propagateException, since this function is primarily used to take an
+        exception already effectively &quot;thrown&quot; by setting an ExceptionCode out
+        argument and propagate it into the JavaScript engine's exception machinery.
+
</ins><span class="cx"> 2016-10-07  Alex Christensen  &lt;achristensen@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Non-special URL fragments should percent-encode non-ASCII characters
</span></span></pre></div>
<a id="trunkToolsScriptsdowebcorerename"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/do-webcore-rename (206959 => 206960)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/do-webcore-rename        2016-10-08 20:42:52 UTC (rev 206959)
+++ trunk/Tools/Scripts/do-webcore-rename        2016-10-08 23:01:27 UTC (rev 206960)
</span><span class="lines">@@ -109,6 +109,9 @@
</span><span class="cx"> );
</span><span class="cx"> 
</span><span class="cx"> my %renamesContemplatedForTheFuture = (
</span><ins>+    &quot;setDOMException&quot; =&gt; &quot;propagateException&quot;,
+    &quot;setDOMExceptionSlow&quot; =&gt; &quot;propagateExceptionSlowPath&quot;,
+
</ins><span class="cx">     &quot;PassRefPtr&quot; =&gt; &quot;DeprecatedPassRefPtr&quot;,
</span><span class="cx"> 
</span><span class="cx">     &quot;HTMLPlugInImageElement&quot; =&gt; &quot;HTMLEmbeddedObjectElement&quot;,
</span></span></pre>
</div>
</div>

</body>
</html>