summaryrefslogtreecommitdiff
path: root/deps/v8/test/inspector
diff options
context:
space:
mode:
authorAlexey Kozyatinskiy <kozyatinskiy@chromium.org>2017-08-01 14:17:31 -0700
committerEugene Ostroukhov <eostroukhov@chromium.org>2017-08-11 11:17:02 -0700
commit73c59bbbf9bd2a53ab322cb822ae718fabef7b6c (patch)
tree38ccf1d11e3b943b812e46e146988b5cdbc0380a /deps/v8/test/inspector
parent7307839b559b13c242e9d5341201ec17f83f3eed (diff)
downloadandroid-node-v8-73c59bbbf9bd2a53ab322cb822ae718fabef7b6c.tar.gz
android-node-v8-73c59bbbf9bd2a53ab322cb822ae718fabef7b6c.tar.bz2
android-node-v8-73c59bbbf9bd2a53ab322cb822ae718fabef7b6c.zip
deps: cherry-pick f19b889 from V8 upstream
Original commit message: [inspector] support for cases when embedder doesn't call contextDestroyed Node.js doesn't have good place to call contextDestroyed. We need to cleanup everything on our side to allow clients to not call contextDestroyed method. R=dgozman@chromium.org,eostroukhov@chromium.com Bug: none Change-Id: Ibe3f01fd18afbfa579e5db66ab6f174d5fad7c82 Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_chromium_rel_ng Reviewed-on: https://chromium-review.googlesource.com/575519 Reviewed-by: Dmitry Gozman <dgozman@chromium.org> Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#46849} Reviewed-on: https://chromium-review.googlesource.com/596549 Cr-Commit-Position: refs/heads/master@{#47060} Ref: https://chromium.googlesource.com/v8/v8.git/+/f19b889be801bdebc04c49090e37c787f7ba8805 PR-URL: https://github.com/nodejs/node/pull/14465 Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Diffstat (limited to 'deps/v8/test/inspector')
-rw-r--r--deps/v8/test/inspector/inspector-test.cc9
-rw-r--r--deps/v8/test/inspector/runtime/context-destroyed-on-context-collected-expected.txt7
-rw-r--r--deps/v8/test/inspector/runtime/context-destroyed-on-context-collected.js14
3 files changed, 30 insertions, 0 deletions
diff --git a/deps/v8/test/inspector/inspector-test.cc b/deps/v8/test/inspector/inspector-test.cc
index 2e105c54d9..0395cc3483 100644
--- a/deps/v8/test/inspector/inspector-test.cc
+++ b/deps/v8/test/inspector/inspector-test.cc
@@ -619,6 +619,9 @@ class InspectorExtension : public IsolateData::SetupGlobalTask {
inspector->Set(ToV8String(isolate, "fireContextDestroyed"),
v8::FunctionTemplate::New(
isolate, &InspectorExtension::FireContextDestroyed));
+ inspector->Set(
+ ToV8String(isolate, "freeContext"),
+ v8::FunctionTemplate::New(isolate, &InspectorExtension::FreeContext));
inspector->Set(ToV8String(isolate, "setMaxAsyncTaskStacks"),
v8::FunctionTemplate::New(
isolate, &InspectorExtension::SetMaxAsyncTaskStacks));
@@ -658,6 +661,12 @@ class InspectorExtension : public IsolateData::SetupGlobalTask {
data->inspector()->ContextDestroyed(context);
}
+ static void FreeContext(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext();
+ IsolateData* data = IsolateData::FromContext(context);
+ data->FreeContext(context);
+ }
+
static void SetMaxAsyncTaskStacks(
const v8::FunctionCallbackInfo<v8::Value>& args) {
if (args.Length() != 1 || !args[0]->IsInt32()) {
diff --git a/deps/v8/test/inspector/runtime/context-destroyed-on-context-collected-expected.txt b/deps/v8/test/inspector/runtime/context-destroyed-on-context-collected-expected.txt
new file mode 100644
index 0000000000..9a5e1708c1
--- /dev/null
+++ b/deps/v8/test/inspector/runtime/context-destroyed-on-context-collected-expected.txt
@@ -0,0 +1,7 @@
+Tests that contextDesrtoyed nofitication is fired when context is collected.
+{
+ method : Runtime.executionContextDestroyed
+ params : {
+ executionContextId : <executionContextId>
+ }
+}
diff --git a/deps/v8/test/inspector/runtime/context-destroyed-on-context-collected.js b/deps/v8/test/inspector/runtime/context-destroyed-on-context-collected.js
new file mode 100644
index 0000000000..9f715937c6
--- /dev/null
+++ b/deps/v8/test/inspector/runtime/context-destroyed-on-context-collected.js
@@ -0,0 +1,14 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+let {session, contextGroup, Protocol} =
+ InspectorTest.start('Tests that contextDesrtoyed nofitication is fired when context is collected.');
+
+(async function test() {
+ await Protocol.Runtime.enable();
+ Protocol.Runtime.onExecutionContextDestroyed(InspectorTest.logMessage);
+ contextGroup.addScript('inspector.freeContext()');
+ await Protocol.HeapProfiler.collectGarbage();
+ InspectorTest.completeTest();
+})();