Index: Source/bindings/core/v8/V8ScriptRunner.cpp |
diff --git a/Source/bindings/core/v8/V8ScriptRunner.cpp b/Source/bindings/core/v8/V8ScriptRunner.cpp |
index e7d3fa1a89b20c2f24dfd4b0d08ebfbd463e98ec..36182aa62a12e896c6319ea2532a496a26d9fe8a 100644 |
--- a/Source/bindings/core/v8/V8ScriptRunner.cpp |
+++ b/Source/bindings/core/v8/V8ScriptRunner.cpp |
@@ -359,7 +359,15 @@ PassOwnPtr<CompileFn> selectCompileFunction(ScriptResource* resource, ScriptStre |
v8::Local<v8::Script> V8ScriptRunner::compileScript(const ScriptSourceCode& source, v8::Isolate* isolate, AccessControlStatus corsStatus, V8CacheOptions cacheOptions) |
{ |
- return compileScript(v8String(isolate, source.source()), source.url(), source.startPosition(), isolate, source.resource(), source.streamer(), source.resource() ? source.resource()->cacheHandler() : nullptr, corsStatus, cacheOptions); |
+ v8::Handle<v8::String> sourceAsV8String(v8String(isolate, source.source())); |
+ if (sourceAsV8String.IsEmpty()) { |
+ // String conversion fails when the source size exceeds the V8 string |
+ // length of (currently) 256MB. |
+ V8ThrowException::throwGeneralError(isolate, "JavaScript source exceeds maximum string length."); |
vogelheim
2015/03/06 17:07:52
Does this even make any sense?
When I reproduce t
marja
2015/03/06 18:10:10
Hmm, there is some mechanism so that we get a cons
haraken
2015/03/07 04:17:15
A short answer is that I don't think this check ma
vogelheim
2015/03/09 17:36:52
Good plan, and with a detour it led to a solution:
vogelheim
2015/03/09 17:36:52
I disagree (on that part), and/or there's a misund
|
+ return v8::Local<v8::Script>(); |
+ } |
+ |
+ return compileScript(sourceAsV8String, source.url(), source.startPosition(), isolate, source.resource(), source.streamer(), source.resource() ? source.resource()->cacheHandler() : nullptr, corsStatus, cacheOptions); |
} |
v8::Local<v8::Script> V8ScriptRunner::compileScript(v8::Handle<v8::String> code, const String& fileName, const TextPosition& scriptStartPosition, v8::Isolate* isolate, ScriptResource* resource, ScriptStreamer* streamer, CachedMetadataHandler* cacheHandler, AccessControlStatus corsStatus, V8CacheOptions cacheOptions, bool isInternalScript) |