| 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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 | 533 |
| 534 // Run the script and keep track of the current recursion depth. | 534 // Run the script and keep track of the current recursion depth. |
| 535 v8::MaybeLocal<v8::Value> result; | 535 v8::MaybeLocal<v8::Value> result; |
| 536 { | 536 { |
| 537 if (ScriptForbiddenScope::isScriptForbidden()) { | 537 if (ScriptForbiddenScope::isScriptForbidden()) { |
| 538 throwScriptForbiddenException(isolate); | 538 throwScriptForbiddenException(isolate); |
| 539 return v8::MaybeLocal<v8::Value>(); | 539 return v8::MaybeLocal<v8::Value>(); |
| 540 } | 540 } |
| 541 v8::MicrotasksScope microtasksScope(isolate, | 541 v8::MicrotasksScope microtasksScope(isolate, |
| 542 v8::MicrotasksScope::kRunMicrotasks); | 542 v8::MicrotasksScope::kRunMicrotasks); |
| 543 probe::willExecuteScript(context); | 543 probe::ExecuteScript probe(context); |
| 544 ThreadDebugger::willExecuteScript(isolate, | 544 ThreadDebugger::willExecuteScript(isolate, |
| 545 script->GetUnboundScript()->GetId()); | 545 script->GetUnboundScript()->GetId()); |
| 546 result = script->Run(isolate->GetCurrentContext()); | 546 result = script->Run(isolate->GetCurrentContext()); |
| 547 ThreadDebugger::didExecuteScript(isolate); | 547 ThreadDebugger::didExecuteScript(isolate); |
| 548 probe::didExecuteScript(context); | |
| 549 } | 548 } |
| 550 | 549 |
| 551 CHECK(!isolate->IsDead()); | 550 CHECK(!isolate->IsDead()); |
| 552 return result; | 551 return result; |
| 553 } | 552 } |
| 554 | 553 |
| 555 v8::MaybeLocal<v8::Value> V8ScriptRunner::compileAndRunInternalScript( | 554 v8::MaybeLocal<v8::Value> V8ScriptRunner::compileAndRunInternalScript( |
| 556 v8::Local<v8::String> source, | 555 v8::Local<v8::String> source, |
| 557 v8::Isolate* isolate, | 556 v8::Isolate* isolate, |
| 558 const String& fileName, | 557 const String& fileName, |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 TRACE_EVENT_BEGIN1("devtools.timeline", "FunctionCall", "data", | 651 TRACE_EVENT_BEGIN1("devtools.timeline", "FunctionCall", "data", |
| 653 InspectorFunctionCallEvent::data(context, function)); | 652 InspectorFunctionCallEvent::data(context, function)); |
| 654 | 653 |
| 655 DCHECK(!frame || | 654 DCHECK(!frame || |
| 656 BindingSecurity::shouldAllowAccessToFrame( | 655 BindingSecurity::shouldAllowAccessToFrame( |
| 657 toDOMWindow(function->CreationContext())->toLocalDOMWindow(), | 656 toDOMWindow(function->CreationContext())->toLocalDOMWindow(), |
| 658 frame, BindingSecurity::ErrorReportOption::DoNotReport)); | 657 frame, BindingSecurity::ErrorReportOption::DoNotReport)); |
| 659 CHECK(!ThreadState::current()->isWrapperTracingForbidden()); | 658 CHECK(!ThreadState::current()->isWrapperTracingForbidden()); |
| 660 v8::MicrotasksScope microtasksScope(isolate, | 659 v8::MicrotasksScope microtasksScope(isolate, |
| 661 v8::MicrotasksScope::kRunMicrotasks); | 660 v8::MicrotasksScope::kRunMicrotasks); |
| 662 probe::willCallFunction(context); | 661 probe::CallFunction probe(context, function); |
| 663 ThreadDebugger::willExecuteScript(isolate, function->ScriptId()); | 662 ThreadDebugger::willExecuteScript(isolate, function->ScriptId()); |
| 664 v8::MaybeLocal<v8::Value> result = | 663 v8::MaybeLocal<v8::Value> result = |
| 665 function->Call(isolate->GetCurrentContext(), receiver, argc, args); | 664 function->Call(isolate->GetCurrentContext(), receiver, argc, args); |
| 666 CHECK(!isolate->IsDead()); | 665 CHECK(!isolate->IsDead()); |
| 667 ThreadDebugger::didExecuteScript(isolate); | 666 ThreadDebugger::didExecuteScript(isolate); |
| 668 probe::didCallFunction(context, function); | |
| 669 if (!depth) | 667 if (!depth) |
| 670 TRACE_EVENT_END0("devtools.timeline", "FunctionCall"); | 668 TRACE_EVENT_END0("devtools.timeline", "FunctionCall"); |
| 671 return result; | 669 return result; |
| 672 } | 670 } |
| 673 | 671 |
| 674 v8::MaybeLocal<v8::Value> V8ScriptRunner::callInternalFunction( | 672 v8::MaybeLocal<v8::Value> V8ScriptRunner::callInternalFunction( |
| 675 v8::Local<v8::Function> function, | 673 v8::Local<v8::Function> function, |
| 676 v8::Local<v8::Value> receiver, | 674 v8::Local<v8::Value> receiver, |
| 677 int argc, | 675 int argc, |
| 678 v8::Local<v8::Value> args[], | 676 v8::Local<v8::Value> args[], |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 v8AtomicString(isolate, "((e) => { throw e; })"), origin) | 733 v8AtomicString(isolate, "((e) => { throw e; })"), origin) |
| 736 .ToLocalChecked(); | 734 .ToLocalChecked(); |
| 737 v8::Local<v8::Function> thrower = runCompiledInternalScript(isolate, script) | 735 v8::Local<v8::Function> thrower = runCompiledInternalScript(isolate, script) |
| 738 .ToLocalChecked() | 736 .ToLocalChecked() |
| 739 .As<v8::Function>(); | 737 .As<v8::Function>(); |
| 740 v8::Local<v8::Value> args[] = {exception}; | 738 v8::Local<v8::Value> args[] = {exception}; |
| 741 callInternalFunction(thrower, thrower, WTF_ARRAY_LENGTH(args), args, isolate); | 739 callInternalFunction(thrower, thrower, WTF_ARRAY_LENGTH(args), args, isolate); |
| 742 } | 740 } |
| 743 | 741 |
| 744 } // namespace blink | 742 } // namespace blink |
| OLD | NEW |