<?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>234190</bug_id>
          
          <creation_ts>2021-12-10 18:07:12 -0800</creation_ts>
          <short_desc>WebCore::createDOMException() should abort early if termination is pending.</short_desc>
          <delta_ts>2021-12-11 08:57:16 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore JavaScript</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Mark Lam">mark.lam</reporter>
          <assigned_to name="Mark Lam">mark.lam</assigned_to>
          <cc>cdumez</cc>
    
    <cc>darin</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>youennf</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1823134</commentid>
    <comment_count>0</comment_count>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2021-12-10 18:07:12 -0800</bug_when>
    <thetext>Attempting to create Error objects may re-enter the VM, which we should not do when termination is pending.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1823136</commentid>
    <comment_count>1</comment_count>
      <attachid>446853</attachid>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2021-12-10 18:16:38 -0800</bug_when>
    <thetext>Created attachment 446853
[fast-cq] proposed patch.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1823138</commentid>
    <comment_count>2</comment_count>
      <attachid>446853</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2021-12-10 18:29:14 -0800</bug_when>
    <thetext>Comment on attachment 446853
[fast-cq] proposed patch.

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

&gt; Source/WebCore/bindings/js/JSDOMExceptionHandling.cpp:145
&gt; +    VM&amp; vm = lexicalGlobalObject-&gt;vm();
&gt; +    if (UNLIKELY(vm.hasPendingTerminationException()))
&gt; +        return jsUndefined();

What about the other similar functions, like the ones called by this function? For example, createSyntaxError?

I don’t think we need to put &quot;vm&quot; into a local variable, even though we do that often, since we are only using it once here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1823139</commentid>
    <comment_count>3</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2021-12-10 18:30:19 -0800</bug_when>
    <thetext>I suspect we’ll need this test for hasPendingTerminationException in more places. I don’t think this one function could possibly be the only one with a unique need for it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1823142</commentid>
    <comment_count>4</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2021-12-10 18:31:34 -0800</bug_when>
    <thetext>We should think about exactly which level is responsible for this check, and possibly move it elsewhere.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1823150</commentid>
    <comment_count>5</comment_count>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2021-12-10 19:11:35 -0800</bug_when>
    <thetext>I was hoping createDOMException() would be a good choke point, but I didn&apos;t do the due diligence.  You are correct: the underlying factory methods are called from so many places in WebCore.  On JSC side, we have regimented exception checks which would prevent these from being called.  But on WebCore side, perhaps we need something more.  I&apos;ll look into to moving the check lower, or see if I can think of a more elegant solution.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1823216</commentid>
    <comment_count>6</comment_count>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2021-12-11 08:53:02 -0800</bug_when>
    <thetext>On second thought, this fix works, and will prevent http/wpt/fetch/ tests from failing flakily due to this issue.  So, let&apos;s land this first to help alleviate the bots while we think of better solutions.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1823219</commentid>
    <comment_count>7</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2021-12-11 08:56:27 -0800</bug_when>
    <thetext>Committed r286912 (245138@main): &lt;https://commits.webkit.org/245138@main&gt;

All reviewed patches have been landed. Closing bug and clearing flags on attachment 446853.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1823221</commentid>
    <comment_count>8</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-12-11 08:57:16 -0800</bug_when>
    <thetext>&lt;rdar://problem/86365930&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>446853</attachid>
            <date>2021-12-10 18:16:38 -0800</date>
            <delta_ts>2021-12-11 08:56:29 -0800</delta_ts>
            <desc>[fast-cq] proposed patch.</desc>
            <filename>bug-234190.patch</filename>
            <type>text/plain</type>
            <size>1645</size>
            <attacher name="Mark Lam">mark.lam</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2UvV2Vi
Q29yZS9DaGFuZ2VMb2cJKHJldmlzaW9uIDI4Njg5MykKKysrIFNvdXJjZS9XZWJDb3JlL0NoYW5n
ZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwzICsxLDIwIEBACisyMDIxLTEyLTEwICBNYXJrIExh
bSAgPG1hcmsubGFtQGFwcGxlLmNvbT4KKworICAgICAgICBXZWJDb3JlOjpjcmVhdGVET01FeGNl
cHRpb24oKSBzaG91bGQgYWJvcnQgZWFybHkgaWYgdGVybWluYXRpb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lcHRpb25IYW5kbGluZy5jcHAJKHJldmlzaW9uIDI4NjY2MCkKKysrIFNvdXJjZS9X
ZWJDb3JlL2JpbmRpbmdzL2pzL0pTRE9NRXhjZXB0aW9uSGFuZGxpbmcuY3BwCSh3b3JraW5nIGNv
cHkpCkBAIC0xNDAsNiArMTQwLDEwIEBAIHZvaWQgcmVwb3J0Q3VycmVudEV4Y2VwdGlvbihKU0ds
b2JhbE9iamUKIAogSlNWYWx1ZSBjcmVhdGVET01FeGNlcHRpb24oSlNHbG9iYWxPYmplY3QqIGxl
eGljYWxHbG9iYWxPYmplY3QsIEV4Y2VwdGlvbkNvZGUgZWMsIGNvbnN0IFN0cmluZyYgbWVzc2Fn
ZSkKIHsKKyAgICBWTSYgdm0gPSBsZXhpY2FsR2xvYmFsT2JqZWN0LT52bSgpOworICAgIGlmIChV
TkxJS0VMWSh2bS5oYXNQZW5kaW5nVGVybWluYXRpb25FeGNlcHRpb24oKSkpCisgICAgICAgIHJl
dHVybiBqc1VuZGVmaW5lZCgpOworCiAgICAgc3dpdGNoIChlYykgewogICAgIGNhc2UgRXhpc3Rp
bmdFeGNlcHRpb25FcnJvcjoKICAgICAgICAgcmV0dXJuIGpzVW5kZWZpbmVkKCk7Cg==
</data>

          </attachment>
      

    </bug>

</bugzilla>