[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/khtml
From:       Germain Garand <germain () ebooksfrance ! org>
Date:       2010-03-02 9:28:01
Message-ID: 1267522081.952867.32112.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1097846 by ggarand:

better spec conformance for loading of script generated sub-documents:

No longer use an had hoc auto-close mode for frames opened by
document.write, rely on explicit close() instead.

-matches MSIE/Firefox : unclosed iframe keep owner document in loading
 state for as long as explicit close() hasn't been called.
.matches HTML5 draft for load event emission,
  cf. events/iframe_onload2.html

 M  +2 -21     html/htmltokenizer.cpp  
 M  +0 -4      html/htmltokenizer.h  
 M  +6 -2      xml/dom_docimpl.cpp  
 M  +4 -0      xml/dom_docimpl.h  


--- trunk/KDE/kdelibs/khtml/html/htmltokenizer.cpp #1097845:1097846
@@ -145,7 +145,6 @@
     charsets = KGlobal::charsets();
     parser = new KHTMLParser(_view, _doc);
     m_executingScript = 0;
-    m_autoCloseTimer = 0;
     m_externalScriptsTimerId = 0;
     m_tokenizerYieldDelay = sTokenizerFastYieldDelay;
     m_yieldTimer = 0;
@@ -166,7 +165,6 @@
     charsets = KGlobal::charsets();
     parser = new KHTMLParser( i, _doc );
     m_executingScript = 0;
-    m_autoCloseTimer = 0;
     m_externalScriptsTimerId = 0;
     m_tokenizerYieldDelay = sTokenizerFastYieldDelay;
     m_yieldTimer = 0;
@@ -202,11 +200,6 @@
     rawContent = 0;
     rawContentSize = rawContentMaxSize = rawContentResync = 0;
 
-    if (m_autoCloseTimer > 0) {
-        killTimer(m_autoCloseTimer);
-        m_autoCloseTimer = 0;
-    }
-
     if (m_yieldTimer > 0) {
         killTimer(m_yieldTimer);
         m_yieldTimer = 0;
@@ -1635,12 +1628,13 @@
     return true;
 }
 
+
+#include "khtmlpart_p.h"
 void HTMLTokenizer::write( const TokenizerString &str, bool appendData )
 {
 #ifdef TOKEN_DEBUG
     kDebug( 6036 ) << this << " Tokenizer::write(\"" << str.toString() << "\"," << \
appendData << ")";  #endif
-
     if ( !buffer )
         return;
 
@@ -1905,8 +1899,6 @@
         killTimer(m_yieldTimer);
         m_yieldTimer = 0;
         write( TokenizerString(), true );
-    } else if ( e->timerId() == m_autoCloseTimer && cachedScript.isEmpty() ) {
-         finish();
     } else if ( e->timerId() == m_externalScriptsTimerId ) {
         if (view && view->hasLayoutPending()) {
             // all stylesheets are loaded but the style modifications 
@@ -1919,13 +1911,6 @@
     }
 }
 
-void HTMLTokenizer::setAutoClose( bool b ) {
-    killTimer( m_autoCloseTimer );
-    m_autoCloseTimer = 0;
-    if ( b )
-        m_autoCloseTimer = startTimer(100);
-}
-
 void HTMLTokenizer::end()
 {
     if ( buffer ) {
@@ -1948,10 +1933,6 @@
 
 void HTMLTokenizer::finish()
 {
-    if ( m_autoCloseTimer ) {
-        killTimer( m_autoCloseTimer );
-        m_autoCloseTimer = 0;
-    }
     // The purpose of this iteration is to recover from 'raw content' tokenizing \
                mode.
     // In this mode, any error such as the lack of a closing tag (for the considered \
element) or of a closing comment,  // would result in the entire document being \
                absorbed in one node.
--- trunk/KDE/kdelibs/khtml/html/htmltokenizer.h #1097845:1097846
@@ -174,7 +174,6 @@
     void setNormalYieldDelay();
     virtual void setOnHold(bool _onHold);
     void abort() { m_abort = true; }
-    virtual void setAutoClose(bool b=true);
     virtual bool isWaitingForScripts() const;
     virtual bool isExecutingScript() const;
 
@@ -405,9 +404,6 @@
     // line number at which the current <script> started
     int scriptStartLineno;
     int tagStartLineno;
-    // autoClose mode is used when the tokenizer was created by a script \
                document.writing
-    // on an already loaded document
-    int m_autoCloseTimer;
     int m_tokenizerYieldDelay;
     int m_yieldTimer;
     QTime m_time;
--- trunk/KDE/kdelibs/khtml/xml/dom_docimpl.cpp #1097845:1097846
@@ -1647,7 +1647,11 @@
 
 void DocumentImpl::close(  )
 {
-    if (parsing() || !m_tokenizer) return;
+    if (parsing() && hasVariableLength() && m_tokenizer) {
+        m_tokenizer->finish();
+        assert(!parsing());
+    } else if (parsing() || !m_tokenizer)
+        return;
 
     if ( m_render )
         m_render->close();
@@ -1675,7 +1679,7 @@
         open();
         if (m_view)
             m_view->part()->resetFromScript();
-        m_tokenizer->setAutoClose();
+        setHasVariableLength();
     }
     m_tokenizer->write(text, false);
 }
--- trunk/KDE/kdelibs/khtml/xml/dom_docimpl.h #1097845:1097846
@@ -404,6 +404,9 @@
     void setParsing(bool b) { m_bParsing = b; }
     bool parsing() const { return m_bParsing; }
 
+    void setHasVariableLength(bool b=true) { m_bVariableLength = b; }
+    bool hasVariableLength() const { return m_bVariableLength; }
+
     void setTextColor( QColor color ) { m_textColor = color; }
     QColor textColor() const { return m_textColor; }
 
@@ -676,6 +679,7 @@
     bool m_async;
     bool m_hadLoadError;
     bool m_docLoading;
+    bool m_bVariableLength;
 
     QEventLoop* m_inSyncLoad;
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic