Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 78058 | Differences between
and this patch

Collapse All | Expand All

(-)kdelibs-3.3.2/khtml/html/htmltokenizer.cpp (-1 / +29 lines)
Lines 133-138 Link Here
133
    charsets = KGlobal::charsets();
133
    charsets = KGlobal::charsets();
134
    parser = new KHTMLParser(_view, _doc);
134
    parser = new KHTMLParser(_view, _doc);
135
    m_executingScript = 0;
135
    m_executingScript = 0;
136
    m_autoCloseTimer = 0;
136
    onHold = false;
137
    onHold = false;
137
138
138
    reset();
139
    reset();
Lines 147-152 Link Here
147
    charsets = KGlobal::charsets();
148
    charsets = KGlobal::charsets();
148
    parser = new KHTMLParser( i, _doc );
149
    parser = new KHTMLParser( i, _doc );
149
    m_executingScript = 0;
150
    m_executingScript = 0;
151
    m_autoCloseTimer = 0;
150
    onHold = false;
152
    onHold = false;
151
153
152
    reset();
154
    reset();
Lines 170-175 Link Here
170
    scriptCode = 0;
172
    scriptCode = 0;
171
    scriptCodeSize = scriptCodeMaxSize = scriptCodeResync = 0;
173
    scriptCodeSize = scriptCodeMaxSize = scriptCodeResync = 0;
172
174
175
    if (m_autoCloseTimer) {
176
        killTimer(m_autoCloseTimer);
177
        m_autoCloseTimer = 0;
178
    }
179
	     
173
    currToken.reset();
180
    currToken.reset();
174
}
181
}
175
182
Lines 1480-1491 Link Here
1480
    }
1487
    }
1481
    _src = QString::null;
1488
    _src = QString::null;
1482
1489
1483
    if (noMoreData && cachedScript.isEmpty() && !m_executingScript )
1490
    if (noMoreData && cachedScript.isEmpty() && !m_executingScript)
1484
        end(); // this actually causes us to be deleted
1491
        end(); // this actually causes us to be deleted
1485
}
1492
}
1486
1493
1494
void HTMLTokenizer::timerEvent( QTimerEvent *e )
1495
{
1496
    if ( e->timerId() == m_autoCloseTimer && cachedScript.isEmpty() ) {
1497
        finish();
1498
        if (!m_autoCloseTimer && parser->doc())
1499
            parser->doc()->setParsing( false );
1500
    }
1501
}
1502
1503
void HTMLTokenizer::setAutoClose( bool b ) {
1504
    killTimer( m_autoCloseTimer );
1505
    m_autoCloseTimer = 0;
1506
    if ( b )
1507
        m_autoCloseTimer = startTimer(100);
1508
}
1509
1487
void HTMLTokenizer::end()
1510
void HTMLTokenizer::end()
1488
{
1511
{
1512
    if ( m_autoCloseTimer ) {
1513
        killTimer( m_autoCloseTimer );
1514
        m_autoCloseTimer = 0;
1515
    }
1516
1489
    if ( buffer == 0 ) {
1517
    if ( buffer == 0 ) {
1490
        emit finishedParsing();
1518
        emit finishedParsing();
1491
        return;
1519
        return;
(-)kdelibs-3.3.2/khtml/html/htmltokenizer.h (-2 / +8 lines)
Lines 130-136 Link Here
130
    void write( const QString &str, bool appendData );
130
    void write( const QString &str, bool appendData );
131
    void end();
131
    void end();
132
    void finish();
132
    void finish();
133
    void timerEvent( QTimerEvent *e );
133
    virtual void setOnHold(bool _onHold);
134
    virtual void setOnHold(bool _onHold);
135
    virtual void setAutoClose(bool b=true);
136
    virtual bool isWaitingForScripts() const;
137
    virtual bool isExecutingScript() const;
134
138
135
protected:
139
protected:
136
    void reset();
140
    void reset();
Lines 169-176 Link Here
169
    // from CachedObjectClient
173
    // from CachedObjectClient
170
    void notifyFinished(khtml::CachedObject *finishedObj);
174
    void notifyFinished(khtml::CachedObject *finishedObj);
171
175
172
    virtual bool isWaitingForScripts() const;
173
    virtual bool isExecutingScript() const;
174
protected:
176
protected:
175
    // Internal buffers
177
    // Internal buffers
176
    ///////////////////
178
    ///////////////////
Lines 332-337 Link Here
332
    // line number at which the current <script> started
334
    // line number at which the current <script> started
333
    int scriptStartLineno;
335
    int scriptStartLineno;
334
    int tagStartLineno;
336
    int tagStartLineno;
337
    // autoClose mode is used when the tokenizer was created by a script document.writing
338
    // on an already loaded document
339
    int m_autoCloseTimer;
340
335
341
336
#define CBUFLEN 20
342
#define CBUFLEN 20
337
    char cBuffer[CBUFLEN+2];
343
    char cBuffer[CBUFLEN+2];
(-)kdelibs-3.3.2/khtml/khtml_part.cpp (+12 lines)
Lines 1922-1927 Link Here
1922
    }
1922
    }
1923
}
1923
}
1924
1924
1925
void KHTMLPart::resetFromScript()
1926
{
1927
    closeURL();
1928
    d->m_bComplete = false;
1929
    d->m_bLoadEventEmitted = false;
1930
    disconnect(d->m_doc,SIGNAL(finishedParsing()),this,SLOT(slotFinishedParsing()));
1931
    connect(d->m_doc,SIGNAL(finishedParsing()),this,SLOT(slotFinishedParsing()));
1932
    d->m_doc->setParsing(true);
1933
1934
    emit started( 0L );
1935
}
1936
1925
void KHTMLPart::slotFinishedParsing()
1937
void KHTMLPart::slotFinishedParsing()
1926
{
1938
{
1927
  d->m_doc->setParsing(false);
1939
  d->m_doc->setParsing(false);
(-)kdelibs-3.3.2/khtml/khtml_part.h (+1 lines)
Lines 1465-1470 Link Here
1465
  void setStatusBarText( const QString& text, StatusBarPriority p);
1465
  void setStatusBarText( const QString& text, StatusBarPriority p);
1466
1466
1467
  bool restoreURL( const KURL &url );
1467
  bool restoreURL( const KURL &url );
1468
  void resetFromScript();
1468
  void emitSelectionChanged();
1469
  void emitSelectionChanged();
1469
  // Returns whether callingHtmlPart may access this part
1470
  // Returns whether callingHtmlPart may access this part
1470
  bool checkFrameAccess(KHTMLPart *callingHtmlPart);
1471
  bool checkFrameAccess(KHTMLPart *callingHtmlPart);
(-)kdelibs-3.3.2/khtml/xml/dom_docimpl.cpp (-2 / +6 lines)
Lines 29-34 Link Here
29
#include "xml/dom2_rangeimpl.h"
29
#include "xml/dom2_rangeimpl.h"
30
#include "xml/dom2_eventsimpl.h"
30
#include "xml/dom2_eventsimpl.h"
31
#include "xml/xml_tokenizer.h"
31
#include "xml/xml_tokenizer.h"
32
#include "html/htmltokenizer.h"
32
33
33
#include "css/csshelper.h"
34
#include "css/csshelper.h"
34
#include "css/cssstyleselector.h"
35
#include "css/cssstyleselector.h"
Lines 1180-1186 Link Here
1180
    // on an explicit document.close(), the tokenizer might still be waiting on scripts,
1181
    // on an explicit document.close(), the tokenizer might still be waiting on scripts,
1181
    // and in that case we don't want to destroy it because that will prevent the
1182
    // and in that case we don't want to destroy it because that will prevent the
1182
    // scripts from getting processed.
1183
    // scripts from getting processed.
1183
    if (m_tokenizer && !m_tokenizer->isWaitingForScripts()) {
1184
    if (m_tokenizer && !m_tokenizer->isWaitingForScripts() && !m_tokenizer->isExecutingScript()) {
1184
        delete m_tokenizer;
1185
        delete m_tokenizer;
1185
        m_tokenizer = 0;
1186
        m_tokenizer = 0;
1186
    }
1187
    }
Lines 1198-1204 Link Here
1198
{
1199
{
1199
    if (!m_tokenizer) {
1200
    if (!m_tokenizer) {
1200
        open();
1201
        open();
1201
        write(QString::fromLatin1("<html><title></title><body>"));
1202
        if (m_view)
1203
            m_view->part()->resetFromScript();
1204
        m_tokenizer->setAutoClose();
1205
        write(QString::fromLatin1("<html>"));
1202
    }
1206
    }
1203
    m_tokenizer->write(text, false);
1207
    m_tokenizer->write(text, false);
1204
}
1208
}
(-)kdelibs-3.3.2/khtml/xml/xml_tokenizer.h (+4 lines)
Lines 121-126 Link Here
121
    virtual void finish() = 0;
121
    virtual void finish() = 0;
122
    virtual void setOnHold(bool /*_onHold*/) {}
122
    virtual void setOnHold(bool /*_onHold*/) {}
123
    virtual bool isWaitingForScripts() const = 0;
123
    virtual bool isWaitingForScripts() const = 0;
124
    virtual bool isExecutingScript() const = 0;
125
    virtual void setAutoClose(bool b=true) = 0;
124
126
125
signals:
127
signals:
126
    void finishedParsing();
128
    void finishedParsing();
Lines 156-166 Link Here
156
    virtual void write( const QString &str, bool );
158
    virtual void write( const QString &str, bool );
157
    virtual void end();
159
    virtual void end();
158
    virtual void finish();
160
    virtual void finish();
161
    virtual void setAutoClose(bool b=true) { qWarning("XMLTokenizer::setAutoClose: stub."); (void)b; }
159
162
160
    // from CachedObjectClient
163
    // from CachedObjectClient
161
    void notifyFinished(khtml::CachedObject *finishedObj);
164
    void notifyFinished(khtml::CachedObject *finishedObj);
162
165
163
    virtual bool isWaitingForScripts() const;
166
    virtual bool isWaitingForScripts() const;
167
    virtual bool isExecutingScript() const { return false; }
164
168
165
protected:
169
protected:
166
    DOM::DocumentPtr *m_doc;
170
    DOM::DocumentPtr *m_doc;

Return to bug 78058