Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1281)

Side by Side Diff: chrome/test/data/extensions/subscribe_page_action/subscribe.js

Issue 10407017: Convert RSS extension to use manifest version 2 (with CSP protection). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/data/extensions/subscribe_page_action/subscribe.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Grab the querystring, removing question mark at the front and splitting on 5 // Grab the querystring, removing question mark at the front and splitting on
6 // the ampersand. 6 // the ampersand.
7 var queryString = location.search.substring(1).split("&"); 7 var queryString = location.search.substring(1).split("&");
8 8
9 // The feed URL is the first component and always present. 9 // The feed URL is the first component and always present.
10 var feedUrl = decodeURIComponent(queryString[0]); 10 var feedUrl = decodeURIComponent(queryString[0]);
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 // The tests always expect an IFRAME, so add one showing the error. 137 // The tests always expect an IFRAME, so add one showing the error.
138 var html = "<body><span id=\"error\" class=\"item_desc\">" + error + 138 var html = "<body><span id=\"error\" class=\"item_desc\">" + error +
139 "</span></body>"; 139 "</span></body>";
140 140
141 var error_frame = createFrame('error', html); 141 var error_frame = createFrame('error', html);
142 var itemsTag = document.getElementById('items'); 142 var itemsTag = document.getElementById('items');
143 itemsTag.appendChild(error_frame); 143 itemsTag.appendChild(error_frame);
144 } 144 }
145 145
146 function createFrame(frame_id, html) { 146 function createFrame(frame_id, html) {
147 var csp = '<meta http-equiv="content-security-policy" ' +
148 'value="script-src \'self\';">';
abarth-chromium 2012/05/17 17:02:34 Can you add an object-src directive here? Assumin
Finnur 2012/05/17 19:20:37 Added. I'm not using any plugins (that I know of)
147 frame = document.createElement('iframe'); 149 frame = document.createElement('iframe');
148 frame.id = frame_id; 150 frame.id = frame_id;
149 frame.src = "data:text/html;charset=utf-8,<html>" + styleSheet + html + 151 frame.src = "data:text/html;charset=utf-8,<html>" + csp + styleSheet + html +
150 "</html>"; 152 "</html>";
151 frame.scrolling = "auto"; 153 frame.scrolling = "auto";
152 frame.frameBorder = "0"; 154 frame.frameBorder = "0";
153 frame.marginWidth = "0"; 155 frame.marginWidth = "0";
154 return frame; 156 return frame;
155 } 157 }
156 158
157 function embedAsIframe(rssText) { 159 function embedAsIframe(rssText) {
158 var itemsTag = document.getElementById('items'); 160 var itemsTag = document.getElementById('items');
159 161
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 function onSelectChanged() { 217 function onSelectChanged() {
216 if (!storageEnabled) 218 if (!storageEnabled)
217 return; 219 return;
218 var readerDropdown = document.getElementById('readerDropdown'); 220 var readerDropdown = document.getElementById('readerDropdown');
219 221
220 // If the last item (Manage...) was selected we show the options. 222 // If the last item (Manage...) was selected we show the options.
221 var oldSelection = readerDropdown.selectedIndex; 223 var oldSelection = readerDropdown.selectedIndex;
222 if (readerDropdown.selectedIndex == readerDropdown.length - 1) 224 if (readerDropdown.selectedIndex == readerDropdown.length - 1)
223 window.location = "options.html"; 225 window.location = "options.html";
224 } 226 }
227
228 document.addEventListener('DOMContentLoaded', function () {
229 document.title =
230 chrome.i18n.getMessage("rss_subscription_default_title");
231 i18nReplace('rss_subscription_subscribe_using');
232 i18nReplace('rss_subscription_subscribe_button');
233 i18nReplace('rss_subscription_always_use');
234 i18nReplace('rss_subscription_feed_preview');
235 i18nReplaceImpl('feedUrl', 'rss_subscription_feed_link', '');
236
237 var dropdown = document.getElementById('readerDropdown');
238 dropdown.addEventListener('change', onSelectChanged);
239 var button = document.getElementById('rss_subscription_subscribe_button');
240 button.addEventListener('click', navigate);
241
242 main();
243 });
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/subscribe_page_action/subscribe.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698