OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
352 // Failed resources should never get this far. | 352 // Failed resources should never get this far. |
353 ASSERT(!resource->errorOccurred()); | 353 ASSERT(!resource->errorOccurred()); |
354 ASSERT(streamer->isFinished()); | 354 ASSERT(streamer->isFinished()); |
355 ASSERT(!streamer->streamingSuppressed()); | 355 ASSERT(!streamer->streamingSuppressed()); |
356 return WTF::bind<v8::Isolate*, v8::Handle<v8::String>, v8::ScriptOrigin>(pos tStreamCompile, resource->cacheHandler(), streamer); | 356 return WTF::bind<v8::Isolate*, v8::Handle<v8::String>, v8::ScriptOrigin>(pos tStreamCompile, resource->cacheHandler(), streamer); |
357 } | 357 } |
358 } // namespace | 358 } // namespace |
359 | 359 |
360 v8::Local<v8::Script> V8ScriptRunner::compileScript(const ScriptSourceCode& sour ce, v8::Isolate* isolate, AccessControlStatus corsStatus, V8CacheOptions cacheOp tions) | 360 v8::Local<v8::Script> V8ScriptRunner::compileScript(const ScriptSourceCode& sour ce, v8::Isolate* isolate, AccessControlStatus corsStatus, V8CacheOptions cacheOp tions) |
361 { | 361 { |
362 return compileScript(v8String(isolate, source.source()), source.url(), sourc e.startPosition(), isolate, source.resource(), source.streamer(), source.resourc e() ? source.resource()->cacheHandler() : nullptr, corsStatus, cacheOptions); | 362 v8::Handle<v8::String> sourceAsV8String(v8String(isolate, source.source())); |
363 if (sourceAsV8String.IsEmpty()) { | |
364 // String conversion fails when the source size exceeds the V8 string | |
365 // length of (currently) 256MB. | |
366 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
| |
367 return v8::Local<v8::Script>(); | |
368 } | |
369 | |
370 return compileScript(sourceAsV8String, source.url(), source.startPosition(), isolate, source.resource(), source.streamer(), source.resource() ? source.resou rce()->cacheHandler() : nullptr, corsStatus, cacheOptions); | |
363 } | 371 } |
364 | 372 |
365 v8::Local<v8::Script> V8ScriptRunner::compileScript(v8::Handle<v8::String> code, const String& fileName, const TextPosition& scriptStartPosition, v8::Isolate* i solate, ScriptResource* resource, ScriptStreamer* streamer, CachedMetadataHandle r* cacheHandler, AccessControlStatus corsStatus, V8CacheOptions cacheOptions, bo ol isInternalScript) | 373 v8::Local<v8::Script> V8ScriptRunner::compileScript(v8::Handle<v8::String> code, const String& fileName, const TextPosition& scriptStartPosition, v8::Isolate* i solate, ScriptResource* resource, ScriptStreamer* streamer, CachedMetadataHandle r* cacheHandler, AccessControlStatus corsStatus, V8CacheOptions cacheOptions, bo ol isInternalScript) |
366 { | 374 { |
367 TRACE_EVENT1("v8", "v8.compile", "fileName", fileName.utf8()); | 375 TRACE_EVENT1("v8", "v8.compile", "fileName", fileName.utf8()); |
368 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Compile"); | 376 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Compile"); |
369 | 377 |
370 ASSERT(!streamer || resource); | 378 ASSERT(!streamer || resource); |
371 ASSERT(!resource || resource->cacheHandler() == cacheHandler); | 379 ASSERT(!resource || resource->cacheHandler() == cacheHandler); |
372 | 380 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
505 { | 513 { |
506 return cacheTag(CacheTagParser, cacheHandler); | 514 return cacheTag(CacheTagParser, cacheHandler); |
507 } | 515 } |
508 | 516 |
509 unsigned V8ScriptRunner::tagForCodeCache(CachedMetadataHandler* cacheHandler) | 517 unsigned V8ScriptRunner::tagForCodeCache(CachedMetadataHandler* cacheHandler) |
510 { | 518 { |
511 return cacheTag(CacheTagCode, cacheHandler); | 519 return cacheTag(CacheTagCode, cacheHandler); |
512 } | 520 } |
513 | 521 |
514 } // namespace blink | 522 } // namespace blink |
OLD | NEW |