summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authorskerner@chromium.org <skerner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-30 05:57:37 +0000
committerskerner@chromium.org <skerner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-30 05:57:37 +0000
commitcadb40bdf4335ee89371b09a754cbf1197c68f73 (patch)
tree231b6cbf99d5d38d22fc4fe0ead53f484ef1cf7a /chrome/common
parent6a1d0f520bbbad446501a1cfd94e7451671f2633 (diff)
downloadchromium_src-cadb40bdf4335ee89371b09a754cbf1197c68f73.zip
chromium_src-cadb40bdf4335ee89371b09a754cbf1197c68f73.tar.gz
chromium_src-cadb40bdf4335ee89371b09a754cbf1197c68f73.tar.bz2
Loosen permission on extension temp dir when a flag is used.
Issue 35198 can not be reproduced locally. To enable users to do experiments, three command line flags are added to chrome: --issue35198-crxdir-browser: Have the browser process create the directory in which the extension will be unzipped. --issue35198-logging: Enable log messages from directory creation in the utility process to be moved to the browser process. --issue35198-permission: Use the most permissive file permissions possible on the extension unpack directory. BUG=35198 TEST=manual Review URL: http://codereview.chromium.org/2802018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51231 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/chrome_switches.cc7
-rw-r--r--chrome/common/chrome_switches.h3
-rw-r--r--chrome/common/extensions/extension_unpacker.cc17
3 files changed, 25 insertions, 2 deletions
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index e77bee5..cb1ec25 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -528,6 +528,13 @@ const char kInternalNaCl[] = "internal-nacl";
// Runs a trusted Pepper plugin inside the renderer process.
const char kInternalPepper[] = "internal-pepper";
+// The following flags allow users who can reproduce crbug/35198
+// to enable extra logging and behaviors. They will be removed once
+// the issue is fixed.
+const char kIssue35198CrxDirBrowser[] = "issue35198-crxdir-browser";
+const char kIssue35198ExtraLogging[] = "issue35198-logging";
+const char kIssue35198Permission[] = "issue35198-permission";
+
// Specifies the flags passed to JS engine
const char kJavaScriptFlags[] = "js-flags";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index 2f43e5c..8f25ebd 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -160,6 +160,9 @@ extern const char kInstallerTestClean[];
extern const char kInstallerTestForce[];
extern const char kInternalNaCl[];
extern const char kInternalPepper[];
+extern const char kIssue35198CrxDirBrowser[];
+extern const char kIssue35198ExtraLogging[];
+extern const char kIssue35198Permission[];
extern const char kJavaScriptFlags[];
extern const char kLoadExtension[];
extern const char kLoadPlugin[];
diff --git a/chrome/common/extensions/extension_unpacker.cc b/chrome/common/extensions/extension_unpacker.cc
index 599aa11..64ff857 100644
--- a/chrome/common/extensions/extension_unpacker.cc
+++ b/chrome/common/extensions/extension_unpacker.cc
@@ -4,6 +4,7 @@
#include "chrome/common/extensions/extension_unpacker.h"
+#include "base/command_line.h"
#include "base/file_util.h"
#include "base/scoped_handle.h"
#include "base/scoped_temp_dir.h"
@@ -11,6 +12,7 @@
#include "base/thread.h"
#include "base/values.h"
#include "net/base/file_stream.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/common_param_traits.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_constants.h"
@@ -142,12 +144,23 @@ bool ExtensionUnpacker::Run() {
extension_path_.DirName().AppendASCII(filenames::kTempExtensionName);
#if defined(OS_WIN)
+ // To understand crbug/35198, allow users who can reproduce the issue
+ // to enable extra logging while unpacking.
+ bool extra_logging = CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kIssue35198ExtraLogging);
+ LOG(INFO) << "Extra logging for issue 35198: " << extra_logging;
+
std::ostringstream log_stream;
std::string dir_string = WideToUTF8(temp_install_dir_.value());
log_stream << kCouldNotCreateDirectoryError << dir_string << std::endl;
+
if (!file_util::CreateDirectoryExtraLogging(temp_install_dir_, log_stream)) {
- log_stream.flush();
- SetError(log_stream.str());
+ if (extra_logging) {
+ log_stream.flush();
+ SetError(log_stream.str());
+ } else {
+ SetError(kCouldNotCreateDirectoryError + dir_string);
+ }
return false;
}
#else