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

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

Issue 6332008: The RSS subscribe.js should not double-decoded the URL passed in.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 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
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]);
Finnur 2011/01/20 14:56:46 We already decode the feedUrl here, which is why w
11 11
12 // We allow synchronous requests for testing. This component is only present 12 // We allow synchronous requests for testing. This component is only present
13 // if true. 13 // if true.
14 var synchronousRequest = queryString[1] == "synchronous"; 14 var synchronousRequest = queryString[1] == "synchronous";
15 15
16 // The XMLHttpRequest object that tries to load and parse the feed, and (if 16 // The XMLHttpRequest object that tries to load and parse the feed, and (if
17 // testing) also the style sheet and the frame js. 17 // testing) also the style sheet and the frame js.
18 var req; 18 var req;
19 19
20 // Depending on whether this is run from a test or from the extension, this 20 // Depending on whether this is run from a test or from the extension, this
(...skipping 11 matching lines...) Expand all
32 32
33 // A list of feed readers, populated by localStorage if available, otherwise 33 // A list of feed readers, populated by localStorage if available, otherwise
34 // hard coded. 34 // hard coded.
35 var feedReaderList; 35 var feedReaderList;
36 36
37 // Navigates to the reader of the user's choice (for subscribing to the feed). 37 // Navigates to the reader of the user's choice (for subscribing to the feed).
38 function navigate() { 38 function navigate() {
39 var select = document.getElementById('readerDropdown'); 39 var select = document.getElementById('readerDropdown');
40 var url = 40 var url =
41 feedReaderList[select.selectedIndex].url.replace( 41 feedReaderList[select.selectedIndex].url.replace(
42 "%s", escape(encodeURI(feedUrl))); 42 "%s", escape(feedUrl));
Aaron Boodman 2011/01/20 17:47:15 escape and encodeURI do subtlety different things.
43 43
44 // Before we navigate, see if we want to skip this step in the future... 44 // Before we navigate, see if we want to skip this step in the future...
45 if (storageEnabled) { 45 if (storageEnabled) {
46 // See if the user wants to always use this reader. 46 // See if the user wants to always use this reader.
47 var alwaysUse = document.getElementById('alwaysUse'); 47 var alwaysUse = document.getElementById('alwaysUse');
48 if (alwaysUse.checked) { 48 if (alwaysUse.checked) {
49 window.localStorage.defaultReader = 49 window.localStorage.defaultReader =
50 feedReaderList[select.selectedIndex].url; 50 feedReaderList[select.selectedIndex].url;
51 window.localStorage.showPreviewPage = "No"; 51 window.localStorage.showPreviewPage = "No";
52 } 52 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 frameScript = "<script>" + req.responseText + 98 frameScript = "<script>" + req.responseText +
99 "<" + "/script>"; 99 "<" + "/script>";
100 } else { 100 } else {
101 // Normal loading just requires links to the css and the js file. 101 // Normal loading just requires links to the css and the js file.
102 styleSheet = "<link rel='stylesheet' type='text/css' href='" + 102 styleSheet = "<link rel='stylesheet' type='text/css' href='" +
103 chrome.extension.getURL("style.css") + "'>"; 103 chrome.extension.getURL("style.css") + "'>";
104 frameScript = "<script src='" + chrome.extension.getURL("iframe.js") + 104 frameScript = "<script src='" + chrome.extension.getURL("iframe.js") +
105 "'></" + "script>"; 105 "'></" + "script>";
106 } 106 }
107 107
108 feedUrl = decodeURIComponent(feedUrl);
109 req.onload = handleResponse; 108 req.onload = handleResponse;
110 req.onerror = handleError; 109 req.onerror = handleError;
111 // Not everyone sets the mime type correctly, which causes handleResponse 110 // Not everyone sets the mime type correctly, which causes handleResponse
112 // to fail to XML parse the response text from the server. By forcing 111 // to fail to XML parse the response text from the server. By forcing
113 // it to text/xml we avoid this. 112 // it to text/xml we avoid this.
114 req.overrideMimeType('text/xml'); 113 req.overrideMimeType('text/xml');
115 req.open("GET", feedUrl, !synchronousRequest); 114 req.open("GET", feedUrl, !synchronousRequest);
116 req.send(null); 115 req.send(null);
117 116
118 document.getElementById('feedUrl').href = 'view-source:' + feedUrl; 117 document.getElementById('feedUrl').href = 'view-source:' + feedUrl;
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 function onSelectChanged() { 215 function onSelectChanged() {
217 if (!storageEnabled) 216 if (!storageEnabled)
218 return; 217 return;
219 var readerDropdown = document.getElementById('readerDropdown'); 218 var readerDropdown = document.getElementById('readerDropdown');
220 219
221 // If the last item (Manage...) was selected we show the options. 220 // If the last item (Manage...) was selected we show the options.
222 var oldSelection = readerDropdown.selectedIndex; 221 var oldSelection = readerDropdown.selectedIndex;
223 if (readerDropdown.selectedIndex == readerDropdown.length - 1) 222 if (readerDropdown.selectedIndex == readerDropdown.length - 1)
224 window.location = "options.html"; 223 window.location = "options.html";
225 } 224 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_browsertests_misc.cc ('k') | chrome/test/data/feeds/url_decoding.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698