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

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

Issue 471363003: overrideMimeType should be called after open to be spec compliant (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | « no previous file | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 } else { 120 } else {
121 // Normal loading just requires links to the css and the js file. 121 // Normal loading just requires links to the css and the js file.
122 styleSheet = "<link rel='stylesheet' type='text/css' href='" + 122 styleSheet = "<link rel='stylesheet' type='text/css' href='" +
123 chrome.extension.getURL("style.css") + "'>"; 123 chrome.extension.getURL("style.css") + "'>";
124 frameScript = "<script src='" + chrome.extension.getURL("iframe.js") + 124 frameScript = "<script src='" + chrome.extension.getURL("iframe.js") +
125 "'></" + "script>"; 125 "'></" + "script>";
126 } 126 }
127 127
128 req.onload = handleResponse; 128 req.onload = handleResponse;
129 req.onerror = handleError; 129 req.onerror = handleError;
130 req.open("GET", feedUrl, !synchronousRequest);
130 // Not everyone sets the mime type correctly, which causes handleResponse 131 // Not everyone sets the mime type correctly, which causes handleResponse
131 // to fail to XML parse the response text from the server. By forcing 132 // to fail to XML parse the response text from the server. By forcing
132 // it to text/xml we avoid this. 133 // it to text/xml we avoid this.
133 req.overrideMimeType('text/xml'); 134 req.overrideMimeType('text/xml');
134 req.open("GET", feedUrl, !synchronousRequest);
135 req.send(null); 135 req.send(null);
136 136
137 document.getElementById('feedUrl').href = 'view-source:' + feedUrl; 137 document.getElementById('feedUrl').href = 'view-source:' + feedUrl;
138 } 138 }
139 139
140 // Sets the title for the feed. 140 // Sets the title for the feed.
141 function setFeedTitle(title) { 141 function setFeedTitle(title) {
142 var titleTag = document.getElementById('title'); 142 var titleTag = document.getElementById('title');
143 titleTag.textContent = 143 titleTag.textContent =
144 chrome.i18n.getMessage("rss_subscription_feed_for", title); 144 chrome.i18n.getMessage("rss_subscription_feed_for", title);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 var button = document.getElementById('rss_subscription_subscribe_button'); 256 var button = document.getElementById('rss_subscription_subscribe_button');
257 button.addEventListener('click', navigate); 257 button.addEventListener('click', navigate);
258 258
259 main(); 259 main();
260 }); 260 });
261 261
262 window.addEventListener("message", function(e) { 262 window.addEventListener("message", function(e) {
263 if (e.ports[0] && e.data === token) 263 if (e.ports[0] && e.data === token)
264 e.ports[0].postMessage(req.responseText); 264 e.ports[0].postMessage(req.responseText);
265 }, false); 265 }, false);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698