Title: [135582] trunk
Revision
135582
Author
[email protected]
Date
2012-11-23 03:17:50 -0800 (Fri, 23 Nov 2012)

Log Message

[Qt] QWebPage::shouldInterruptJavaScript should be virtual in Qt 5
https://bugs.webkit.org/show_bug.cgi?id=103111

Reviewed by Kenneth Rohde Christiansen.

This function was added as a slot during Qt 4.x times because adding
virtual functions breaks binary compatibility. This constraint is gone
with the initial release of WebKit with Qt 5, and therefore we can
make it virtual now.

The change is fully source compatible as existing "re-implementations"
as slots will now be called through it being a virtual function. They
become unused slots.

Source/WebKit/qt:

* Api/qwebpage.cpp:
(QWebPagePrivate::shouldInterruptJavaScript):
* Api/qwebpage.h:
* Api/qwebpage_p.h:
* WebCoreSupport/ChromeClientQt.cpp:
(WebCore::ChromeClientQt::shouldInterruptJavaScript):
* WebCoreSupport/QWebPageAdapter.h:
(QWebPageAdapter):
* tests/qwebpage/tst_qwebpage.cpp:
(JSTestPage::shouldInterruptJavaScript):
(JSTestPage):

Tools:

* DumpRenderTree/qt/DumpRenderTreeQt.h:
(WebCore::WebPage::shouldInterruptJavaScript):
(WebPage):
* QtTestBrowser/webpage.h:
(WebPage):

Modified Paths

Diff

Modified: trunk/Source/WebKit/qt/Api/qwebpage.cpp (135581 => 135582)


--- trunk/Source/WebKit/qt/Api/qwebpage.cpp	2012-11-23 11:17:22 UTC (rev 135581)
+++ trunk/Source/WebKit/qt/Api/qwebpage.cpp	2012-11-23 11:17:50 UTC (rev 135582)
@@ -467,6 +467,11 @@
     return q->_javascript_Prompt(QWebFramePrivate::kit(frame), msg, defaultValue, result);
 }
 
+bool QWebPagePrivate::shouldInterruptJavaScript()
+{
+    return q->shouldInterruptJavaScript();
+}
+
 void QWebPagePrivate::printRequested(QWebFrameAdapter *frame)
 {
     emit q->printRequested(QWebFramePrivate::kit(frame));
@@ -2406,10 +2411,6 @@
     If the user wanted to stop the _javascript_ the implementation should return true; otherwise false.
 
     The default implementation executes the query using QMessageBox::information with QMessageBox::Yes and QMessageBox::No buttons.
-
-    \warning Because of binary compatibility constraints, this function is not virtual. If you want to
-    provide your own implementation in a QWebPage subclass, reimplement the shouldInterruptJavaScript()
-    slot in your subclass instead. QtWebKit will dynamically detect the slot and call it.
 */
 bool QWebPage::shouldInterruptJavaScript()
 {

Modified: trunk/Source/WebKit/qt/Api/qwebpage.h (135581 => 135582)


--- trunk/Source/WebKit/qt/Api/qwebpage.h	2012-11-23 11:17:22 UTC (rev 135581)
+++ trunk/Source/WebKit/qt/Api/qwebpage.h	2012-11-23 11:17:50 UTC (rev 135582)
@@ -368,8 +368,7 @@
 
     QWebPageAdapter* handle() const;
 
-public Q_SLOTS:
-    bool shouldInterruptJavaScript();
+    virtual bool shouldInterruptJavaScript();
 
 Q_SIGNALS:
     void loadStarted();

Modified: trunk/Source/WebKit/qt/Api/qwebpage_p.h (135581 => 135582)


--- trunk/Source/WebKit/qt/Api/qwebpage_p.h	2012-11-23 11:17:22 UTC (rev 135581)
+++ trunk/Source/WebKit/qt/Api/qwebpage_p.h	2012-11-23 11:17:50 UTC (rev 135582)
@@ -89,6 +89,7 @@
     virtual void _javascript_Alert(QWebFrameAdapter*, const QString& msg) OVERRIDE;
     virtual bool _javascript_Confirm(QWebFrameAdapter*, const QString& msg) OVERRIDE;
     virtual bool _javascript_Prompt(QWebFrameAdapter*, const QString& msg, const QString& defaultValue, QString* result) OVERRIDE;
+    virtual bool shouldInterruptJavaScript() OVERRIDE;
     virtual void printRequested(QWebFrameAdapter*) OVERRIDE;
     virtual void databaseQuotaExceeded(QWebFrameAdapter*, const QString& databaseName) OVERRIDE;
     virtual void applicationCacheQuotaExceeded(QWebSecurityOrigin*, quint64 defaultOriginQuota, quint64 totalSpaceNeeded) OVERRIDE;

Modified: trunk/Source/WebKit/qt/ChangeLog (135581 => 135582)


--- trunk/Source/WebKit/qt/ChangeLog	2012-11-23 11:17:22 UTC (rev 135581)
+++ trunk/Source/WebKit/qt/ChangeLog	2012-11-23 11:17:50 UTC (rev 135582)
@@ -1,3 +1,31 @@
+2012-11-23  Simon Hausmann  <[email protected]>
+
+        [Qt] QWebPage::shouldInterruptJavaScript should be virtual in Qt 5
+        https://bugs.webkit.org/show_bug.cgi?id=103111
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        This function was added as a slot during Qt 4.x times because adding
+        virtual functions breaks binary compatibility. This constraint is gone
+        with the initial release of WebKit with Qt 5, and therefore we can
+        make it virtual now.
+
+        The change is fully source compatible as existing "re-implementations"
+        as slots will now be called through it being a virtual function. They
+        become unused slots.
+
+        * Api/qwebpage.cpp:
+        (QWebPagePrivate::shouldInterruptJavaScript):
+        * Api/qwebpage.h:
+        * Api/qwebpage_p.h:
+        * WebCoreSupport/ChromeClientQt.cpp:
+        (WebCore::ChromeClientQt::shouldInterruptJavaScript):
+        * WebCoreSupport/QWebPageAdapter.h:
+        (QWebPageAdapter):
+        * tests/qwebpage/tst_qwebpage.cpp:
+        (JSTestPage::shouldInterruptJavaScript):
+        (JSTestPage):
+
 2012-11-23  Pierre Rossi  <[email protected]>
 
         [Qt] REGRESSION(r135515): 3 appcache tests still failing

Modified: trunk/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp (135581 => 135582)


--- trunk/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp	2012-11-23 11:17:22 UTC (rev 135581)
+++ trunk/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp	2012-11-23 11:17:50 UTC (rev 135582)
@@ -365,9 +365,7 @@
 
 bool ChromeClientQt::shouldInterruptJavaScript()
 {
-    bool shouldInterrupt = false;
-    QMetaObject::invokeMethod(m_webPage->handle(), "shouldInterruptJavaScript", Qt::DirectConnection, Q_RETURN_ARG(bool, shouldInterrupt));
-    return shouldInterrupt;
+    return m_webPage->shouldInterruptJavaScript();
 }
 
 KeyboardUIMode ChromeClientQt::keyboardUIMode()

Modified: trunk/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h (135581 => 135582)


--- trunk/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h	2012-11-23 11:17:22 UTC (rev 135581)
+++ trunk/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.h	2012-11-23 11:17:50 UTC (rev 135582)
@@ -76,6 +76,7 @@
     virtual void _javascript_Alert(QWebFrameAdapter*, const QString& msg) = 0;
     virtual bool _javascript_Confirm(QWebFrameAdapter*, const QString& msg) = 0;
     virtual bool _javascript_Prompt(QWebFrameAdapter*, const QString& msg, const QString& defaultValue, QString* result) = 0;
+    virtual bool shouldInterruptJavaScript() = 0;
     virtual void printRequested(QWebFrameAdapter*) = 0;
     virtual void databaseQuotaExceeded(QWebFrameAdapter*, const QString& databaseName) = 0;
     virtual void applicationCacheQuotaExceeded(QWebSecurityOrigin*, quint64 defaultOriginQuota, quint64 totalSpaceNeeded) = 0;

Modified: trunk/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp (135581 => 135582)


--- trunk/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp	2012-11-23 11:17:22 UTC (rev 135581)
+++ trunk/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp	2012-11-23 11:17:50 UTC (rev 135582)
@@ -281,10 +281,11 @@
     JSTestPage(QObject* parent = 0)
     : QWebPage(parent) {}
 
-public Q_SLOTS:
-    bool shouldInterruptJavaScript() {
+    virtual bool shouldInterruptJavaScript()
+    {
         return true;
     }
+public Q_SLOTS:
     void requestPermission(QWebFrame* frame, QWebPage::Feature feature)
     {
         if (m_allowGeolocation)

Modified: trunk/Tools/ChangeLog (135581 => 135582)


--- trunk/Tools/ChangeLog	2012-11-23 11:17:22 UTC (rev 135581)
+++ trunk/Tools/ChangeLog	2012-11-23 11:17:50 UTC (rev 135582)
@@ -1,3 +1,25 @@
+2012-11-23  Simon Hausmann  <[email protected]>
+
+        [Qt] QWebPage::shouldInterruptJavaScript should be virtual in Qt 5
+        https://bugs.webkit.org/show_bug.cgi?id=103111
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        This function was added as a slot during Qt 4.x times because adding
+        virtual functions breaks binary compatibility. This constraint is gone
+        with the initial release of WebKit with Qt 5, and therefore we can
+        make it virtual now.
+
+        The change is fully source compatible as existing "re-implementations"
+        as slots will now be called through it being a virtual function. They
+        become unused slots.
+
+        * DumpRenderTree/qt/DumpRenderTreeQt.h:
+        (WebCore::WebPage::shouldInterruptJavaScript):
+        (WebPage):
+        * QtTestBrowser/webpage.h:
+        (WebPage):
+
 2012-11-22  Peter Beverloo  <[email protected]>
 
         [Chromium] Return an accurate exit code when running Android suites, and wait after restarting adb as root

Modified: trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h (135581 => 135582)


--- trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h	2012-11-23 11:17:22 UTC (rev 135581)
+++ trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h	2012-11-23 11:17:50 UTC (rev 135582)
@@ -204,8 +204,9 @@
 
     void permissionSet(QWebPage::Feature feature);
 
+    virtual bool shouldInterruptJavaScript() { return false; }
+
 public Q_SLOTS:
-    bool shouldInterruptJavaScript() { return false; }
     void requestPermission(QWebFrame* frame, QWebPage::Feature feature);
     void cancelPermission(QWebFrame* frame, QWebPage::Feature feature);
 

Modified: trunk/Tools/QtTestBrowser/webpage.h (135581 => 135582)


--- trunk/Tools/QtTestBrowser/webpage.h	2012-11-23 11:17:22 UTC (rev 135581)
+++ trunk/Tools/QtTestBrowser/webpage.h	2012-11-23 11:17:50 UTC (rev 135582)
@@ -52,10 +52,11 @@
     QString userAgentForUrl(const QUrl& url) const;
     void setInterruptingJavaScriptEnabled(bool enabled) { m_interruptingJavaScriptEnabled = enabled; }
 
+    virtual bool shouldInterruptJavaScript();
+
 public Q_SLOTS:
     void openUrlInDefaultBrowser(const QUrl& url = ""
     void setUserAgent(const QString& ua) { m_userAgent = ua; }
-    bool shouldInterruptJavaScript();
     void authenticationRequired(QNetworkReply*, QAuthenticator*);
     void requestPermission(QWebFrame* frame, QWebPage::Feature feature);
     void featurePermissionRequestCanceled(QWebFrame* frame, QWebPage::Feature feature);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to