[Qt] QtTestBrowser should provide option to enable/disable Javascript
authorvivek.vg@samsung.com <vivek.vg@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Feb 2013 16:04:21 +0000 (16:04 +0000)
committervivek.vg@samsung.com <vivek.vg@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Feb 2013 16:04:21 +0000 (16:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=107461

Reviewed by Jocelyn Turcotte.

Option to enable/disable Javascript would be handy option to test
certain functionalities of web pages with/without Javascript.

* QtTestBrowser/launcherwindow.cpp:
(LauncherWindow::createChrome):
(LauncherWindow::toggleJavaScriptEnabled):
* QtTestBrowser/launcherwindow.h:
(LauncherWindow):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@142125 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/QtTestBrowser/launcherwindow.cpp
Tools/QtTestBrowser/launcherwindow.h

index 11dbd51..4472bc7 100644 (file)
@@ -1,3 +1,19 @@
+2013-02-07  Vivek Galatage  <vivek.vg@samsung.com>
+
+        [Qt] QtTestBrowser should provide option to enable/disable Javascript
+        https://bugs.webkit.org/show_bug.cgi?id=107461
+
+        Reviewed by Jocelyn Turcotte.
+
+        Option to enable/disable Javascript would be handy option to test
+        certain functionalities of web pages with/without Javascript.
+
+        * QtTestBrowser/launcherwindow.cpp:
+        (LauncherWindow::createChrome):
+        (LauncherWindow::toggleJavaScriptEnabled):
+        * QtTestBrowser/launcherwindow.h:
+        (LauncherWindow):
+
 2013-02-07  Raphael Kubo da Costa  <raphael.kubo.da.costa@intel.com>
 
         [EFL] Add a WebKit2 Performance bot.
 2013-02-07  Raphael Kubo da Costa  <raphael.kubo.da.costa@intel.com>
 
         [EFL] Add a WebKit2 Performance bot.
index 855190b..b8e080b 100644 (file)
@@ -496,6 +496,10 @@ void LauncherWindow::createChrome()
 #endif
     toggleScrollAnimator->setChecked(false);
 
 #endif
     toggleScrollAnimator->setChecked(false);
 
+    QAction* toggleJavaScriptEnabled = settingsMenu->addAction("Enable Javascript", this, SLOT(toggleJavaScriptEnabled(bool)));
+    toggleJavaScriptEnabled->setCheckable(true);
+    toggleJavaScriptEnabled->setChecked(settings->testAttribute(QWebSettings::JavascriptEnabled));
+
     QAction* toggleInterruptingJavaScripteEnabled = settingsMenu->addAction("Enable interrupting js scripts", this, SLOT(toggleInterruptingJavaScriptEnabled(bool)));
     toggleInterruptingJavaScripteEnabled->setCheckable(true);
     toggleInterruptingJavaScripteEnabled->setChecked(false);
     QAction* toggleInterruptingJavaScripteEnabled = settingsMenu->addAction("Enable interrupting js scripts", this, SLOT(toggleInterruptingJavaScriptEnabled(bool)));
     toggleInterruptingJavaScripteEnabled->setCheckable(true);
     toggleInterruptingJavaScripteEnabled->setChecked(false);
@@ -923,6 +927,11 @@ void LauncherWindow::toggleFrameFlattening(bool toggle)
     page()->settings()->setAttribute(QWebSettings::FrameFlatteningEnabled, toggle);
 }
 
     page()->settings()->setAttribute(QWebSettings::FrameFlatteningEnabled, toggle);
 }
 
+void LauncherWindow::toggleJavaScriptEnabled(bool enable)
+{
+    page()->settings()->setAttribute(QWebSettings::JavascriptEnabled, enable);
+}
+
 void LauncherWindow::toggleInterruptingJavaScriptEnabled(bool enable)
 {
     page()->setInterruptingJavaScriptEnabled(enable);
 void LauncherWindow::toggleInterruptingJavaScriptEnabled(bool enable)
 {
     page()->setInterruptingJavaScriptEnabled(enable);
index fb3137d..185f21b 100644 (file)
@@ -160,6 +160,7 @@ protected Q_SLOTS:
     void toggleSpatialNavigation(bool b);
     void toggleFullScreenMode(bool enable);
     void toggleFrameFlattening(bool toggle);
     void toggleSpatialNavigation(bool b);
     void toggleFullScreenMode(bool enable);
     void toggleFrameFlattening(bool toggle);
+    void toggleJavaScriptEnabled(bool enable);
     void toggleInterruptingJavaScriptEnabled(bool enable);
     void toggleJavascriptCanOpenWindows(bool enable);
     void toggleAutoLoadImages(bool enable);
     void toggleInterruptingJavaScriptEnabled(bool enable);
     void toggleJavascriptCanOpenWindows(bool enable);
     void toggleAutoLoadImages(bool enable);