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

Side by Side Diff: extensions/common/manifest_handlers/oauth2_manifest_handler.cc

Issue 832333008: Add a CHECK to investigate crash in OAuth2ManifestHandler::Parse (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "extensions/common/manifest_handlers/oauth2_manifest_handler.h" 5 #include "extensions/common/manifest_handlers/oauth2_manifest_handler.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 bool OAuth2ManifestHandler::Parse(Extension* extension, 47 bool OAuth2ManifestHandler::Parse(Extension* extension,
48 base::string16* error) { 48 base::string16* error) {
49 scoped_ptr<OAuth2Info> info(new OAuth2Info); 49 scoped_ptr<OAuth2Info> info(new OAuth2Info);
50 const base::DictionaryValue* dict = NULL; 50 const base::DictionaryValue* dict = NULL;
51 if (!extension->manifest()->GetDictionary(keys::kOAuth2, &dict)) { 51 if (!extension->manifest()->GetDictionary(keys::kOAuth2, &dict)) {
52 *error = base::ASCIIToUTF16(errors::kInvalidOAuth2ClientId); 52 *error = base::ASCIIToUTF16(errors::kInvalidOAuth2ClientId);
53 return false; 53 return false;
54 } 54 }
55 55
56 // This should not be possible, but it looks like the source of the crash in
57 // http://crbug.com/445683. Perhaps something is overwriting the stack.
58 CHECK(info);
59
56 // HasPath checks for whether the manifest is allowed to have 60 // HasPath checks for whether the manifest is allowed to have
57 // oauth2.auto_approve based on whitelist, and if it is present. 61 // oauth2.auto_approve based on whitelist, and if it is present.
58 // GetBoolean reads the value of auto_approve directly from dict to prevent 62 // GetBoolean reads the value of auto_approve directly from dict to prevent
59 // duplicate checking. 63 // duplicate checking.
60 if (extension->manifest()->HasPath(keys::kOAuth2AutoApprove) && 64 if (extension->manifest()->HasPath(keys::kOAuth2AutoApprove) &&
61 !dict->GetBoolean(kAutoApprove, &info->auto_approve)) { 65 !dict->GetBoolean(kAutoApprove, &info->auto_approve)) {
62 *error = base::ASCIIToUTF16(errors::kInvalidOAuth2AutoApprove); 66 *error = base::ASCIIToUTF16(errors::kInvalidOAuth2AutoApprove);
63 return false; 67 return false;
64 } 68 }
65 69
(...skipping 23 matching lines...) Expand all
89 93
90 extension->SetManifestData(keys::kOAuth2, info.release()); 94 extension->SetManifestData(keys::kOAuth2, info.release());
91 return true; 95 return true;
92 } 96 }
93 97
94 const std::vector<std::string> OAuth2ManifestHandler::Keys() const { 98 const std::vector<std::string> OAuth2ManifestHandler::Keys() const {
95 return SingleKey(keys::kOAuth2); 99 return SingleKey(keys::kOAuth2);
96 } 100 }
97 101
98 } // namespace extensions 102 } // namespace extensions
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