Bug 165055

Summary: Fix exception scope verification failures in miscellaneous files.
Product: WebKit Reporter: Mark Lam <mark.lam>
Component: JavaScriptCoreAssignee: Mark Lam <mark.lam>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, fpizlo, ggaren, jfbastien, keith_miller, msaboff, saam, ysuzuki
Priority: P2    
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 162351    
Attachments:
Description Flags
proposed patch.
none
proposed patch.
mark.lam: review-
proposed patch. saam: review+

Description Mark Lam 2016-11-23 22:27:02 PST
Patch coming.
Comment 1 Mark Lam 2016-11-23 22:30:59 PST
Created attachment 295393 [details]
proposed patch.
Comment 2 Mark Lam 2016-11-23 22:33:10 PST
Created attachment 295394 [details]
proposed patch.
Comment 3 Mark Lam 2016-11-24 13:37:45 PST
Comment on attachment 295394 [details]
proposed patch.

It is invalid to replace returning encodedJSValue() with returning { }.  On 32-bit builds, the former is non-zero, while the latter is 0.  Will fix this patch.
Comment 4 Mark Lam 2016-11-25 14:15:05 PST
Created attachment 295430 [details]
proposed patch.
Comment 5 Saam Barati 2016-11-28 13:53:35 PST
Comment on attachment 295430 [details]
proposed patch.

View in context: https://bugs.webkit.org/attachment.cgi?id=295430&action=review

> Source/JavaScriptCore/runtime/ModuleLoaderPrototype.cpp:148
> +    if (!moduleRecord) {
> +        scope.release();

Why not just move the DECLARE_THROW_SCOPE lower?
Comment 6 Mark Lam 2016-11-28 14:19:00 PST
Comment on attachment 295430 [details]
proposed patch.

View in context: https://bugs.webkit.org/attachment.cgi?id=295430&action=review

>> Source/JavaScriptCore/runtime/ModuleLoaderPrototype.cpp:148
>> +        scope.release();
> 
> Why not just move the DECLARE_THROW_SCOPE lower?

Because the rule of thumb is to DECLARE_THROW_SCOPE (or DECLARE_CATCH_SCOPE) as high up in the function as much as possible.  Keeping it consistent this way removes the chance of missing needed exception checks because someone declared it too late, and a function call that can throw is added subsequently before the declaration of the throw scope.
Comment 7 Mark Lam 2016-11-28 14:22:26 PST
Thanks for the review.  Landed in r209018: <http://trac.webkit.org/r209018>.