<?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>103702</bug_id>
          
          <creation_ts>2012-11-29 18:30:48 -0800</creation_ts>
          <short_desc>PluginDocument fires didFinishDocumentLoadForFrame upon receiving initial bytes instead of when load completes</short_desc>
          <delta_ts>2012-11-30 15:31:47 -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>Plug-ins</component>
          <version>528+ (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="Tim Horton">thorton</reporter>
          <assigned_to name="Tim Horton">thorton</assigned_to>
          <cc>andersca</cc>
    
    <cc>ap</cc>
    
    <cc>bdakin</cc>
    
    <cc>beidson</cc>
    
    <cc>ojan</cc>
    
    <cc>webkit.review.bot</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>779727</commentid>
    <comment_count>0</comment_count>
    <who name="Tim Horton">thorton</who>
    <bug_when>2012-11-29 18:30:48 -0800</bug_when>
    <thetext>PluginDocumentParser::appendBytes() was made to call finish() in http://trac.webkit.org/changeset/14838. This is a bit odd because it basically means that onload and all the other load-y events get called immediately when the first bytes arrive, instead of when the document&apos;s main resource is actually finished loading.

However, DocumentWriter::end() already calls finish() at a more appropriate time. Reading http://trac.webkit.org/changeset/114062 makes me assume that at some point in the past (and likely in the case of r14838), finish() would not get called in the case of a main resource load, but it is now.

I&apos;m having trouble doing sufficient archaeology to determine when that change occurred, but I don&apos;t think it matters.

I&apos;d like to remove that call to finish() if there are no objections.

&lt;rdar://problem/12762534&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>779831</commentid>
    <comment_count>1</comment_count>
    <who name="Brady Eidson">beidson</who>
    <bug_when>2012-11-29 22:50:32 -0800</bug_when>
    <thetext>(In reply to comment #0)
&gt; PluginDocumentParser::appendBytes() was made to call finish() in http://trac.webkit.org/changeset/14838. This is a bit odd because it basically means that onload and all the other load-y events get called immediately when the first bytes arrive, instead of when the document&apos;s main resource is actually finished loading.
&gt; 
&gt; However, DocumentWriter::end() already calls finish() at a more appropriate time. Reading http://trac.webkit.org/changeset/114062 makes me assume that at some point in the past (and likely in the case of r14838), finish() would not get called in the case of a main resource load, but it is now.
&gt; 
&gt; I&apos;m having trouble doing sufficient archaeology to determine when that change occurred, but I don&apos;t think it matters.
&gt; 
&gt; I&apos;d like to remove that call to finish() if there are no objections.

Here&apos;s why I hesitate to support this change - I&apos;m not sure it matters!  Is there any difficulty we&apos;re running in to as a result here?  Do PluginDocuments even *have* script that observes this?

Thinking logically about what a PluginDocument is... it&apos;s a template of HTML built in to the engine which instantiates a Plugin with the main resource data.  Especially in a world of asynchronous plugin initialization I&apos;m not yet convinced this is *wrong*.

Hearing any symptom it causes could quickly change my mind.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>779832</commentid>
    <comment_count>2</comment_count>
    <who name="Tim Horton">thorton</who>
    <bug_when>2012-11-29 22:51:18 -0800</bug_when>
    <thetext>(In reply to comment #1)
&gt; (In reply to comment #0)
&gt; &gt; PluginDocumentParser::appendBytes() was made to call finish() in http://trac.webkit.org/changeset/14838. This is a bit odd because it basically means that onload and all the other load-y events get called immediately when the first bytes arrive, instead of when the document&apos;s main resource is actually finished loading.
&gt; &gt; 
&gt; &gt; However, DocumentWriter::end() already calls finish() at a more appropriate time. Reading http://trac.webkit.org/changeset/114062 makes me assume that at some point in the past (and likely in the case of r14838), finish() would not get called in the case of a main resource load, but it is now.
&gt; &gt; 
&gt; &gt; I&apos;m having trouble doing sufficient archaeology to determine when that change occurred, but I don&apos;t think it matters.
&gt; &gt; 
&gt; &gt; I&apos;d like to remove that call to finish() if there are no objections.
&gt; 
&gt; Here&apos;s why I hesitate to support this change - I&apos;m not sure it matters!  Is there any difficulty we&apos;re running in to as a result here?  Do PluginDocuments even *have* script that observes this?
&gt; 
&gt; Thinking logically about what a PluginDocument is... it&apos;s a template of HTML built in to the engine which instantiates a Plugin with the main resource data.  Especially in a world of asynchronous plugin initialization I&apos;m not yet convinced this is *wrong*.
&gt; 
&gt; Hearing any symptom it causes could quickly change my mind.

Please read the Radar.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>779838</commentid>
    <comment_count>3</comment_count>
    <who name="Tim Horton">thorton</who>
    <bug_when>2012-11-29 22:56:52 -0800</bug_when>
    <thetext>(In reply to comment #2)
&gt; &gt; Hearing any symptom it causes could quickly change my mind.
&gt; 
&gt; Please read the Radar.

For those who can&apos;t, the symptom is basically that clients who listen to didFinishDocumentLoadForFrame get the notification way too early.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>779849</commentid>
    <comment_count>4</comment_count>
      <attachid>176905</attachid>
    <who name="Tim Horton">thorton</who>
    <bug_when>2012-11-29 23:34:24 -0800</bug_when>
    <thetext>Created attachment 176905
patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>780279</commentid>
    <comment_count>5</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2012-11-30 11:58:42 -0800</bug_when>
    <thetext>The patch looks good to me, but I&apos;d like to better understand whether this only affects DOMContentLoaded, or also the load event.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>780461</commentid>
    <comment_count>6</comment_count>
    <who name="Tim Horton">thorton</who>
    <bug_when>2012-11-30 15:09:53 -0800</bug_when>
    <thetext>By experiment, both DOMContentLoaded and onload now fire when the main resource finishes loading instead of immediately (I confirmed they both fired immediately before, too).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>780472</commentid>
    <comment_count>7</comment_count>
    <who name="Tim Horton">thorton</who>
    <bug_when>2012-11-30 15:27:08 -0800</bug_when>
    <thetext>Technically, this is about didFinishDocumentLoadForFrame, not DOMContentLoaded. Also, we really ideally wouldn&apos;t move DOMContentLoaded - the DOM is actually ready immediately upon PluginDocument construction. However, we&apos;re not convinced there&apos;s actually a way to observe DOMContentLoaded on a PluginDocument, so it likely doesn&apos;t matter.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>780473</commentid>
    <comment_count>8</comment_count>
      <attachid>176905</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2012-11-30 15:27:55 -0800</bug_when>
    <thetext>Comment on attachment 176905
patch

r=me

I think that the new behavior is correct for the load event, but not logical for DOMContentLoaded.

However, the purpose of this bug is to get client delegates at the right time, and timing of DOM events doesn&apos;t matter nearly as much. Also, I&apos;m not sure if the change of behavior for DOMContentLoaded is even observable.

Please update the bug title to track what we actually want to fix in Bugzilla and in ChangeLog.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>780477</commentid>
    <comment_count>9</comment_count>
    <who name="Tim Horton">thorton</who>
    <bug_when>2012-11-30 15:31:47 -0800</bug_when>
    <thetext>(In reply to comment #8)
&gt; (From update of attachment 176905 [details])
&gt; r=me
&gt; 
&gt; I think that the new behavior is correct for the load event, but not logical for DOMContentLoaded.
&gt; 
&gt; However, the purpose of this bug is to get client delegates at the right time, and timing of DOM events doesn&apos;t matter nearly as much. Also, I&apos;m not sure if the change of behavior for DOMContentLoaded is even observable.

Indeed. Thanks, Alexey!

http://trac.webkit.org/changeset/136289</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>176905</attachid>
            <date>2012-11-29 23:34:24 -0800</date>
            <delta_ts>2012-11-30 15:27:55 -0800</delta_ts>
            <desc>patch</desc>
            <filename>plugindocument.diff</filename>
            <type>text/plain</type>
            <size>1891</size>
            <attacher name="Tim Horton">thorton</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1NvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZyBiL1NvdXJjZS9XZWJDb3JlL0No
YW5nZUxvZwppbmRleCBiOGRlN2Q5Li41MWEzYWQxIDEwMDY0NAotLS0gYS9Tb3VyY2UvV2ViQ29y
ZS9DaGFuZ2VMb2cKKysrIGIvU291cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCkBAIC0xLDMgKzEsMjQg
QEAKKzIwMTItMTEtMjkgIFRpbSBIb3J0b24gIDx0aW1vdGh5X2hvcnRvbkBhcHBsZS5jb20+CisK
KyAgICAgICAgUGx1Z2luRG9jdW1lbnQgZmlyZXMgRE9NQ29udGVudExvYWRlZCB1cG9uIHJlY2Vp
dmluZyBpbml0aWFsIGJ5dGVzIGluc3RlYWQgb2Ygd2hlbiBsb2FkIGNvbXBsZXRlcworICAgICAg
ICBodHRwczovL2J1Z3Mud2Via2l0Lm9yZy9zaG93X2J1Zy5jZ2k/aWQ9MTAzNzAyCisgICAgICAg
IDxyZGFyOi8vcHJvYmxlbS8xMjc2MjUzND4KKworICAgICAgICBSZXZpZXdlZCBieSBOT0JPRFkg
KE9PUFMhKS4KKworICAgICAgICBSZW1vdmUgdGhlIGNhbGwgdG8gZmluaXNoKCkgZnJvbSBQbHVn
aW5Eb2N1bWVudFBhcnNlcjo6YXBwZW5kQnl0ZXMoKS4KKworICAgICAgICBUaGlzIHdhcyBpbnRy
b2R1Y2VkIGluIGh0dHA6Ly90cmFjLndlYmtpdC5vcmcvY2hhbmdlc2V0LzE0ODM4LCB3aGVuIGZp
bmlzaCgpIHdvdWxkbid0IGdldAorICAgICAgICBjYWxsZWQgZm9yIFBsdWdpbkRvY3VtZW50cyBh
bnkgb3RoZXIgd2F5LiBJbiB0aGUgdGltZS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gYS9Tb3VyY2UvV2ViQ29yZS9odG1sL1BsdWdpbkRvY3VtZW50LmNwcAorKysgYi9T
b3VyY2UvV2ViQ29yZS9odG1sL1BsdWdpbkRvY3VtZW50LmNwcApAQCAtMTMzLDggKzEzMyw2IEBA
IHZvaWQgUGx1Z2luRG9jdW1lbnRQYXJzZXI6OmFwcGVuZEJ5dGVzKERvY3VtZW50V3JpdGVyKiwg
Y29uc3QgY2hhciosIHNpemVfdCkKICAgICAgICAgICAgIGZyYW1lLT5sb2FkZXIoKS0+YWN0aXZl
RG9jdW1lbnRMb2FkZXIoKS0+bWFpblJlc291cmNlTG9hZGVyKCktPnNldFNob3VsZEJ1ZmZlckRh
dGEoRG9Ob3RCdWZmZXJEYXRhKTsKICAgICAgICAgfQogICAgIH0KLQotICAgIGZpbmlzaCgpOwog
fQogCiBQbHVnaW5Eb2N1bWVudDo6UGx1Z2luRG9jdW1lbnQoRnJhbWUqIGZyYW1lLCBjb25zdCBL
VVJMJiB1cmwpCg==
</data>
<flag name="review"
          id="192834"
          type_id="1"
          status="+"
          setter="ap"
    />
          </attachment>
      

    </bug>

</bugzilla>