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

Side by Side Diff: chrome/browser/devtools/devtools_ui_bindings.cc

Issue 1586903002: [DevTools] Whitelist remoteBase and loadNetworkResource schemes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/Runtime.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "chrome/browser/devtools/devtools_ui_bindings.h" 5 #include "chrome/browser/devtools/devtools_ui_bindings.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 entry->SetTitle( 645 entry->SetTitle(
646 base::UTF8ToUTF16(base::StringPrintf(kTitleFormat, url.c_str()))); 646 base::UTF8ToUTF16(base::StringPrintf(kTitleFormat, url.c_str())));
647 web_contents()->NotifyNavigationStateChanged(content::INVALIDATE_TYPE_TITLE); 647 web_contents()->NotifyNavigationStateChanged(content::INVALIDATE_TYPE_TITLE);
648 } 648 }
649 649
650 void DevToolsUIBindings::LoadNetworkResource(const DispatchCallback& callback, 650 void DevToolsUIBindings::LoadNetworkResource(const DispatchCallback& callback,
651 const std::string& url, 651 const std::string& url,
652 const std::string& headers, 652 const std::string& headers,
653 int stream_id) { 653 int stream_id) {
654 GURL gurl(url); 654 GURL gurl(url);
655 if (!gurl.is_valid()) { 655 bool schemeIsAllowed = gurl.is_valid() &&
656 (gurl.SchemeIs(url::kHttpScheme) || gurl.SchemeIs(url::kHttpsScheme) ||
657 gurl.SchemeIs(url::kDataScheme) || gurl.SchemeIs(url::kFtpScheme));
658 if (!gurl.is_valid() || !schemeIsAllowed) {
656 base::DictionaryValue response; 659 base::DictionaryValue response;
657 response.SetInteger("statusCode", 404); 660 response.SetInteger("statusCode", 404);
658 callback.Run(&response); 661 callback.Run(&response);
659 return; 662 return;
660 } 663 }
661 664
662 net::URLFetcher* fetcher = 665 net::URLFetcher* fetcher =
663 net::URLFetcher::Create(gurl, net::URLFetcher::GET, this).release(); 666 net::URLFetcher::Create(gurl, net::URLFetcher::GET, this).release();
664 pending_requests_[fetcher] = callback; 667 pending_requests_[fetcher] = callback;
665 fetcher->SetRequestContext(profile_->GetRequestContext()); 668 fetcher->SetRequestContext(profile_->GetRequestContext());
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 return; 1223 return;
1221 frontend_loaded_ = true; 1224 frontend_loaded_ = true;
1222 1225
1223 // Call delegate first - it seeds importants bit of information. 1226 // Call delegate first - it seeds importants bit of information.
1224 delegate_->OnLoadCompleted(); 1227 delegate_->OnLoadCompleted();
1225 1228
1226 AddDevToolsExtensionsToClient(); 1229 AddDevToolsExtensionsToClient();
1227 if (g_web_socket_api_channel) 1230 if (g_web_socket_api_channel)
1228 g_web_socket_api_channel->AttachedToBindings(this); 1231 g_web_socket_api_channel->AttachedToBindings(this);
1229 } 1232 }
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/Runtime.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698