<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>49720</bug_id>
          
          <creation_ts>2010-11-18 02:24:46 -0800</creation_ts>
          <short_desc>[Qt] Not possible to catch C++ exception thrown from slot called from JS</short_desc>
          <delta_ts>2014-04-24 16:45:19 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>Qt, QtTriaged</keywords>
          <priority>P3</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>49725</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Kent Hansen">kent.hansen</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>zherczeg</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>310756</commentid>
    <comment_count>0</comment_count>
    <who name="Kent Hansen">kent.hansen</who>
    <bug_when>2010-11-18 02:24:46 -0800</bug_when>
    <thetext>The attached application aborts with

&quot;terminate called after throwing an instance of &apos;int&apos;&quot;

even though the call to evaluateJavaScript() (which calls the slot that throws the exception) is inside a try..catch.

Last tested against r72178.

This only happens when the JIT is enabled. It seems the C++ runtime is not able to properly unwind the stack and find the exception handler in that case.

The question is whether this is something that can be fixed in the JIT. If not, it seems like we need to introduce try..catch in the QtWebKit bridge (and convert the C++ exception to a JS exception, possibly). Alternatively, we can document that throwing exceptions from C++ is not supported in this case (e.g. the application developer should introduce try..catch on his side where necessary).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>310763</commentid>
    <comment_count>1</comment_count>
      <attachid>74221</attachid>
    <who name="Kent Hansen">kent.hansen</who>
    <bug_when>2010-11-18 02:57:54 -0800</bug_when>
    <thetext>Created attachment 74221
Testcase</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>310766</commentid>
    <comment_count>2</comment_count>
    <who name="Kent Hansen">kent.hansen</who>
    <bug_when>2010-11-18 03:17:19 -0800</bug_when>
    <thetext>Found the same issue in relation to LLVM: http://old.nabble.com/C%2B%2B-Exception-Handling-Problem-td22427938.html

Solution from above thread: &quot;My guess here is that there are JITted functions in your stack. If that&apos;s the case, you need to set the ExceptionHandling flag of LLVM on. This will make the JIT generate dwarf tables for JITted code, and libgcc
will be able to unwind these functions.&quot;

So the ideal solution for us would be to have dwarf table generation in JSC (that would have to be explicitly enabled, e.g. through a QWebSettings flag).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>975157</commentid>
    <comment_count>3</comment_count>
    <who name="Jocelyn Turcotte">jturcotte</who>
    <bug_when>2014-02-03 03:16:59 -0800</bug_when>
    <thetext>=== Bulk closing of Qt bugs ===

If you believe that this bug report is still relevant for a non-Qt port of webkit.org, please re-open it and remove [Qt] from the summary.

If you believe that this is still an important QtWebKit bug, please fill a new report at https://bugreports.qt-project.org and add a link to this issue. See http://qt-project.org/wiki/ReportingBugsInQt for additional guidelines.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1003852</commentid>
    <comment_count>4</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2014-04-24 16:45:19 -0700</bug_when>
    <thetext>Moving all JavaScriptGlue bugs to JavaScriptCore. The JavaScriptGlue framework itself is long gone. And most of the more recent bugs put in this component were put there by people who thought this was for some other aspect of “JavaScript glue” and have nothing to do with the actual original reason for the existence of this component, which was an OS-X-only framework named JavaScriptGlue.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>74221</attachid>
            <date>2010-11-18 02:57:54 -0800</date>
            <delta_ts>2010-11-18 02:57:54 -0800</delta_ts>
            <desc>Testcase</desc>
            <filename>main.cpp</filename>
            <type>text/x-c++src</type>
            <size>519</size>
            <attacher name="Kent Hansen">kent.hansen</attacher>
            
              <data encoding="base64">I2luY2x1ZGUgPFF0R3VpPgojaW5jbHVkZSA8UXRXZWJLaXQ+CgpjbGFzcyBUZXN0IDogcHVibGlj
IFFPYmplY3QKewogICAgUV9PQkpFQ1QKcHVibGljIHNsb3RzOgogICAgdm9pZCB0aHJvd0Zyb21D
cHAoKSB7CiAgICAgICAgdGhyb3cgMTIzOwogICAgfQp9OwoKaW50IG1haW4oaW50IGFyZ2MsIGNo
YXIgKiphcmd2KQp7CiAgICBRQXBwbGljYXRpb24gYXBwKGFyZ2MsIGFyZ3YpOwogICAgUVdlYlBh
Z2UgcGFnZTsKICAgIFFXZWJGcmFtZSAqZnJhbWUgPSBwYWdlLm1haW5GcmFtZSgpOwogICAgVGVz
dCB0c3Q7CiAgICBmcmFtZS0+YWRkVG9KYXZhU2NyaXB0V2luZG93T2JqZWN0KCJ0c3QiLCAmdHN0
KTsKICAgIHRyeSB7CiAgICAgICAgZnJhbWUtPmV2YWx1YXRlSmF2YVNjcmlwdCgidHN0LnRocm93
RnJvbUNwcCgpIik7CiAgICB9IGNhdGNoICguLi4pIHsKICAgICAgICBxV2FybmluZygiUEFTUzog
Y2F1Z2h0IGV4Y2VwdGlvbiIpOwogICAgfQogICAgcmV0dXJuIDA7Cn0KCiNpbmNsdWRlICJtYWlu
Lm1vYyIK
</data>

          </attachment>
      

    </bug>

</bugzilla>