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

Side by Side Diff: chrome/browser/extensions/extension_service.cc

Issue 7981002: Fix crash by preventing extensions from changing their IDs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update comment Created 9 years, 2 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 | chrome/common/extensions/extension_constants.h » ('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) 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 #include "chrome/browser/extensions/extension_service.h" 5 #include "chrome/browser/extensions/extension_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after
1421 extension = Extension::Create( 1421 extension = Extension::Create(
1422 info.extension_path, 1422 info.extension_path,
1423 info.extension_location, 1423 info.extension_location,
1424 *info.extension_manifest, 1424 *info.extension_manifest,
1425 flags, 1425 flags,
1426 &error); 1426 &error);
1427 } else { 1427 } else {
1428 error = errors::kManifestUnreadable; 1428 error = errors::kManifestUnreadable;
1429 } 1429 }
1430 1430
1431 // Once installed, non-unpacked extensions cannot change their IDs (e.g., by
1432 // updating the 'key' field in their manifest).
1433 if (extension &&
1434 extension->location() != Extension::LOAD &&
1435 info.extension_id != extension->id()) {
1436 error = errors::kCannotChangeExtensionID;
1437 extension = NULL;
asargent_no_longer_on_chrome 2011/09/26 22:08:04 It might be good to include a uma histogram here,
jstritar 2011/09/26 22:11:03 Agreed. Do you think we should add a one off histo
1438 }
1439
1431 if (!extension) { 1440 if (!extension) {
1432 ReportExtensionLoadError(info.extension_path, 1441 ReportExtensionLoadError(info.extension_path,
1433 error, 1442 error,
1434 chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, 1443 chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR,
1435 false); 1444 false);
1436 return; 1445 return;
1437 } 1446 }
1438 1447
1439 if (write_to_prefs) 1448 if (write_to_prefs)
1440 extension_prefs_->UpdateManifest(extension); 1449 extension_prefs_->UpdateManifest(extension);
(...skipping 1450 matching lines...) Expand 10 before | Expand all | Expand 10 after
2891 2900
2892 ExtensionService::NaClModuleInfoList::iterator 2901 ExtensionService::NaClModuleInfoList::iterator
2893 ExtensionService::FindNaClModule(const GURL& url) { 2902 ExtensionService::FindNaClModule(const GURL& url) {
2894 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); 2903 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin();
2895 iter != nacl_module_list_.end(); ++iter) { 2904 iter != nacl_module_list_.end(); ++iter) {
2896 if (iter->url == url) 2905 if (iter->url == url)
2897 return iter; 2906 return iter;
2898 } 2907 }
2899 return nacl_module_list_.end(); 2908 return nacl_module_list_.end();
2900 } 2909 }
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/extension_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698