diff options
author | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-17 17:38:25 +0000 |
---|---|---|
committer | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-17 17:38:25 +0000 |
commit | d1195cf8c0f9ac9bbb18293da8f081e3eafff37c (patch) | |
tree | 30ebeb0530a9dc9bacfb3a49a908dfb065c80daf | |
parent | 559ce8549ece8ab6d08407a50842aad1945b2515 (diff) | |
download | chromium_src-d1195cf8c0f9ac9bbb18293da8f081e3eafff37c.zip chromium_src-d1195cf8c0f9ac9bbb18293da8f081e3eafff37c.tar.gz chromium_src-d1195cf8c0f9ac9bbb18293da8f081e3eafff37c.tar.bz2 |
Fixes bug where favicons wouldn't always show up in history page. This
would happen for an URLs that contained parens. These need to be
escaped when using in CSS.
BUG=none
TEST=Go to a page that has parens in it (such as
http://en.wikipedia.org/wiki/The_Wire_(season_5) ). Then open up
history and make sure you get a favicon for the site.
Review URL: http://codereview.chromium.org/48043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11876 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/resources/history.html | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/chrome/browser/resources/history.html b/chrome/browser/resources/history.html index c952fe8..73a2946 100644 --- a/chrome/browser/resources/history.html +++ b/chrome/browser/resources/history.html @@ -21,6 +21,12 @@ function createElementWithClassName(type, className) { return elm; } +// Escapes a URI as appropriate for CSS. +function encodeURIForCSS(uri) { + // CSS uris need to have '(' and ')' escaped. + return uri.replace(/\(/g, "\\(").replace(/\)/g, "\\)"); +} + // TODO(glen): Get rid of these global references, replace with a controller // or just make the classes own more of the page. var historyModel; @@ -157,7 +163,8 @@ Page.prototype.getTitleDOM_ = function() { node.className = 'title'; var link = document.createElement('a'); link.href = this.url_; - link.style.backgroundImage = 'url(chrome-ui://favicon/' + this.url_ + ')'; + link.style.backgroundImage = + 'url(chrome-ui://favicon/' + encodeURIForCSS(this.url_) + ')'; link.appendChild(document.createTextNode(this.title_)); this.highlightNodeContent_(link); |