RESOLVED FIXED Bug 33617
[Qt] DRT missing setUserStyleSheetLocation and setUserStyleSheetEnabled in LayoutTestController
https://bugs.webkit.org/show_bug.cgi?id=33617
Summary [Qt] DRT missing setUserStyleSheetLocation and setUserStyleSheetEnabled in La...
Diego Gonzalez
Reported 2010-01-13 12:24:45 PST
The setUserStyleSheetLocation and setUserStyleSheetEnabled are missing in LayoutTestController, which fails the http/tests/security/local-user-CSS-from-remote.html LayoutTest
Attachments
Proposed patch (4.12 KB, patch)
2010-01-13 12:48 PST, Diego Gonzalez
no flags
Proposed patch v0.2 (4.19 KB, patch)
2010-01-13 14:23 PST, Diego Gonzalez
no flags
Diego Gonzalez
Comment 1 2010-01-13 12:48:51 PST
Created attachment 46492 [details] Proposed patch
WebKit Review Bot
Comment 2 2010-01-13 12:51:36 PST
Attachment 46492 [details] did not pass style-queue: Failed to run "WebKitTools/Scripts/check-webkit-style" exit_code: 1 WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp:174: Should have a space between // and comment [whitespace/comments] [4] Total errors found: 1
Jakub Wieczorek
Comment 3 2010-01-13 13:48:57 PST
Let me add my 3 cents... > --- a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp > +++ b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp > @@ -171,6 +171,7 @@ void WebPage::resetSettings() > m_drt->layoutTestController()->setXSSAuditorEnabled(false); > > QWebSettings::setMaximumPagesInCache(0); // reset to default > + settings()->setUserStyleSheetUrl(QUrl("")); //reset to default The default constructor (QUrl()) would be fine as well. > --- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp > +++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp > @@ -391,3 +391,22 @@ void LayoutTestController::overridePreference(const QString& name, const QVarian > else if (name == "WebKitUsesPageCachePreferenceKey") > QWebSettings::setMaximumPagesInCache(value.toInt()); > } > + > +static QUrl userStyleSheetLocation = QUrl(""); I would make it a member variable instead. > +void LayoutTestController::setUserStyleSheetLocation(const QString& url) > +{ > + if (!url.isEmpty()) Is this check even needed? > +void LayoutTestController::setUserStyleSheetEnabled(bool enabled) > +{ > + QWebSettings* settings = m_topLoadingFrame->page()->settings(); > + if (settings) { I doubt settings can be null here. > + if (enabled) > + settings->setUserStyleSheetUrl(userStyleSheetLocation); > + else > + settings->setUserStyleSheetUrl(QUrl("")); Same as above, I would use the default constructor.
Diego Gonzalez
Comment 4 2010-01-13 14:03:11 PST
(In reply to comment #3) > Let me add my 3 cents... > > > --- a/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp > > +++ b/WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp > > @@ -171,6 +171,7 @@ void WebPage::resetSettings() > > m_drt->layoutTestController()->setXSSAuditorEnabled(false); > > > > QWebSettings::setMaximumPagesInCache(0); // reset to default > > + settings()->setUserStyleSheetUrl(QUrl("")); //reset to default > > The default constructor (QUrl()) would be fine as well. > > > --- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp > > +++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp > > @@ -391,3 +391,22 @@ void LayoutTestController::overridePreference(const QString& name, const QVarian > > else if (name == "WebKitUsesPageCachePreferenceKey") > > QWebSettings::setMaximumPagesInCache(value.toInt()); > > } > > + > > +static QUrl userStyleSheetLocation = QUrl(""); > > I would make it a member variable instead. > > > +void LayoutTestController::setUserStyleSheetLocation(const QString& url) > > +{ > > + if (!url.isEmpty()) > > Is this check even needed? > > > +void LayoutTestController::setUserStyleSheetEnabled(bool enabled) > > +{ > > + QWebSettings* settings = m_topLoadingFrame->page()->settings(); > > + if (settings) { > > I doubt settings can be null here. > > > + if (enabled) > > + settings->setUserStyleSheetUrl(userStyleSheetLocation); > > + else > > + settings->setUserStyleSheetUrl(QUrl("")); > > Same as above, I would use the default constructor. Good suggestions! Thanks a lot. Reviewing now
Diego Gonzalez
Comment 5 2010-01-13 14:23:25 PST
Created attachment 46507 [details] Proposed patch v0.2 Correct style and add Jakub suggestions
Antonio Gomes
Comment 6 2010-01-13 19:50:24 PST
LGTM ! simon, kenneth , could one of you guys please review ? thx (In reply to comment #5) > Created an attachment (id=46507) [details] > Proposed patch v0.2 > > Correct style and add Jakub suggestions
Kenneth Rohde Christiansen
Comment 7 2010-01-13 23:38:01 PST
Comment on attachment 46507 [details] Proposed patch v0.2 LGTM, r=me > + if (enabled) > + m_drt->webPage()->settings()->setUserStyleSheetUrl(m_userStyleSheetLocation); > + else > + m_drt->webPage()->settings()->setUserStyleSheetUrl(QUrl()); Do you know what happens if I give an invalid url to setUserStyleSheetUrl? Is that handled?
WebKit Commit Bot
Comment 8 2010-01-14 01:47:32 PST
Comment on attachment 46507 [details] Proposed patch v0.2 Clearing flags on attachment: 46507 Committed r53249: <http://trac.webkit.org/changeset/53249>
WebKit Commit Bot
Comment 9 2010-01-14 01:47:38 PST
All reviewed patches have been landed. Closing bug.
Eric Seidel (no email)
Comment 10 2010-01-14 02:43:19 PST
This looks like this caused one test to regress: http://build.webkit.org/results/Qt%20Linux%20Release/r53249%20(5974)/http/tests/security/local-user-CSS-from-remote-pretty-diff.html I'm going to look at rolling this out unless someone is around to comment.
Eric Seidel (no email)
Comment 11 2010-01-14 02:46:17 PST
In case the buildbot results are purged by the time someone looks at this, here is the failing diff: --- layout-test-results/http/tests/security/local-user-CSS-from-remote-expected.txt 2010-01-14 01:54:07.000000000 -0800 +++ layout-test-results/http/tests/security/local-user-CSS-from-remote-actual.txt 2010-01-14 01:54:07.000000000 -0800 @@ -2,4 +2,4 @@ To run this test manually you must set your user style sheet in your Safari preferences to LayoutTests/http/tests/security/resources/cssStyle.css If the background is yellow then the user stylesheet was loaded. -Test Passed: Local user stylesheet loaded. +Test Failed: Local user stylesheet not loaded into remote document.
Kenneth Rohde Christiansen
Comment 12 2010-01-14 02:46:54 PST
I guess Diego will first be around in 2 hours or so. He is in the Manaus, Brazil time zone.
Eric Seidel (no email)
Comment 13 2010-01-14 02:48:21 PST
Reverted r53249 for reason: This caused http/tests/security/local-user-CSS-from-remote.html to fail on the Qt Release Build Bot. Committed r53253: <http://trac.webkit.org/changeset/53253>
Antonio Gomes
Comment 14 2010-01-14 02:58:38 PST
guys that test regressed because bug 33614 (see dependency field) has to land first ! kenneth , could look over that one and we re-try this ? (In reply to comment #13) > Reverted r53249 for reason: > > This caused http/tests/security/local-user-CSS-from-remote.html to fail on the > Qt Release Build Bot. > > Committed r53253: <http://trac.webkit.org/changeset/53253>
Antonio Gomes
Comment 15 2010-01-14 02:59:20 PST
(In reply to comment #7) > (From update of attachment 46507 [details]) > LGTM, r=me > > > + if (enabled) > > + m_drt->webPage()->settings()->setUserStyleSheetUrl(m_userStyleSheetLocation); > > + else > > + m_drt->webPage()->settings()->setUserStyleSheetUrl(QUrl()); > > Do you know what happens if I give an invalid url to setUserStyleSheetUrl? Is > that handled? in this case, it is like unsetting the userStyleSheet
Eric Seidel (no email)
Comment 16 2010-01-14 03:03:11 PST
Yup. It's just better to roll-out first and ask questions later. That way we keep the bots green more of the time. In this case that's extra important because we have over a days worth of commits pent up in the commit-queue because it was blocked all day due to bug 33638. This will be easy to roll back in once we can do so without breaking the bots. Just go ahead and set r+/cq+ on the patch once it's ready to land again :)
Antonio Gomes
Comment 17 2010-01-14 11:49:09 PST
Committing to http://svn.webkit.org/repository/webkit/trunk ... M LayoutTests/ChangeLog M LayoutTests/platform/qt/Skipped M WebKitTools/ChangeLog M WebKitTools/DumpRenderTree/qt/DumpRenderTreeQt.cpp M WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp M WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h Committed r53281
Eric Seidel (no email)
Comment 18 2010-01-14 11:50:53 PST
It's unclear what changed between checkins and why this new one isn't going to cause failures. :) The bots will tell. :)
Note You need to log in before you can comment on or make changes to this bug.