diff options
author | johnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-09 21:47:24 +0000 |
---|---|---|
committer | johnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-09 21:47:24 +0000 |
commit | e9fdd159ffd94e3e097bd6905d84e6b564b04c2c (patch) | |
tree | e4255dec2671b7dad55213615758f6f487a919f5 /chrome/browser/notifications/desktop_notifications_unittest.cc | |
parent | 1ec4e04d215b1952a9ae634a26aa068844cc7c5f (diff) | |
download | chromium_src-e9fdd159ffd94e3e097bd6905d84e6b564b04c2c.zip chromium_src-e9fdd159ffd94e3e097bd6905d84e6b564b04c2c.tar.gz chromium_src-e9fdd159ffd94e3e097bd6905d84e6b564b04c2c.tar.bz2 |
Properly escape user input for notifications, since URL-encoded characters are leaking through as HTML in non-HTML notifications.
BUG=45859
TEST=see bug
Review URL: http://codereview.chromium.org/2743007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49328 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/notifications/desktop_notifications_unittest.cc')
-rw-r--r-- | chrome/browser/notifications/desktop_notifications_unittest.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/chrome/browser/notifications/desktop_notifications_unittest.cc b/chrome/browser/notifications/desktop_notifications_unittest.cc index be7a6f6..5cd03c3 100644 --- a/chrome/browser/notifications/desktop_notifications_unittest.cc +++ b/chrome/browser/notifications/desktop_notifications_unittest.cc @@ -281,7 +281,7 @@ TEST_F(DesktopNotificationsTest, TestUserInputEscaping) { GURL("http://www.google.com"), GURL("/icon.png"), ASCIIToUTF16("<script>window.alert('uh oh');</script>"), - ASCIIToUTF16("<i>this text is in italics</i>"), + ASCIIToUTF16("<i>this text is in italics</i>, as is %3ci%3ethis%3c/i%3e"), 0, 0, DesktopNotificationService::PageNotification, 1)); MessageLoopForUI::current()->RunAllPending(); @@ -290,4 +290,7 @@ TEST_F(DesktopNotificationsTest, TestUserInputEscaping) { GURL data_url = balloon->notification().content_url(); EXPECT_EQ(std::string::npos, data_url.spec().find("<script>")); EXPECT_EQ(std::string::npos, data_url.spec().find("<i>")); + // URL-encoded versions of tags should also not be found. + EXPECT_EQ(std::string::npos, data_url.spec().find("%3cscript%3e")); + EXPECT_EQ(std::string::npos, data_url.spec().find("%3ci%3e")); } |