Bug 107461 - [Qt] QtTestBrowser should provide option to enable/disable Javascript
Summary: [Qt] QtTestBrowser should provide option to enable/disable Javascript
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Vivek Galatage
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-21 10:40 PST by Vivek Galatage
Modified: 2013-02-07 08:06 PST (History)
8 users (show)

See Also:


Attachments
Patch (3.04 KB, patch)
2013-01-21 10:44 PST, Vivek Galatage
no flags Details | Formatted Diff | Diff
Patch (3.04 KB, patch)
2013-01-21 21:53 PST, Vivek Galatage
no flags Details | Formatted Diff | Diff
Patch (2.95 KB, patch)
2013-02-07 04:14 PST, Vivek Galatage
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vivek Galatage 2013-01-21 10:40:19 PST
QtTestBrowser should provide option to enable/disable Javascript.

Patch to follow.
Comment 1 Vivek Galatage 2013-01-21 10:44:46 PST
Created attachment 183804 [details]
Patch
Comment 2 Vivek Galatage 2013-01-21 21:53:25 PST
Created attachment 183888 [details]
Patch
Comment 3 Noam Rosenthal 2013-01-21 23:33:31 PST
You can do this via web inspector; Do you really need this duplicated in the browser settings?
Comment 4 Vivek Galatage 2013-01-21 23:40:24 PST
(In reply to comment #3)
> You can do this via web inspector; Do you really need this duplicated in the browser settings?

yes I agree. But for a quick test for disabling it we need to open the inspector and then navigate it to the "Inspector settings" and then in the "General" tab to actually disable it. I thought for a test browser that would take a little longer hence introduced this quick menu item. 

Also one thing I am finding different is that on linux the inspector is not shown inside the QtTestBrowser whereas the same is shown on the mac.
Comment 5 Jocelyn Turcotte 2013-01-22 03:17:39 PST
(In reply to comment #4)
It feels like you would be the only one using this menu. QtTestBrowser is more a WebKit developer tool then a web developer tool.

Do you see a use case where other developers might want to use this menu?
Comment 6 Vivek Galatage 2013-01-22 03:23:25 PST
(In reply to comment #5)
> (In reply to comment #4)
> It feels like you would be the only one using this menu. QtTestBrowser is more a WebKit developer tool then a web developer tool.
> 
> Do you see a use case where other developers might want to use this menu?

I agree. The use case is something like: I am working on [1] and wanted a quick way to verify this bug. Hence I wanted it to quickly provide me an option to enable/disable the Javascript and hence prompted me in adding it to the QtTestBrowser.

[1] https://bugs.webkit.org/show_bug.cgi?id=103902
Comment 7 Vivek Galatage 2013-02-04 02:06:12 PST
(In reply to comment #5)
> (In reply to comment #4)
> It feels like you would be the only one using this menu. QtTestBrowser is more a WebKit developer tool then a web developer tool.
> 
> Do you see a use case where other developers might want to use this menu?

Another use case is that of browsers (almost all the browsers) providing the option to disable JavaScript execution altogether. So this menu would help simulate that behavior as well. In this case, the users usually disable the option via browser settings as such.
Comment 8 Jocelyn Turcotte 2013-02-07 03:28:25 PST
Comment on attachment 183888 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=183888&action=review

> Tools/QtTestBrowser/launcherwindow.cpp:501
> +    toggleJavaScriptEnabled->setChecked(true);

This should read:
toggleJavaScriptEnabled->setChecked(settings->testAttribute(QWebSettings::JavascriptEnabled));

> Tools/QtTestBrowser/launcherwindow.cpp:933
> +    statusBar()->showMessage(QString("Javascript ") + QString(enable ? "enabled" : "disabled"), 5000);

This isn't necessary, the checkbox already tells the user if JS is enabled or not.
Comment 9 Vivek Galatage 2013-02-07 04:13:20 PST
Comment on attachment 183888 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=183888&action=review

Thank you for your feedback.

>> Tools/QtTestBrowser/launcherwindow.cpp:501
>> +    toggleJavaScriptEnabled->setChecked(true);
> 
> This should read:
> toggleJavaScriptEnabled->setChecked(settings->testAttribute(QWebSettings::JavascriptEnabled));

Sure, I will correct this.

>> Tools/QtTestBrowser/launcherwindow.cpp:933
>> +    statusBar()->showMessage(QString("Javascript ") + QString(enable ? "enabled" : "disabled"), 5000);
> 
> This isn't necessary, the checkbox already tells the user if JS is enabled or not.

Agreed.
Comment 10 Vivek Galatage 2013-02-07 04:14:49 PST
Created attachment 187057 [details]
Patch
Comment 11 WebKit Review Bot 2013-02-07 08:05:57 PST
Comment on attachment 187057 [details]
Patch

Clearing flags on attachment: 187057

Committed r142125: <http://trac.webkit.org/changeset/142125>
Comment 12 WebKit Review Bot 2013-02-07 08:06:02 PST
All reviewed patches have been landed.  Closing bug.