<?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>154059</bug_id>
          
          <creation_ts>2016-02-09 18:54:25 -0800</creation_ts>
          <short_desc>WebFrame _stringByEvaluatingJavaScriptFromString:forceUserGesture: should assert that it is being called from the &quot;main&quot; thread.</short_desc>
          <delta_ts>2016-02-12 16:15:44 -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>WebKit Misc.</component>
          <version>WebKit Local 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>ap</cc>
    
    <cc>beidson</cc>
    
    <cc>commit-queue</cc>
    
    <cc>darin</cc>
    
    <cc>ggaren</cc>
    
    <cc>manian</cc>
    
    <cc>timothy</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1163369</commentid>
    <comment_count>0</comment_count>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2016-02-09 18:54:25 -0800</bug_when>
    <thetext>This makes it so that misbehaving clients which call it (indirectly) from another thread (not the main thread) will fail faster.  Otherwise, we get potential memory corruption that results in strange crashes elsewhere later.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1163521</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2016-02-10 10:38:42 -0800</bug_when>
    <thetext>&lt;rdar://problem/24590120&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1163523</commentid>
    <comment_count>2</comment_count>
      <attachid>271005</attachid>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2016-02-10 10:57:12 -0800</bug_when>
    <thetext>Created attachment 271005
proposed patch.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1163588</commentid>
    <comment_count>3</comment_count>
      <attachid>271005</attachid>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2016-02-10 13:26:37 -0800</bug_when>
    <thetext>Comment on attachment 271005
proposed patch.

r=me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1163608</commentid>
    <comment_count>4</comment_count>
      <attachid>271005</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2016-02-10 14:17:00 -0800</bug_when>
    <thetext>Comment on attachment 271005
proposed patch.

Clearing flags on attachment: 271005

Committed r196395: &lt;http://trac.webkit.org/changeset/196395&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1163609</commentid>
    <comment_count>5</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2016-02-10 14:17:02 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1163747</commentid>
    <comment_count>6</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2016-02-11 07:26:32 -0800</bug_when>
    <thetext>We typically use Objective-C exceptions rather than RELEASE_ASSERT for this kind of thread restriction. These are easier for developers to understand than a crash.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1163750</commentid>
    <comment_count>7</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2016-02-11 08:33:58 -0800</bug_when>
    <thetext>Our previous work on this uses these functions:

WebCoreThreadViolationCheckRoundOne
WebCoreThreadViolationCheckRoundTwo

from the header ThreadCheck.h</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1163751</commentid>
    <comment_count>8</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2016-02-11 08:40:17 -0800</bug_when>
    <thetext>Instead, or possibly in addition to, this RELEASE_ASSERT, we should add WebCoreThreadViolationCheckRoundTwo to the public API entry point -[WebView stringByEvaluatingJavaScriptFromString:] or come up with a WebCoreThreadViolationCheckRoundThree. And possibly add it to the internal bottleneck method as well.

A lot of thought went into how WebCoreThreadViolationCheck works, and it’s designed for just this sort of situation.

On the other hand, it’s not surprising we have forgotten about this since that work was done 7 years ago!

Bug 22976 was when we created all of this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1164416</commentid>
    <comment_count>9</comment_count>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2016-02-12 16:15:44 -0800</bug_when>
    <thetext>(In reply to comment #8)
&gt; A lot of thought went into how WebCoreThreadViolationCheck works, and it’s
&gt; designed for just this sort of situation.

I&apos;ve added thread violation checks to WebView&apos;s public APIs in https://bugs.webkit.org/show_bug.cgi?id=154183.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>271005</attachid>
            <date>2016-02-10 10:57:12 -0800</date>
            <delta_ts>2016-02-10 14:17:00 -0800</delta_ts>
            <desc>proposed patch.</desc>
            <filename>bug-154059.patch</filename>
            <type>text/plain</type>
            <size>1506</size>
            <attacher name="Mark Lam">mark.lam</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJLaXQvbWFjL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2Uv
V2ViS2l0L21hYy9DaGFuZ2VMb2cJKHJldmlzaW9uIDE5NjM3MCkKKysrIFN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WVzIGluIEFWQXNz
ZXRSZXNvdXJjZUxvYWRlcgpJbmRleDogU291cmNlL1dlYktpdC9tYWMvV2ViVmlldy9XZWJGcmFt
ZS5tbQo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2UvV2ViS2l0L21hYy9XZWJWaWV3L1dlYkZyYW1lLm1t
CShyZXZpc2lvbiAxOTYzNjgpCisrKyBTb3VyY2UvV2ViS2l0L21hYy9XZWJWaWV3L1dlYkZyYW1l
Lm1tCSh3b3JraW5nIGNvcHkpCkBAIC02NzAsNiArNjcwLDggQEAgLSAoTlNTdHJpbmcgKilfc3Ry
aW5nQnlFdmFsdWF0aW5nSmF2YVNjcgogICAgIGlmICghc3RyaW5nKQogICAgICAgICByZXR1cm4g
QCIiOwogCisgICAgUkVMRUFTRV9BU1NFUlQoaXNNYWluVGhyZWFkKCkpOworCiAgICAgQVNTRVJU
KF9wcml2YXRlLT5jb3JlRnJhbWUtPmRvY3VtZW50KCkpOwogICAgIFJldGFpblB0cjxXZWJGcmFt
ZT4gcHJvdGVjdChzZWxmKTsgLy8gRXhlY3V0aW5nIGFyYml0cmFyeSBKYXZhU2NyaXB0IGNhbiBk
ZXN0cm95IHRoZSBmcmFtZS4KICAgICAK
</data>

          </attachment>
      

    </bug>

</bugzilla>