diff options
76 files changed, 260 insertions, 536 deletions
diff --git a/chrome/test/base/v8_unit_test.cc b/chrome/test/base/v8_unit_test.cc index 392ff45..80ac9fb 100644 --- a/chrome/test/base/v8_unit_test.cc +++ b/chrome/test/base/v8_unit_test.cc @@ -11,7 +11,6 @@ #include "base/strings/stringprintf.h" #include "chrome/common/chrome_paths.h" #include "third_party/WebKit/public/web/WebKit.h" -#include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h" namespace { @@ -96,7 +95,8 @@ bool V8UnitTest::RunJavascriptTestF(const std::string& test_fixture, v8::Local<v8::Context> context = v8::Local<v8::Context>::New(isolate, context_); v8::Context::Scope context_scope(context); - blink::WebScopedMicrotaskSuppression microtasks_scope; + v8::MicrotasksScope microtasks( + isolate, v8::MicrotasksScope::kDoNotRunMicrotasks); v8::Local<v8::Value> function_property = context->Global()->Get(v8::String::NewFromUtf8(isolate, "runTest")); @@ -211,7 +211,8 @@ void V8UnitTest::ExecuteScriptInContext(const base::StringPiece& script_source, v8::Local<v8::Context> context = v8::Local<v8::Context>::New(isolate, context_); v8::Context::Scope context_scope(context); - blink::WebScopedMicrotaskSuppression microtasks_scope; + v8::MicrotasksScope microtasks( + isolate, v8::MicrotasksScope::kDoNotRunMicrotasks); v8::Local<v8::String> source = v8::String::NewFromUtf8(isolate, script_source.data(), @@ -260,7 +261,8 @@ void V8UnitTest::TestFunction(const std::string& function_name) { v8::Local<v8::Context> context = v8::Local<v8::Context>::New(isolate, context_); v8::Context::Scope context_scope(context); - blink::WebScopedMicrotaskSuppression microtasks_scope; + v8::MicrotasksScope microtasks( + isolate, v8::MicrotasksScope::kDoNotRunMicrotasks); v8::Local<v8::Value> function_property = context->Global()->Get( v8::String::NewFromUtf8(isolate, function_name.c_str())); diff --git a/components/guest_view/renderer/guest_view_container.cc b/components/guest_view/renderer/guest_view_container.cc index c410c6f..4d8df38 100644 --- a/components/guest_view/renderer/guest_view_container.cc +++ b/components/guest_view/renderer/guest_view_container.cc @@ -11,7 +11,6 @@ #include "content/public/renderer/render_frame.h" #include "content/public/renderer/render_frame_observer.h" #include "content/public/renderer/render_view.h" -#include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h" namespace { @@ -154,7 +153,7 @@ void GuestViewContainer::HandlePendingResponseCallback( void GuestViewContainer::RunDestructionCallback(bool embedder_frame_destroyed) { // Do not attempt to run |destruction_callback_| if the embedder frame was // destroyed. Trying to invoke callback on RenderFrame destruction results in - // assertion failure when calling WebScopedMicrotaskSuppression. + // assertion failure when calling v8::MicrotasksScope. if (embedder_frame_destroyed) return; @@ -168,7 +167,8 @@ void GuestViewContainer::RunDestructionCallback(bool embedder_frame_destroyed) { return; v8::Context::Scope context_scope(context); - blink::WebScopedMicrotaskSuppression suppression; + v8::MicrotasksScope microtasks( + destruction_isolate_, v8::MicrotasksScope::kDoNotRunMicrotasks); callback->Call(context->Global(), 0 /* argc */, nullptr); } diff --git a/components/guest_view/renderer/guest_view_request.cc b/components/guest_view/renderer/guest_view_request.cc index d0aa061..fead0c5 100644 --- a/components/guest_view/renderer/guest_view_request.cc +++ b/components/guest_view/renderer/guest_view_request.cc @@ -13,7 +13,6 @@ #include "content/public/renderer/render_view.h" #include "third_party/WebKit/public/web/WebLocalFrame.h" #include "third_party/WebKit/public/web/WebRemoteFrame.h" -#include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h" #include "third_party/WebKit/public/web/WebView.h" namespace guest_view { @@ -43,7 +42,8 @@ void GuestViewRequest::ExecuteCallbackIfAvailable( return; v8::Context::Scope context_scope(context); - blink::WebScopedMicrotaskSuppression suppression; + v8::MicrotasksScope microtasks( + isolate(), v8::MicrotasksScope::kDoNotRunMicrotasks); callback->Call(context->Global(), argc, argv.get()); } diff --git a/content/child/v8_value_converter_impl_unittest.cc b/content/child/v8_value_converter_impl_unittest.cc index 435ea30..ccb1db5 100644 --- a/content/child/v8_value_converter_impl_unittest.cc +++ b/content/child/v8_value_converter_impl_unittest.cc @@ -14,7 +14,6 @@ #include "base/values.h" #include "content/child/v8_value_converter_impl.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h" #include "v8/include/v8.h" namespace content { @@ -288,7 +287,8 @@ TEST_F(V8ValueConverterImplTest, ObjectExceptions) { v8::Local<v8::Context> context = v8::Local<v8::Context>::New(isolate_, context_); v8::Context::Scope context_scope(context); - blink::WebScopedMicrotaskSuppression microtasks_scope; + v8::MicrotasksScope microtasks( + isolate_, v8::MicrotasksScope::kDoNotRunMicrotasks); // Set up objects to throw when reading or writing 'foo'. const char* source = @@ -331,7 +331,8 @@ TEST_F(V8ValueConverterImplTest, ArrayExceptions) { v8::Local<v8::Context> context = v8::Local<v8::Context>::New(isolate_, context_); v8::Context::Scope context_scope(context); - blink::WebScopedMicrotaskSuppression microtasks_scope; + v8::MicrotasksScope microtasks( + isolate_, v8::MicrotasksScope::kDoNotRunMicrotasks); const char* source = "(function() {" "var arr = [];" @@ -408,7 +409,8 @@ TEST_F(V8ValueConverterImplTest, Prototype) { v8::Local<v8::Context> context = v8::Local<v8::Context>::New(isolate_, context_); v8::Context::Scope context_scope(context); - blink::WebScopedMicrotaskSuppression microtasks_scope; + v8::MicrotasksScope microtasks( + isolate_, v8::MicrotasksScope::kDoNotRunMicrotasks); const char* source = "(function() {" "Object.prototype.foo = 'foo';" @@ -433,7 +435,8 @@ TEST_F(V8ValueConverterImplTest, StripNullFromObjects) { v8::Local<v8::Context> context = v8::Local<v8::Context>::New(isolate_, context_); v8::Context::Scope context_scope(context); - blink::WebScopedMicrotaskSuppression microtasks_scope; + v8::MicrotasksScope microtasks( + isolate_, v8::MicrotasksScope::kDoNotRunMicrotasks); const char* source = "(function() {" "return { foo: undefined, bar: null };" @@ -492,7 +495,8 @@ TEST_F(V8ValueConverterImplTest, WeirdProperties) { v8::Local<v8::Context> context = v8::Local<v8::Context>::New(isolate_, context_); v8::Context::Scope context_scope(context); - blink::WebScopedMicrotaskSuppression microtasks_scope; + v8::MicrotasksScope microtasks( + isolate_, v8::MicrotasksScope::kDoNotRunMicrotasks); const char* source = "(function() {" "return {" @@ -531,7 +535,8 @@ TEST_F(V8ValueConverterImplTest, ArrayGetters) { v8::Local<v8::Context> context = v8::Local<v8::Context>::New(isolate_, context_); v8::Context::Scope context_scope(context); - blink::WebScopedMicrotaskSuppression microtasks_scope; + v8::MicrotasksScope microtasks( + isolate_, v8::MicrotasksScope::kDoNotRunMicrotasks); const char* source = "(function() {" "var a = [0];" @@ -556,7 +561,8 @@ TEST_F(V8ValueConverterImplTest, UndefinedValueBehavior) { v8::Local<v8::Context> context = v8::Local<v8::Context>::New(isolate_, context_); v8::Context::Scope context_scope(context); - blink::WebScopedMicrotaskSuppression microtasks_scope; + v8::MicrotasksScope microtasks( + isolate_, v8::MicrotasksScope::kDoNotRunMicrotasks); v8::Local<v8::Object> object; { diff --git a/content/renderer/java/gin_java_bridge_value_converter_unittest.cc b/content/renderer/java/gin_java_bridge_value_converter_unittest.cc index 2178fca..33c3222 100644 --- a/content/renderer/java/gin_java_bridge_value_converter_unittest.cc +++ b/content/renderer/java/gin_java_bridge_value_converter_unittest.cc @@ -12,7 +12,6 @@ #include "content/common/android/gin_java_bridge_value.h" #include "content/renderer/java/gin_java_bridge_value_converter.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h" #include "v8/include/v8.h" namespace content { @@ -100,7 +99,8 @@ TEST_F(GinJavaBridgeValueConverterTest, TypedArrays) { v8::Local<v8::Context> context = v8::Local<v8::Context>::New(isolate_, context_); v8::Context::Scope context_scope(context); - blink::WebScopedMicrotaskSuppression microtasks_scope; + v8::MicrotasksScope microtasks_scope( + isolate_, v8::MicrotasksScope::kDoNotRunMicrotasks); scoped_ptr<GinJavaBridgeValueConverter> converter( new GinJavaBridgeValueConverter()); diff --git a/content/renderer/pepper/v8_var_converter_unittest.cc b/content/renderer/pepper/v8_var_converter_unittest.cc index e030ffd..283aad6 100644 --- a/content/renderer/pepper/v8_var_converter_unittest.cc +++ b/content/renderer/pepper/v8_var_converter_unittest.cc @@ -29,7 +29,6 @@ #include "ppapi/shared_impl/var.h" #include "ppapi/shared_impl/var_tracker.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h" #include "v8/include/v8.h" using ppapi::ArrayBufferVar; @@ -404,7 +403,8 @@ TEST_F(V8VarConverterTest, StrangeDictionaryKeyTest) { v8::Local<v8::Context> context = v8::Local<v8::Context>::New(isolate_, context_); v8::Context::Scope context_scope(context); - blink::WebScopedMicrotaskSuppression microtasks_scope; + v8::MicrotasksScope microtasks( + isolate_, v8::MicrotasksScope::kDoNotRunMicrotasks); const char* source = "(function() {" diff --git a/extensions/renderer/activity_log_converter_strategy_unittest.cc b/extensions/renderer/activity_log_converter_strategy_unittest.cc index aa80447..fbb9597 100644 --- a/extensions/renderer/activity_log_converter_strategy_unittest.cc +++ b/extensions/renderer/activity_log_converter_strategy_unittest.cc @@ -6,7 +6,6 @@ #include "base/values.h" #include "extensions/renderer/activity_log_converter_strategy.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h" #include "v8/include/v8.h" using content::V8ValueConverter; @@ -123,7 +122,8 @@ TEST_F(ActivityLogConverterStrategyTest, ConversionTest) { "};" "})();"; - blink::WebScopedMicrotaskSuppression microtasks_scope; + v8::MicrotasksScope microtasks( + isolate_, v8::MicrotasksScope::kDoNotRunMicrotasks); v8::Local<v8::Script> script( v8::Script::Compile(v8::String::NewFromUtf8(isolate_, source))); v8::Local<v8::Object> v8_object = script->Run().As<v8::Object>(); diff --git a/extensions/renderer/guest_view/extensions_guest_view_container.cc b/extensions/renderer/guest_view/extensions_guest_view_container.cc index 3fa9882..ffa3580 100644 --- a/extensions/renderer/guest_view/extensions_guest_view_container.cc +++ b/extensions/renderer/guest_view/extensions_guest_view_container.cc @@ -5,7 +5,6 @@ #include "extensions/renderer/guest_view/extensions_guest_view_container.h" #include "content/public/renderer/render_frame.h" -#include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h" #include "ui/gfx/geometry/size.h" namespace extensions { @@ -56,7 +55,8 @@ void ExtensionsGuestViewContainer::CallElementResizeCallback( v8::Integer::New(element_resize_isolate_, new_size.height())}; v8::Context::Scope context_scope(context); - blink::WebScopedMicrotaskSuppression suppression; + v8::MicrotasksScope microtasks( + element_resize_isolate_, v8::MicrotasksScope::kDoNotRunMicrotasks); callback->Call(context->Global(), argc, argv); } diff --git a/extensions/renderer/messaging_bindings.cc b/extensions/renderer/messaging_bindings.cc index 722bc72..0d87c4c 100644 --- a/extensions/renderer/messaging_bindings.cc +++ b/extensions/renderer/messaging_bindings.cc @@ -35,7 +35,6 @@ #include "extensions/renderer/v8_helpers.h" #include "third_party/WebKit/public/web/WebDocument.h" #include "third_party/WebKit/public/web/WebLocalFrame.h" -#include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h" #include "third_party/WebKit/public/web/WebScopedUserGesture.h" #include "third_party/WebKit/public/web/WebScopedWindowFocusAllowedIndicator.h" #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" diff --git a/extensions/renderer/module_system.cc b/extensions/renderer/module_system.cc index 4ca689a..692939e 100644 --- a/extensions/renderer/module_system.cc +++ b/extensions/renderer/module_system.cc @@ -22,7 +22,6 @@ #include "extensions/renderer/v8_helpers.h" #include "gin/modules/module_registry.h" #include "third_party/WebKit/public/web/WebFrame.h" -#include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h" namespace extensions { diff --git a/extensions/renderer/safe_builtins.cc b/extensions/renderer/safe_builtins.cc index 3a66eaf..fbd88bd 100644 --- a/extensions/renderer/safe_builtins.cc +++ b/extensions/renderer/safe_builtins.cc @@ -9,7 +9,6 @@ #include "base/strings/stringprintf.h" #include "extensions/renderer/script_context.h" #include "extensions/renderer/v8_helpers.h" -#include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h" namespace extensions { @@ -201,7 +200,8 @@ class ExtensionImpl : public v8::Extension { return; } - blink::WebScopedMicrotaskSuppression microtasks_scope; + v8::MicrotasksScope microtasks( + info.GetIsolate(), v8::MicrotasksScope::kDoNotRunMicrotasks); v8::Local<v8::Value> return_value; if (function->Call(context, recv, argc, argv.get()).ToLocal(&return_value)) info.GetReturnValue().Set(return_value); diff --git a/extensions/renderer/script_context.cc b/extensions/renderer/script_context.cc index f6f47f3..4bcec51 100644 --- a/extensions/renderer/script_context.cc +++ b/extensions/renderer/script_context.cc @@ -29,7 +29,6 @@ #include "third_party/WebKit/public/web/WebDocument.h" #include "third_party/WebKit/public/web/WebFrame.h" #include "third_party/WebKit/public/web/WebLocalFrame.h" -#include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h" #include "third_party/WebKit/public/web/WebView.h" #include "v8/include/v8.h" @@ -185,7 +184,8 @@ v8::Local<v8::Value> ScriptContext::CallFunction( v8::EscapableHandleScope handle_scope(isolate()); v8::Context::Scope scope(v8_context()); - blink::WebScopedMicrotaskSuppression suppression; + v8::MicrotasksScope microtasks( + isolate(), v8::MicrotasksScope::kDoNotRunMicrotasks); if (!is_valid_) { return handle_scope.Escape( v8::Local<v8::Primitive>(v8::Undefined(isolate()))); @@ -434,7 +434,8 @@ v8::Local<v8::Value> ScriptContext::RunScript( return v8::Undefined(isolate()); } - blink::WebScopedMicrotaskSuppression suppression; + v8::MicrotasksScope microtasks( + isolate(), v8::MicrotasksScope::kDoNotRunMicrotasks); v8::TryCatch try_catch(isolate()); try_catch.SetCaptureMessage(true); v8::ScriptOrigin origin( diff --git a/extensions/renderer/utils_native_handler.cc b/extensions/renderer/utils_native_handler.cc index d93f2e6..1ded40c 100644 --- a/extensions/renderer/utils_native_handler.cc +++ b/extensions/renderer/utils_native_handler.cc @@ -7,7 +7,6 @@ #include "base/macros.h" #include "base/strings/stringprintf.h" #include "extensions/renderer/script_context.h" -#include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h" #include "third_party/WebKit/public/web/WebSerializedScriptValue.h" namespace extensions { diff --git a/extensions/renderer/v8_helpers.h b/extensions/renderer/v8_helpers.h index b0dd17a..0a3b2eb 100644 --- a/extensions/renderer/v8_helpers.h +++ b/extensions/renderer/v8_helpers.h @@ -9,7 +9,6 @@ #include <string.h> #include "base/strings/string_number_conversions.h" -#include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h" #include "v8/include/v8.h" namespace extensions { @@ -156,7 +155,8 @@ inline bool CallFunction(v8::Local<v8::Context> context, int argc, v8::Local<v8::Value> argv[], v8::Local<v8::Value>* out) { - blink::WebScopedMicrotaskSuppression microtasks_scope; + v8::MicrotasksScope microtasks_scope( + context->GetIsolate(), v8::MicrotasksScope::kDoNotRunMicrotasks); return function->Call(context, recv, argc, argv).ToLocal(out); } diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/timeline-test.js b/third_party/WebKit/LayoutTests/http/tests/inspector/timeline-test.js index 6b13a87..cc148cc 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/timeline-test.js +++ b/third_party/WebKit/LayoutTests/http/tests/inspector/timeline-test.js @@ -1,3 +1,10 @@ +function wrapCallFunctionForTimeline(f) +{ + var script = document.createElement("script"); + script.textContent = "(" + f.toString() + ")()\n//# sourceURL=wrapCallFunctionForTimeline.js"; + document.body.appendChild(script); +} + var initialize_Timeline = function() { InspectorTest.preloadPanel("timeline"); diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/timeline/fetch-as-stream.html b/third_party/WebKit/LayoutTests/inspector-protocol/timeline/fetch-as-stream.html index 4f0e1d4..6c11d72 100644 --- a/third_party/WebKit/LayoutTests/inspector-protocol/timeline/fetch-as-stream.html +++ b/third_party/WebKit/LayoutTests/inspector-protocol/timeline/fetch-as-stream.html @@ -93,7 +93,6 @@ function test() ++knownEvents[event.name]; } assertGreaterOrEqual(events.length, 10, "Too few trace events recorded"); - assertGreaterOrEqual(knownEvents["FunctionCall"], 1, "Too few FunctionCall events"); assertGreaterOrEqual(knownEvents["UpdateLayoutTree"], 1, "Too few UpdateLayoutTree events"); assertGreaterOrEqual(knownEvents["Layout"], 1, "Too few Layout events"); InspectorTest.log("Event sanity test done"); diff --git a/third_party/WebKit/LayoutTests/inspector/tracing.html b/third_party/WebKit/LayoutTests/inspector/tracing.html index c7ee50d..c0fb911 100644 --- a/third_party/WebKit/LayoutTests/inspector/tracing.html +++ b/third_party/WebKit/LayoutTests/inspector/tracing.html @@ -91,7 +91,6 @@ function test() ++knownEvents[event.name]; } InspectorTest.assertGreaterOrEqual(events.length, 100, "Too few trace events recorded"); - InspectorTest.assertGreaterOrEqual(knownEvents["v8.callFunction"], 1, "Too few v8.callFunction"); InspectorTest.assertGreaterOrEqual(knownEvents["UpdateLayoutTree"], 1, "Too few UpdateLayoutTree"); InspectorTest.assertGreaterOrEqual(knownEvents["FrameView::layout"], 1, "Too few FrameView::layout"); InspectorTest.assertGreaterOrEqual(phaseComplete, 50, "Too few begin events"); diff --git a/third_party/WebKit/LayoutTests/inspector/tracing/timeline-bound-function-expected.txt b/third_party/WebKit/LayoutTests/inspector/tracing/timeline-bound-function-expected.txt index c8f5b5d..4151574 100644 --- a/third_party/WebKit/LayoutTests/inspector/tracing/timeline-bound-function-expected.txt +++ b/third_party/WebKit/LayoutTests/inspector/tracing/timeline-bound-function-expected.txt @@ -1,6 +1,5 @@ Tests extracting information about original functions from bound ones -FunctionCall :1 FunctionCall timeline-bound-function.html:7 diff --git a/third_party/WebKit/LayoutTests/inspector/tracing/timeline-injected-script-eval-expected.txt b/third_party/WebKit/LayoutTests/inspector/tracing/timeline-injected-script-eval-expected.txt index 63be6e9..4fa0644 100644 --- a/third_party/WebKit/LayoutTests/inspector/tracing/timeline-injected-script-eval-expected.txt +++ b/third_party/WebKit/LayoutTests/inspector/tracing/timeline-injected-script-eval-expected.txt @@ -1,17 +1 @@ -Tests the Timeline API function call record for InjectedScript.eval call feature. - -FunctionCall Properties: -{ - data : { - frame : <string> - scriptId : <string> - scriptLine : <number> - scriptName : <string> - } - endTime : <number> - frameId : <string> - startTime : <number> - type : "FunctionCall" -} -Text details for FunctionCall: undefined - +Tests the Timeline API function call is not recorded for InjectedScript.eval. diff --git a/third_party/WebKit/LayoutTests/inspector/tracing/timeline-injected-script-eval.html b/third_party/WebKit/LayoutTests/inspector/tracing/timeline-injected-script-eval.html index 6fa62fa..9fd6787 100644 --- a/third_party/WebKit/LayoutTests/inspector/tracing/timeline-injected-script-eval.html +++ b/third_party/WebKit/LayoutTests/inspector/tracing/timeline-injected-script-eval.html @@ -19,7 +19,7 @@ function test() <body onload="runTest()"> <p> -Tests the Timeline API function call record for InjectedScript.eval call feature. +Tests the Timeline API function call is not recorded for InjectedScript.eval. </p> </body> diff --git a/third_party/WebKit/LayoutTests/inspector/tracing/timeline-layout.html b/third_party/WebKit/LayoutTests/inspector/tracing/timeline-layout.html index bf7ebbf..7c2ed83 100644 --- a/third_party/WebKit/LayoutTests/inspector/tracing/timeline-layout.html +++ b/third_party/WebKit/LayoutTests/inspector/tracing/timeline-layout.html @@ -19,8 +19,8 @@ function invalidateAndForceLayout(element) function performActions() { - invalidateAndForceLayout(document.getElementById("invalidate1")); - invalidateAndForceLayout(document.getElementById("invalidate2")); + wrapCallFunctionForTimeline(() => invalidateAndForceLayout(document.getElementById("invalidate1"))); + wrapCallFunctionForTimeline(() => invalidateAndForceLayout(document.getElementById("invalidate2"))); } function test() diff --git a/third_party/WebKit/LayoutTests/inspector/tracing/timeline-recalculate-styles-expected.txt b/third_party/WebKit/LayoutTests/inspector/tracing/timeline-recalculate-styles-expected.txt index dafad285..e3dd2b4 100644 --- a/third_party/WebKit/LayoutTests/inspector/tracing/timeline-recalculate-styles-expected.txt +++ b/third_party/WebKit/LayoutTests/inspector/tracing/timeline-recalculate-styles-expected.txt @@ -8,7 +8,7 @@ UpdateLayoutTree Properties: frame : <string> stackTrace : <object> } - elementCount : 2 + elementCount : 3 } endTime : <number> frameId : <string> @@ -16,6 +16,6 @@ UpdateLayoutTree Properties: startTime : <number> type : "UpdateLayoutTree" } -Text details for UpdateLayoutTree: timeline-recalculate-styles.html:20 +Text details for UpdateLayoutTree: wrapCallFunctionForTimeline.js:8 UpdateLayoutTree has a warning diff --git a/third_party/WebKit/LayoutTests/inspector/tracing/timeline-recalculate-styles.html b/third_party/WebKit/LayoutTests/inspector/tracing/timeline-recalculate-styles.html index df024b8..1458e25 100644 --- a/third_party/WebKit/LayoutTests/inspector/tracing/timeline-recalculate-styles.html +++ b/third_party/WebKit/LayoutTests/inspector/tracing/timeline-recalculate-styles.html @@ -11,7 +11,7 @@ <script> -function performActions() +function forceStyle() { var element = document.createElement("div"); element.className = "test-style"; @@ -20,6 +20,11 @@ function performActions() var unused = element.offsetWidth; } +function performActions() +{ + wrapCallFunctionForTimeline(forceStyle); +} + function test() { InspectorTest.performActionsAndPrint("performActions()", "UpdateLayoutTree"); diff --git a/third_party/WebKit/LayoutTests/inspector/tracing/timeline-receive-response-event-expected.txt b/third_party/WebKit/LayoutTests/inspector/tracing/timeline-receive-response-event-expected.txt index c0dac66..088ca5b 100644 --- a/third_party/WebKit/LayoutTests/inspector/tracing/timeline-receive-response-event-expected.txt +++ b/third_party/WebKit/LayoutTests/inspector/tracing/timeline-receive-response-event-expected.txt @@ -1,6 +1,6 @@ Tests the Timeline API instrumentation of a SendRequest, ReceiveResponse etc. - ResourceSendRequest +ResourceSendRequest ResourceReceiveResponse ResourceReceivedData ResourceFinish diff --git a/third_party/WebKit/LayoutTests/inspector/tracing/timeline-script-id-expected.txt b/third_party/WebKit/LayoutTests/inspector/tracing/timeline-script-id-expected.txt index cb22f7f..54bf6b2 100644 --- a/third_party/WebKit/LayoutTests/inspector/tracing/timeline-script-id-expected.txt +++ b/third_party/WebKit/LayoutTests/inspector/tracing/timeline-script-id-expected.txt @@ -2,7 +2,6 @@ Test that checks location resolving mechanics for TimerInstall TimerRemove and F It expects two FunctionCall for InjectedScript, two TimerInstall events, two FunctionCall events and one TimerRemove event to be logged with performActions.js script name and some line number. -detailsTextContent for FunctionCall event: 'undefined' detailsTextContent for TimerInstall event: 'performActions.js:3' details.textContent for TimerInstall event: 'performActions.js:3' detailsTextContent for TimerInstall event: 'performActions.js:4' diff --git a/third_party/WebKit/LayoutTests/inspector/tracing/timeline-time-expected.txt b/third_party/WebKit/LayoutTests/inspector/tracing/timeline-time-expected.txt index 0009030..6c78afe 100644 --- a/third_party/WebKit/LayoutTests/inspector/tracing/timeline-time-expected.txt +++ b/third_party/WebKit/LayoutTests/inspector/tracing/timeline-time-expected.txt @@ -2,17 +2,13 @@ Test nesting of time/timeEnd records on Timeline Running: testSimpleConsoleTime -----> Function Call Running: testNestedConsoleTime -----> Function Call Running: testUnbalancedConsoleTime -----> Function Call Running: testConsoleTimeWithoutConsoleTimeEnd -----> Function Call ---------> Timestamp: Foo ---------> Timestamp: Bar ---------> Timestamp: Baz +----> Timestamp: Foo +----> Timestamp: Bar +----> Timestamp: Baz diff --git a/third_party/WebKit/LayoutTests/inspector/tracing/timeline-timer-expected.txt b/third_party/WebKit/LayoutTests/inspector/tracing/timeline-timer-expected.txt index 36b374a..58d172d 100644 --- a/third_party/WebKit/LayoutTests/inspector/tracing/timeline-timer-expected.txt +++ b/third_party/WebKit/LayoutTests/inspector/tracing/timeline-timer-expected.txt @@ -108,19 +108,6 @@ FunctionCall Properties: startTime : <number> type : "FunctionCall" } -FunctionCall Properties: -{ - data : { - frame : <string> - scriptId : <string> - scriptLine : <number> - scriptName : <string> - } - endTime : <number> - frameId : <string> - startTime : <number> - type : "FunctionCall" -} EvaluateScript Properties: { data : { diff --git a/third_party/WebKit/Source/core/dom/Microtask.cpp b/third_party/WebKit/Source/bindings/core/v8/Microtask.cpp index 344c9e0..ade8bba 100644 --- a/third_party/WebKit/Source/core/dom/Microtask.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/Microtask.cpp @@ -28,13 +28,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "core/dom/Microtask.h" +#include "bindings/core/v8/Microtask.h" -#include "bindings/core/v8/V8PerIsolateData.h" #include "platform/ScriptForbiddenScope.h" #include "platform/Task.h" -#include "public/platform/WebTaskRunner.h" -#include <v8.h> namespace blink { diff --git a/third_party/WebKit/Source/core/dom/Microtask.h b/third_party/WebKit/Source/bindings/core/v8/Microtask.h index 82ac7d1..89ecd0f 100644 --- a/third_party/WebKit/Source/core/dom/Microtask.h +++ b/third_party/WebKit/Source/bindings/core/v8/Microtask.h @@ -31,7 +31,6 @@ #ifndef Microtask_h #define Microtask_h -#include "bindings/core/v8/ScriptState.h" #include "core/CoreExport.h" #include "public/platform/WebTaskRunner.h" #include "wtf/Allocator.h" @@ -41,6 +40,25 @@ namespace blink { +// C++ calls into script contexts which are "owned" by blink (created in a +// process where WebKit.cpp initializes v8) must declare their type: +// +// 1. Calls into page/author script from a frame +// 2. Calls into page/author script from a worker +// 3. Calls into internal script (typically setup/teardown work) +// +// Debug-time checking of this is enforced via v8::MicrotasksScope. +// +// Calls of type (1) should generally go through ScriptController, as inspector +// instrumentation is needed. ScriptController allocates V8RecursionScope for you. +// +// Calls of type (2) should always stack-allocate a v8::MicrotasksScope(kRunMicrtoasks) +// in the same block as the call into script. +// +// Calls of type (3) should stack allocate a v8::MicrotasksScope(kDoNotRunMicrotasks) -- +// this skips work that is spec'd to happen at the end of the outer-most +// script stack frame of calls into page script: +// http://www.whatwg.org/specs/web-apps/current-work/#perform-a-microtask-checkpoint class CORE_EXPORT Microtask { STATIC_ONLY(Microtask); public: diff --git a/third_party/WebKit/Source/bindings/core/v8/ReadableStreamOperationsTest.cpp b/third_party/WebKit/Source/bindings/core/v8/ReadableStreamOperationsTest.cpp index ba889fe..1391abf 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ReadableStreamOperationsTest.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ReadableStreamOperationsTest.cpp @@ -12,7 +12,6 @@ #include "bindings/core/v8/V8BindingForTesting.h" #include "bindings/core/v8/V8BindingMacros.h" #include "bindings/core/v8/V8IteratorResultValue.h" -#include "bindings/core/v8/V8RecursionScope.h" #include "bindings/core/v8/V8ThrowException.h" #include "core/dom/Document.h" #include "core/streams/ReadableStreamController.h" @@ -150,7 +149,7 @@ public: { v8::Local<v8::String> source; v8::Local<v8::Script> script; - V8RecursionScope::MicrotaskSuppression microtasks(isolate()); + v8::MicrotasksScope microtasks(isolate(), v8::MicrotasksScope::kDoNotRunMicrotasks); if (!v8Call(v8::String::NewFromUtf8(isolate(), s, v8::NewStringType::kNormal), source)) { ADD_FAILURE(); return ScriptValue(); diff --git a/third_party/WebKit/Source/bindings/core/v8/V8ObjectConstructor.h b/third_party/WebKit/Source/bindings/core/v8/V8ObjectConstructor.h index 10b0a1f..93e73c0 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8ObjectConstructor.h +++ b/third_party/WebKit/Source/bindings/core/v8/V8ObjectConstructor.h @@ -32,7 +32,6 @@ #define V8ObjectConstructor_h #include "bindings/core/v8/V8PerIsolateData.h" -#include "bindings/core/v8/V8RecursionScope.h" #include "wtf/Allocator.h" #include <v8.h> @@ -51,7 +50,7 @@ public: ConstructorMode(v8::Isolate* isolate) : m_isolate(isolate) - , m_microtaskSuppression(isolate) + , m_microtaskSuppression(isolate, v8::MicrotasksScope::kDoNotRunMicrotasks) { V8PerIsolateData* data = V8PerIsolateData::from(m_isolate); m_previous = data->m_constructorMode; @@ -72,7 +71,7 @@ public: private: v8::Isolate* m_isolate; bool m_previous; - V8RecursionScope::MicrotaskSuppression m_microtaskSuppression; + v8::MicrotasksScope m_microtaskSuppression; }; class V8ObjectConstructor { diff --git a/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.h b/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.h index 2cda3f4..c286e6c 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.h +++ b/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.h @@ -98,7 +98,7 @@ public: v8::Local<v8::Context> ensureScriptRegexpContext(); void clearScriptRegexpContext(); - // EndOfScopeTasks are run by V8RecursionScope when control is returning + // EndOfScopeTasks are run when control is returning // to C++ from script, after executing a script task (e.g. callback, // event) or microtasks (e.g. promise). This is explicitly needed for // Indexed DB transactions per spec, but should in general be avoided. diff --git a/third_party/WebKit/Source/bindings/core/v8/V8RecursionScope.cpp b/third_party/WebKit/Source/bindings/core/v8/V8RecursionScope.cpp deleted file mode 100644 index b4c3acf..0000000 --- a/third_party/WebKit/Source/bindings/core/v8/V8RecursionScope.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "bindings/core/v8/V8RecursionScope.h" - -namespace blink { - -} // namespace blink diff --git a/third_party/WebKit/Source/bindings/core/v8/V8RecursionScope.h b/third_party/WebKit/Source/bindings/core/v8/V8RecursionScope.h deleted file mode 100644 index 8bbd26c..0000000 --- a/third_party/WebKit/Source/bindings/core/v8/V8RecursionScope.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef V8RecursionScope_h -#define V8RecursionScope_h - -#include "bindings/core/v8/V8PerIsolateData.h" -#include "core/CoreExport.h" -#include "wtf/Noncopyable.h" -#include <v8.h> - -namespace blink { - -// C++ calls into script contexts which are "owned" by WebKit (created in a -// process where WebKit.cpp initializes v8) must declare their type: -// -// 1. Calls into page/author script from a frame -// 2. Calls into page/author script from a worker -// 3. Calls into internal script (typically setup/teardown work) -// -// Debug-time checking of this is enforced via this class. -// -// Calls of type (1) should generally go through ScriptController, as inspector -// instrumentation is needed. ScriptController allocates V8RecursionScope for you. -// Calls of type (2) should always stack-allocate a V8RecursionScope in the same -// block as the call into script. Calls of type (3) should stack allocate a -// V8RecursionScope::MicrotaskSuppression -- this skips work that is spec'd to -// happen at the end of the outer-most script stack frame of calls into page script: -// -// http://www.whatwg.org/specs/web-apps/current-work/#perform-a-microtask-checkpoint -class CORE_EXPORT V8RecursionScope { - STACK_ALLOCATED(); -public: - explicit V8RecursionScope(v8::Isolate* isolate) - : m_scope(isolate, v8::MicrotasksScope::kRunMicrotasks) - { - ASSERT(isolate->GetMicrotasksPolicy() == v8::MicrotasksPolicy::kScoped); - } - - ~V8RecursionScope() - { - } - - static int recursionLevel(v8::Isolate* isolate) - { - return v8::MicrotasksScope::GetCurrentDepth(isolate); - } - - class MicrotaskSuppression { - USING_FAST_MALLOC(MicrotaskSuppression); - WTF_MAKE_NONCOPYABLE(MicrotaskSuppression); - public: - explicit MicrotaskSuppression(v8::Isolate* isolate) - : m_scope(isolate, v8::MicrotasksScope::kDoNotRunMicrotasks) - { - } - - ~MicrotaskSuppression() - { - } - - private: - v8::MicrotasksScope m_scope; - }; - -private: - v8::MicrotasksScope m_scope; -}; - -} // namespace blink - -#endif // V8RecursionScope_h diff --git a/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp b/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp index 51bc05d..de8a036 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp @@ -29,7 +29,6 @@ #include "bindings/core/v8/ScriptStreamer.h" #include "bindings/core/v8/V8Binding.h" #include "bindings/core/v8/V8GCController.h" -#include "bindings/core/v8/V8RecursionScope.h" #include "bindings/core/v8/V8ThrowException.h" #include "core/dom/ExecutionContext.h" #include "core/fetch/CachedMetadata.h" @@ -400,7 +399,7 @@ v8::MaybeLocal<v8::Value> V8ScriptRunner::runCompiledScript(v8::Isolate* isolate TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); TRACE_EVENT1("v8", "v8.run", "fileName", TRACE_STR_COPY(*v8::String::Utf8Value(script->GetUnboundScript()->GetScriptName()))); - if (V8RecursionScope::recursionLevel(isolate) >= kMaxRecursionDepth) + if (v8::MicrotasksScope::GetCurrentDepth(isolate) >= kMaxRecursionDepth) return throwStackOverflowExceptionIfNeeded(isolate); RELEASE_ASSERT(!context->isIteratingOverObservers()); @@ -412,7 +411,7 @@ v8::MaybeLocal<v8::Value> V8ScriptRunner::runCompiledScript(v8::Isolate* isolate throwScriptForbiddenException(isolate); return v8::MaybeLocal<v8::Value>(); } - V8RecursionScope recursionScope(isolate); + v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kRunMicrotasks); InspectorInstrumentationCookie cookie = InspectorInstrumentation::willExecuteScript(context, script->GetUnboundScript()->GetId()); result = script->Run(isolate->GetCurrentContext()); InspectorInstrumentation::didExecuteScript(cookie); @@ -430,7 +429,7 @@ v8::MaybeLocal<v8::Value> V8ScriptRunner::compileAndRunInternalScript(v8::Local< TRACE_EVENT0("v8", "v8.run"); TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); - V8RecursionScope::MicrotaskSuppression recursionScope(isolate); + v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunMicrotasks); v8::MaybeLocal<v8::Value> result = script->Run(isolate->GetCurrentContext()); crashIfIsolateIsDead(isolate); return result; @@ -440,7 +439,7 @@ v8::MaybeLocal<v8::Value> V8ScriptRunner::runCompiledInternalScript(v8::Isolate* { TRACE_EVENT0("v8", "v8.run"); TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); - V8RecursionScope::MicrotaskSuppression recursionScope(isolate); + v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunMicrotasks); v8::MaybeLocal<v8::Value> result = script->Run(isolate->GetCurrentContext()); crashIfIsolateIsDead(isolate); return result; @@ -451,7 +450,7 @@ v8::MaybeLocal<v8::Value> V8ScriptRunner::callFunction(v8::Local<v8::Function> f TRACE_EVENT1("devtools.timeline,v8", "FunctionCall", "data", devToolsTraceEventData(isolate, context, function)); TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); - if (V8RecursionScope::recursionLevel(isolate) >= kMaxRecursionDepth) + if (v8::MicrotasksScope::GetCurrentDepth(isolate) >= kMaxRecursionDepth) return v8::MaybeLocal<v8::Value>(throwStackOverflowExceptionIfNeeded(isolate)); RELEASE_ASSERT(!context->isIteratingOverObservers()); @@ -460,7 +459,7 @@ v8::MaybeLocal<v8::Value> V8ScriptRunner::callFunction(v8::Local<v8::Function> f throwScriptForbiddenException(isolate); return v8::MaybeLocal<v8::Value>(); } - V8RecursionScope recursionScope(isolate); + v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kRunMicrotasks); InspectorInstrumentationCookie cookie = InspectorInstrumentation::willExecuteScript(context, function->ScriptId()); v8::MaybeLocal<v8::Value> result = function->Call(isolate->GetCurrentContext(), receiver, argc, args); crashIfIsolateIsDead(isolate); @@ -472,7 +471,7 @@ v8::MaybeLocal<v8::Value> V8ScriptRunner::callInternalFunction(v8::Local<v8::Fun { TRACE_EVENT0("v8", "v8.callFunction"); TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); - V8RecursionScope::MicrotaskSuppression recursionScope(isolate); + v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunMicrotasks); v8::MaybeLocal<v8::Value> result = function->Call(isolate->GetCurrentContext(), receiver, argc, args); crashIfIsolateIsDead(isolate); return result; @@ -483,7 +482,7 @@ v8::MaybeLocal<v8::Object> V8ScriptRunner::instantiateObject(v8::Isolate* isolat TRACE_EVENT0("v8", "v8.newInstance"); TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); - V8RecursionScope::MicrotaskSuppression scope(isolate); + v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunMicrotasks); v8::MaybeLocal<v8::Object> result = objectTemplate->NewInstance(isolate->GetCurrentContext()); crashIfIsolateIsDead(isolate); return result; @@ -494,7 +493,7 @@ v8::MaybeLocal<v8::Object> V8ScriptRunner::instantiateObject(v8::Isolate* isolat TRACE_EVENT0("v8", "v8.newInstance"); TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); - V8RecursionScope::MicrotaskSuppression scope(isolate); + v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunMicrotasks); v8::MaybeLocal<v8::Object> result = function->NewInstance(isolate->GetCurrentContext(), argc, argv); crashIfIsolateIsDead(isolate); return result; @@ -508,7 +507,7 @@ v8::MaybeLocal<v8::Object> V8ScriptRunner::instantiateObjectInDocument(v8::Isola throwScriptForbiddenException(isolate); return v8::MaybeLocal<v8::Object>(); } - V8RecursionScope scope(isolate); + v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kRunMicrotasks); v8::MaybeLocal<v8::Object> result = function->NewInstance(isolate->GetCurrentContext(), argc, argv); crashIfIsolateIsDead(isolate); return result; diff --git a/third_party/WebKit/Source/bindings/core/v8/v8.gypi b/third_party/WebKit/Source/bindings/core/v8/v8.gypi index b11d584..2cfebfa 100644 --- a/third_party/WebKit/Source/bindings/core/v8/v8.gypi +++ b/third_party/WebKit/Source/bindings/core/v8/v8.gypi @@ -42,6 +42,8 @@ 'JSONValuesForV8.cpp', 'JSONValuesForV8.h', 'Maplike.h', + 'Microtask.cpp', + 'Microtask.h', 'NativeValueTraits.h', 'NPV8Object.cpp', 'NPV8Object.h', @@ -159,8 +161,6 @@ 'V8PerIsolateData.cpp', 'V8PerIsolateData.h', 'V8PersistentValueVector.h', - 'V8RecursionScope.cpp', - 'V8RecursionScope.h', 'V8ScriptRunner.cpp', 'V8ScriptRunner.h', 'V8StringResource.cpp', diff --git a/third_party/WebKit/Source/core/core.gypi b/third_party/WebKit/Source/core/core.gypi index 758e5f1..e9c96ab 100644 --- a/third_party/WebKit/Source/core/core.gypi +++ b/third_party/WebKit/Source/core/core.gypi @@ -2476,8 +2476,6 @@ 'dom/MessageChannel.cpp', 'dom/MessageChannel.h', 'dom/MessagePort.cpp', - 'dom/Microtask.cpp', - 'dom/Microtask.h', 'dom/MutationCallback.h', 'dom/MutationObserver.cpp', 'dom/MutationObserver.h', diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp index 4049c86..12c4f9f 100644 --- a/third_party/WebKit/Source/core/dom/Document.cpp +++ b/third_party/WebKit/Source/core/dom/Document.cpp @@ -32,6 +32,7 @@ #include "bindings/core/v8/ExceptionMessages.h" #include "bindings/core/v8/ExceptionState.h" #include "bindings/core/v8/ExceptionStatePlaceholder.h" +#include "bindings/core/v8/Microtask.h" #include "bindings/core/v8/ScriptCallStack.h" #include "bindings/core/v8/ScriptController.h" #include "bindings/core/v8/UnionTypesCore.h" @@ -79,7 +80,6 @@ #include "core/dom/IntersectionObserverController.h" #include "core/dom/LayoutTreeBuilderTraversal.h" #include "core/dom/MainThreadTaskRunner.h" -#include "core/dom/Microtask.h" #include "core/dom/MutationObserver.h" #include "core/dom/NodeChildRemovalTracker.h" #include "core/dom/NodeComputedStyle.h" diff --git a/third_party/WebKit/Source/core/dom/MutationObserver.cpp b/third_party/WebKit/Source/core/dom/MutationObserver.cpp index 17cfe91..af9b35a 100644 --- a/third_party/WebKit/Source/core/dom/MutationObserver.cpp +++ b/third_party/WebKit/Source/core/dom/MutationObserver.cpp @@ -31,8 +31,8 @@ #include "core/dom/MutationObserver.h" #include "bindings/core/v8/ExceptionState.h" +#include "bindings/core/v8/Microtask.h" #include "core/dom/ExceptionCode.h" -#include "core/dom/Microtask.h" #include "core/dom/MutationCallback.h" #include "core/dom/MutationObserverInit.h" #include "core/dom/MutationObserverRegistration.h" diff --git a/third_party/WebKit/Source/core/dom/Node.cpp b/third_party/WebKit/Source/core/dom/Node.cpp index 1e36ff9..04bfecc 100644 --- a/third_party/WebKit/Source/core/dom/Node.cpp +++ b/third_party/WebKit/Source/core/dom/Node.cpp @@ -26,6 +26,7 @@ #include "bindings/core/v8/DOMDataStore.h" #include "bindings/core/v8/ExceptionState.h" +#include "bindings/core/v8/Microtask.h" #include "bindings/core/v8/V8DOMWrapper.h" #include "core/HTMLNames.h" #include "core/css/CSSSelector.h" @@ -44,7 +45,6 @@ #include "core/dom/ElementTraversal.h" #include "core/dom/ExceptionCode.h" #include "core/dom/LayoutTreeBuilderTraversal.h" -#include "core/dom/Microtask.h" #include "core/dom/NodeRareData.h" #include "core/dom/NodeTraversal.h" #include "core/dom/ProcessingInstruction.h" diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementMicrotaskDispatcher.cpp b/third_party/WebKit/Source/core/dom/custom/CustomElementMicrotaskDispatcher.cpp index 2cdd768..8bacf42 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementMicrotaskDispatcher.cpp +++ b/third_party/WebKit/Source/core/dom/custom/CustomElementMicrotaskDispatcher.cpp @@ -4,7 +4,7 @@ #include "core/dom/custom/CustomElementMicrotaskDispatcher.h" -#include "core/dom/Microtask.h" +#include "bindings/core/v8/Microtask.h" #include "core/dom/custom/CustomElementCallbackQueue.h" #include "core/dom/custom/CustomElementMicrotaskImportStep.h" #include "core/dom/custom/CustomElementProcessingStack.h" diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementMicrotaskRunQueue.cpp b/third_party/WebKit/Source/core/dom/custom/CustomElementMicrotaskRunQueue.cpp index 660598a..b1e6643 100644 --- a/third_party/WebKit/Source/core/dom/custom/CustomElementMicrotaskRunQueue.cpp +++ b/third_party/WebKit/Source/core/dom/custom/CustomElementMicrotaskRunQueue.cpp @@ -4,7 +4,7 @@ #include "core/dom/custom/CustomElementMicrotaskRunQueue.h" -#include "core/dom/Microtask.h" +#include "bindings/core/v8/Microtask.h" #include "core/dom/custom/CustomElementAsyncImportMicrotaskQueue.h" #include "core/dom/custom/CustomElementSyncMicrotaskQueue.h" #include "core/html/imports/HTMLImportLoader.h" diff --git a/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp b/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp index ef82805..2779b52 100644 --- a/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp @@ -30,8 +30,8 @@ #include "core/html/HTMLSlotElement.h" +#include "bindings/core/v8/Microtask.h" #include "core/HTMLNames.h" -#include "core/dom/Microtask.h" #include "core/dom/NodeTraversal.h" #include "core/dom/StyleChangeReason.h" #include "core/dom/shadow/ElementShadow.h" diff --git a/third_party/WebKit/Source/core/html/parser/HTMLScriptRunner.cpp b/third_party/WebKit/Source/core/html/parser/HTMLScriptRunner.cpp index e1fd873..8993658 100644 --- a/third_party/WebKit/Source/core/html/parser/HTMLScriptRunner.cpp +++ b/third_party/WebKit/Source/core/html/parser/HTMLScriptRunner.cpp @@ -25,12 +25,12 @@ #include "core/html/parser/HTMLScriptRunner.h" +#include "bindings/core/v8/Microtask.h" #include "bindings/core/v8/ScriptSourceCode.h" #include "bindings/core/v8/V8PerIsolateData.h" #include "core/dom/Element.h" #include "core/events/Event.h" #include "core/dom/IgnoreDestructiveWriteCountIncrementer.h" -#include "core/dom/Microtask.h" #include "core/dom/ScriptLoader.h" #include "core/fetch/ScriptResource.h" #include "core/frame/LocalFrame.h" diff --git a/third_party/WebKit/Source/core/inspector/DevToolsHost.cpp b/third_party/WebKit/Source/core/inspector/DevToolsHost.cpp index fc66082..fa123be 100644 --- a/third_party/WebKit/Source/core/inspector/DevToolsHost.cpp +++ b/third_party/WebKit/Source/core/inspector/DevToolsHost.cpp @@ -30,7 +30,6 @@ #include "core/inspector/DevToolsHost.h" #include "bindings/core/v8/ScriptState.h" -#include "bindings/core/v8/V8RecursionScope.h" #include "bindings/core/v8/V8ScriptRunner.h" #include "core/clipboard/Pasteboard.h" #include "core/dom/ExecutionContext.h" @@ -147,7 +146,7 @@ void DevToolsHost::evaluateScript(const String& expression) return; ScriptState::Scope scope(scriptState); UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture); - V8RecursionScope recursionScope(scriptState->isolate()); + v8::MicrotasksScope microtasks(scriptState->isolate(), v8::MicrotasksScope::kRunMicrotasks); v8::Local<v8::String> source = v8AtomicString(scriptState->isolate(), expression.utf8().data()); V8ScriptRunner::compileAndRunInternalScript(source, scriptState->isolate(), String(), TextPosition()); } diff --git a/third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp b/third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp index cf188fa..b885df2 100644 --- a/third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp +++ b/third_party/WebKit/Source/core/inspector/ThreadDebugger.cpp @@ -11,10 +11,8 @@ #include "bindings/core/v8/V8HTMLCollection.h" #include "bindings/core/v8/V8Node.h" #include "bindings/core/v8/V8NodeList.h" -#include "bindings/core/v8/V8RecursionScope.h" -#include "bindings/core/v8/V8ScriptRunner.h" -#include "core/dom/Microtask.h" #include "core/inspector/InspectorDOMDebuggerAgent.h" +#include "platform/ScriptForbiddenScope.h" #include "wtf/CurrentTime.h" namespace blink { @@ -34,31 +32,6 @@ void ThreadDebugger::eventListeners(v8::Local<v8::Value> value, V8EventListenerI InspectorDOMDebuggerAgent::eventListenersInfoForTarget(m_isolate, value, result); } -v8::MaybeLocal<v8::Object> ThreadDebugger::instantiateObject(v8::Local<v8::Function> function) -{ - return V8ScriptRunner::instantiateObject(m_isolate, function); -} - -v8::MaybeLocal<v8::Value> ThreadDebugger::runCompiledScript(v8::Local<v8::Context> context, v8::Local<v8::Script> script) -{ - return V8ScriptRunner::runCompiledScript(m_isolate, script, toExecutionContext(context)); -} - -v8::MaybeLocal<v8::Value> ThreadDebugger::compileAndRunInternalScript(v8::Local<v8::String> script) -{ - return V8ScriptRunner::compileAndRunInternalScript(script, m_isolate); -} - -v8::MaybeLocal<v8::Value> ThreadDebugger::callFunction(v8::Local<v8::Function> function, v8::Local<v8::Context> context, v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> info[]) -{ - return V8ScriptRunner::callFunction(function, toExecutionContext(context), receiver, argc, info, m_isolate); -} - -v8::MaybeLocal<v8::Value> ThreadDebugger::callInternalFunction(v8::Local<v8::Function> function, v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> info[]) -{ - return V8ScriptRunner::callInternalFunction(function, receiver, argc, info, m_isolate); -} - String16 ThreadDebugger::valueSubtype(v8::Local<v8::Value> value) { if (V8Node::hasInstance(value, m_isolate)) @@ -81,7 +54,12 @@ bool ThreadDebugger::formatAccessorsAsProperties(v8::Local<v8::Value> value) bool ThreadDebugger::hasRecursionLevel() { - return !!V8RecursionScope::recursionLevel(m_isolate); + return !!v8::MicrotasksScope::GetCurrentDepth(m_isolate); +} + +bool ThreadDebugger::isExecutionAllowed() +{ + return !ScriptForbiddenScope::isScriptForbidden(); } double ThreadDebugger::currentTimeMS() diff --git a/third_party/WebKit/Source/core/inspector/ThreadDebugger.h b/third_party/WebKit/Source/core/inspector/ThreadDebugger.h index 19eec3e..5ae90bf 100644 --- a/third_party/WebKit/Source/core/inspector/ThreadDebugger.h +++ b/third_party/WebKit/Source/core/inspector/ThreadDebugger.h @@ -26,14 +26,10 @@ public: void muteWarningsAndDeprecations() override { }; void unmuteWarningsAndDeprecations() override { }; void eventListeners(v8::Local<v8::Value>, V8EventListenerInfoList&) override; - v8::MaybeLocal<v8::Object> instantiateObject(v8::Local<v8::Function>) override; - v8::MaybeLocal<v8::Value> runCompiledScript(v8::Local<v8::Context>, v8::Local<v8::Script>) override; - v8::MaybeLocal<v8::Value> compileAndRunInternalScript(v8::Local<v8::String>) override; - v8::MaybeLocal<v8::Value> callFunction(v8::Local<v8::Function>, v8::Local<v8::Context>, v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> info[]) override; - v8::MaybeLocal<v8::Value> callInternalFunction(v8::Local<v8::Function>, v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> info[]) override; String16 valueSubtype(v8::Local<v8::Value>) override; bool formatAccessorsAsProperties(v8::Local<v8::Value>) override; bool hasRecursionLevel() override; + bool isExecutionAllowed() override; double currentTimeMS() override; V8Debugger* debugger() const { return m_debugger.get(); } diff --git a/third_party/WebKit/Source/core/loader/ImageLoader.cpp b/third_party/WebKit/Source/core/loader/ImageLoader.cpp index 98e3431..4cb1edf 100644 --- a/third_party/WebKit/Source/core/loader/ImageLoader.cpp +++ b/third_party/WebKit/Source/core/loader/ImageLoader.cpp @@ -21,6 +21,7 @@ #include "core/loader/ImageLoader.h" +#include "bindings/core/v8/Microtask.h" #include "bindings/core/v8/ScriptController.h" #include "bindings/core/v8/ScriptState.h" #include "bindings/core/v8/V8Binding.h" @@ -28,7 +29,6 @@ #include "core/dom/Document.h" #include "core/dom/Element.h" #include "core/dom/IncrementLoadEventDelayCount.h" -#include "core/dom/Microtask.h" #include "core/events/Event.h" #include "core/events/EventSender.h" #include "core/fetch/FetchRequest.h" diff --git a/third_party/WebKit/Source/core/workers/WorkerThread.cpp b/third_party/WebKit/Source/core/workers/WorkerThread.cpp index 9a6f109..c3eb7a7 100644 --- a/third_party/WebKit/Source/core/workers/WorkerThread.cpp +++ b/third_party/WebKit/Source/core/workers/WorkerThread.cpp @@ -26,11 +26,11 @@ #include "core/workers/WorkerThread.h" +#include "bindings/core/v8/Microtask.h" #include "bindings/core/v8/ScriptSourceCode.h" #include "bindings/core/v8/V8GCController.h" #include "bindings/core/v8/V8IdleTaskRunner.h" #include "bindings/core/v8/V8Initializer.h" -#include "core/dom/Microtask.h" #include "core/inspector/InspectorInstrumentation.h" #include "core/inspector/InspectorTaskRunner.h" #include "core/workers/DedicatedWorkerGlobalScope.h" diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js index a69268d..f198907 100644 --- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js +++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js @@ -469,7 +469,13 @@ WebInspector.TimelineUIUtils.buildDetailsTextForTraceEvent = function(event, tar function linkifyTopCallFrameAsText() { var frame = WebInspector.TimelineUIUtils.topStackFrame(event); - return frame ? linkifyLocationAsText(frame.scriptId, frame.lineNumber, frame.columnNumber) : null; + var text = frame ? linkifyLocationAsText(frame.scriptId, frame.lineNumber, frame.columnNumber) : null; + if (frame && !text) { + text = frame.url; + if (typeof frame.lineNumber === "number") + text += ":" + (frame.lineNumber + 1); + } + return text; } } diff --git a/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.cpp b/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.cpp index f15d54a..49b0d62 100644 --- a/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.cpp +++ b/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.cpp @@ -12,7 +12,6 @@ #include "bindings/core/v8/ScriptValue.h" #include "bindings/core/v8/V8BindingMacros.h" #include "bindings/core/v8/V8IteratorResultValue.h" -#include "bindings/core/v8/V8RecursionScope.h" #include "bindings/core/v8/V8Uint8Array.h" #include "core/dom/DOMTypedArray.h" #include "public/platform/Platform.h" diff --git a/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandleTest.cpp b/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandleTest.cpp index 00c3fa6..5955359 100644 --- a/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandleTest.cpp +++ b/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandleTest.cpp @@ -8,7 +8,6 @@ #include "bindings/core/v8/ScriptState.h" #include "bindings/core/v8/V8BindingMacros.h" #include "bindings/core/v8/V8GCController.h" -#include "bindings/core/v8/V8RecursionScope.h" #include "core/dom/Document.h" #include "core/testing/DummyPageHolder.h" #include "modules/fetch/DataConsumerHandleTestUtil.h" @@ -60,7 +59,7 @@ public: { v8::Local<v8::String> source; v8::Local<v8::Script> script; - V8RecursionScope::MicrotaskSuppression microtasks(isolate()); + v8::MicrotasksScope microtasks(isolate(), v8::MicrotasksScope::kDoNotRunMicrotasks); if (!v8Call(v8::String::NewFromUtf8(isolate(), s, v8::NewStringType::kNormal), source)) { ADD_FAILURE(); return v8::MaybeLocal<v8::Value>(); diff --git a/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp b/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp index ebc6f23..242a318 100644 --- a/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp +++ b/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp @@ -33,6 +33,7 @@ #include "bindings/core/v8/ArrayValue.h" #include "bindings/core/v8/ExceptionMessages.h" #include "bindings/core/v8/ExceptionState.h" +#include "bindings/core/v8/Microtask.h" #include "bindings/core/v8/Nullable.h" #include "bindings/core/v8/ScriptPromiseResolver.h" #include "bindings/core/v8/ScriptState.h" @@ -43,7 +44,6 @@ #include "core/dom/Document.h" #include "core/dom/ExceptionCode.h" #include "core/dom/ExecutionContext.h" -#include "core/dom/Microtask.h" #include "core/frame/Deprecation.h" #include "core/frame/LocalFrame.h" #include "core/html/VoidCallback.h" diff --git a/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp b/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp index ba26c81..dc59c7a 100644 --- a/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp +++ b/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp @@ -36,6 +36,7 @@ #include "platform/v8_inspector/InjectedScriptHost.h" #include "platform/v8_inspector/InjectedScriptManager.h" #include "platform/v8_inspector/RemoteObjectId.h" +#include "platform/v8_inspector/V8DebuggerImpl.h" #include "platform/v8_inspector/V8FunctionCall.h" #include "platform/v8_inspector/V8StringUtil.h" #include "platform/v8_inspector/public/V8Debugger.h" @@ -115,12 +116,11 @@ static void weakCallback(const v8::WeakCallbackInfo<InjectedScript>& data) data.GetParameter()->dispose(); } -InjectedScript::InjectedScript(InjectedScriptManager* manager, v8::Local<v8::Context> context, v8::Local<v8::Object> object, V8DebuggerClient* client, PassOwnPtr<InjectedScriptNative> injectedScriptNative, int contextId) +InjectedScript::InjectedScript(InjectedScriptManager* manager, v8::Local<v8::Context> context, v8::Local<v8::Object> object, PassOwnPtr<InjectedScriptNative> injectedScriptNative, int contextId) : m_manager(manager) , m_isolate(context->GetIsolate()) , m_context(m_isolate, context) , m_value(m_isolate, object) - , m_client(client) , m_native(injectedScriptNative) , m_contextId(contextId) { @@ -134,7 +134,7 @@ InjectedScript::~InjectedScript() void InjectedScript::evaluate(ErrorString* errorString, const String16& expression, const String16& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, OwnPtr<protocol::Runtime::RemoteObject>* result, Maybe<bool>* wasThrown, Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails) { v8::HandleScope handles(m_isolate); - V8FunctionCall function(m_client, context(), v8Value(), "evaluate"); + V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "evaluate"); function.appendArgument(expression); function.appendArgument(objectGroup); function.appendArgument(includeCommandLineAPI); @@ -146,7 +146,7 @@ void InjectedScript::evaluate(ErrorString* errorString, const String16& expressi void InjectedScript::callFunctionOn(ErrorString* errorString, const String16& objectId, const String16& expression, const String16& arguments, bool returnByValue, bool generatePreview, OwnPtr<protocol::Runtime::RemoteObject>* result, Maybe<bool>* wasThrown) { v8::HandleScope handles(m_isolate); - V8FunctionCall function(m_client, context(), v8Value(), "callFunctionOn"); + V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "callFunctionOn"); function.appendArgument(objectId); function.appendArgument(expression); function.appendArgument(arguments); @@ -158,7 +158,7 @@ void InjectedScript::callFunctionOn(ErrorString* errorString, const String16& ob void InjectedScript::evaluateOnCallFrame(ErrorString* errorString, v8::Local<v8::Object> callFrames, const String16& callFrameId, const String16& expression, const String16& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, OwnPtr<RemoteObject>* result, Maybe<bool>* wasThrown, Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails) { v8::HandleScope handles(m_isolate); - V8FunctionCall function(m_client, context(), v8Value(), "evaluateOnCallFrame"); + V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "evaluateOnCallFrame"); function.appendArgument(callFrames); function.appendArgument(callFrameId); function.appendArgument(expression); @@ -172,7 +172,7 @@ void InjectedScript::evaluateOnCallFrame(ErrorString* errorString, v8::Local<v8: void InjectedScript::restartFrame(ErrorString* errorString, v8::Local<v8::Object> callFrames, const String16& callFrameId) { v8::HandleScope handles(m_isolate); - V8FunctionCall function(m_client, context(), v8Value(), "restartFrame"); + V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "restartFrame"); function.appendArgument(callFrames); function.appendArgument(callFrameId); OwnPtr<protocol::Value> resultValue = makeCall(function); @@ -197,7 +197,7 @@ void InjectedScript::setVariableValue(ErrorString* errorString, const String16& newValueStr) { v8::HandleScope handles(m_isolate); - V8FunctionCall function(m_client, context(), v8Value(), "setVariableValue"); + V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "setVariableValue"); if (callFrameIdOpt.isJust()) { function.appendArgument(callFrames); function.appendArgument(callFrameIdOpt.fromJust()); @@ -227,7 +227,7 @@ void InjectedScript::setVariableValue(ErrorString* errorString, void InjectedScript::getFunctionDetails(ErrorString* errorString, const String16& functionId, OwnPtr<FunctionDetails>* result) { v8::HandleScope handles(m_isolate); - V8FunctionCall function(m_client, context(), v8Value(), "getFunctionDetails"); + V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "getFunctionDetails"); function.appendArgument(functionId); OwnPtr<protocol::Value> resultValue = makeCall(function); protocol::ErrorSupport errors(errorString); @@ -237,7 +237,7 @@ void InjectedScript::getFunctionDetails(ErrorString* errorString, const String16 void InjectedScript::getGeneratorObjectDetails(ErrorString* errorString, const String16& objectId, OwnPtr<GeneratorObjectDetails>* result) { v8::HandleScope handles(m_isolate); - V8FunctionCall function(m_client, context(), v8Value(), "getGeneratorObjectDetails"); + V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "getGeneratorObjectDetails"); function.appendArgument(objectId); OwnPtr<protocol::Value> resultValue = makeCall(function); protocol::ErrorSupport errors(errorString); @@ -247,7 +247,7 @@ void InjectedScript::getGeneratorObjectDetails(ErrorString* errorString, const S void InjectedScript::getCollectionEntries(ErrorString* errorString, const String16& objectId, OwnPtr<Array<CollectionEntry>>* result) { v8::HandleScope handles(m_isolate); - V8FunctionCall function(m_client, context(), v8Value(), "getCollectionEntries"); + V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "getCollectionEntries"); function.appendArgument(objectId); OwnPtr<protocol::Value> resultValue = makeCall(function); protocol::ErrorSupport errors(errorString); @@ -257,7 +257,7 @@ void InjectedScript::getCollectionEntries(ErrorString* errorString, const String void InjectedScript::getProperties(ErrorString* errorString, const String16& objectId, bool ownProperties, bool accessorPropertiesOnly, bool generatePreview, OwnPtr<Array<PropertyDescriptor>>* properties, Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails) { v8::HandleScope handles(m_isolate); - V8FunctionCall function(m_client, context(), v8Value(), "getProperties"); + V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "getProperties"); function.appendArgument(objectId); function.appendArgument(ownProperties); function.appendArgument(accessorPropertiesOnly); @@ -276,7 +276,7 @@ void InjectedScript::getProperties(ErrorString* errorString, const String16& obj void InjectedScript::getInternalProperties(ErrorString* errorString, const String16& objectId, Maybe<Array<InternalPropertyDescriptor>>* properties, Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails) { v8::HandleScope handles(m_isolate); - V8FunctionCall function(m_client, context(), v8Value(), "getInternalProperties"); + V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "getInternalProperties"); function.appendArgument(objectId); OwnPtr<protocol::Value> result = makeCallWithExceptionDetails(function, exceptionDetails); @@ -307,14 +307,14 @@ v8::MaybeLocal<v8::Value> InjectedScript::runCompiledScript(v8::Local<v8::Script v8::Local<v8::Symbol> commandLineAPISymbolValue = V8Debugger::commandLineAPISymbol(m_isolate); v8::Local<v8::Object> global = context()->Global(); if (includeCommandLineAPI) { - V8FunctionCall function(m_client, context(), v8Value(), "commandLineAPI"); + V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "commandLineAPI"); bool hadException = false; v8::Local<v8::Value> commandLineAPI = function.call(hadException, false); if (!hadException) global->Set(commandLineAPISymbolValue, commandLineAPI); } - v8::MaybeLocal<v8::Value> maybeValue = m_client->runCompiledScript(context(), script); + v8::MaybeLocal<v8::Value> maybeValue = m_manager->debugger()->runCompiledScript(context(), script); if (includeCommandLineAPI) global->Delete(context(), commandLineAPISymbolValue); @@ -324,7 +324,7 @@ v8::MaybeLocal<v8::Value> InjectedScript::runCompiledScript(v8::Local<v8::Script PassOwnPtr<Array<CallFrame>> InjectedScript::wrapCallFrames(v8::Local<v8::Object> callFrames) { v8::HandleScope handles(m_isolate); - V8FunctionCall function(m_client, context(), v8Value(), "wrapCallFrames"); + V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "wrapCallFrames"); function.appendArgument(callFrames); bool hadException = false; v8::Local<v8::Value> callFramesValue = callFunctionWithEvalEnabled(function, hadException); @@ -339,7 +339,7 @@ PassOwnPtr<Array<CallFrame>> InjectedScript::wrapCallFrames(v8::Local<v8::Object PassOwnPtr<protocol::Runtime::RemoteObject> InjectedScript::wrapObject(v8::Local<v8::Value> value, const String16& groupName, bool generatePreview) const { v8::HandleScope handles(m_isolate); - V8FunctionCall function(m_client, context(), v8Value(), "wrapObject"); + V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "wrapObject"); function.appendArgument(value); function.appendArgument(groupName); function.appendArgument(canAccessInspectedWindow()); @@ -355,7 +355,7 @@ PassOwnPtr<protocol::Runtime::RemoteObject> InjectedScript::wrapObject(v8::Local PassOwnPtr<protocol::Runtime::RemoteObject> InjectedScript::wrapTable(v8::Local<v8::Value> table, v8::Local<v8::Value> columns) const { v8::HandleScope handles(m_isolate); - V8FunctionCall function(m_client, context(), v8Value(), "wrapTable"); + V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "wrapTable"); function.appendArgument(canAccessInspectedWindow()); function.appendArgument(table); if (columns.IsEmpty()) @@ -385,7 +385,7 @@ void InjectedScript::releaseObjectGroup(const String16& objectGroup) v8::HandleScope handles(m_isolate); m_native->releaseObjectGroup(objectGroup); if (objectGroup == "console") { - V8FunctionCall function(m_client, context(), v8Value(), "clearLastEvaluationResult"); + V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "clearLastEvaluationResult"); bool hadException = false; callFunctionWithEvalEnabled(function, hadException); ASSERT(!hadException); @@ -395,7 +395,7 @@ void InjectedScript::releaseObjectGroup(const String16& objectGroup) void InjectedScript::setCustomObjectFormatterEnabled(bool enabled) { v8::HandleScope handles(m_isolate); - V8FunctionCall function(m_client, context(), v8Value(), "setCustomObjectFormatterEnabled"); + V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "setCustomObjectFormatterEnabled"); function.appendArgument(enabled); makeCall(function); } @@ -405,7 +405,7 @@ bool InjectedScript::canAccessInspectedWindow() const v8::Local<v8::Context> callingContext = m_isolate->GetCallingContext(); if (callingContext.IsEmpty()) return true; - return m_client->callingContextCanAccessContext(callingContext, context()); + return m_manager->debugger()->client()->callingContextCanAccessContext(callingContext, context()); } v8::Local<v8::Context> InjectedScript::context() const diff --git a/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.h b/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.h index b5b9487..4532745 100644 --- a/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.h +++ b/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.h @@ -41,7 +41,6 @@ namespace blink { class InjectedScriptManager; class RemoteObjectId; class V8FunctionCall; -class V8DebuggerClient; namespace protocol { class DictionaryValue; @@ -114,7 +113,7 @@ public: private: friend InjectedScript* InjectedScriptManager::injectedScriptFor(v8::Local<v8::Context>); - InjectedScript(InjectedScriptManager*, v8::Local<v8::Context>, v8::Local<v8::Object>, V8DebuggerClient*, PassOwnPtr<InjectedScriptNative>, int contextId); + InjectedScript(InjectedScriptManager*, v8::Local<v8::Context>, v8::Local<v8::Object>, PassOwnPtr<InjectedScriptNative>, int contextId); bool canAccessInspectedWindow() const; v8::Local<v8::Value> v8Value() const; @@ -127,7 +126,6 @@ private: v8::Isolate* m_isolate; v8::Global<v8::Context> m_context; v8::Global<v8::Value> m_value; - V8DebuggerClient* m_client; OwnPtr<InjectedScriptNative> m_native; int m_contextId; String16 m_origin; diff --git a/third_party/WebKit/Source/platform/v8_inspector/InjectedScriptManager.cpp b/third_party/WebKit/Source/platform/v8_inspector/InjectedScriptManager.cpp index 9ea7977..38181c5 100644 --- a/third_party/WebKit/Source/platform/v8_inspector/InjectedScriptManager.cpp +++ b/third_party/WebKit/Source/platform/v8_inspector/InjectedScriptManager.cpp @@ -51,7 +51,7 @@ PassOwnPtr<InjectedScriptManager> InjectedScriptManager::create(V8DebuggerImpl* InjectedScriptManager::InjectedScriptManager(V8DebuggerImpl* debugger) : m_injectedScriptHost(InjectedScriptHost::create(debugger)) , m_customObjectFormatterEnabled(false) - , m_client(debugger->client()) + , m_debugger(debugger) { } @@ -125,14 +125,14 @@ InjectedScript* InjectedScriptManager::injectedScriptFor(v8::Local<v8::Context> return it->second; v8::Local<v8::Context> callingContext = context->GetIsolate()->GetCallingContext(); - if (!callingContext.IsEmpty() && !m_client->callingContextCanAccessContext(callingContext, context)) + if (!callingContext.IsEmpty() && !m_debugger->client()->callingContextCanAccessContext(callingContext, context)) return nullptr; OwnPtr<InjectedScriptNative> injectedScriptNative = adoptPtr(new InjectedScriptNative(context->GetIsolate())); String16 injectedScriptSource(reinterpret_cast<const char*>(InjectedScriptSource_js), sizeof(InjectedScriptSource_js)); v8::Local<v8::Object> object = createInjectedScript(injectedScriptSource, context, contextId, injectedScriptNative.get()); - OwnPtr<InjectedScript> result = adoptPtr(new InjectedScript(this, context, object, m_client, injectedScriptNative.release(), contextId)); + OwnPtr<InjectedScript> result = adoptPtr(new InjectedScript(this, context, object, injectedScriptNative.release(), contextId)); InjectedScript* resultPtr = result.get(); if (m_customObjectFormatterEnabled) result->setCustomObjectFormatterEnabled(m_customObjectFormatterEnabled); @@ -152,7 +152,7 @@ v8::Local<v8::Object> InjectedScriptManager::createInjectedScript(const String16 m_injectedScriptHost->setWrapperTemplate(wrapperTemplate, isolate); } - v8::Local<v8::Object> scriptHostWrapper = V8InjectedScriptHost::wrap(m_client, wrapperTemplate, context, m_injectedScriptHost.get()); + v8::Local<v8::Object> scriptHostWrapper = V8InjectedScriptHost::wrap(wrapperTemplate, context, m_injectedScriptHost.get()); if (scriptHostWrapper.IsEmpty()) return v8::Local<v8::Object>(); @@ -164,14 +164,15 @@ v8::Local<v8::Object> InjectedScriptManager::createInjectedScript(const String16 // injected script id and explicit reference to the inspected global object. The function is expected // to create and configure InjectedScript instance that is going to be used by the inspector. v8::Local<v8::Value> value; - if (!m_client->compileAndRunInternalScript(toV8String(isolate, source)).ToLocal(&value)) + if (!m_debugger->compileAndRunInternalScript(context, toV8String(isolate, source)).ToLocal(&value)) return v8::Local<v8::Object>(); ASSERT(value->IsFunction()); - + v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(value); v8::Local<v8::Object> windowGlobal = context->Global(); v8::Local<v8::Value> info[] = { scriptHostWrapper, windowGlobal, v8::Number::New(context->GetIsolate(), id) }; + v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunMicrotasks); v8::Local<v8::Value> injectedScriptValue; - if (!m_client->callInternalFunction(v8::Local<v8::Function>::Cast(value), windowGlobal, WTF_ARRAY_LENGTH(info), info).ToLocal(&injectedScriptValue)) + if (!function->Call(context, windowGlobal, WTF_ARRAY_LENGTH(info), info).ToLocal(&injectedScriptValue)) return v8::Local<v8::Object>(); if (!injectedScriptValue->IsObject()) return v8::Local<v8::Object>(); diff --git a/third_party/WebKit/Source/platform/v8_inspector/InjectedScriptManager.h b/third_party/WebKit/Source/platform/v8_inspector/InjectedScriptManager.h index a1042c3..4e5bd31 100644 --- a/third_party/WebKit/Source/platform/v8_inspector/InjectedScriptManager.h +++ b/third_party/WebKit/Source/platform/v8_inspector/InjectedScriptManager.h @@ -51,6 +51,7 @@ public: ~InjectedScriptManager(); InjectedScriptHost* injectedScriptHost(); + V8DebuggerImpl* debugger() { return m_debugger; } InjectedScript* injectedScriptFor(v8::Local<v8::Context>); InjectedScript* findInjectedScript(int) const; @@ -70,7 +71,7 @@ private: IdToInjectedScriptMap m_idToInjectedScript; OwnPtr<InjectedScriptHost> m_injectedScriptHost; bool m_customObjectFormatterEnabled; - V8DebuggerClient* m_client; + V8DebuggerImpl* m_debugger; }; } // namespace blink diff --git a/third_party/WebKit/Source/platform/v8_inspector/InspectorWrapper.cpp b/third_party/WebKit/Source/platform/v8_inspector/InspectorWrapper.cpp index e8277ba..9e1092a 100644 --- a/third_party/WebKit/Source/platform/v8_inspector/InspectorWrapper.cpp +++ b/third_party/WebKit/Source/platform/v8_inspector/InspectorWrapper.cpp @@ -32,14 +32,14 @@ v8::Local<v8::FunctionTemplate> InspectorWrapperBase::createWrapperTemplate(v8:: return functionTemplate; } -v8::Local<v8::Object> InspectorWrapperBase::createWrapper(V8DebuggerClient* client, v8::Local<v8::FunctionTemplate> constructorTemplate, v8::Local<v8::Context> context) +v8::Local<v8::Object> InspectorWrapperBase::createWrapper(v8::Local<v8::FunctionTemplate> constructorTemplate, v8::Local<v8::Context> context) { v8::Local<v8::Function> function; if (!constructorTemplate->GetFunction(context).ToLocal(&function)) return v8::Local<v8::Object>(); v8::Local<v8::Object> result; - if (!client->instantiateObject(function).ToLocal(&result)) + if (!function->NewInstance(context).ToLocal(&result)) return v8::Local<v8::Object>(); return result; } diff --git a/third_party/WebKit/Source/platform/v8_inspector/InspectorWrapper.h b/third_party/WebKit/Source/platform/v8_inspector/InspectorWrapper.h index f13c507..ab393f9 100644 --- a/third_party/WebKit/Source/platform/v8_inspector/InspectorWrapper.h +++ b/third_party/WebKit/Source/platform/v8_inspector/InspectorWrapper.h @@ -11,8 +11,6 @@ namespace blink { -class V8DebuggerClient; - class InspectorWrapperBase { public: struct V8MethodConfiguration { @@ -28,7 +26,7 @@ public: static v8::Local<v8::FunctionTemplate> createWrapperTemplate(v8::Isolate*, const char* className, const protocol::Vector<V8MethodConfiguration>& methods, const protocol::Vector<V8AttributeConfiguration>& attributes); protected: - static v8::Local<v8::Object> createWrapper(V8DebuggerClient*, v8::Local<v8::FunctionTemplate>, v8::Local<v8::Context>); + static v8::Local<v8::Object> createWrapper(v8::Local<v8::FunctionTemplate>, v8::Local<v8::Context>); static void* unwrap(v8::Local<v8::Context>, v8::Local<v8::Object>, const char* name); static v8::Local<v8::String> v8InternalizedString(v8::Isolate*, const char* name); @@ -71,10 +69,10 @@ public: return InspectorWrapperBase::createWrapperTemplate(isolate, className, methods, attributes); } - static v8::Local<v8::Object> wrap(V8DebuggerClient* client, v8::Local<v8::FunctionTemplate> constructorTemplate, v8::Local<v8::Context> context, T* object) + static v8::Local<v8::Object> wrap(v8::Local<v8::FunctionTemplate> constructorTemplate, v8::Local<v8::Context> context, T* object) { v8::Context::Scope contextScope(context); - v8::Local<v8::Object> result = InspectorWrapperBase::createWrapper(client, constructorTemplate, context); + v8::Local<v8::Object> result = InspectorWrapperBase::createWrapper(constructorTemplate, context); if (result.IsEmpty()) return v8::Local<v8::Object>(); v8::Isolate* isolate = context->GetIsolate(); @@ -85,10 +83,10 @@ public: return result; } - static v8::Local<v8::Object> wrap(V8DebuggerClient* client, v8::Local<v8::FunctionTemplate> constructorTemplate, v8::Local<v8::Context> context, PassOwnPtr<T> object) + static v8::Local<v8::Object> wrap(v8::Local<v8::FunctionTemplate> constructorTemplate, v8::Local<v8::Context> context, PassOwnPtr<T> object) { v8::Context::Scope contextScope(context); - v8::Local<v8::Object> result = InspectorWrapperBase::createWrapper(client, constructorTemplate, context); + v8::Local<v8::Object> result = InspectorWrapperBase::createWrapper(constructorTemplate, context); if (result.IsEmpty()) return v8::Local<v8::Object>(); v8::Isolate* isolate = context->GetIsolate(); diff --git a/third_party/WebKit/Source/platform/v8_inspector/JavaScriptCallFrame.cpp b/third_party/WebKit/Source/platform/v8_inspector/JavaScriptCallFrame.cpp index 6222e7d..299b11c 100644 --- a/third_party/WebKit/Source/platform/v8_inspector/JavaScriptCallFrame.cpp +++ b/third_party/WebKit/Source/platform/v8_inspector/JavaScriptCallFrame.cpp @@ -31,15 +31,13 @@ #include "platform/v8_inspector/JavaScriptCallFrame.h" #include "platform/v8_inspector/V8StringUtil.h" -#include "platform/v8_inspector/public/V8DebuggerClient.h" #include <v8-debug.h> namespace blink { -JavaScriptCallFrame::JavaScriptCallFrame(V8DebuggerClient* client, v8::Local<v8::Context> debuggerContext, v8::Local<v8::Object> callFrame) - : m_client(client) - , m_isolate(debuggerContext->GetIsolate()) +JavaScriptCallFrame::JavaScriptCallFrame(v8::Local<v8::Context> debuggerContext, v8::Local<v8::Object> callFrame) + : m_isolate(debuggerContext->GetIsolate()) , m_debuggerContext(m_isolate, debuggerContext) , m_callFrame(m_isolate, callFrame) { @@ -53,21 +51,20 @@ PassOwnPtr<JavaScriptCallFrame> JavaScriptCallFrame::caller() { v8::HandleScope handleScope(m_isolate); v8::Local<v8::Context> debuggerContext = v8::Local<v8::Context>::New(m_isolate, m_debuggerContext); - v8::Context::Scope contextScope(debuggerContext); v8::Local<v8::Value> callerFrame = v8::Local<v8::Object>::New(m_isolate, m_callFrame)->Get(toV8StringInternalized(m_isolate, "caller")); if (callerFrame.IsEmpty() || !callerFrame->IsObject()) return 0; - return JavaScriptCallFrame::create(m_client, debuggerContext, v8::Local<v8::Object>::Cast(callerFrame)); + return JavaScriptCallFrame::create(debuggerContext, v8::Local<v8::Object>::Cast(callerFrame)); } int JavaScriptCallFrame::callV8FunctionReturnInt(const char* name) const { v8::HandleScope handleScope(m_isolate); - v8::Context::Scope contextScope(v8::Local<v8::Context>::New(m_isolate, m_debuggerContext)); + v8::Local<v8::Context> context = v8::Local<v8::Context>::New(m_isolate, m_debuggerContext); v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_callFrame); v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(toV8StringInternalized(m_isolate, name))); v8::Local<v8::Value> result; - if (!m_client->callInternalFunction(func, callFrame, 0, nullptr).ToLocal(&result) || !result->IsInt32()) + if (!func->Call(context, callFrame, 0, nullptr).ToLocal(&result) || !result->IsInt32()) return 0; return result.As<v8::Int32>()->Value(); } @@ -75,11 +72,11 @@ int JavaScriptCallFrame::callV8FunctionReturnInt(const char* name) const String16 JavaScriptCallFrame::callV8FunctionReturnString(const char* name) const { v8::HandleScope handleScope(m_isolate); - v8::Context::Scope contextScope(v8::Local<v8::Context>::New(m_isolate, m_debuggerContext)); + v8::Local<v8::Context> context = v8::Local<v8::Context>::New(m_isolate, m_debuggerContext); v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_callFrame); v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(toV8StringInternalized(m_isolate, name))); v8::Local<v8::Value> result; - if (!m_client->callInternalFunction(func, callFrame, 0, nullptr).ToLocal(&result)) + if (!func->Call(context, callFrame, 0, nullptr).ToLocal(&result)) return String16(); return toProtocolStringWithTypeCheck(result); } @@ -123,7 +120,7 @@ v8::Local<v8::Value> JavaScriptCallFrame::scopeChain() const { v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_callFrame); v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(toV8StringInternalized(m_isolate, "scopeChain"))); - v8::Local<v8::Array> scopeChain = v8::Local<v8::Array>::Cast(m_client->callInternalFunction(func, callFrame, 0, nullptr).ToLocalChecked()); + v8::Local<v8::Array> scopeChain = v8::Local<v8::Array>::Cast(func->Call(m_isolate->GetCurrentContext(), callFrame, 0, nullptr).ToLocalChecked()); v8::Local<v8::Array> result = v8::Array::New(m_isolate, scopeChain->Length()); for (uint32_t i = 0; i < scopeChain->Length(); i++) result->Set(i, scopeChain->Get(i)); @@ -134,7 +131,7 @@ int JavaScriptCallFrame::scopeType(int scopeIndex) const { v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_callFrame); v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(toV8StringInternalized(m_isolate, "scopeType"))); - v8::Local<v8::Array> scopeType = v8::Local<v8::Array>::Cast(m_client->callInternalFunction(func, callFrame, 0, nullptr).ToLocalChecked()); + v8::Local<v8::Array> scopeType = v8::Local<v8::Array>::Cast(func->Call(m_isolate->GetCurrentContext(), callFrame, 0, nullptr).ToLocalChecked()); return scopeType->Get(scopeIndex)->Int32Value(); } @@ -142,7 +139,7 @@ v8::Local<v8::String> JavaScriptCallFrame::scopeName(int scopeIndex) const { v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_callFrame); v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(toV8StringInternalized(m_isolate, "scopeName"))); - v8::Local<v8::Array> scopeType = v8::Local<v8::Array>::Cast(m_client->callInternalFunction(func, callFrame, 0, nullptr).ToLocalChecked()); + v8::Local<v8::Array> scopeType = v8::Local<v8::Array>::Cast(func->Call(m_isolate->GetCurrentContext(), callFrame, 0, nullptr).ToLocalChecked()); return scopeType->Get(scopeIndex)->ToString(); } @@ -160,7 +157,7 @@ v8::Local<v8::Value> JavaScriptCallFrame::callScopeLocationFunction(const char* { v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_callFrame); v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(toV8StringInternalized(m_isolate, name))); - v8::Local<v8::Array> locations = v8::Local<v8::Array>::Cast(m_client->callInternalFunction(func, callFrame, 0, nullptr).ToLocalChecked()); + v8::Local<v8::Array> locations = v8::Local<v8::Array>::Cast(func->Call(m_isolate->GetCurrentContext(), callFrame, 0, nullptr).ToLocalChecked()); return locations->Get(scopeIndex); } @@ -177,7 +174,6 @@ String16 JavaScriptCallFrame::stepInPositions() const bool JavaScriptCallFrame::isAtReturn() const { v8::HandleScope handleScope(m_isolate); - v8::Context::Scope contextScope(v8::Local<v8::Context>::New(m_isolate, m_debuggerContext)); v8::Local<v8::Value> result = v8::Local<v8::Object>::New(m_isolate, m_callFrame)->Get(toV8StringInternalized(m_isolate, "isAtReturn")); if (result.IsEmpty() || !result->IsBoolean()) return false; @@ -200,7 +196,7 @@ v8::Local<v8::Value> JavaScriptCallFrame::evaluateWithExceptionDetails(v8::Local v8::TryCatch tryCatch(m_isolate); v8::Local<v8::Object> wrappedResult = v8::Object::New(m_isolate); v8::Local<v8::Value> result; - if (m_client->callInternalFunction(evalFunction, callFrame, WTF_ARRAY_LENGTH(argv), argv).ToLocal(&result)) { + if (evalFunction->Call(m_isolate->GetCurrentContext(), callFrame, WTF_ARRAY_LENGTH(argv), argv).ToLocal(&result)) { wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "result"), result); wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "exceptionDetails"), v8::Undefined(m_isolate)); } else { @@ -215,7 +211,7 @@ v8::MaybeLocal<v8::Value> JavaScriptCallFrame::restart() v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_callFrame); v8::Local<v8::Function> restartFunction = v8::Local<v8::Function>::Cast(callFrame->Get(toV8StringInternalized(m_isolate, "restart"))); v8::Debug::SetLiveEditEnabled(m_isolate, true); - v8::MaybeLocal<v8::Value> result = m_client->callInternalFunction(restartFunction, callFrame, 0, nullptr); + v8::MaybeLocal<v8::Value> result = restartFunction->Call(m_isolate->GetCurrentContext(), callFrame, 0, nullptr); v8::Debug::SetLiveEditEnabled(m_isolate, false); return result; } @@ -229,7 +225,7 @@ v8::MaybeLocal<v8::Value> JavaScriptCallFrame::setVariableValue(int scopeNumber, variableName, newValue }; - return m_client->callInternalFunction(setVariableValueFunction, callFrame, WTF_ARRAY_LENGTH(argv), argv); + return setVariableValueFunction->Call(m_isolate->GetCurrentContext(), callFrame, WTF_ARRAY_LENGTH(argv), argv); } v8::Local<v8::Object> JavaScriptCallFrame::createExceptionDetails(v8::Isolate* isolate, v8::Local<v8::Message> message) diff --git a/third_party/WebKit/Source/platform/v8_inspector/JavaScriptCallFrame.h b/third_party/WebKit/Source/platform/v8_inspector/JavaScriptCallFrame.h index b30ca47..bd17be7 100644 --- a/third_party/WebKit/Source/platform/v8_inspector/JavaScriptCallFrame.h +++ b/third_party/WebKit/Source/platform/v8_inspector/JavaScriptCallFrame.h @@ -38,13 +38,11 @@ namespace blink { -class V8DebuggerClient; - class JavaScriptCallFrame { public: - static PassOwnPtr<JavaScriptCallFrame> create(V8DebuggerClient* client, v8::Local<v8::Context> debuggerContext, v8::Local<v8::Object> callFrame) + static PassOwnPtr<JavaScriptCallFrame> create(v8::Local<v8::Context> debuggerContext, v8::Local<v8::Object> callFrame) { - return adoptPtr(new JavaScriptCallFrame(client, debuggerContext, callFrame)); + return adoptPtr(new JavaScriptCallFrame(debuggerContext, callFrame)); } ~JavaScriptCallFrame(); @@ -78,16 +76,13 @@ public: void setWrapperTemplate(v8::Local<v8::FunctionTemplate> wrapperTemplate, v8::Isolate* isolate) { m_wrapperTemplate.Reset(isolate, wrapperTemplate); } v8::Local<v8::FunctionTemplate> wrapperTemplate(v8::Isolate* isolate) { return v8::Local<v8::FunctionTemplate>::New(isolate, m_wrapperTemplate); } - V8DebuggerClient* client() { return m_client; } - private: - JavaScriptCallFrame(V8DebuggerClient*, v8::Local<v8::Context> debuggerContext, v8::Local<v8::Object> callFrame); + JavaScriptCallFrame(v8::Local<v8::Context> debuggerContext, v8::Local<v8::Object> callFrame); int callV8FunctionReturnInt(const char* name) const; String16 callV8FunctionReturnString(const char* name) const; v8::Local<v8::Value> callScopeLocationFunction(const char* name, int scopeIndex) const; - V8DebuggerClient* m_client; v8::Isolate* m_isolate; OwnPtr<JavaScriptCallFrame> m_caller; v8::Global<v8::Context> m_debuggerContext; diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp index ea1ab6d..aa2e1f6 100644 --- a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp +++ b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp @@ -63,7 +63,7 @@ v8::MaybeLocal<v8::Value> V8DebuggerImpl::callDebuggerMethod(const char* functio v8::Local<v8::Object> debuggerScript = m_debuggerScript.Get(m_isolate); v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(debuggerScript->Get(v8InternalizedString(functionName))); ASSERT(m_isolate->InContext()); - return m_client->callInternalFunction(function, debuggerScript, argc, argv); + return function->Call(m_isolate->GetCurrentContext(), debuggerScript, argc, argv); } PassOwnPtr<V8Debugger> V8Debugger::create(v8::Isolate* isolate, V8DebuggerClient* client) @@ -210,14 +210,12 @@ V8RuntimeAgentImpl* V8DebuggerImpl::getRuntimeAgentForContext(v8::Local<v8::Cont void V8DebuggerImpl::getCompiledScripts(int contextGroupId, protocol::Vector<V8DebuggerParsedScript>& result) { v8::HandleScope scope(m_isolate); - v8::Context::Scope contextScope(debuggerContext()); - v8::Local<v8::Object> debuggerScript = m_debuggerScript.Get(m_isolate); ASSERT(!debuggerScript->IsUndefined()); v8::Local<v8::Function> getScriptsFunction = v8::Local<v8::Function>::Cast(debuggerScript->Get(v8InternalizedString("getScripts"))); v8::Local<v8::Value> argv[] = { v8::Integer::New(m_isolate, contextGroupId) }; v8::Local<v8::Value> value; - if (!m_client->callInternalFunction(getScriptsFunction, debuggerScript, WTF_ARRAY_LENGTH(argv), argv).ToLocal(&value)) + if (!getScriptsFunction->Call(debuggerContext(), debuggerScript, WTF_ARRAY_LENGTH(argv), argv).ToLocal(&value)) return; ASSERT(value->IsArray()); v8::Local<v8::Array> scriptsArray = v8::Local<v8::Array>::Cast(value); @@ -492,7 +490,7 @@ PassOwnPtr<JavaScriptCallFrame> V8DebuggerImpl::wrapCallFrames() ASSERT(!currentCallFrameV8.IsEmpty()); if (!currentCallFrameV8->IsObject()) return nullptr; - return JavaScriptCallFrame::create(m_client, debuggerContext(), v8::Local<v8::Object>::Cast(currentCallFrameV8)); + return JavaScriptCallFrame::create(debuggerContext(), v8::Local<v8::Object>::Cast(currentCallFrameV8)); } v8::Local<v8::Object> V8DebuggerImpl::currentCallFrames() @@ -512,7 +510,7 @@ v8::Local<v8::Object> V8DebuggerImpl::currentCallFrames() v8::Local<v8::FunctionTemplate> wrapperTemplate = v8::Local<v8::FunctionTemplate>::New(m_isolate, m_callFrameWrapperTemplate); v8::Local<v8::Context> context = m_pausedContext.IsEmpty() ? m_isolate->GetCurrentContext() : m_pausedContext; v8::Context::Scope scope(context); - v8::Local<v8::Object> wrapper = V8JavaScriptCallFrame::wrap(m_client, wrapperTemplate, context, currentCallFrame.release()); + v8::Local<v8::Object> wrapper = V8JavaScriptCallFrame::wrap(wrapperTemplate, context, currentCallFrame.release()); return wrapper; } @@ -533,7 +531,7 @@ PassOwnPtr<JavaScriptCallFrame> V8DebuggerImpl::callFrameNoScopes(int index) ASSERT(!currentCallFrameV8.IsEmpty()); if (!currentCallFrameV8->IsObject()) return nullptr; - return JavaScriptCallFrame::create(m_client, debuggerContext(), v8::Local<v8::Object>::Cast(currentCallFrameV8)); + return JavaScriptCallFrame::create(debuggerContext(), v8::Local<v8::Object>::Cast(currentCallFrameV8)); } static V8DebuggerImpl* toV8DebuggerImpl(v8::Local<v8::Value> data) @@ -611,7 +609,7 @@ v8::Local<v8::Value> V8DebuggerImpl::callInternalGetterFunction(v8::Local<v8::Ob { v8::Local<v8::Value> getterValue = object->Get(v8InternalizedString(functionName)); ASSERT(!getterValue.IsEmpty() && getterValue->IsFunction()); - return m_client->callInternalFunction(v8::Local<v8::Function>::Cast(getterValue), object, 0, 0).ToLocalChecked(); + return v8::Local<v8::Function>::Cast(getterValue)->Call(m_isolate->GetCurrentContext(), object, 0, 0).ToLocalChecked(); } void V8DebuggerImpl::handleV8DebugEvent(const v8::Debug::EventDetails& eventDetails) @@ -721,7 +719,7 @@ void V8DebuggerImpl::compileDebuggerScript() v8::Local<v8::String> scriptValue = v8::String::NewFromUtf8(m_isolate, DebuggerScript_js, v8::NewStringType::kInternalized, sizeof(DebuggerScript_js)).ToLocalChecked(); v8::Local<v8::Value> value; - if (!m_client->compileAndRunInternalScript(scriptValue).ToLocal(&value)) + if (!compileAndRunInternalScript(debuggerContext(), scriptValue).ToLocal(&value)) return; ASSERT(value->IsObject()); m_debuggerScript.Reset(m_isolate, value.As<v8::Object>()); @@ -790,7 +788,54 @@ bool V8DebuggerImpl::isPaused() return !m_pausedContext.IsEmpty(); } -v8::Local<v8::Script> V8DebuggerImpl::compileInternalScript(v8::Local<v8::Context>, v8::Local<v8::String> code, const String16& fileName) +v8::MaybeLocal<v8::Value> V8DebuggerImpl::runCompiledScript(v8::Local<v8::Context> context, v8::Local<v8::Script> script) +{ + // TODO(dgozman): get rid of this check. + if (!m_client->isExecutionAllowed()) + return v8::MaybeLocal<v8::Value>(); + + v8::MicrotasksScope microtasksScope(m_isolate, v8::MicrotasksScope::kRunMicrotasks); + int groupId = getGroupId(context); + V8DebuggerAgentImpl* agent = groupId ? m_debuggerAgentsMap.get(groupId) : nullptr; + if (agent) + agent->willExecuteScript(script->GetUnboundScript()->GetId()); + v8::MaybeLocal<v8::Value> result = script->Run(context); + // Get agent from the map again, since it could have detached during script execution. + agent = groupId ? m_debuggerAgentsMap.get(groupId) : nullptr; + if (agent) + agent->didExecuteScript(); + return result; +} + +v8::MaybeLocal<v8::Value> V8DebuggerImpl::callFunction(v8::Local<v8::Function> function, v8::Local<v8::Context> context, v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> info[]) +{ + // TODO(dgozman): get rid of this check. + if (!m_client->isExecutionAllowed()) + return v8::MaybeLocal<v8::Value>(); + + v8::MicrotasksScope microtasksScope(m_isolate, v8::MicrotasksScope::kRunMicrotasks); + int groupId = getGroupId(context); + V8DebuggerAgentImpl* agent = groupId ? m_debuggerAgentsMap.get(groupId) : nullptr; + if (agent) + agent->willExecuteScript(function->ScriptId()); + v8::MaybeLocal<v8::Value> result = function->Call(context, receiver, argc, info); + // Get agent from the map again, since it could have detached during script execution. + agent = groupId ? m_debuggerAgentsMap.get(groupId) : nullptr; + if (agent) + agent->didExecuteScript(); + return result; +} + +v8::MaybeLocal<v8::Value> V8DebuggerImpl::compileAndRunInternalScript(v8::Local<v8::Context> context, v8::Local<v8::String> source) +{ + v8::Local<v8::Script> script = compileInternalScript(context, source, String()); + if (script.IsEmpty()) + return v8::MaybeLocal<v8::Value>(); + v8::MicrotasksScope microtasksScope(m_isolate, v8::MicrotasksScope::kDoNotRunMicrotasks); + return script->Run(context); +} + +v8::Local<v8::Script> V8DebuggerImpl::compileInternalScript(v8::Local<v8::Context> context, v8::Local<v8::String> code, const String16& fileName) { // NOTE: For compatibility with WebCore, ScriptSourceCode's line starts at // 1, whereas v8 starts at 0. @@ -805,7 +850,7 @@ v8::Local<v8::Script> V8DebuggerImpl::compileInternalScript(v8::Local<v8::Contex v8::True(m_isolate)); // opaqueresource v8::ScriptCompiler::Source source(code, origin); v8::Local<v8::Script> script; - if (!v8::ScriptCompiler::Compile(m_isolate->GetCurrentContext(), &source, v8::ScriptCompiler::kNoCompileOptions).ToLocal(&script)) + if (!v8::ScriptCompiler::Compile(context, &source, v8::ScriptCompiler::kNoCompileOptions).ToLocal(&script)) return v8::Local<v8::Script>(); return script; } diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.h b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.h index 185dd37..28aafa5 100644 --- a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.h +++ b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.h @@ -98,6 +98,9 @@ public: v8::Isolate* isolate() const { return m_isolate; } V8DebuggerClient* client() { return m_client; } + v8::MaybeLocal<v8::Value> runCompiledScript(v8::Local<v8::Context>, v8::Local<v8::Script>); + v8::MaybeLocal<v8::Value> callFunction(v8::Local<v8::Function>, v8::Local<v8::Context>, v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> info[]); + v8::MaybeLocal<v8::Value> compileAndRunInternalScript(v8::Local<v8::Context>, v8::Local<v8::String>); v8::Local<v8::Script> compileInternalScript(v8::Local<v8::Context>, v8::Local<v8::String>, const String16& fileName); v8::Local<v8::Context> regexContext(); diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8FunctionCall.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8FunctionCall.cpp index d6fff84..5d7c210 100644 --- a/third_party/WebKit/Source/platform/v8_inspector/V8FunctionCall.cpp +++ b/third_party/WebKit/Source/platform/v8_inspector/V8FunctionCall.cpp @@ -30,6 +30,7 @@ #include "platform/v8_inspector/V8FunctionCall.h" +#include "platform/v8_inspector/V8DebuggerImpl.h" #include "platform/v8_inspector/V8StringUtil.h" #include "platform/v8_inspector/public/V8DebuggerClient.h" #include "wtf/PassOwnPtr.h" @@ -38,8 +39,8 @@ namespace blink { -V8FunctionCall::V8FunctionCall(V8DebuggerClient* client, v8::Local<v8::Context> context, v8::Local<v8::Value> value, const String16& name) - : m_client(client) +V8FunctionCall::V8FunctionCall(V8DebuggerImpl* debugger, v8::Local<v8::Context> context, v8::Local<v8::Value> value, const String16& name) + : m_debugger(debugger) , m_context(context) , m_name(toV8String(context->GetIsolate(), name)) , m_value(value) @@ -104,7 +105,7 @@ v8::Local<v8::Value> V8FunctionCall::callWithoutExceptionHandling() } v8::Local<v8::Value> result; - if (!m_client->callFunction(function, m_context, thisObject, m_arguments.size(), info.get()).ToLocal(&result)) + if (!m_debugger->callFunction(function, m_context, thisObject, m_arguments.size(), info.get()).ToLocal(&result)) return v8::Local<v8::Value>(); return result; } diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8FunctionCall.h b/third_party/WebKit/Source/platform/v8_inspector/V8FunctionCall.h index a063620..a9230cc 100644 --- a/third_party/WebKit/Source/platform/v8_inspector/V8FunctionCall.h +++ b/third_party/WebKit/Source/platform/v8_inspector/V8FunctionCall.h @@ -38,11 +38,11 @@ namespace blink { -class V8DebuggerClient; +class V8DebuggerImpl; class V8FunctionCall { public: - V8FunctionCall(V8DebuggerClient*, v8::Local<v8::Context>, v8::Local<v8::Value>, const String16& name); + V8FunctionCall(V8DebuggerImpl*, v8::Local<v8::Context>, v8::Local<v8::Value>, const String16& name); void appendArgument(v8::Local<v8::Value>); void appendArgument(const String16&); @@ -57,7 +57,7 @@ public: v8::Local<v8::Context> context() { return m_context; } protected: - V8DebuggerClient* m_client; + V8DebuggerImpl* m_debugger; v8::Local<v8::Context> m_context; protocol::Vector<v8::Local<v8::Value>> m_arguments; v8::Local<v8::String> m_name; diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8InjectedScriptHost.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8InjectedScriptHost.cpp index 2276780..18bd41e 100644 --- a/third_party/WebKit/Source/platform/v8_inspector/V8InjectedScriptHost.cpp +++ b/third_party/WebKit/Source/platform/v8_inspector/V8InjectedScriptHost.cpp @@ -293,7 +293,7 @@ void V8InjectedScriptHost::evalCallback(const v8::FunctionCallbackInfo<v8::Value InjectedScriptHost* host = V8InjectedScriptHost::unwrap(isolate->GetCurrentContext(), info.Holder()); if (!host->debugger()) return; - if (!host->debugger()->client()->compileAndRunInternalScript(expression).ToLocal(&result)) { + if (!host->debugger()->compileAndRunInternalScript(isolate->GetCurrentContext(), expression).ToLocal(&result)) { v8SetReturnValue(info, tryCatch.ReThrow()); return; } @@ -346,7 +346,7 @@ void V8InjectedScriptHost::evaluateWithExceptionDetailsCallback(const v8::Functi global->Set(commandLineAPISymbolValue, commandLineAPI); } - v8::MaybeLocal<v8::Value> result = host->debugger()->client()->runCompiledScript(context, script); + v8::MaybeLocal<v8::Value> result = host->debugger()->runCompiledScript(context, script); if (result.IsEmpty()) { global->Delete(context, commandLineAPISymbolValue); setExceptionAsReturnValue(info, wrappedResult, tryCatch); @@ -599,9 +599,9 @@ v8::Local<v8::FunctionTemplate> V8InjectedScriptHost::createWrapperTemplate(v8:: return InjectedScriptHostWrapper::createWrapperTemplate(isolate, methods, attributes); } -v8::Local<v8::Object> V8InjectedScriptHost::wrap(V8DebuggerClient* client, v8::Local<v8::FunctionTemplate> constructorTemplate, v8::Local<v8::Context> context, InjectedScriptHost* host) +v8::Local<v8::Object> V8InjectedScriptHost::wrap(v8::Local<v8::FunctionTemplate> constructorTemplate, v8::Local<v8::Context> context, InjectedScriptHost* host) { - return InjectedScriptHostWrapper::wrap(client, constructorTemplate, context, host); + return InjectedScriptHostWrapper::wrap(constructorTemplate, context, host); } InjectedScriptHost* V8InjectedScriptHost::unwrap(v8::Local<v8::Context> context, v8::Local<v8::Object> object) diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8InjectedScriptHost.h b/third_party/WebKit/Source/platform/v8_inspector/V8InjectedScriptHost.h index f16adf4..1566d1b 100644 --- a/third_party/WebKit/Source/platform/v8_inspector/V8InjectedScriptHost.h +++ b/third_party/WebKit/Source/platform/v8_inspector/V8InjectedScriptHost.h @@ -14,7 +14,7 @@ class V8DebuggerClient; class V8InjectedScriptHost { public: - static v8::Local<v8::Object> wrap(V8DebuggerClient*, v8::Local<v8::FunctionTemplate> constructorTemplate, v8::Local<v8::Context>, InjectedScriptHost*); + static v8::Local<v8::Object> wrap(v8::Local<v8::FunctionTemplate> constructorTemplate, v8::Local<v8::Context>, InjectedScriptHost*); static InjectedScriptHost* unwrap(v8::Local<v8::Context>, v8::Local<v8::Object>); static v8::Local<v8::FunctionTemplate> createWrapperTemplate(v8::Isolate*); diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8JavaScriptCallFrame.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8JavaScriptCallFrame.cpp index b680100..9595551a 100644 --- a/third_party/WebKit/Source/platform/v8_inspector/V8JavaScriptCallFrame.cpp +++ b/third_party/WebKit/Source/platform/v8_inspector/V8JavaScriptCallFrame.cpp @@ -24,7 +24,7 @@ void callerAttributeGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallba v8::Local<v8::FunctionTemplate> wrapperTemplate = impl->wrapperTemplate(isolate); if (wrapperTemplate.IsEmpty()) return; - info.GetReturnValue().Set(V8JavaScriptCallFrame::wrap(impl->client(), wrapperTemplate, isolate->GetCurrentContext(), caller.release())); + info.GetReturnValue().Set(V8JavaScriptCallFrame::wrap(wrapperTemplate, isolate->GetCurrentContext(), caller.release())); } void sourceIDAttributeGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info) @@ -203,11 +203,11 @@ v8::Local<v8::FunctionTemplate> V8JavaScriptCallFrame::createWrapperTemplate(v8: return JavaScriptCallFrameWrapper::createWrapperTemplate(isolate, methods, attributes); } -v8::Local<v8::Object> V8JavaScriptCallFrame::wrap(V8DebuggerClient* client, v8::Local<v8::FunctionTemplate> constructorTemplate, v8::Local<v8::Context> context, PassOwnPtr<JavaScriptCallFrame> frame) +v8::Local<v8::Object> V8JavaScriptCallFrame::wrap(v8::Local<v8::FunctionTemplate> constructorTemplate, v8::Local<v8::Context> context, PassOwnPtr<JavaScriptCallFrame> frame) { // Store template for .caller callback frame->setWrapperTemplate(constructorTemplate, context->GetIsolate()); - return JavaScriptCallFrameWrapper::wrap(client, constructorTemplate, context, frame); + return JavaScriptCallFrameWrapper::wrap(constructorTemplate, context, frame); } JavaScriptCallFrame* V8JavaScriptCallFrame::unwrap(v8::Local<v8::Context> context, v8::Local<v8::Object> object) diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8JavaScriptCallFrame.h b/third_party/WebKit/Source/platform/v8_inspector/V8JavaScriptCallFrame.h index 83edad6..a4672b6 100644 --- a/third_party/WebKit/Source/platform/v8_inspector/V8JavaScriptCallFrame.h +++ b/third_party/WebKit/Source/platform/v8_inspector/V8JavaScriptCallFrame.h @@ -17,7 +17,7 @@ class V8DebuggerClient; class V8JavaScriptCallFrame { public: static v8::Local<v8::FunctionTemplate> createWrapperTemplate(v8::Isolate*); - static v8::Local<v8::Object> wrap(V8DebuggerClient*, v8::Local<v8::FunctionTemplate> constructorTemplate, v8::Local<v8::Context>, PassOwnPtr<JavaScriptCallFrame>); + static v8::Local<v8::Object> wrap(v8::Local<v8::FunctionTemplate> constructorTemplate, v8::Local<v8::Context>, PassOwnPtr<JavaScriptCallFrame>); static JavaScriptCallFrame* unwrap(v8::Local<v8::Context>, v8::Local<v8::Object>); }; diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8Regex.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8Regex.cpp index 32053d4..84cd04c 100644 --- a/third_party/WebKit/Source/platform/v8_inspector/V8Regex.cpp +++ b/third_party/WebKit/Source/platform/v8_inspector/V8Regex.cpp @@ -45,7 +45,6 @@ int V8Regex::match(const String16& string, int startFrom, int* matchLength) cons v8::Isolate* isolate = m_debugger->isolate(); v8::HandleScope handleScope(isolate); v8::Local<v8::Context> context = m_debugger->regexContext(); - v8::Context::Scope contextScope(context); v8::TryCatch tryCatch(isolate); v8::Local<v8::RegExp> regex = m_regex.Get(isolate); @@ -54,7 +53,7 @@ int V8Regex::match(const String16& string, int startFrom, int* matchLength) cons return -1; v8::Local<v8::Value> argv[] = { toV8String(isolate, string.substring(startFrom)) }; v8::Local<v8::Value> returnValue; - if (!m_debugger->client()->callInternalFunction(exec.As<v8::Function>(), regex, WTF_ARRAY_LENGTH(argv), argv).ToLocal(&returnValue)) + if (!exec.As<v8::Function>()->Call(context, regex, WTF_ARRAY_LENGTH(argv), argv).ToLocal(&returnValue)) return -1; // RegExp#exec returns null if there's no match, otherwise it returns an diff --git a/third_party/WebKit/Source/platform/v8_inspector/public/V8DebuggerClient.h b/third_party/WebKit/Source/platform/v8_inspector/public/V8DebuggerClient.h index 21691ca..5e48345 100644 --- a/third_party/WebKit/Source/platform/v8_inspector/public/V8DebuggerClient.h +++ b/third_party/WebKit/Source/platform/v8_inspector/public/V8DebuggerClient.h @@ -23,16 +23,10 @@ public: virtual void eventListeners(v8::Local<v8::Value>, V8EventListenerInfoList&) = 0; virtual void contextsToReport(int contextGroupId, V8ContextInfoVector&) = 0; virtual bool callingContextCanAccessContext(v8::Local<v8::Context> calling, v8::Local<v8::Context> target) = 0; - - virtual v8::MaybeLocal<v8::Object> instantiateObject(v8::Local<v8::Function>) = 0; - virtual v8::MaybeLocal<v8::Value> runCompiledScript(v8::Local<v8::Context>, v8::Local<v8::Script>) = 0; - virtual v8::MaybeLocal<v8::Value> compileAndRunInternalScript(v8::Local<v8::String>) = 0; - virtual v8::MaybeLocal<v8::Value> callFunction(v8::Local<v8::Function>, v8::Local<v8::Context>, v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> info[]) = 0; - virtual v8::MaybeLocal<v8::Value> callInternalFunction(v8::Local<v8::Function>, v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> info[]) = 0; - virtual String16 valueSubtype(v8::Local<v8::Value>) = 0; virtual bool formatAccessorsAsProperties(v8::Local<v8::Value>) = 0; virtual bool hasRecursionLevel() = 0; + virtual bool isExecutionAllowed() = 0; virtual double currentTimeMS() = 0; }; diff --git a/third_party/WebKit/Source/web/WebKit.cpp b/third_party/WebKit/Source/web/WebKit.cpp index 29cca01..c0b0857 100644 --- a/third_party/WebKit/Source/web/WebKit.cpp +++ b/third_party/WebKit/Source/web/WebKit.cpp @@ -30,12 +30,12 @@ #include "public/web/WebKit.h" +#include "bindings/core/v8/Microtask.h" #include "bindings/core/v8/V8Binding.h" #include "bindings/core/v8/V8GCController.h" #include "bindings/core/v8/V8Initializer.h" #include "core/Init.h" #include "core/animation/AnimationClock.h" -#include "core/dom/Microtask.h" #include "core/page/Page.h" #include "gin/public/v8_platform.h" #include "modules/InitModules.h" diff --git a/third_party/WebKit/Source/web/WebScopedMicrotaskSuppression.cpp b/third_party/WebKit/Source/web/WebScopedMicrotaskSuppression.cpp deleted file mode 100644 index a719a9c..0000000 --- a/third_party/WebKit/Source/web/WebScopedMicrotaskSuppression.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "public/web/WebScopedMicrotaskSuppression.h" - -#include "bindings/core/v8/V8RecursionScope.h" -#include "wtf/Assertions.h" -#include "wtf/OwnPtr.h" - -namespace blink { - -#if ENABLE(ASSERT) -class WebScopedMicrotaskSuppression::Impl : public V8RecursionScope::MicrotaskSuppression { -public: - Impl(v8::Isolate* isolate) - : V8RecursionScope::MicrotaskSuppression(isolate) - { - } -}; -#endif - -void WebScopedMicrotaskSuppression::initialize() -{ -#if ENABLE(ASSERT) - m_impl.reset(new Impl(v8::Isolate::GetCurrent())); -#endif -} - -void WebScopedMicrotaskSuppression::reset() -{ -#if ENABLE(ASSERT) - m_impl.reset(0); -#endif -} - -} // namespace blink diff --git a/third_party/WebKit/Source/web/web.gypi b/third_party/WebKit/Source/web/web.gypi index e31cbe8..1fbdecb 100644 --- a/third_party/WebKit/Source/web/web.gypi +++ b/third_party/WebKit/Source/web/web.gypi @@ -198,7 +198,6 @@ 'WebRemoteFrameImpl.cpp', 'WebRemoteFrameImpl.h', 'WebRuntimeFeatures.cpp', - 'WebScopedMicrotaskSuppression.cpp', 'WebScopedUserGesture.cpp', 'WebScopedWindowFocusAllowedIndicator.cpp', 'WebScriptController.cpp', diff --git a/third_party/WebKit/public/blink_headers.gypi b/third_party/WebKit/public/blink_headers.gypi index 0033df8..254ba13 100644 --- a/third_party/WebKit/public/blink_headers.gypi +++ b/third_party/WebKit/public/blink_headers.gypi @@ -442,7 +442,6 @@ "web/WebRemoteFrameClient.h", "web/WebRuntimeFeatures.h", "web/WebSandboxFlags.h", - "web/WebScopedMicrotaskSuppression.h", "web/WebScopedUserGesture.h", "web/WebScopedWindowFocusAllowedIndicator.h", "web/WebScriptController.h", diff --git a/third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h b/third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h deleted file mode 100644 index dd96fc6..0000000 --- a/third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WebScopedMicrotaskSuppression_h -#define WebScopedMicrotaskSuppression_h - -#include "../platform/WebPrivateOwnPtr.h" - -namespace blink { - -// This class wraps V8RecursionScope::BypassMicrotaskCheckpoint. Please -// see V8RecursionScope.h for full usage. Short story: Embedder calls into -// script contexts which also host page script must do one of two things: -// -// 1. If the call may cause any page/author script to run, it must be -// captured for pre/post work (e.g. inspector instrumentation/microtask -// delivery) and thus be invoked through WebFrame (e.g. executeScript*, -// callFunction*). -// 2. If the call will not cause any page/author script to run, the call -// should be made directly via the v8 context, but the callsite must be -// accompanied by a stack allocated WebScopedMicrotaskSuppression, e.g.: -// -// ... -// { -// blink::WebScopedMicrotaskSuppression suppression; -// func->Call(global, argv, args); -// } -// ... -// -class WebScopedMicrotaskSuppression { -public: - WebScopedMicrotaskSuppression() { initialize(); } - ~WebScopedMicrotaskSuppression() { reset(); } - -private: - BLINK_EXPORT void initialize(); - BLINK_EXPORT void reset(); - - // Always declare this data member. When assertions are on in - // Release builds of Blink, this header may be included from - // Chromium with different preprocessor options than used when - // building Blink itself. - class Impl; - WebPrivateOwnPtr<Impl> m_impl; -}; - -} // namespace blink - -#endif |