<?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>137906</bug_id>
          
          <creation_ts>2014-10-20 18:29:03 -0700</creation_ts>
          <short_desc>Don&apos;t create cached functions for HTMLDocument.write*()</short_desc>
          <delta_ts>2014-10-29 11:32:45 -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>WebCore JavaScript</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>136724</blocked>
    
    <blocked>136901</blocked>
    
    <blocked>137907</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Saboff">msaboff</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>darin</cc>
    
    <cc>ggaren</cc>
    
    <cc>simon.fraser</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1043054</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2014-10-20 18:29:03 -0700</bug_when>
    <thetext>For the same reasons outline in &lt;https://bugs.webkit.org/show_bug.cgi?id=137839&gt; - &quot;Don&apos;t create cached functions that access lexicalGlobalObject()&quot;, create uncached version of write() and writeln().  These function should have been part of that bug, but are handled here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1043063</commentid>
    <comment_count>1</comment_count>
      <attachid>240172</attachid>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2014-10-20 18:50:50 -0700</bug_when>
    <thetext>Created attachment 240172
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1043181</commentid>
    <comment_count>2</comment_count>
      <attachid>240172</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2014-10-21 08:44:16 -0700</bug_when>
    <thetext>Comment on attachment 240172
Patch

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

&gt; Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp:69
&gt; +    if (equal(propertyName.publicName(), &quot;write&quot;)) {

Given that this idiom is a good one, I think we should add:

    bool operator==(PropertyName, const char*);

So we don&apos;t have to write this longer sequence at each call site. I also think it’s possibly slightly more efficient to save one branch and use uid() instead of publicName() since the empty uniques would never compare equal to a non-empty string. But that&apos;s the kind of thing that I would like the person writing the override to worry about rather than having to worry about it at each call site.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1043187</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2014-10-21 08:52:03 -0700</bug_when>
    <thetext>(In reply to comment #2)
&gt; Comment on attachment 240172 [details]
&gt; Patch
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=240172&amp;action=review
&gt; 
&gt; &gt; Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp:69
&gt; &gt; +    if (equal(propertyName.publicName(), &quot;write&quot;)) {
&gt; 
&gt; Given that this idiom is a good one, I think we should add:
&gt; 
&gt;     bool operator==(PropertyName, const char*);
&gt; 
&gt; So we don&apos;t have to write this longer sequence at each call site. I also
&gt; think it’s possibly slightly more efficient to save one branch and use uid()
&gt; instead of publicName() since the empty uniques would never compare equal to
&gt; a non-empty string. But that&apos;s the kind of thing that I would like the
&gt; person writing the override to worry about rather than having to worry about
&gt; it at each call site.

Thanks for the review.

I&apos;ll make the suggested changes, including using uid() in another patch.  Tracked in &lt;https://bugs.webkit.org/show_bug.cgi?id=137925&gt; - &quot;Add operator==(PropertyName, char*)&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1043215</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2014-10-21 10:19:45 -0700</bug_when>
    <thetext>Committed r174985: &lt;http://trac.webkit.org/changeset/174985&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1043225</commentid>
    <comment_count>5</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2014-10-21 10:47:02 -0700</bug_when>
    <thetext>This is the kind of subtle change where the test case is more valuable than the code change. Please add a test for this, or note in the ChangeLog which tests already cover this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1043234</commentid>
    <comment_count>6</comment_count>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2014-10-21 11:12:02 -0700</bug_when>
    <thetext>(In reply to comment #5)
&gt; This is the kind of subtle change where the test case is more valuable than
&gt; the code change. Please add a test for this, or note in the ChangeLog which
&gt; tests already cover this.

This change is covered by the tests:
LayoutTests/http/tests/security/aboutBlank/security-context-grandchildren-write-lexical.html
LayoutTests/http/tests/security/aboutBlank/security-context-grandchildren-writeln-lexical.html
LayoutTests/http/tests/security/aboutBlank/security-context-write.html
LayoutTests/http/tests/security/aboutBlank/security-context-writeln.html
LayoutTests/http/tests/xmlhttprequest/request-from-popup.html
LayoutTests/http/tests/navigation/new-window-redirect-history.html
LayoutTests/http/tests/misc/window-open-then-write.html

I&apos;ll update the change log accordingly.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1043273</commentid>
    <comment_count>7</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2014-10-21 13:59:41 -0700</bug_when>
    <thetext>(In reply to comment #6)
&gt; This change is covered by the tests:

Sorry, I don’t understand. Were those tests failing before? I didn’t see a patch to the expected results to expect success instead of failure.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1043278</commentid>
    <comment_count>8</comment_count>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2014-10-21 14:11:02 -0700</bug_when>
    <thetext>(In reply to comment #7)
&gt; (In reply to comment #6)
&gt; &gt; This change is covered by the tests:
&gt; 
&gt; Sorry, I don’t understand. Were those tests failing before? I didn’t see a
&gt; patch to the expected results to expect success instead of failure.

This change was split out from &lt;https://bugs.webkit.org/show_bug.cgi?id=137907&gt; similar to how &lt;https://bugs.webkit.org/show_bug.cgi?id=137839&gt; was split out.  This change is needed for &lt;https://bugs.webkit.org/show_bug.cgi?id=137907&gt; or the tests listed above fail.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1044792</commentid>
    <comment_count>9</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2014-10-29 11:32:45 -0700</bug_when>
    <thetext>I think this caused bug 138082.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>240172</attachid>
            <date>2014-10-20 18:50:50 -0700</date>
            <delta_ts>2014-10-21 08:44:16 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>137906.patch</filename>
            <type>text/plain</type>
            <size>2753</size>
            <attacher name="Michael Saboff">msaboff</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2UvV2Vi
Q29yZS9DaGFuZ2VMb2cJKHJldmlzaW9uIDE3NDkxOCkKKysrIFNvdXJjZS9XZWJDb3JlL0NoYW5n
ZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwzICsxLDE3IEBACisyMDE0LTEwLTIwICBNaWNoYWVs
IFNhYm9mZiAgPG1zYWJvZmZAYXBwbGUuY29tPgorCisgICAgICAgIERvbid0IGNyZWF0ZSBjYWNo
ZWQgZnVuY3Rpb25zIHR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E1MQ29s
bGVjdGlvbiBwbHVnaW5zOwo=
</data>
<flag name="review"
          id="264936"
          type_id="1"
          status="+"
          setter="darin"
    />
          </attachment>
      

    </bug>

</bugzilla>