Bug 189185

Summary: Fix exception check accounting in constructJSWebAssemblyCompileError().
Product: WebKit Reporter: Mark Lam <mark.lam>
Component: JavaScriptCoreAssignee: Mark Lam <mark.lam>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, ews-watchlist, keith_miller, msaboff, realdawei, saam, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
proposed patch.
none
Patch none

Description Mark Lam 2018-08-31 00:06:21 PDT
<rdar://problem/39786007>
Comment 1 Mark Lam 2018-08-31 00:15:19 PDT
Created attachment 348616 [details]
proposed patch.
Comment 2 Michael Saboff 2018-08-31 09:47:15 PDT
Comment on attachment 348616 [details]
proposed patch.

r=me
Comment 3 WebKit Commit Bot 2018-08-31 10:12:39 PDT
Comment on attachment 348616 [details]
proposed patch.

Clearing flags on attachment: 348616

Committed r235558: <https://trac.webkit.org/changeset/235558>
Comment 4 WebKit Commit Bot 2018-08-31 10:12:40 PDT
All reviewed patches have been landed.  Closing bug.
Comment 5 Saam Barati 2018-08-31 11:30:46 PDT
Comment on attachment 348616 [details]
proposed patch.

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

> Source/JavaScriptCore/wasm/js/JSWebAssemblyModule.cpp:51
> +        auto* error = JSWebAssemblyCompileError::create(exec, vm, structure->globalObject()->WebAssemblyCompileErrorStructure(), result.error());

Why would creating the exception throw an exception?
Comment 6 Mark Lam 2018-08-31 14:01:41 PDT
(In reply to Saam Barati from comment #5)
> Comment on attachment 348616 [details]
> proposed patch.
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=348616&action=review
> 
> > Source/JavaScriptCore/wasm/js/JSWebAssemblyModule.cpp:51
> > +        auto* error = JSWebAssemblyCompileError::create(exec, vm, structure->globalObject()->WebAssemblyCompileErrorStructure(), result.error());
> 
> Why would creating the exception throw an exception?

See "static JSWebAssemblyCompileError* create(ExecState* exec, VM& vm, Structure* structure, JSValue message)" in JSWebAssemblyCompileError.h.  It calls message.toWTFString(exec) which can throw.
Comment 7 Saam Barati 2018-08-31 14:54:39 PDT
(In reply to Mark Lam from comment #6)
> (In reply to Saam Barati from comment #5)
> > Comment on attachment 348616 [details]
> > proposed patch.
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=348616&action=review
> > 
> > > Source/JavaScriptCore/wasm/js/JSWebAssemblyModule.cpp:51
> > > +        auto* error = JSWebAssemblyCompileError::create(exec, vm, structure->globalObject()->WebAssemblyCompileErrorStructure(), result.error());
> > 
> > Why would creating the exception throw an exception?
> 
> See "static JSWebAssemblyCompileError* create(ExecState* exec, VM& vm,
> Structure* structure, JSValue message)" in JSWebAssemblyCompileError.h.  It
> calls message.toWTFString(exec) which can throw.

Ok, makes sense.
Comment 8 Dawei Fenton (:realdawei) 2018-09-04 10:55:31 PDT
Reopening to attach new patch.
Comment 9 Dawei Fenton (:realdawei) 2018-09-04 10:55:32 PDT
Created attachment 348827 [details]
Patch
Comment 10 WebKit Commit Bot 2018-09-04 11:53:54 PDT
Comment on attachment 348827 [details]
Patch

Clearing flags on attachment: 348827

Committed r235624: <https://trac.webkit.org/changeset/235624>
Comment 11 WebKit Commit Bot 2018-09-04 11:53:55 PDT
All reviewed patches have been landed.  Closing bug.