summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorerikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-20 17:41:21 +0000
committererikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-20 17:41:21 +0000
commita15019678ab608953c47fd59cdc883b13e179e22 (patch)
treead4bff1cfbf1c85b3551f4dfb36e30ddbaf21f11 /chrome
parent7dc8d79bc15a895f02aa720dc6aa5af190adc678 (diff)
downloadchromium_src-a15019678ab608953c47fd59cdc883b13e179e22.zip
chromium_src-a15019678ab608953c47fd59cdc883b13e179e22.tar.gz
chromium_src-a15019678ab608953c47fd59cdc883b13e179e22.tar.bz2
fix url handling to only allow http and https URLs
BUG=none TEST=none Review URL: http://codereview.chromium.org/418011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32622 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/common/extensions/docs/examples/extensions/news/feed.html13
1 files changed, 11 insertions, 2 deletions
diff --git a/chrome/common/extensions/docs/examples/extensions/news/feed.html b/chrome/common/extensions/docs/examples/extensions/news/feed.html
index 92f14f2..0fd455d 100644
--- a/chrome/common/extensions/docs/examples/extensions/news/feed.html
+++ b/chrome/common/extensions/docs/examples/extensions/news/feed.html
@@ -241,8 +241,17 @@ function buildPreview(doc) {
}
}
+// Show |url| in a new tab.
+function showUrl(url) {
+ // Only allow http and https URLs.
+ if (url.indexOf("http:") != 0 && url.indexOf("https:") != 0) {
+ return;
+ }
+ chrome.tabs.create({url: url});
+}
+
function moreStories(event) {
- chrome.tabs.create({url: moreStoriesUrl});
+ showUrl(moreStoriesUrl);
}
function showDesc(event) {
@@ -283,7 +292,7 @@ function iframeMessageHandler(e) {
url = url.substring(0, index);
}
}
- chrome.tabs.create({url:url});
+ showUrl(url);
}
}
return;