Bug 199541 - switch(String) needs to check for exceptions when resolving the string
Summary: switch(String) needs to check for exceptions when resolving the string
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Michael Saboff
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-07-05 20:06 PDT by Michael Saboff
Modified: 2019-07-06 06:34 PDT (History)
6 users (show)

See Also:


Attachments
Patch (6.09 KB, patch)
2019-07-05 20:12 PDT, Michael Saboff
mark.lam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Saboff 2019-07-05 20:06:16 PDT
A String value for a switch statement may be an unresolved rope and could throw an exception during resolution.  Switch statement processing needs to handle the exception.
Comment 1 Michael Saboff 2019-07-05 20:06:33 PDT
<rdar://problem/52669115>
Comment 2 Michael Saboff 2019-07-05 20:12:17 PDT
Created attachment 373560 [details]
Patch
Comment 3 Mark Lam 2019-07-05 20:58:57 PDT
Comment on attachment 373560 [details]
Patch

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

r=me with throwScope declaration fix.

> Source/JavaScriptCore/dfg/DFGOperations.cpp:2478
>  

nit: can you remove this empty line?

> Source/JavaScriptCore/jit/JITOperations.cpp:2320
> +        auto throwScope = DECLARE_THROW_SCOPE(vm);

You should declare this at the top of the function at the earliest possible location.  This is the recommended best practice unless there's a really good reason not to.
Comment 4 Michael Saboff 2019-07-06 06:33:40 PDT
(In reply to Mark Lam from comment #3)
> Comment on attachment 373560 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=373560&action=review
> 
> r=me with throwScope declaration fix.
> 
> > Source/JavaScriptCore/dfg/DFGOperations.cpp:2478
> >  
> 
> nit: can you remove this empty line?
> 
> > Source/JavaScriptCore/jit/JITOperations.cpp:2320
> > +        auto throwScope = DECLARE_THROW_SCOPE(vm);
> 
> You should declare this at the top of the function at the earliest possible
> location.  This is the recommended best practice unless there's a really
> good reason not to.

I made these changes.
Comment 5 Michael Saboff 2019-07-06 06:34:53 PDT
Committed r247194: <https://trac.webkit.org/changeset/247194>