diff options
24 files changed, 169 insertions, 106 deletions
diff --git a/chrome/test/base/v8_unit_test.cc b/chrome/test/base/v8_unit_test.cc index 392ff45..9f52f06 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,6 @@ 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::Local<v8::Value> function_property = context->Global()->Get(v8::String::NewFromUtf8(isolate, "runTest")); @@ -211,7 +209,6 @@ 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::Local<v8::String> source = v8::String::NewFromUtf8(isolate, script_source.data(), @@ -260,7 +257,6 @@ 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::Local<v8::Value> function_property = context->Global()->Get( v8::String::NewFromUtf8(isolate, function_name.c_str())); diff --git a/content/child/v8_value_converter_impl_unittest.cc b/content/child/v8_value_converter_impl_unittest.cc index 435ea30..311fa7f 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,6 @@ 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; // Set up objects to throw when reading or writing 'foo'. const char* source = @@ -331,7 +329,6 @@ 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; const char* source = "(function() {" "var arr = [];" @@ -408,7 +405,6 @@ 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; const char* source = "(function() {" "Object.prototype.foo = 'foo';" @@ -433,7 +429,6 @@ 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; const char* source = "(function() {" "return { foo: undefined, bar: null };" @@ -492,7 +487,6 @@ 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; const char* source = "(function() {" "return {" @@ -531,7 +525,6 @@ 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; const char* source = "(function() {" "var a = [0];" @@ -556,7 +549,6 @@ 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::Local<v8::Object> object; { diff --git a/content/renderer/pepper/v8_var_converter_unittest.cc b/content/renderer/pepper/v8_var_converter_unittest.cc index e030ffd..cd07abb 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,6 @@ 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; 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..9237cad 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,6 @@ TEST_F(ActivityLogConverterStrategyTest, ConversionTest) { "};" "})();"; - blink::WebScopedMicrotaskSuppression microtasks_scope; 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/api_test_base.cc b/extensions/renderer/api_test_base.cc index 79f95e2..abf868b 100644 --- a/extensions/renderer/api_test_base.cc +++ b/extensions/renderer/api_test_base.cc @@ -214,7 +214,7 @@ void ApiTestEnvironment::RunTestInner(const std::string& test_name, } void ApiTestEnvironment::RunPromisesAgain() { - v8::MicrotasksScope::PerformCheckpoint(env()->isolate()); + env()->isolate()->RunMicrotasks(); base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&ApiTestEnvironment::RunPromisesAgain, base::Unretained(this))); diff --git a/extensions/renderer/module_system_test.cc b/extensions/renderer/module_system_test.cc index 06a4d55..68c4bd1 100644 --- a/extensions/renderer/module_system_test.cc +++ b/extensions/renderer/module_system_test.cc @@ -253,7 +253,7 @@ void ModuleSystemTest::ExpectNoAssertionsMade() { } void ModuleSystemTest::RunResolvedPromises() { - v8::MicrotasksScope::PerformCheckpoint(isolate_); + isolate_->RunMicrotasks(); } } // namespace extensions diff --git a/extensions/renderer/safe_builtins.cc b/extensions/renderer/safe_builtins.cc index 3a66eaf..3bfa01a 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,6 @@ class ExtensionImpl : public v8::Extension { return; } - blink::WebScopedMicrotaskSuppression microtasks_scope; 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/gin/run_microtasks_observer.cc b/gin/run_microtasks_observer.cc index 0ca0078..f453a66 100644 --- a/gin/run_microtasks_observer.cc +++ b/gin/run_microtasks_observer.cc @@ -15,7 +15,7 @@ void RunMicrotasksObserver::WillProcessTask(const base::PendingTask& task) { void RunMicrotasksObserver::DidProcessTask(const base::PendingTask& task) { v8::Isolate::Scope scope(isolate_); - v8::MicrotasksScope::PerformCheckpoint(isolate_); + isolate_->RunMicrotasks(); } } // namespace gin diff --git a/gin/run_microtasks_observer.h b/gin/run_microtasks_observer.h index ca160be..7f1431f 100644 --- a/gin/run_microtasks_observer.h +++ b/gin/run_microtasks_observer.h @@ -12,7 +12,7 @@ namespace gin { // Runs any pending v8 Microtasks each time a task is completed. // TODO(hansmuller); At some point perhaps this can be replaced with -// the (currently experimental) v8::MicrotasksPolicy::kAuto method. +// the (currently experimental) Isolate::SetAutorunMicrotasks() method. class RunMicrotasksObserver : public base::MessageLoop::TaskObserver { public: diff --git a/third_party/WebKit/Source/bindings/core/v8/ReadableStreamOperationsTest.cpp b/third_party/WebKit/Source/bindings/core/v8/ReadableStreamOperationsTest.cpp index 49ddfe5..a76e6d0 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" @@ -139,7 +138,7 @@ public: ~ReadableStreamOperationsTest() override { // Execute all pending microtasks - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_FALSE(m_block.HasCaught()); } @@ -150,7 +149,6 @@ public: { v8::Local<v8::String> source; v8::Local<v8::Script> script; - V8RecursionScope::MicrotaskSuppression microtasks(isolate()); if (!v8Call(v8::String::NewFromUtf8(isolate(), s, v8::NewStringType::kNormal), source)) { ADD_FAILURE(); return ScriptValue(); @@ -255,12 +253,12 @@ TEST_F(ReadableStreamOperationsTest, Read) Function::createFunction(scriptState(), it2), NotReached::createFunction(scriptState())); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_FALSE(it1->isSet()); EXPECT_FALSE(it2->isSet()); ASSERT_FALSE(evalWithPrintingError("controller.enqueue('hello')").isEmpty()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_TRUE(it1->isSet()); EXPECT_TRUE(it1->isValid()); EXPECT_FALSE(it1->isDone()); @@ -268,7 +266,7 @@ TEST_F(ReadableStreamOperationsTest, Read) EXPECT_FALSE(it2->isSet()); ASSERT_FALSE(evalWithPrintingError("controller.close()").isEmpty()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_TRUE(it1->isSet()); EXPECT_TRUE(it1->isValid()); EXPECT_FALSE(it1->isDone()); @@ -311,7 +309,7 @@ TEST_F(ReadableStreamOperationsTest, CreateReadableStreamWithCustomUnderlyingSou ReadableStreamOperations::read(scriptState(), reader).then(Function::createFunction(scriptState(), it2), NotReached::createFunction(scriptState())); ReadableStreamOperations::read(scriptState(), reader).then(Function::createFunction(scriptState(), it3), NotReached::createFunction(scriptState())); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_EQ(10, underlyingSource->desiredSize()); @@ -328,7 +326,7 @@ TEST_F(ReadableStreamOperationsTest, CreateReadableStreamWithCustomUnderlyingSou EXPECT_FALSE(it3->isSet()); underlyingSource->close(); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_TRUE(it3->isSet()); EXPECT_TRUE(it3->isValid()); diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyTest.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyTest.cpp index f6601dd..34f2d7c 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyTest.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptPromisePropertyTest.cpp @@ -281,7 +281,7 @@ TEST_F(ScriptPromisePropertyGarbageCollectedTest, Resolve_ResolvesScriptPromise) property()->resolve(value); EXPECT_EQ(Property::Resolved, property()->getState()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_EQ(1u, nResolveCalls); EXPECT_EQ(1u, nOtherResolveCalls); EXPECT_EQ(wrap(mainWorld(), value), actual); @@ -307,7 +307,7 @@ TEST_F(ScriptPromisePropertyGarbageCollectedTest, ResolveAndGetPromiseOnOtherWor property()->resolve(value); EXPECT_EQ(Property::Resolved, property()->getState()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_EQ(1u, nResolveCalls); EXPECT_EQ(0u, nOtherResolveCalls); @@ -316,7 +316,7 @@ TEST_F(ScriptPromisePropertyGarbageCollectedTest, ResolveAndGetPromiseOnOtherWor otherPromise.then(stub(currentScriptState(), otherActual, nOtherResolveCalls), notReached(currentScriptState())); } - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_EQ(1u, nResolveCalls); EXPECT_EQ(1u, nOtherResolveCalls); EXPECT_EQ(wrap(mainWorld(), value), actual); @@ -343,7 +343,7 @@ TEST_F(ScriptPromisePropertyGarbageCollectedTest, Reject_RejectsScriptPromise) property()->promise(otherWorld()).then(notReached(currentScriptState()), stub(currentScriptState(), otherActual, nOtherRejectCalls)); } - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_EQ(1u, nRejectCalls); EXPECT_EQ(wrap(mainWorld(), reason), actual); EXPECT_EQ(1u, nOtherRejectCalls); @@ -374,7 +374,7 @@ TEST_F(ScriptPromisePropertyGarbageCollectedTest, Resolve_DeadContext) property()->resolve(new GarbageCollectedScriptWrappable("value")); EXPECT_EQ(Property::Pending, property()->getState()); - v8::MicrotasksScope::PerformCheckpoint(v8::Isolate::GetCurrent()); + v8::Isolate::GetCurrent()->RunMicrotasks(); } TEST_F(ScriptPromisePropertyGarbageCollectedTest, Reset) @@ -405,7 +405,7 @@ TEST_F(ScriptPromisePropertyGarbageCollectedTest, Reset) EXPECT_EQ(0u, nOldResolveCalls); EXPECT_EQ(0u, nNewRejectCalls); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_EQ(1u, nOldResolveCalls); EXPECT_EQ(1u, nNewRejectCalls); EXPECT_NE(oldPromise, newPromise); @@ -445,7 +445,7 @@ TEST_F(ScriptPromisePropertyRefCountedTest, Resolve) property()->resolve(value.get()); EXPECT_EQ(Property::Resolved, property()->getState()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_EQ(1u, nResolveCalls); EXPECT_EQ(wrap(mainWorld(), value), actual); } @@ -464,7 +464,7 @@ TEST_F(ScriptPromisePropertyRefCountedTest, Reject) property()->reject(reason); EXPECT_EQ(Property::Rejected, property()->getState()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_EQ(1u, nRejectCalls); EXPECT_EQ(wrap(mainWorld(), reason), actual); } @@ -514,7 +514,7 @@ public: property->promise(DOMWrapperWorld::mainWorld()).then(stub(currentScriptState(), actualValue, nResolveCalls), notReached(currentScriptState())); } property->resolve(value); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); { ScriptState::Scope scope(mainScriptState()); actual = toCoreString(actualValue.v8Value()->ToString(mainScriptState()->context()).ToLocalChecked()); diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolverTest.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolverTest.cpp index 1c946d9..b6cf586 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolverTest.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseResolverTest.cpp @@ -60,7 +60,7 @@ public: createClosure(callback, v8::Undefined(isolate()), isolate()); // Execute all pending microtasks - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); } OwnPtr<DummyPageHolder> m_pageHolder; @@ -96,7 +96,7 @@ TEST_F(ScriptPromiseResolverTest, resolve) EXPECT_EQ(String(), onFulfilled); EXPECT_EQ(String(), onRejected); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_EQ(String(), onFulfilled); EXPECT_EQ(String(), onRejected); @@ -111,14 +111,14 @@ TEST_F(ScriptPromiseResolverTest, resolve) EXPECT_EQ(String(), onFulfilled); EXPECT_EQ(String(), onRejected); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_EQ("hello", onFulfilled); EXPECT_EQ(String(), onRejected); resolver->resolve("bye"); resolver->reject("bye"); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_EQ("hello", onFulfilled); EXPECT_EQ(String(), onRejected); @@ -144,7 +144,7 @@ TEST_F(ScriptPromiseResolverTest, reject) EXPECT_EQ(String(), onFulfilled); EXPECT_EQ(String(), onRejected); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_EQ(String(), onFulfilled); EXPECT_EQ(String(), onRejected); @@ -159,14 +159,14 @@ TEST_F(ScriptPromiseResolverTest, reject) EXPECT_EQ(String(), onFulfilled); EXPECT_EQ(String(), onRejected); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_EQ(String(), onFulfilled); EXPECT_EQ("hello", onRejected); resolver->resolve("bye"); resolver->reject("bye"); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_EQ(String(), onFulfilled); EXPECT_EQ("hello", onRejected); @@ -196,7 +196,7 @@ TEST_F(ScriptPromiseResolverTest, stop) } resolver->resolve("hello"); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_EQ(String(), onFulfilled); EXPECT_EQ(String(), onRejected); @@ -321,7 +321,7 @@ TEST_F(ScriptPromiseResolverTest, resolveVoid) } resolver->resolve(); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_EQ("undefined", onFulfilled); EXPECT_EQ(String(), onRejected); @@ -345,7 +345,7 @@ TEST_F(ScriptPromiseResolverTest, rejectVoid) } resolver->reject(); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_EQ(String(), onFulfilled); EXPECT_EQ("undefined", onRejected); diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseTest.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseTest.cpp index 01d144e..5c3fec7 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseTest.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseTest.cpp @@ -83,7 +83,7 @@ public: createClosure(callback, v8::Undefined(m_scope.isolate()), m_scope.isolate()); // Execute all pending microtasks - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); } String toString(const ScriptValue& value) @@ -124,13 +124,13 @@ TEST_F(ScriptPromiseTest, thenResolve) EXPECT_TRUE(onFulfilled.isEmpty()); EXPECT_TRUE(onRejected.isEmpty()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); resolver.resolve(v8String(isolate(), "hello")); EXPECT_TRUE(onFulfilled.isEmpty()); EXPECT_TRUE(onRejected.isEmpty()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_EQ("hello", toString(onFulfilled)); EXPECT_TRUE(onRejected.isEmpty()); @@ -148,7 +148,7 @@ TEST_F(ScriptPromiseTest, resolveThen) EXPECT_TRUE(onFulfilled.isEmpty()); EXPECT_TRUE(onRejected.isEmpty()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_EQ("hello", toString(onFulfilled)); EXPECT_TRUE(onRejected.isEmpty()); @@ -165,13 +165,13 @@ TEST_F(ScriptPromiseTest, thenReject) EXPECT_TRUE(onFulfilled.isEmpty()); EXPECT_TRUE(onRejected.isEmpty()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); resolver.reject(v8String(isolate(), "hello")); EXPECT_TRUE(onFulfilled.isEmpty()); EXPECT_TRUE(onRejected.isEmpty()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_TRUE(onFulfilled.isEmpty()); EXPECT_EQ("hello", toString(onRejected)); @@ -189,7 +189,7 @@ TEST_F(ScriptPromiseTest, rejectThen) EXPECT_TRUE(onFulfilled.isEmpty()); EXPECT_TRUE(onRejected.isEmpty()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_TRUE(onFulfilled.isEmpty()); EXPECT_EQ("hello", toString(onRejected)); @@ -226,7 +226,7 @@ TEST_F(ScriptPromiseTest, castNonPromise) EXPECT_TRUE(onRejected1.isEmpty()); EXPECT_TRUE(onRejected2.isEmpty()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_EQ("hello", toString(onFulfilled1)); EXPECT_EQ("hello", toString(onFulfilled2)); @@ -248,7 +248,7 @@ TEST_F(ScriptPromiseTest, reject) EXPECT_TRUE(onFulfilled.isEmpty()); EXPECT_TRUE(onRejected.isEmpty()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_TRUE(onFulfilled.isEmpty()); EXPECT_EQ("hello", toString(onRejected)); @@ -264,7 +264,7 @@ TEST_F(ScriptPromiseTest, rejectWithExceptionState) EXPECT_TRUE(onFulfilled.isEmpty()); EXPECT_TRUE(onRejected.isEmpty()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_TRUE(onFulfilled.isEmpty()); EXPECT_EQ("SyntaxError: some syntax error", toString(onRejected)); @@ -282,7 +282,7 @@ TEST_F(ScriptPromiseTest, allWithEmptyPromises) EXPECT_TRUE(onFulfilled.isEmpty()); EXPECT_TRUE(onRejected.isEmpty()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_FALSE(onFulfilled.isEmpty()); EXPECT_TRUE(toStringArray(onFulfilled).isEmpty()); @@ -304,7 +304,7 @@ TEST_F(ScriptPromiseTest, allWithResolvedPromises) EXPECT_TRUE(onFulfilled.isEmpty()); EXPECT_TRUE(onRejected.isEmpty()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_FALSE(onFulfilled.isEmpty()); Vector<String> values = toStringArray(onFulfilled); @@ -329,7 +329,7 @@ TEST_F(ScriptPromiseTest, allWithRejectedPromise) EXPECT_TRUE(onFulfilled.isEmpty()); EXPECT_TRUE(onRejected.isEmpty()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_TRUE(onFulfilled.isEmpty()); EXPECT_FALSE(onRejected.isEmpty()); diff --git a/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp b/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp index f0a8dfd..04de69e 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp @@ -321,7 +321,7 @@ static void initializeV8Common(v8::Isolate* isolate) v8::Debug::SetLiveEditEnabled(isolate, false); - isolate->SetMicrotasksPolicy(v8::MicrotasksPolicy::kScoped); + isolate->SetAutorunMicrotasks(false); } namespace { diff --git a/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp b/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp index 65c02bc..0a2cfcb 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp @@ -30,6 +30,7 @@ #include "bindings/core/v8/V8Binding.h" #include "bindings/core/v8/V8HiddenValue.h" #include "bindings/core/v8/V8ObjectConstructor.h" +#include "bindings/core/v8/V8RecursionScope.h" #include "bindings/core/v8/V8ScriptRunner.h" #include "core/frame/Deprecation.h" #include "core/inspector/MainThreadDebugger.h" @@ -52,6 +53,18 @@ static void microtasksCompletedCallback(v8::Isolate* isolate) V8PerIsolateData::from(isolate)->runEndOfScopeTasks(); } +#if ENABLE(ASSERT) +static void assertV8RecursionScope(v8::Isolate* isolate) +{ + ASSERT(V8RecursionScope::properlyUsed(isolate)); +} + +static bool runningUnitTest() +{ + return Platform::current()->unitTestSupport(); +} +#endif + static void useCounterCallback(v8::Isolate* isolate, v8::Isolate::UseCounterFeature feature) { UseCounter::Feature blinkFeature; @@ -130,15 +143,25 @@ static void useCounterCallback(v8::Isolate* isolate, v8::Isolate::UseCounterFeat } V8PerIsolateData::V8PerIsolateData() - : m_isolateHolder(adoptPtr(new gin::IsolateHolder())) + : m_destructionPending(false) + , m_isolateHolder(adoptPtr(new gin::IsolateHolder())) , m_stringCache(adoptPtr(new StringCache(isolate()))) , m_hiddenValue(V8HiddenValue::create()) , m_constructorMode(ConstructorMode::CreateNewObject) + , m_recursionLevel(0) , m_isHandlingRecursionLevelError(false) , m_isReportingException(false) +#if ENABLE(ASSERT) + , m_internalScriptRecursionLevel(0) +#endif + , m_performingMicrotaskCheckpoint(false) { // FIXME: Remove once all v8::Isolate::GetCurrent() calls are gone. isolate()->Enter(); +#if ENABLE(ASSERT) + if (!runningUnitTest()) + isolate()->AddCallCompletedCallback(&assertV8RecursionScope); +#endif isolate()->AddBeforeCallEnteredCallback(&beforeCallEnteredCallback); isolate()->AddMicrotasksCompletedCallback(µtasksCompletedCallback); if (isMainThread()) @@ -183,6 +206,9 @@ void V8PerIsolateData::willBeDestroyed(v8::Isolate* isolate) { V8PerIsolateData* data = from(isolate); + ASSERT(!data->m_destructionPending); + data->m_destructionPending = true; + data->m_threadDebugger.clear(); // Clear any data that may have handles into the heap, // prior to calling ThreadState::detach(). @@ -193,6 +219,10 @@ void V8PerIsolateData::willBeDestroyed(v8::Isolate* isolate) // gets called but before the Isolate exits. void V8PerIsolateData::destroy(v8::Isolate* isolate) { +#if ENABLE(ASSERT) + if (!runningUnitTest()) + isolate->RemoveCallCompletedCallback(&assertV8RecursionScope); +#endif isolate->RemoveBeforeCallEnteredCallback(&beforeCallEnteredCallback); isolate->RemoveMicrotasksCompletedCallback(µtasksCompletedCallback); V8PerIsolateData* data = from(isolate); diff --git a/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.h b/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.h index 33ed8dc..5d709e7 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.h +++ b/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.h @@ -74,18 +74,31 @@ public: static void enableIdleTasks(v8::Isolate*, PassOwnPtr<gin::V8IdleTaskRunner>); + bool destructionPending() const { return m_destructionPending; } v8::Isolate* isolate() { return m_isolateHolder->isolate(); } StringCache* stringCache() { return m_stringCache.get(); } v8::Persistent<v8::Value>& ensureLiveRoot(); + int recursionLevel() const { return m_recursionLevel; } + int incrementRecursionLevel() { return ++m_recursionLevel; } + int decrementRecursionLevel() { return --m_recursionLevel; } bool isHandlingRecursionLevelError() const { return m_isHandlingRecursionLevelError; } void setIsHandlingRecursionLevelError(bool value) { m_isHandlingRecursionLevelError = value; } bool isReportingException() const { return m_isReportingException; } void setReportingException(bool value) { m_isReportingException = value; } + bool performingMicrotaskCheckpoint() const { return m_performingMicrotaskCheckpoint; } + void setPerformingMicrotaskCheckpoint(bool performingMicrotaskCheckpoint) { m_performingMicrotaskCheckpoint = performingMicrotaskCheckpoint; } + +#if ENABLE(ASSERT) + int internalScriptRecursionLevel() const { return m_internalScriptRecursionLevel; } + int incrementInternalScriptRecursionLevel() { return ++m_internalScriptRecursionLevel; } + int decrementInternalScriptRecursionLevel() { return --m_internalScriptRecursionLevel; } +#endif + V8HiddenValue* hiddenValue() { return m_hiddenValue.get(); } v8::Local<v8::FunctionTemplate> domTemplate(const void* domTemplateKey, v8::FunctionCallback = 0, v8::Local<v8::Value> data = v8::Local<v8::Value>(), v8::Local<v8::Signature> = v8::Local<v8::Signature>(), int length = 0); @@ -118,6 +131,7 @@ private: bool hasInstance(const WrapperTypeInfo* untrusted, v8::Local<v8::Value>, DOMTemplateMap&); v8::Local<v8::Object> findInstanceInPrototypeChain(const WrapperTypeInfo*, v8::Local<v8::Value>, DOMTemplateMap&); + bool m_destructionPending; OwnPtr<gin::IsolateHolder> m_isolateHolder; DOMTemplateMap m_domTemplateMapForMainWorld; DOMTemplateMap m_domTemplateMapForNonMainWorld; @@ -129,9 +143,15 @@ private: bool m_constructorMode; friend class ConstructorMode; + int m_recursionLevel; bool m_isHandlingRecursionLevelError; bool m_isReportingException; +#if ENABLE(ASSERT) + int m_internalScriptRecursionLevel; +#endif + bool m_performingMicrotaskCheckpoint; + Vector<OwnPtr<EndOfScopeTask>> m_endOfScopeTasks; OwnPtr<ThreadDebugger> m_threadDebugger; }; diff --git a/third_party/WebKit/Source/bindings/core/v8/V8RecursionScope.cpp b/third_party/WebKit/Source/bindings/core/v8/V8RecursionScope.cpp index b4c3acf..ed10e86 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8RecursionScope.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8RecursionScope.cpp @@ -30,6 +30,13 @@ #include "bindings/core/v8/V8RecursionScope.h" +#include "core/dom/Microtask.h" + namespace blink { +void V8RecursionScope::didLeaveScriptContext() +{ + Microtask::performCheckpoint(m_isolate); +} + } // namespace blink diff --git a/third_party/WebKit/Source/bindings/core/v8/V8RecursionScope.h b/third_party/WebKit/Source/bindings/core/v8/V8RecursionScope.h index 8bbd26c..dd9a51f 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8RecursionScope.h +++ b/third_party/WebKit/Source/bindings/core/v8/V8RecursionScope.h @@ -59,39 +59,63 @@ class CORE_EXPORT V8RecursionScope { STACK_ALLOCATED(); public: explicit V8RecursionScope(v8::Isolate* isolate) - : m_scope(isolate, v8::MicrotasksScope::kRunMicrotasks) + : m_isolate(isolate) { - ASSERT(isolate->GetMicrotasksPolicy() == v8::MicrotasksPolicy::kScoped); + V8PerIsolateData::from(m_isolate)->incrementRecursionLevel(); + // If you want V8 to autorun microtasks, this class needs to have a + // v8::Isolate::SuppressMicrotaskExecutionScope member. + ASSERT(!isolate->WillAutorunMicrotasks()); } ~V8RecursionScope() { + if (!V8PerIsolateData::from(m_isolate)->decrementRecursionLevel()) + didLeaveScriptContext(); } static int recursionLevel(v8::Isolate* isolate) { - return v8::MicrotasksScope::GetCurrentDepth(isolate); + return V8PerIsolateData::from(isolate)->recursionLevel(); } +#if ENABLE(ASSERT) + static bool properlyUsed(v8::Isolate* isolate) + { + return recursionLevel(isolate) > 0 || V8PerIsolateData::from(isolate)->internalScriptRecursionLevel() > 0; + } +#endif + class MicrotaskSuppression { USING_FAST_MALLOC(MicrotaskSuppression); WTF_MAKE_NONCOPYABLE(MicrotaskSuppression); public: - explicit MicrotaskSuppression(v8::Isolate* isolate) - : m_scope(isolate, v8::MicrotasksScope::kDoNotRunMicrotasks) + MicrotaskSuppression(v8::Isolate* isolate) +#if ENABLE(ASSERT) + : m_isolate(isolate) +#endif { +#if ENABLE(ASSERT) + V8PerIsolateData::from(m_isolate)->incrementInternalScriptRecursionLevel(); +#endif } ~MicrotaskSuppression() { +#if ENABLE(ASSERT) + V8PerIsolateData::from(m_isolate)->decrementInternalScriptRecursionLevel(); +#endif } private: - v8::MicrotasksScope m_scope; +#if ENABLE(ASSERT) + v8::Isolate* m_isolate; +#endif }; private: - v8::MicrotasksScope m_scope; + void didLeaveScriptContext(); + + v8::Isolate* m_isolate; }; } // namespace blink diff --git a/third_party/WebKit/Source/core/dom/Microtask.cpp b/third_party/WebKit/Source/core/dom/Microtask.cpp index 344c9e0..7c3ec6e 100644 --- a/third_party/WebKit/Source/core/dom/Microtask.cpp +++ b/third_party/WebKit/Source/core/dom/Microtask.cpp @@ -40,9 +40,13 @@ namespace blink { void Microtask::performCheckpoint(v8::Isolate* isolate) { - if (ScriptForbiddenScope::isScriptForbidden()) + V8PerIsolateData* isolateData = V8PerIsolateData::from(isolate); + ASSERT(isolateData); + if (isolateData->recursionLevel() || isolateData->performingMicrotaskCheckpoint() || isolateData->destructionPending() || ScriptForbiddenScope::isScriptForbidden()) return; - v8::MicrotasksScope::PerformCheckpoint(isolate); + isolateData->setPerformingMicrotaskCheckpoint(true); + isolate->RunMicrotasks(); + isolateData->setPerformingMicrotaskCheckpoint(false); } static void microtaskFunctionCallback(void* data) diff --git a/third_party/WebKit/Source/core/streams/ReadableStreamReaderTest.cpp b/third_party/WebKit/Source/core/streams/ReadableStreamReaderTest.cpp index 352a30f..f7e12f8 100644 --- a/third_party/WebKit/Source/core/streams/ReadableStreamReaderTest.cpp +++ b/third_party/WebKit/Source/core/streams/ReadableStreamReaderTest.cpp @@ -179,7 +179,7 @@ TEST_F(ReadableStreamReaderTest, Release) EXPECT_TRUE(onFulfilled.isNull()); EXPECT_TRUE(onRejected.isNull()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_TRUE(onFulfilled.isNull()); EXPECT_EQ("AbortError: the reader is already released", onRejected); @@ -208,7 +208,7 @@ TEST_F(ReadableStreamReaderTest, ReadAfterRelease) EXPECT_FALSE(result.isSet); EXPECT_TRUE(onRejected.isNull()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_FALSE(result.isSet); EXPECT_EQ("TypeError: the reader is already released", onRejected); @@ -250,7 +250,7 @@ TEST_F(ReadableStreamReaderTest, EnqueueThenRead) EXPECT_FALSE(result.isSet); EXPECT_TRUE(onRejected.isNull()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_TRUE(result.isSet); EXPECT_FALSE(result.isDone); @@ -264,7 +264,7 @@ TEST_F(ReadableStreamReaderTest, EnqueueThenRead) EXPECT_FALSE(result2.isSet); EXPECT_TRUE(onRejected2.isNull()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_TRUE(result2.isSet); EXPECT_FALSE(result2.isDone); @@ -290,7 +290,7 @@ TEST_F(ReadableStreamReaderTest, ReadThenEnqueue) EXPECT_FALSE(result2.isSet); EXPECT_TRUE(onRejected2.isNull()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_FALSE(result.isSet); EXPECT_TRUE(onRejected.isNull()); @@ -298,7 +298,7 @@ TEST_F(ReadableStreamReaderTest, ReadThenEnqueue) EXPECT_TRUE(onRejected2.isNull()); m_stream->enqueue("hello"); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_TRUE(result.isSet); EXPECT_FALSE(result.isDone); @@ -308,7 +308,7 @@ TEST_F(ReadableStreamReaderTest, ReadThenEnqueue) EXPECT_TRUE(onRejected2.isNull()); m_stream->enqueue("world"); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_TRUE(result2.isSet); EXPECT_FALSE(result2.isDone); @@ -330,7 +330,7 @@ TEST_F(ReadableStreamReaderTest, ClosedReader) String onClosedFulfilled, onClosedRejected; ReadResult result; String onReadRejected; - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); reader->closed(scriptState()).then(createCaptor(&onClosedFulfilled), createCaptor(&onClosedRejected)); reader->read(scriptState()).then(createResultCaptor(&result), createCaptor(&onReadRejected)); EXPECT_TRUE(onClosedFulfilled.isNull()); @@ -338,7 +338,7 @@ TEST_F(ReadableStreamReaderTest, ClosedReader) EXPECT_FALSE(result.isSet); EXPECT_TRUE(onReadRejected.isNull()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_EQ("undefined", onClosedFulfilled); EXPECT_TRUE(onClosedRejected.isNull()); EXPECT_TRUE(result.isSet); @@ -361,7 +361,7 @@ TEST_F(ReadableStreamReaderTest, ErroredReader) String onClosedFulfilled, onClosedRejected; String onReadFulfilled, onReadRejected; - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); reader->closed(scriptState()).then(createCaptor(&onClosedFulfilled), createCaptor(&onClosedRejected)); reader->read(scriptState()).then(createCaptor(&onReadFulfilled), createCaptor(&onReadRejected)); EXPECT_TRUE(onClosedFulfilled.isNull()); @@ -369,7 +369,7 @@ TEST_F(ReadableStreamReaderTest, ErroredReader) EXPECT_TRUE(onReadFulfilled.isNull()); EXPECT_TRUE(onReadRejected.isNull()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_TRUE(onClosedFulfilled.isNull()); EXPECT_EQ("SyntaxError: some error", onClosedRejected); EXPECT_TRUE(onReadFulfilled.isNull()); @@ -389,7 +389,7 @@ TEST_F(ReadableStreamReaderTest, PendingReadsShouldBeResolvedWhenClosed) reader->read(scriptState()).then(createResultCaptor(&result), createCaptor(&onRejected)); reader->read(scriptState()).then(createResultCaptor(&result2), createCaptor(&onRejected2)); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_FALSE(result.isSet); EXPECT_TRUE(onRejected.isNull()); EXPECT_FALSE(result2.isSet); @@ -401,7 +401,7 @@ TEST_F(ReadableStreamReaderTest, PendingReadsShouldBeResolvedWhenClosed) EXPECT_FALSE(result2.isSet); EXPECT_TRUE(onRejected2.isNull()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_TRUE(result.isSet); EXPECT_TRUE(result.isDone); @@ -427,7 +427,7 @@ TEST_F(ReadableStreamReaderTest, PendingReadsShouldBeRejectedWhenErrored) reader->read(scriptState()).then(createCaptor(&onFulfilled), createCaptor(&onRejected)); reader->read(scriptState()).then(createCaptor(&onFulfilled2), createCaptor(&onRejected2)); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_TRUE(onFulfilled.isNull()); EXPECT_TRUE(onRejected.isNull()); EXPECT_TRUE(onFulfilled2.isNull()); @@ -439,7 +439,7 @@ TEST_F(ReadableStreamReaderTest, PendingReadsShouldBeRejectedWhenErrored) EXPECT_TRUE(onFulfilled2.isNull()); EXPECT_TRUE(onRejected2.isNull()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_TRUE(onFulfilled.isNull()); EXPECT_EQ(onRejected, "SyntaxError: some error"); @@ -460,7 +460,7 @@ TEST_F(ReadableStreamReaderTest, PendingReadsShouldBeResolvedWhenCanceled) reader->read(scriptState()).then(createResultCaptor(&result), createCaptor(&onRejected)); reader->read(scriptState()).then(createResultCaptor(&result2), createCaptor(&onRejected2)); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_FALSE(result.isSet); EXPECT_TRUE(onRejected.isNull()); EXPECT_FALSE(result2.isSet); @@ -473,7 +473,7 @@ TEST_F(ReadableStreamReaderTest, PendingReadsShouldBeResolvedWhenCanceled) EXPECT_FALSE(result2.isSet); EXPECT_TRUE(onRejected2.isNull()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_TRUE(result.isSet); EXPECT_TRUE(result.isDone); @@ -502,7 +502,7 @@ TEST_F(ReadableStreamReaderTest, CancelShouldNotWorkWhenNotActive) EXPECT_TRUE(onFulfilled.isNull()); EXPECT_TRUE(onRejected.isNull()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_TRUE(onFulfilled.isNull()); EXPECT_EQ("TypeError: the reader is already released", onRejected); @@ -528,7 +528,7 @@ TEST_F(ReadableStreamReaderTest, Cancel) EXPECT_TRUE(onCancelFulfilled.isNull()); EXPECT_TRUE(onCancelRejected.isNull()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_EQ("undefined", onClosedFulfilled); EXPECT_TRUE(onClosedRejected.isNull()); EXPECT_EQ("undefined", onCancelFulfilled); @@ -552,7 +552,7 @@ TEST_F(ReadableStreamReaderTest, Close) EXPECT_TRUE(onFulfilled.isNull()); EXPECT_TRUE(onRejected.isNull()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_EQ("undefined", onFulfilled); EXPECT_TRUE(onRejected.isNull()); EXPECT_FALSE(exceptionState.hadException()); @@ -574,7 +574,7 @@ TEST_F(ReadableStreamReaderTest, Error) EXPECT_TRUE(onFulfilled.isNull()); EXPECT_TRUE(onRejected.isNull()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_TRUE(onFulfilled.isNull()); EXPECT_EQ("SyntaxError: some error", onRejected); EXPECT_FALSE(exceptionState.hadException()); diff --git a/third_party/WebKit/Source/core/streams/ReadableStreamTest.cpp b/third_party/WebKit/Source/core/streams/ReadableStreamTest.cpp index 031ecdd..fb52f46 100644 --- a/third_party/WebKit/Source/core/streams/ReadableStreamTest.cpp +++ b/third_party/WebKit/Source/core/streams/ReadableStreamTest.cpp @@ -304,7 +304,7 @@ TEST_F(ReadableStreamTest, CloseWhenReadable) stream->read(scriptState()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_EQ(ReadableStream::Readable, stream->stateInternal()); EXPECT_FALSE(stream->isPulling()); @@ -335,7 +335,7 @@ TEST_F(ReadableStreamTest, CancelWhenClosed) EXPECT_TRUE(onFulfilled.isNull()); EXPECT_TRUE(onRejected.isNull()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_EQ("undefined", onFulfilled); EXPECT_TRUE(onRejected.isNull()); } @@ -358,7 +358,7 @@ TEST_F(ReadableStreamTest, CancelWhenErrored) EXPECT_TRUE(onFulfilled.isNull()); EXPECT_TRUE(onRejected.isNull()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_TRUE(onFulfilled.isNull()); EXPECT_EQ("NotFoundError: error", onRejected); } @@ -392,7 +392,7 @@ TEST_F(ReadableStreamTest, CancelWhenReadable) EXPECT_TRUE(onCancelFulfilled.isNull()); EXPECT_TRUE(onCancelRejected.isNull()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_EQ("undefined", onCancelFulfilled); EXPECT_TRUE(onCancelRejected.isNull()); } @@ -416,7 +416,7 @@ TEST_F(ReadableStreamTest, CancelWhenLocked) EXPECT_TRUE(onFulfilled.isNull()); EXPECT_TRUE(onRejected.isNull()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_TRUE(onFulfilled.isNull()); EXPECT_EQ("TypeError: this stream is locked to a ReadableStreamReader", onRejected); @@ -563,7 +563,7 @@ TEST_F(ReadableStreamTest, GetClosedReader) EXPECT_TRUE(onFulfilled.isNull()); EXPECT_TRUE(onRejected.isNull()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_EQ("undefined", onFulfilled); EXPECT_TRUE(onRejected.isNull()); } @@ -586,7 +586,7 @@ TEST_F(ReadableStreamTest, GetErroredReader) EXPECT_TRUE(onFulfilled.isNull()); EXPECT_TRUE(onRejected.isNull()); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); EXPECT_TRUE(onFulfilled.isNull()); EXPECT_EQ("SyntaxError: some error", onRejected); } diff --git a/third_party/WebKit/Source/modules/cachestorage/CacheTest.cpp b/third_party/WebKit/Source/modules/cachestorage/CacheTest.cpp index 1c4030c..7834ae9 100644 --- a/third_party/WebKit/Source/modules/cachestorage/CacheTest.cpp +++ b/third_party/WebKit/Source/modules/cachestorage/CacheTest.cpp @@ -249,7 +249,7 @@ public: { ScriptValue onReject; promise.then(UnreachableFunction::create(scriptState()), TestFunction::create(scriptState(), &onReject)); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); return onReject; } @@ -263,7 +263,7 @@ public: { ScriptValue onResolve; promise.then(TestFunction::create(scriptState(), &onResolve), UnreachableFunction::create(scriptState())); - v8::MicrotasksScope::PerformCheckpoint(isolate()); + isolate()->RunMicrotasks(); return onResolve; } diff --git a/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandleTest.cpp b/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandleTest.cpp index fba225c..9a9daea 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,6 @@ public: { v8::Local<v8::String> source; v8::Local<v8::Script> script; - V8RecursionScope::MicrotaskSuppression microtasks(isolate()); 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/serviceworkers/ServiceWorkerContainerTest.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainerTest.cpp index cb4e2da..8c0af13 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainerTest.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainerTest.cpp @@ -92,7 +92,7 @@ void expectRejected(ScriptState* scriptState, ScriptPromise& promise, const Scri { StubScriptFunction resolved, rejected; promise.then(resolved.function(scriptState), rejected.function(scriptState)); - v8::MicrotasksScope::PerformCheckpoint(promise.isolate()); + promise.isolate()->RunMicrotasks(); EXPECT_EQ(0ul, resolved.callCount()); EXPECT_EQ(1ul, rejected.callCount()); if (rejected.callCount()) |