<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Introducing ExceptionResult."
href="https://bugs.webkit.org/show_bug.cgi?id=145870">145870</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Introducing ExceptionResult.
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr>
<tr>
<th>Product</th>
<td>WebKit
</td>
</tr>
<tr>
<th>Version</th>
<td>528+ (Nightly build)
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Unspecified
</td>
</tr>
<tr>
<th>OS</th>
<td>Unspecified
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>Normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P2
</td>
</tr>
<tr>
<th>Component</th>
<td>JavaScriptCore
</td>
</tr>
<tr>
<th>Assignee</th>
<td>webkit-unassigned@lists.webkit.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>mark.lam@apple.com
</td>
</tr></table>
<p>
<div>
<pre>Before r185259, calls into the VM takes a JSValue* exceptionResult argument for returning any uncaught exception that may have been thrown while executing JS code. As a result, clients of the VM APIs will declare a local JSValue exceptionResult which is automatically initialized to a null value (i.e. the empty value, not the JS null value). With r185259, the call APIs were changes to take an Exception*& exceptionResult instead, and the VM functions are responsible for initializing the exceptionResult to null if no exception is thrown. This introduces 2 issues:
1. the VM code is vulnerable to modifications that may add early returns before the exceptionResult is nullified. This can result in the exceptionResult being used without initialization.
2. Previously, a client could technically use the same exceptionResult for more than one calls into the VM. If an earlier call sets it to a thrown value, the thrown value will stick unless a subsequent call throws a different exception. With the new Exception*& exceptionResult, the VM calls will always clear the exceptionResult before proceeding. As a result, the client's exceptionResult will be null after the second call even though the first call saw an exception thrown. This is a change in expected behavior.
To fix these issues, we'll introduce an ExceptionResult class which embeds and auto-initializes an Exception*. The VM calls will be reverted to only set the exceptionResult if a new exception is thrown.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>