<?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>18064</bug_id>
          
          <creation_ts>2008-03-25 03:34:29 -0700</creation_ts>
          <short_desc>assert-fail in WebCore::FrameLoader::saveDocumentState (document is null)</short_desc>
          <delta_ts>2008-04-19 01:55:13 -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>WebKitGTK</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://acid3.acidtests.org/reference.html</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>Gtk</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>18411</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jasper Bryant-Greene">jasper</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>jchaffraix</cc>
    
    <cc>jmalonzo</cc>
    
    <cc>xan.lopez</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>75092</commentid>
    <comment_count>0</comment_count>
    <who name="Jasper Bryant-Greene">jasper</who>
    <bug_when>2008-03-25 03:34:29 -0700</bug_when>
    <thetext>This is only an issue in debug builds because in release builds there is a null check for document immediately after the assert. A probable fix is to just remove the ASSERT() although it would be interesting to find out why document is null only on GTK.

Backtrace:

#0  0x00007fc0ce043ed1 in WebCore::FrameLoader::saveDocumentState (this=0xb2f930) at WebCore/loader/FrameLoader.cpp:4001
#1  0x00007fc0ce05f029 in WebCore::FrameLoader::closeURL (this=0x7fffd7019640) at WebCore/loader/FrameLoader.cpp:641
#2  0x00007fc0ce05f07d in WebCore::FrameLoader::detachFromParent (this=0xb2f930) at WebCore/loader/FrameLoader.cpp:3194
#3  0x00007fc0cdfaf105 in WebCore::HTMLFrameOwnerElement::willRemove (this=0xa068c0) at WebCore/html/HTMLFrameOwnerElement.cpp:46
#4  0x00007fc0cddd679e in WebCore::ContainerNode::willRemove (this=0xb07860) at WebCore/dom/ContainerNode.cpp:347
#5  0x00007fc0cddd679e in WebCore::ContainerNode::willRemove (this=0xaf6e30) at WebCore/dom/ContainerNode.cpp:347
#6  0x00007fc0cddd679e in WebCore::ContainerNode::willRemove (this=0x82a580) at WebCore/dom/ContainerNode.cpp:347
#7  0x00007fc0cddd679e in WebCore::ContainerNode::willRemove (this=0x851100) at WebCore/dom/ContainerNode.cpp:347
#8  0x00007fc0ce04ef0f in WebCore::FrameLoader::clear (this=0x810fe0, clearWindowProperties=true, clearScriptObjects=true) at WebCore/loader/FrameLoader.cpp:803
#9  0x00007fc0ce057eef in WebCore::FrameLoader::begin (this=0x810fe0, url=@0x811190, dispatch=false, origin=0x0) at WebCore/loader/FrameLoader.cpp:898
#10 0x00007fc0ce05bda2 in WebCore::FrameLoader::receivedFirstData (this=0x7fffd7019640) at WebCore/loader/FrameLoader.cpp:848
#11 0x00007fc0ce05c7c8 in WebCore::FrameLoader::setEncoding (this=0x810fe0, name=@0x80e048, userChosen=false) at WebCore/loader/FrameLoader.cpp:1749
#12 0x00007fc0cdb4f335 in WebKit::FrameLoaderClient::committedLoad (this=&lt;value optimized out&gt;, loader=&lt;value optimized out&gt;, 
    data=0xfded60 &quot;&lt;!DOCTYPE HTML PUBLIC \&quot;-//W3C//DTD HTML 4.0//EN\&quot;&gt;\n&lt;html&gt;\n &lt;title&gt;The Acid3 Test (Reference Rendering)&lt;/title&gt;\n &lt;style type=\&quot;text/css\&quot;&gt;\n  html { margin: 0; padding: 0; }\n  body { background: #c0c0c0 ur&quot;..., length=1256) at WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp:165
#13 0x00007fc0ce03c683 in WebCore::DocumentLoader::commitLoad (this=0xfcfd80, 
    data=0xfded60 &quot;&lt;!DOCTYPE HTML PUBLIC \&quot;-//W3C//DTD HTML 4.0//EN\&quot;&gt;\n&lt;html&gt;\n &lt;title&gt;The Acid3 Test (Reference Rendering)&lt;/title&gt;\n &lt;style type=\&quot;text/css\&quot;&gt;\n  html { margin: 0; padding: 0; }\n  body { background: #c0c0c0 ur&quot;..., length=1256) at WebCore/loader/DocumentLoader.cpp:325
#14 0x00007fc0ce089ee2 in WebCore::ResourceLoader::didReceiveData (this=0xfcec10, 
    data=0xfded60 &quot;&lt;!DOCTYPE HTML PUBLIC \&quot;-//W3C//DTD HTML 4.0//EN\&quot;&gt;\n&lt;html&gt;\n &lt;title&gt;The Acid3 Test (Reference Rendering)&lt;/title&gt;\n &lt;style type=\&quot;text/css\&quot;&gt;\n  html { margin: 0; padding: 0; }\n  body { background: #c0c0c0 ur&quot;..., length=1256, lengthReceived=0, allAtOnce=false) at WebCore/loader/ResourceLoader.cpp:234
#15 0x00007fc0ce07f4e3 in WebCore::MainResourceLoader::didReceiveData (this=0xfcec10, 
    data=0xfded60 &quot;&lt;!DOCTYPE HTML PUBLIC \&quot;-//W3C//DTD HTML 4.0//EN\&quot;&gt;\n&lt;html&gt;\n &lt;title&gt;The Acid3 Test (Reference Rendering)&lt;/title&gt;\n &lt;style type=\&quot;text/css\&quot;&gt;\n  html { margin: 0; padding: 0; }\n  body { background: #c0c0c0 ur&quot;..., length=1256, lengthReceived=0, allAtOnce=160) at WebCore/loader/MainResourceLoader.cpp:296
#16 0x00007fc0ce271057 in writeCallback (ptr=0xfded60, size=&lt;value optimized out&gt;, nmemb=&lt;value optimized out&gt;, data=&lt;value optimized out&gt;) at WebCore/platform/network/curl/ResourceHandleManager.cpp:126
#17 0x00007fc0c844b838 in ?? () from /usr/lib/libcurl-gnutls.so.4
#18 0x00007fc0c8464b79 in ?? () from /usr/lib/libcurl-gnutls.so.4
#19 0x00007fc0c8464d2f in ?? () from /usr/lib/libcurl-gnutls.so.4
#20 0x00007fc0c845e16a in ?? () from /usr/lib/libcurl-gnutls.so.4
#21 0x00007fc0c8462e9c in ?? () from /usr/lib/libcurl-gnutls.so.4
#22 0x00007fc0c846380b in curl_multi_perform () from /usr/lib/libcurl-gnutls.so.4
#23 0x00007fc0ce2759bc in WebCore::ResourceHandleManager::downloadTimerCallback (this=0x897320, timer=&lt;value optimized out&gt;) at WebCore/platform/network/curl/ResourceHandleManager.cpp:308
#24 0x00007fc0ce15e350 in WebCore::TimerBase::fireTimers (fireTime=1206441151.5012569, firingTimers=@0x7fffd701a880) at WebCore/platform/Timer.cpp:347
#25 0x00007fc0ce15e870 in WebCore::TimerBase::sharedTimerFired () at WebCore/platform/Timer.cpp:368
#26 0x00007fc0cdb86492 in timeout_cb () at WebCore/platform/gtk/SharedTimerGtk.cpp:48
#27 0x00007fc0cccd294b in ?? () from /usr/lib/libglib-2.0.so.0
#28 0x00007fc0cccd2222 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#29 0x00007fc0cccd54d6 in ?? () from /usr/lib/libglib-2.0.so.0
#30 0x00007fc0cccd5797 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
#31 0x00007fc0cd2e3ee3 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
#32 0x00000000004040b8 in main (argc=1, argv=0x7fffd701abc8) at juniper.c:46</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>75286</commentid>
    <comment_count>1</comment_count>
      <attachid>20080</attachid>
    <who name="Jasper Bryant-Greene">jasper</who>
    <bug_when>2008-03-26 03:35:59 -0700</bug_when>
    <thetext>Created attachment 20080
remove bogus assertion

I&apos;m pretty sure the ASSERT is bogus, because a frame can contain no document under certain circumstances, and because there&apos;s an if() test immediately after that protects against the case that the ASSERT is checking for.

Also because although the ASSERT trips on the debug build (for example when clicking the reference rendering link on http://acid3.acidtests.org/), the release build works fine in the same circumstances.

Thus this patch removes the ASSERT.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>75460</commentid>
    <comment_count>2</comment_count>
    <who name="Julien Chaffraix">jchaffraix</who>
    <bug_when>2008-03-27 08:07:18 -0700</bug_when>
    <thetext>(In reply to comment #1)
&gt; Created an attachment (id=20080) [edit]
&gt; remove bogus assertion
&gt; 
&gt; I&apos;m pretty sure the ASSERT is bogus, because a frame can contain no document
&gt; under certain circumstances, and because there&apos;s an if() test immediately after
&gt; that protects against the case that the ASSERT is checking for.

I would be more cautious about removing the ASSERT because first it is never triggered on the Mac port only on Qt/Gtk (as mentionned in http://bugs.webkit.org/show_bug.cgi?id=17984).
You should also be carefull as ASSERTs are not enforced on release build so the null check is a necessity for those cases.

Finally in bug17984, I showed another way of resolving the bug that does not involve removing the ASSERT (but may lead to memory leaks).

&gt; 
&gt; Also because although the ASSERT trips on the debug build (for example when
&gt; clicking the reference rendering link on http://acid3.acidtests.org/), the
&gt; release build works fine in the same circumstances.
&gt; 
&gt; Thus this patch removes the ASSERT.
&gt; 

Your patch lacks a test case (it is pretty straightforward as the assertion can be triggered by a page with an iframe and just reloading it).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>75802</commentid>
    <comment_count>3</comment_count>
    <who name="Julien Chaffraix">jchaffraix</who>
    <bug_when>2008-03-29 19:26:08 -0700</bug_when>
    <thetext>*** Bug 17984 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76129</commentid>
    <comment_count>4</comment_count>
      <attachid>20080</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2008-04-02 02:33:59 -0700</bug_when>
    <thetext>Comment on attachment 20080
remove bogus assertion

r=me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76153</commentid>
    <comment_count>5</comment_count>
      <attachid>20080</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2008-04-02 09:18:17 -0700</bug_when>
    <thetext>Comment on attachment 20080
remove bogus assertion

Clearing review flag because I think Julien is right. The assertion is correct and in fact it&apos;s the null check after the assertion that&apos;s wrong We should fix the bug instead.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76169</commentid>
    <comment_count>6</comment_count>
    <who name="Julien Chaffraix">jchaffraix</who>
    <bug_when>2008-04-02 11:22:30 -0700</bug_when>
    <thetext>Jasper,

the saveDocumentState does try to save frame&apos;s information but it is pointless to save frame&apos;s information when they are not connected to a Document.
The core of the issue is how the frames are released. That&apos;s why the gtk port is the only one concerned with this bug.
I have said that the Qt port would also fail but it is not longer the case. I could not find exactly when it was fixed.
If you want to attack the real issue, I would advise you to have a look at http://trac.webkit.org/projects/webkit/changeset/31521. This is the changeset where Zecke has moved the portion of the code I had hold responsible for the assertion failure (the code in FrameLoaderClient::detachedFromParent4()). The other Qt commits from the same day should give an answer to how and when the frame should be released to avoid both the assertion and a memory leak.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76444</commentid>
    <comment_count>7</comment_count>
    <who name="Julien Chaffraix">jchaffraix</who>
    <bug_when>2008-04-06 13:31:26 -0700</bug_when>
    <thetext>*** Bug 18334 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76446</commentid>
    <comment_count>8</comment_count>
    <who name="Brady Eidson">beidson</who>
    <bug_when>2008-04-06 13:42:36 -0700</bug_when>
    <thetext>I thought Frames were always created with &quot;Empty Documents&quot;?  Maciej went through significant pains to accomplish that for us, and we spent time cleaning up all the loose ends, but are better off for it.

Maybe that empty document creation has pieces reaching into WebKit code and thats why Win/Mac are fine but not Qt/GTK?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77551</commentid>
    <comment_count>9</comment_count>
    <who name="Jan Alonzo">jmalonzo</who>
    <bug_when>2008-04-14 06:31:22 -0700</bug_when>
    <thetext>The patch at bug #18411 fixes this issue so i&apos;ll mark this as dependent on that bug. Feel free to remove the dependency if you think otherwise.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78245</commentid>
    <comment_count>10</comment_count>
    <who name="Jan Alonzo">jmalonzo</who>
    <bug_when>2008-04-19 01:55:13 -0700</bug_when>
    <thetext>(In reply to comment #9)
&gt; The patch at bug #18411 fixes this issue so i&apos;ll mark this as dependent on that
&gt; bug. Feel free to remove the dependency if you think otherwise.
&gt; 

This bug seems to have been fixed by the patch at #18411. Closing as FIXED. 
</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>20080</attachid>
            <date>2008-03-26 03:35:59 -0700</date>
            <delta_ts>2008-04-02 09:18:17 -0700</delta_ts>
            <desc>remove bogus assertion</desc>
            <filename>FrameLoader-saveDocumentState-remove-bogus-assertion.patch</filename>
            <type>text/plain</type>
            <size>1241</size>
            <attacher name="Jasper Bryant-Greene">jasper</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYkNvcmUvQ2hhbmdlTG9n
CShyZXZpc2lvbiAzMTMxMSkKKysrIFdlYkNvcmUvQ2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBA
IC0xLDMgKzEsMTUgQEAKKzIwMDgtMDMtMjYgIEphc3BlciBCcnlhbnQtR3JlZW5lICA8amFzcGVy
QHVuaXguZ2Vlay5uej4KKworICAgICAgICBSZXZpZXdlZCBieSBOT0JPRFkgKE9PUFMhKS4KKwor
ICAgICAgICBGaXhlZCAiYXNzZXJ0LWZhaWwgaW4gV2ViQ29yZTo6RnJhbWVMb2FkZXI6OnNhdmVE
b2N1bWVudFN0YXRlIChkb2N1bWVudCBpcyBudWxsKSIKKyAgICAgICAgaHR0cDovL2J1Z3Mud2Vi
a2l0Lm9yZy9zaG93X2J1Zy5jZ2k/aWQ9MTgwNjQKKworICA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</data>

          </attachment>
      

    </bug>

</bugzilla>