diff options
author | arv@google.com <arv@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-01 20:22:09 +0000 |
---|---|---|
committer | arv@google.com <arv@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-01 20:22:09 +0000 |
commit | 681a74c19def5d7a48a2633ecd497f3aca8c3cb7 (patch) | |
tree | c109fc55c4a3384ca42fcb4eb189e8567cfdfb30 | |
parent | d2b23c9de93d3963d751c493dba2582b13771abf (diff) | |
download | chromium_src-681a74c19def5d7a48a2633ecd497f3aca8c3cb7.zip chromium_src-681a74c19def5d7a48a2633ecd497f3aca8c3cb7.tar.gz chromium_src-681a74c19def5d7a48a2633ecd497f3aca8c3cb7.tar.bz2 |
Escape the URL for the CSS url function.
This fixes issues where the thumbnail on the NTP wasn't showing.
BUG=18380
TEST=Make sure that the following pages show thumbnails on the new tab
page:
http://digg.com/?\
http://code.google.com/p/chromium/issues/list?can=2&q=&sort=-id&colspec=ID+Stars+Pri+Area+Type+Status+Summary+Modified+Owner
http://code.google.com/p/chromium/issues/list?can=2&q=&sort=-id&colspec=ID%20Stars%20Pri%20Area%20Type%20Status%20Summary%20Modified%20Owner
Review URL: http://codereview.chromium.org/178061
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25081 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/resources/new_new_tab.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/chrome/browser/resources/new_new_tab.js b/chrome/browser/resources/new_new_tab.js index af789d8..184b776 100644 --- a/chrome/browser/resources/new_new_tab.js +++ b/chrome/browser/resources/new_new_tab.js @@ -206,7 +206,17 @@ function getThumbnailClassName(data) { } function url(s) { - return 'url("' + encodeURI(s) + '")'; + // http://www.w3.org/TR/css3-values/#uris + // Parentheses, commas, whitespace characters, single quotes (') and double + // quotes (") appearing in a URI must be escaped with a backslash + var s2 = s.replace(/(\(|\)|\,|\s|\'|\"|\\)/g, '\\$1'); + // WebKit has a bug when it comes to URLs that end with \ + // https://bugs.webkit.org/show_bug.cgi?id=28885 + if (/\\\\$/.test(s2)) { + // Add a space to work around the WebKit bug. + s2 += ' '; + } + return 'url("' + s2 + '")'; } function renderMostVisited(data) { |