[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
hausmann at webkit.org
hausmann at webkit.org
Wed Dec 22 11:27:40 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 06b1fe0e9a028ba9344bac335293486871a5d816
Author: hausmann at webkit.org <hausmann at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Jul 26 08:53:50 2010 +0000
[Qt] Use the default timeout interval for JS as the HTML tokenizer delay for setHtml()
Patch by Tor Arne Vestbø <tor.arne.vestbo at nokia.com> on 2009-10-30
Reviewed by Kenneth Rohde Christiansen.
This ensures that long-running JavaScript (for example due to a modal alert() dialog),
will not trigger a deferred load after only 500ms (the default tokenizer delay) while
still giving a reasonable timeout (10 seconds) to prevent deadlock.
https://bugs.webkit.org/show_bug.cgi?id=29381
JavaScriptCore:
* runtime/TimeoutChecker.h: Add getter for the timeout interval
WebKit/qt:
* Api/qwebframe.cpp: Document the behaviour
* WebCoreSupport/FrameLoaderClientQt.cpp: set the custom tokenizer delay for substitute loads
* tests/qwebframe/tst_qwebframe.cpp: Add test
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64036 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 88c9d97..9efa2d0 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,17 @@
+2009-10-30 Tor Arne Vestbø <tor.arne.vestbo at nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Use the default timeout interval for JS as the HTML tokenizer delay for setHtml()
+
+ This ensures that long-running JavaScript (for example due to a modal alert() dialog),
+ will not trigger a deferred load after only 500ms (the default tokenizer delay) while
+ still giving a reasonable timeout (10 seconds) to prevent deadlock.
+
+ https://bugs.webkit.org/show_bug.cgi?id=29381
+
+ * runtime/TimeoutChecker.h: Add getter for the timeout interval
+
2010-07-25 Patrick Gansterer <paroga at paroga.com>
Reviewed by Kent Tamura.
diff --git a/JavaScriptCore/runtime/TimeoutChecker.h b/JavaScriptCore/runtime/TimeoutChecker.h
index 7bfa6d0..5925641 100644
--- a/JavaScriptCore/runtime/TimeoutChecker.h
+++ b/JavaScriptCore/runtime/TimeoutChecker.h
@@ -40,6 +40,7 @@ namespace JSC {
TimeoutChecker();
void setTimeoutInterval(unsigned timeoutInterval) { m_timeoutInterval = timeoutInterval; }
+ unsigned timeoutInterval() const { return m_timeoutInterval; }
unsigned ticksUntilNextCheck() { return m_ticksUntilNextCheck; }
diff --git a/WebKit/qt/Api/qwebframe.cpp b/WebKit/qt/Api/qwebframe.cpp
index d1741ca..f10d5b4 100644
--- a/WebKit/qt/Api/qwebframe.cpp
+++ b/WebKit/qt/Api/qwebframe.cpp
@@ -784,6 +784,10 @@ void QWebFrame::load(const QNetworkRequest &req,
The \a html is loaded immediately; external objects are loaded asynchronously.
+ If a script in the \a html runs longer than the default script timeout (currently 10 seconds),
+ for example due to being blocked by a modal JavaScript alert dialog, this method will return
+ as soon as possible after the timeout and any subsequent \a html will be loaded asynchronously.
+
When using this method WebKit assumes that external resources such as JavaScript programs or style
sheets are encoded in UTF-8 unless otherwise specified. For example, the encoding of an external
script can be specified through the charset attribute of the HTML script tag. It is also possible
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index 3229234..779caa0 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,19 @@
+2009-10-30 Tor Arne Vestbø <tor.arne.vestbo at nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Use the default timeout interval for JS as the HTML tokenizer delay for setHtml()
+
+ This ensures that long-running JavaScript (for example due to a modal alert() dialog),
+ will not trigger a deferred load after only 500ms (the default tokenizer delay) while
+ still giving a reasonable timeout (10 seconds) to prevent deadlock.
+
+ https://bugs.webkit.org/show_bug.cgi?id=29381
+
+ * Api/qwebframe.cpp: Document the behaviour
+ * WebCoreSupport/FrameLoaderClientQt.cpp: set the custom tokenizer delay for substitute loads
+ * tests/qwebframe/tst_qwebframe.cpp: Add test
+
2010-07-23 David Boddie <dboddie at trolltech.com>
Reviewed by Simon Hausmann.
diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
index fc0f6c3..9fe66d9 100644
--- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
@@ -39,6 +39,7 @@
#include "FrameView.h"
#include "DocumentLoader.h"
#include "HitTestResult.h"
+#include "JSDOMWindowBase.h"
#include "MIMETypeRegistry.h"
#include "MouseEvent.h"
#include "ResourceResponse.h"
@@ -879,8 +880,15 @@ bool FrameLoaderClientQt::shouldFallBack(const WebCore::ResourceError&)
WTF::PassRefPtr<WebCore::DocumentLoader> FrameLoaderClientQt::createDocumentLoader(const WebCore::ResourceRequest& request, const SubstituteData& substituteData)
{
RefPtr<DocumentLoader> loader = DocumentLoader::create(request, substituteData);
- if (!deferMainResourceDataLoad || substituteData.isValid())
+ if (!deferMainResourceDataLoad || substituteData.isValid()) {
loader->setDeferMainResourceDataLoad(false);
+ // Use the default timeout interval for JS as the HTML tokenizer delay. This ensures
+ // that long-running JavaScript will still allow setHtml() to be synchronous, while
+ // still giving a reasonable timeout to prevent deadlock.
+ double delay = JSDOMWindowBase::commonJSGlobalData()->timeoutChecker.timeoutInterval() / 1000.0f;
+ m_frame->page()->setCustomHTMLTokenizerTimeDelay(delay);
+ } else
+ m_frame->page()->setCustomHTMLTokenizerTimeDelay(-1);
return loader.release();
}
diff --git a/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
index 3d03157..b208447 100644
--- a/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
+++ b/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
@@ -601,6 +601,7 @@ private slots:
void setHtml();
void setHtmlWithResource();
void setHtmlWithBaseURL();
+ void setHtmlWithJSAlert();
void ipv6HostEncoding();
void metaData();
#if !defined(Q_WS_MAEMO_5)
@@ -2555,6 +2556,33 @@ void tst_QWebFrame::setHtmlWithBaseURL()
QCOMPARE(m_view->page()->history()->count(), 0);
}
+class MyPage : public QWebPage
+{
+public:
+ MyPage() : QWebPage(), alerts(0) {}
+ int alerts;
+
+protected:
+ virtual void javaScriptAlert(QWebFrame*, const QString& msg)
+ {
+ alerts++;
+ QCOMPARE(msg, QString("foo"));
+ // Should not be enough to trigger deferred loading, since we've upped the HTML
+ // tokenizer delay in the Qt frameloader. See HTMLTokenizer::continueProcessing()
+ QTest::qWait(1000);
+ }
+};
+
+void tst_QWebFrame::setHtmlWithJSAlert()
+{
+ QString html("<html><head></head><body><script>alert('foo');</script><p>hello world</p></body></html>");
+ MyPage page;
+ m_view->setPage(&page);
+ page.mainFrame()->setHtml(html);
+ QCOMPARE(page.alerts, 1);
+ QCOMPARE(m_view->page()->mainFrame()->toHtml(), html);
+}
+
class TestNetworkManager : public QNetworkAccessManager
{
public:
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list