<?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>48201</bug_id>
          
          <creation_ts>2010-10-23 21:43:03 -0700</creation_ts>
          <short_desc>REGRESSION Zimbra email compose is broken with the HTML5 parser</short_desc>
          <delta_ts>2010-10-28 13:14:00 -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>Evangelism</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>Regression</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>41115</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Mihai Parparita">mihaip</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>abarth</cc>
    
    <cc>eric</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>298517</commentid>
    <comment_count>0</comment_count>
    <who name="Mihai Parparita">mihaip</who>
    <bug_when>2010-10-23 21:43:03 -0700</bug_when>
    <thetext>To reproduce:

1. Go to http://testzimbra.com/
2. Log in with username &quot;zm1023yyxhm&quot; and password &quot;hvtpki&quot;
3. Wait for all the UI to load
4. Click on the &quot;New&quot; button under the &quot;Mail&quot; tab to bring up a compose window

Expected result:
1. Compose window that you can type in

Actual result:
1. No editable area for the body of the email

This appears to be intermittent, so you may need to try it a few times to trigger it. Having an empty cache seems to make it more likely to happen. Using nightly builds I narrowed it down to the range r64727 to r64636. http://trac.webkit.org/changeset/64712, which enabled the HTML5 tree builder, was in that range. I verified that that particular change was responsible.

This is a beast of an app to reduce, but as far as I can tell, there&apos;s some sort of race condition with the body compose iframe. It has a src of http://demo2.zimbra.com/zimbra/public/blank.html. With the HTML5 parser change, I often see the compose area flash before it&apos;s replaced by the empty blank.html frame. Without the HTML5 change, &quot;Failed to load resource: cancelled&quot; message in the console about the blank.html frame. I&apos;m guessing the app is registering an onload handler and enabling designMode on the frame and filling it with the new email template, and implicitly disabling the load of the blank.html source. That last part is no longer happening with the HTML5 parser, which is why blank.html is clobbering the compose area.

With things like bug 43423 I see that the HTML5 parser is affecting how events are fired for frames, but I don&apos;t know much else about this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>298524</commentid>
    <comment_count>1</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2010-10-23 22:01:50 -0700</bug_when>
    <thetext>Any chance this is related to Bug 43328	?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>298527</commentid>
    <comment_count>2</comment_count>
    <who name="Mihai Parparita">mihaip</who>
    <bug_when>2010-10-23 22:08:02 -0700</bug_when>
    <thetext>It looks like this is the source of the compose mode editor, and specifically the iframe initialization:

http://google.com/codesearch/p?hl=en#l5SZa4ix2r4/Ajax/WebRoot/js/dwt/widgets/DwtHtmlEditor.js&amp;q=DwtHtmlEditor&amp;l=739

The code could definitely be race-y (there&apos;s a 50ms timeout after adding the iframe before trying to initialize it, etc.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>298529</commentid>
    <comment_count>3</comment_count>
    <who name="Mihai Parparita">mihaip</who>
    <bug_when>2010-10-23 22:08:51 -0700</bug_when>
    <thetext>(In reply to comment #1)
&gt; Any chance this is related to Bug 43328    ?

That regressed with the HTML5 lexer (r61234), this didn&apos;t regress till the HTML5 tree builder (r64712), so I don&apos;t think they&apos;re related.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>298530</commentid>
    <comment_count>4</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2010-10-23 22:10:51 -0700</bug_when>
    <thetext>Interesting.  Most of the timing related changes came in with the tokenizer.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>299325</commentid>
    <comment_count>5</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2010-10-26 00:42:24 -0700</bug_when>
    <thetext>The compose window is begin blown away when the first data come back from the network for blank.html.  Clearing the cache makes the bug more likely to occur because it delays the network load.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>299333</commentid>
    <comment_count>6</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2010-10-26 01:15:14 -0700</bug_when>
    <thetext>In Safari 5, I believe Zimbra is calling document.open or document.write on the iframe, which cancels the load.  However, in debugging TOT, I see that it&apos;s not calling those functions.  Instead, it&apos;s using innerHTML to set the content of the frame (which, of course, does not cancel the load).

The reason I believe it&apos;s calling implicitOpen in some form is that the contentDocument.URL of the iframe in Safari 5 is &quot;http://testzimbra.com/&quot;.  The likely way for that to open is because the URL is inherited via implicitOpen.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>299340</commentid>
    <comment_count>7</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2010-10-26 01:28:52 -0700</bug_when>
    <thetext>Look like the code on the live site is slightly different than the code on codesearch:

DwtHtmlEditor.prototype._finishHtmlModeInit = function () {
    var a = this._getIframeDoc();
    try {
        if (AjxEnv.isSafari &amp;&amp; a.body == null) {
            a.open();
            a.write(&quot;&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;/body&gt;&lt;/html&gt;&quot;);
            a.close()
        }
    }
    catch (t) {
        return
    }
    if (AjxEnv.isGeckoBased) {
        a.open();
        a.write(DwtHtmlEditor.INIT_HTML);
        a.close()
    }

    function e(i) {
        this._enableDesignMode(i);
        this._setContentOnTimer();
        this._updateState();
        this._htmlModeInited = true;
        this._registerEditorEventHandlers(document.getElementById(this._iFrameId), i)
    }
    if (AjxEnv.isIE) {
        setTimeout(AjxCallback.simpleClosure(e, this, a), DwtHtmlEditor._INITDELAY)
    } else {
        e.call(this, a)
    }
};</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>299342</commentid>
    <comment_count>8</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2010-10-26 01:34:45 -0700</bug_when>
    <thetext>&gt;         if (AjxEnv.isSafari &amp;&amp; a.body == null) {

I suspect the difference is that in the old tree builder a.body was null at this program point but it&apos;s non-null now, which means the site no longer calls document.open() and it no longer cancels the load.

IMHO, this is an evangelism issue.  Life would be much better if they sent us down the Gecko codepath in this function.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>301262</commentid>
    <comment_count>9</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2010-10-28 13:14:00 -0700</bug_when>
    <thetext>The Zimbra folks have kindly fixed the issue on their end.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>