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

Side by Side Diff: chrome/test/data/extensions/api_test/cross_origin_xhr/content_script/test.js

Issue 2775763002: Block 'ftp:' subresource requests from non-'ftp:' pages. (Closed)
Patch Set: Rebaseline. Created 3 years, 9 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // Tab where the content script has been injected. 5 // Tab where the content script has been injected.
6 var testTabId; 6 var testTabId;
7 7
8 chrome.test.getConfig(function(config) { 8 chrome.test.getConfig(function(config) {
9 9
10 function rewriteURL(url) { 10 function rewriteURL(url) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // TODO(asargent): Explicitly create SSL test server and enable the test. 63 // TODO(asargent): Explicitly create SSL test server and enable the test.
64 // function disallowedSSL() { 64 // function disallowedSSL() {
65 // doReq('https://a.com', false); 65 // doReq('https://a.com', false);
66 // }, 66 // },
67 function targetPageAlwaysAllowed() { 67 function targetPageAlwaysAllowed() {
68 // Even though localhost does not show up in the host permissions, we 68 // Even though localhost does not show up in the host permissions, we
69 // can still make requests to it since it's the page that the content 69 // can still make requests to it since it's the page that the content
70 // script is injected into. 70 // script is injected into.
71 doReq('http://localhost', true); 71 doReq('http://localhost', true);
72 }, 72 },
73 function allowedFtpHostAllowed() { 73 function allowedFtpHostDisllowed() {
74 doReq('ftp://127.0.0.1', true); 74 doReq('ftp://127.0.0.1', false);
75 }, 75 },
76 function disallowedFtpHostDisallowed() { 76 function disallowedFtpHostDisallowed() {
77 // The host is the same as the current page, but the scheme differs. 77 // The host is the same as the current page, but the scheme differs.
78 // The origin is not whitelisted, so the same origin policy must kick in 78 // The origin is not whitelisted, so the same origin policy must kick in
79 // and block the request. 79 // and block the request.
80 doReq('ftp://localhost', false); 80 doReq('ftp://localhost', false);
81 } 81 }
82 ]); 82 ]);
83 }); 83 });
84 }); 84 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698