Index: gin/isolate_holder.cc |
diff --git a/gin/isolate_holder.cc b/gin/isolate_holder.cc |
index 3bda7f5738da93c7bf03c159cb941a342e77ac31..805ab27482395b6e6b3f63368b03ed6dc1f6139b 100644 |
--- a/gin/isolate_holder.cc |
+++ b/gin/isolate_holder.cc |
@@ -24,8 +24,8 @@ bool GenerateEntropy(unsigned char* buffer, size_t amount) { |
return true; |
} |
- |
-void EnsureV8Initialized(bool gin_managed) { |
+void EnsureV8Initialized(gin::IsolateHolder::ScriptMode mode, |
+ bool gin_managed) { |
static bool v8_is_initialized = false; |
static bool v8_is_gin_managed = false; |
if (v8_is_initialized) { |
@@ -39,17 +39,20 @@ void EnsureV8Initialized(bool gin_managed) { |
v8::V8::InitializePlatform(V8Platform::Get()); |
v8::V8::SetArrayBufferAllocator(ArrayBufferAllocator::SharedInstance()); |
- static const char v8_flags[] = "--use_strict --harmony"; |
- v8::V8::SetFlagsFromString(v8_flags, sizeof(v8_flags) - 1); |
+ if (mode == gin::IsolateHolder::kStrictMode) { |
+ // TODO(jochen): drop --harmony. it's really too unstable and broad to use. |
+ static const char v8_flags[] = "--use_strict --harmony"; |
+ v8::V8::SetFlagsFromString(v8_flags, sizeof(v8_flags) - 1); |
+ } |
v8::V8::SetEntropySource(&GenerateEntropy); |
v8::V8::Initialize(); |
} |
} // namespace |
-IsolateHolder::IsolateHolder() |
+IsolateHolder::IsolateHolder(ScriptMode mode) |
: isolate_owner_(true) { |
- EnsureV8Initialized(true); |
+ EnsureV8Initialized(mode, true); |
isolate_ = v8::Isolate::New(); |
v8::ResourceConstraints constraints; |
constraints.ConfigureDefaults(base::SysInfo::AmountOfPhysicalMemory(), |
@@ -61,7 +64,7 @@ IsolateHolder::IsolateHolder() |
IsolateHolder::IsolateHolder(v8::Isolate* isolate, |
v8::ArrayBuffer::Allocator* allocator) |
: isolate_owner_(false), isolate_(isolate) { |
- EnsureV8Initialized(false); |
+ EnsureV8Initialized(kNonStrictMode, false); |
Init(allocator); |
} |