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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 streamer ? selectCompileFunction(cacheOptions, resource, streamer) | 491 streamer ? selectCompileFunction(cacheOptions, resource, streamer) |
492 : selectCompileFunction(cacheOptions, cacheHandler, codeCache, | 492 : selectCompileFunction(cacheOptions, cacheHandler, codeCache, |
493 code, cacheabilityIfNoHandler); | 493 code, cacheabilityIfNoHandler); |
494 | 494 |
495 return (*compileFn)(isolate, code, origin); | 495 return (*compileFn)(isolate, code, origin); |
496 } | 496 } |
497 | 497 |
498 v8::MaybeLocal<v8::Module> V8ScriptRunner::compileModule( | 498 v8::MaybeLocal<v8::Module> V8ScriptRunner::compileModule( |
499 v8::Isolate* isolate, | 499 v8::Isolate* isolate, |
500 const String& source, | 500 const String& source, |
501 const String& fileName) { | 501 const String& fileName, |
| 502 AccessControlStatus accessControlStatus) { |
502 TRACE_EVENT1("v8", "v8.compileModule", "fileName", fileName.utf8()); | 503 TRACE_EVENT1("v8", "v8.compileModule", "fileName", fileName.utf8()); |
503 // TODO(adamk): Add Inspector integration? | 504 // TODO(adamk): Add Inspector integration? |
504 // TODO(adamk): Pass more info into ScriptOrigin. | 505 // TODO(adamk): Pass more info into ScriptOrigin. |
505 v8::ScriptOrigin origin(v8String(isolate, fileName), | 506 v8::ScriptOrigin origin( |
506 v8::Integer::New(isolate, 0), // line_offset | 507 v8String(isolate, fileName), v8::Integer::New(isolate, 0), // line_offset |
507 v8::Integer::New(isolate, 0), // col_offset | 508 v8::Integer::New(isolate, 0), // col_offset |
508 v8Boolean(true, isolate), // accessControlStatus | 509 v8Boolean(accessControlStatus == SharableCrossOrigin, isolate), |
509 v8::Local<v8::Integer>(), // script id | 510 v8::Local<v8::Integer>(), // script id |
510 v8String(isolate, ""), // source_map_url | 511 v8String(isolate, ""), // source_map_url |
511 v8Boolean(false, isolate), // accessControlStatus | 512 v8Boolean(accessControlStatus == OpaqueResource, isolate), |
512 v8Boolean(false, isolate), // is_wasm | 513 v8Boolean(false, isolate), // is_wasm |
513 v8Boolean(true, isolate)); // is_module | 514 v8Boolean(true, isolate)); // is_module |
| 515 |
514 v8::ScriptCompiler::Source scriptSource(v8String(isolate, source), origin); | 516 v8::ScriptCompiler::Source scriptSource(v8String(isolate, source), origin); |
515 return v8::ScriptCompiler::CompileModule(isolate, &scriptSource); | 517 return v8::ScriptCompiler::CompileModule(isolate, &scriptSource); |
516 } | 518 } |
517 | 519 |
518 v8::MaybeLocal<v8::Value> V8ScriptRunner::runCompiledScript( | 520 v8::MaybeLocal<v8::Value> V8ScriptRunner::runCompiledScript( |
519 v8::Isolate* isolate, | 521 v8::Isolate* isolate, |
520 v8::Local<v8::Script> script, | 522 v8::Local<v8::Script> script, |
521 ExecutionContext* context) { | 523 ExecutionContext* context) { |
522 ASSERT(!script.IsEmpty()); | 524 ASSERT(!script.IsEmpty()); |
523 ScopedFrameBlamer frameBlamer( | 525 ScopedFrameBlamer frameBlamer( |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 v8AtomicString(isolate, "((e) => { throw e; })"), origin) | 719 v8AtomicString(isolate, "((e) => { throw e; })"), origin) |
718 .ToLocalChecked(); | 720 .ToLocalChecked(); |
719 v8::Local<v8::Function> thrower = runCompiledInternalScript(isolate, script) | 721 v8::Local<v8::Function> thrower = runCompiledInternalScript(isolate, script) |
720 .ToLocalChecked() | 722 .ToLocalChecked() |
721 .As<v8::Function>(); | 723 .As<v8::Function>(); |
722 v8::Local<v8::Value> args[] = {exception}; | 724 v8::Local<v8::Value> args[] = {exception}; |
723 callInternalFunction(thrower, thrower, WTF_ARRAY_LENGTH(args), args, isolate); | 725 callInternalFunction(thrower, thrower, WTF_ARRAY_LENGTH(args), args, isolate); |
724 } | 726 } |
725 | 727 |
726 } // namespace blink | 728 } // namespace blink |
OLD | NEW |