| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2921d55 commit 4ddb9b3
6 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -102,17 +102,9 @@ namespace node { | |||
| 102 | 102 | #define NODE_ASYNC_CRYPTO_PROVIDER_TYPES(V) | |
| 103 | 103 | #endif // HAVE_OPENSSL | |
| 104 | 104 | ||
| 105 | - #if HAVE_INSPECTOR | ||
| 106 | - #define NODE_ASYNC_INSPECTOR_PROVIDER_TYPES(V) \ | ||
| 107 | - V(INSPECTORJSBINDING) | ||
| 108 | - #else | ||
| 109 | - #define NODE_ASYNC_INSPECTOR_PROVIDER_TYPES(V) | ||
| 110 | - #endif // HAVE_INSPECTOR | ||
| 111 | - | ||
| 112 | - #define NODE_ASYNC_PROVIDER_TYPES(V) \ | ||
| 113 | - NODE_ASYNC_NON_CRYPTO_PROVIDER_TYPES(V) \ | ||
| 114 | - NODE_ASYNC_CRYPTO_PROVIDER_TYPES(V) \ | ||
| 115 | - NODE_ASYNC_INSPECTOR_PROVIDER_TYPES(V) | ||
| 105 | + #define NODE_ASYNC_PROVIDER_TYPES(V) \ | ||
| 106 | + NODE_ASYNC_NON_CRYPTO_PROVIDER_TYPES(V) \ | ||
| 107 | + NODE_ASYNC_CRYPTO_PROVIDER_TYPES(V) | ||
| 116 | 108 | ||
| 117 | 109 | class Environment; | |
| 118 | 110 | class DestroyParam; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,3 @@ | |||
| 1 | - #include "async_wrap-inl.h" | ||
| 2 | 1 | #include "base_object-inl.h" | |
| 3 | 2 | #include "inspector_agent.h" | |
| 4 | 3 | #include "inspector_io.h" | |
@@ -61,7 +60,7 @@ struct MainThreadConnection { | |||
| 61 | 60 | }; | |
| 62 | 61 | ||
| 63 | 62 | template <typename ConnectionType> | |
| 64 | - class JSBindingsConnection : public AsyncWrap { | ||
| 63 | + class JSBindingsConnection : public BaseObject { | ||
| 65 | 64 | public: | |
| 66 | 65 | class JSBindingsSessionDelegate : public InspectorSessionDelegate { | |
| 67 | 66 | public: | |
@@ -91,15 +90,16 @@ class JSBindingsConnection : public AsyncWrap { | |||
| 91 | 90 | JSBindingsConnection(Environment* env, | |
| 92 | 91 | Local<Object> wrap, | |
| 93 | 92 | Local<Function> callback) | |
| 94 | - : AsyncWrap(env, wrap, PROVIDER_INSPECTORJSBINDING), | ||
| 95 | - callback_(env->isolate(), callback) { | ||
| 93 | + : BaseObject(env, wrap), callback_(env->isolate(), callback) { | ||
| 96 | 94 | Agent* inspector = env->inspector_agent(); | |
| 97 | 95 | session_ = ConnectionType::Connect( | |
| 98 | 96 | inspector, std::make_unique<JSBindingsSessionDelegate>(env, this)); | |
| 99 | 97 | } | |
| 100 | 98 | ||
| 101 | 99 | void OnMessage(Local<Value> value) { | |
| 102 | - MakeCallback(callback_.Get(env()->isolate()), 1, &value); | ||
| 100 | + auto result = callback_.Get(env()->isolate()) | ||
| 101 | + ->Call(env()->context(), object(), 1, &value); | ||
| 102 | + (void)result; | ||
| 103 | 103 | } | |
| 104 | 104 | ||
| 105 | 105 | static void Bind(Environment* env, Local<Object> target) { | |
@@ -108,7 +108,6 @@ class JSBindingsConnection : public AsyncWrap { | |||
| 108 | 108 | NewFunctionTemplate(isolate, JSBindingsConnection::New); | |
| 109 | 109 | tmpl->InstanceTemplate()->SetInternalFieldCount( | |
| 110 | 110 | JSBindingsConnection::kInternalFieldCount); | |
| 111 | - tmpl->Inherit(AsyncWrap::GetConstructorTemplate(env)); | ||
| 112 | 111 | SetProtoMethod(isolate, tmpl, "dispatch", JSBindingsConnection::Dispatch); | |
| 113 | 112 | SetProtoMethod( | |
| 114 | 113 | isolate, tmpl, "disconnect", JSBindingsConnection::Disconnect); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,56 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + const common = require('../common'); | ||
| 3 | + const { AsyncLocalStorage } = require('async_hooks'); | ||
| 4 | + const als = new AsyncLocalStorage(); | ||
| 5 | + | ||
| 6 | + function getStore() { | ||
| 7 | + return als.getStore(); | ||
| 8 | + } | ||
| 9 | + | ||
| 10 | + common.skipIfInspectorDisabled(); | ||
| 11 | + | ||
| 12 | + const assert = require('assert'); | ||
| 13 | + const { Session } = require('inspector'); | ||
| 14 | + const path = require('path'); | ||
| 15 | + const { pathToFileURL } = require('url'); | ||
| 16 | + | ||
| 17 | + let valueInFunction = 0; | ||
| 18 | + let valueInBreakpoint = 0; | ||
| 19 | + | ||
| 20 | + function debugged() { | ||
| 21 | + valueInFunction = getStore(); | ||
| 22 | + return 42; | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + async function test() { | ||
| 26 | + const session = new Session(); | ||
| 27 | + | ||
| 28 | + session.connect(); | ||
| 29 | + session.post('Debugger.enable'); | ||
| 30 | + | ||
| 31 | + session.on('Debugger.paused', () => { | ||
| 32 | + valueInBreakpoint = getStore(); | ||
| 33 | + }); | ||
| 34 | + | ||
| 35 | + await new Promise((resolve, reject) => { | ||
| 36 | + session.post('Debugger.setBreakpointByUrl', { | ||
| 37 | + 'lineNumber': 22, | ||
| 38 | + 'url': pathToFileURL(path.resolve(__dirname, __filename)).toString(), | ||
| 39 | + 'columnNumber': 0, | ||
| 40 | + 'condition': '' | ||
| 41 | + }, (error, result) => { | ||
| 42 | + return error ? reject(error) : resolve(result); | ||
| 43 | + }); | ||
| 44 | + }); | ||
| 45 | + | ||
| 46 | + als.run(1, debugged); | ||
| 47 | + assert.strictEqual(valueInFunction, valueInBreakpoint); | ||
| 48 | + assert.strictEqual(valueInFunction, 1); | ||
| 49 | + | ||
| 50 | + session.disconnect(); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + const interval = setInterval(() => {}, 1000); | ||
| 54 | + test().then(common.mustCall(() => { | ||
| 55 | + clearInterval(interval); | ||
| 56 | + })); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,3 @@ | |||
| 1 | - // Flags: --expose-internals | ||
| 2 | 1 | 'use strict'; | |
| 3 | 2 | const common = require('../common'); | |
| 4 | 3 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -47,8 +47,6 @@ const { getSystemErrorName } = require('util'); | |||
| 47 | 47 | delete providers.WORKER; | |
| 48 | 48 | // TODO(danbev): Test for these | |
| 49 | 49 | delete providers.JSUDPWRAP; | |
| 50 | - if (!common.isMainThread) | ||
| 51 | - delete providers.INSPECTORJSBINDING; | ||
| 52 | 50 | delete providers.KEYPAIRGENREQUEST; | |
| 53 | 51 | delete providers.KEYGENREQUEST; | |
| 54 | 52 | delete providers.KEYEXPORTREQUEST; | |
@@ -316,13 +314,6 @@ if (common.hasCrypto) { // eslint-disable-line node-core/crypto-check | |||
| 316 | 314 | testInitialized(req, 'SendWrap'); | |
| 317 | 315 | } | |
| 318 | 316 | ||
| 319 | - if (process.features.inspector && common.isMainThread) { | ||
| 320 | - const binding = internalBinding('inspector'); | ||
| 321 | - const handle = new binding.Connection(() => {}); | ||
| 322 | - testInitialized(handle, 'Connection'); | ||
| 323 | - handle.disconnect(); | ||
| 324 | - } | ||
| 325 | - | ||
| 326 | 317 | // PROVIDER_HEAPDUMP | |
| 327 | 318 | { | |
| 328 | 319 | v8.getHeapSnapshot().destroy(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -68,7 +68,6 @@ declare namespace InternalAsyncWrapBinding { | |||
| 68 | 68 | SIGNREQUEST: 54; | |
| 69 | 69 | TLSWRAP: 55; | |
| 70 | 70 | VERIFYREQUEST: 56; | |
| 71 | - INSPECTORJSBINDING: 57; | ||
| 72 | 71 | } | |
| 73 | 72 | } | |
| 74 | 73 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments