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

Side by Side Diff: chrome/browser/extensions/api/debugger/debugger_api.cc

Issue 910053002: Validate debuggee.targetId before use in chrome.debugger (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments #6 Created 5 years, 10 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 | chrome/browser/extensions/api/debugger/debugger_apitest.cc » ('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 (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 // Implements the Chrome Extensions Debugger API. 5 // Implements the Chrome Extensions Debugger API.
6 6
7 #include "chrome/browser/extensions/api/debugger/debugger_api.h" 7 #include "chrome/browser/extensions/api/debugger/debugger_api.h"
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 extension_host->GetURL(), 522 extension_host->GetURL(),
523 extension(), 523 extension(),
524 &error_)) { 524 &error_)) {
525 return false; 525 return false;
526 } 526 }
527 agent_host_ = 527 agent_host_ =
528 DevToolsAgentHost::GetOrCreateFor(extension_host->host_contents()); 528 DevToolsAgentHost::GetOrCreateFor(extension_host->host_contents());
529 } 529 }
530 } else if (debuggee_.target_id) { 530 } else if (debuggee_.target_id) {
531 agent_host_ = DevToolsAgentHost::GetForId(*debuggee_.target_id); 531 agent_host_ = DevToolsAgentHost::GetForId(*debuggee_.target_id);
532 if (agent_host_.get()) {
533 if (PermissionsData::IsRestrictedUrl(agent_host_->GetURL(),
534 agent_host_->GetURL(),
535 extension(),
536 &error_)) {
537 agent_host_ = nullptr;
538 return false;
539 }
540 }
532 } else { 541 } else {
533 error_ = keys::kInvalidTargetError; 542 error_ = keys::kInvalidTargetError;
534 return false; 543 return false;
535 } 544 }
536 545
537 if (!agent_host_.get()) { 546 if (!agent_host_.get()) {
538 FormatErrorMessage(keys::kNoTargetError); 547 FormatErrorMessage(keys::kNoTargetError);
539 return false; 548 return false;
540 } 549 }
541 return true; 550 return true;
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 const std::vector<DevToolsTargetImpl*>& target_list) { 743 const std::vector<DevToolsTargetImpl*>& target_list) {
735 scoped_ptr<base::ListValue> result(new base::ListValue()); 744 scoped_ptr<base::ListValue> result(new base::ListValue());
736 for (size_t i = 0; i < target_list.size(); ++i) 745 for (size_t i = 0; i < target_list.size(); ++i)
737 result->Append(SerializeTarget(*target_list[i])); 746 result->Append(SerializeTarget(*target_list[i]));
738 STLDeleteContainerPointers(target_list.begin(), target_list.end()); 747 STLDeleteContainerPointers(target_list.begin(), target_list.end());
739 SetResult(result.release()); 748 SetResult(result.release());
740 SendResponse(true); 749 SendResponse(true);
741 } 750 }
742 751
743 } // namespace extensions 752 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/debugger/debugger_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698