Source/WebCore: [Qt] QWebSettings::setUserStyleSheetUrl() does not work with...

Source/WebCore: [Qt] QWebSettings::setUserStyleSheetUrl() does not work with windows paths that contain drive letters
https://bugs.webkit.org/show_bug.cgi?id=34884

KURL::path() alone does not handle removing the leading slash from a windows file path.
Using QUrl::toLocalFile() will turn file:///C:/path into C:/path appropriately.

Patch by Jarred Nicholls <jarred@sencha.com> on 2011-09-10
Reviewed by Andreas Kling.

* platform/qt/KURLQt.cpp:
(WebCore::KURL::fileSystemPath):

Source/WebKit/qt: [Qt] QWebSettings::setUserStyleSheetUrl() does not work with windows paths that contain drive letters
https://bugs.webkit.org/show_bug.cgi?id=34884

KURL::path() alone does not handle removing the leading slash from a windows file path.
Using QUrl::toLocalFile() will turn file:///C:/path into C:/path appropriately.

New test case that ensures a user stylesheet from the file system will load correctly
on all platforms.

Patch by Jarred Nicholls <jarred@sencha.com> on 2011-09-10
Reviewed by Andreas Kling.

* tests/qwebpage/resources/user.css: Added.
(p):
* tests/qwebpage/tst_qwebpage.cpp:
(tst_QWebPage::userStyleSheetFromFile):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@94906 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent bfd3b665
2011-09-10 Jarred Nicholls <jarred@sencha.com>
[Qt] QWebSettings::setUserStyleSheetUrl() does not work with windows paths that contain drive letters
https://bugs.webkit.org/show_bug.cgi?id=34884
KURL::path() alone does not handle removing the leading slash from a windows file path.
Using QUrl::toLocalFile() will turn file:///C:/path into C:/path appropriately.
Reviewed by Andreas Kling.
* platform/qt/KURLQt.cpp:
(WebCore::KURL::fileSystemPath):
2011-09-10 Ken Buchanan <kenrb@chromium.org>
Crash due to bad data in SVGDocumentExtensions m_pendingResources
......@@ -46,7 +46,7 @@ String KURL::fileSystemPath() const
if (!isValid() || !protocolIs("file"))
return String();
return String(path());
return static_cast<QUrl>(*this).toLocalFile();
}
}
......
2011-09-10 Jarred Nicholls <jarred@sencha.com>
[Qt] QWebSettings::setUserStyleSheetUrl() does not work with windows paths that contain drive letters
https://bugs.webkit.org/show_bug.cgi?id=34884
KURL::path() alone does not handle removing the leading slash from a windows file path.
Using QUrl::toLocalFile() will turn file:///C:/path into C:/path appropriately.
New test case that ensures a user stylesheet from the file system will load correctly
on all platforms.
Reviewed by Andreas Kling.
* tests/qwebpage/resources/user.css: Added.
(p):
* tests/qwebpage/tst_qwebpage.cpp:
(tst_QWebPage::userStyleSheetFromFile):
2011-09-09 Fady Samuel <fsamuel@chromium.org>
Move pageScaleFactor code from Frame.{h|cpp} to Page.{h|cpp}
......
p {
background-image: url('http://does.not/exist.png');
}
\ No newline at end of file
......@@ -101,6 +101,7 @@ private slots:
void popupFormSubmission();
void acceptNavigationRequestWithNewWindow();
void userStyleSheet();
void userStyleSheetFromLocalFileUrl();
void loadHtml5Video();
void modified();
void contextMenuCrash();
......@@ -465,7 +466,6 @@ void tst_QWebPage::userStyleSheet()
{
TestNetworkManager* networkManager = new TestNetworkManager(m_page);
m_page->setNetworkAccessManager(networkManager);
networkManager->requestedUrls.clear();
m_page->settings()->setUserStyleSheetUrl(QUrl("data:text/css;charset=utf-8;base64,"
+ QByteArray("p { background-image: url('http://does.not/exist.png');}").toBase64()));
......@@ -476,6 +476,20 @@ void tst_QWebPage::userStyleSheet()
QCOMPARE(networkManager->requestedUrls.at(0), QUrl("http://does.not/exist.png"));
}
void tst_QWebPage::userStyleSheetFromLocalFileUrl()
{
TestNetworkManager* networkManager = new TestNetworkManager(m_page);
m_page->setNetworkAccessManager(networkManager);
QUrl styleSheetUrl = QUrl::fromLocalFile(TESTS_SOURCE_DIR + QLatin1String("qwebpage/resources/user.css"));
m_page->settings()->setUserStyleSheetUrl(styleSheetUrl);
m_view->setHtml("<p>hello world</p>");
QVERIFY(::waitForSignal(m_view, SIGNAL(loadFinished(bool))));
QVERIFY(networkManager->requestedUrls.count() >= 1);
QCOMPARE(networkManager->requestedUrls.at(0), QUrl("http://does.not/exist.png"));
}
void tst_QWebPage::loadHtml5Video()
{
#if defined(WTF_USE_QT_MULTIMEDIA) && WTF_USE_QT_MULTIMEDIA
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment