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

Unified Diff: chrome/browser/extensions/extension_creator.cc

Issue 398001: Add validation to extension packaging. (Closed)
Patch Set: Created 11 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/extensions_service_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_creator.cc
diff --git a/chrome/browser/extensions/extension_creator.cc b/chrome/browser/extensions/extension_creator.cc
index 37f40b81b6ca5ed36461a6166719088ed5681e2b..9b8f31e6bbc9b6a38b3e7a25a2aee9971a2562a1 100644
--- a/chrome/browser/extensions/extension_creator.cc
+++ b/chrome/browser/extensions/extension_creator.cc
@@ -13,6 +13,7 @@
#include "base/scoped_handle.h"
#include "base/scoped_temp_dir.h"
#include "base/string_util.h"
+#include "chrome/browser/extensions/extension_file_util.h"
#include "chrome/browser/extensions/sandboxed_extension_unpacker.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/zip.h"
@@ -50,6 +51,15 @@ bool ExtensionCreator::InitializeInput(
return false;
}
+ // Load the extension once. We don't really need it, but this does a lot of
+ // useful validation of the structure.
+ scoped_ptr<Extension> extension(
+ extension_file_util::LoadExtension(extension_dir,
+ false, // key not required
+ &error_message_));
+ if (!extension.get())
+ return false; // LoadExtension already set error_message_.
+
return true;
}
« no previous file with comments | « no previous file | chrome/browser/extensions/extensions_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698