| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -598,7 +598,7 @@ a V8-inspector based CLI debugger available through `node inspect`. | |||
| 598 | 598 | <a id="DEP0069"></a> | |
| 599 | 599 | ### DEP0069: vm.runInDebugContext(string) | |
| 600 | 600 | ||
| 601 | - Type: Documentation-only | ||
| 601 | + Type: Runtime | ||
| 602 | 602 | ||
| 603 | 603 | The DebugContext will be removed in V8 soon and will not be available in Node | |
| 604 | 604 | 10+. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -313,6 +313,11 @@ console.log(util.inspect(sandbox)); | |||
| 313 | 313 | ## vm.runInDebugContext(code) | |
| 314 | 314 | <!-- YAML | |
| 315 | 315 | added: v0.11.14 | |
| 316 | + deprecated: v8.0.0 | ||
| 317 | + changes: | ||
| 318 | + - version: REPLACEME | ||
| 319 | + pr-url: https://github.com/nodejs/node/pull/12815 | ||
| 320 | + description: Calling this function now emits a deprecation warning. | ||
| 316 | 321 | --> | |
| 317 | 322 | ||
| 318 | 323 | > Stability: 0 - Deprecated. An alternative is in development. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -385,7 +385,11 @@ function stylizeNoColor(str, styleType) { | |||
| 385 | 385 | function ensureDebugIsInitialized() { | |
| 386 | 386 | if (Debug === undefined) { | |
| 387 | 387 | const runInDebugContext = require('vm').runInDebugContext; | |
| 388 | + // a workaround till this entire method is removed | ||
| 389 | + const originalValue = process.noDeprecation; | ||
| 390 | + process.noDeprecation = true; | ||
| 388 | 391 | Debug = runInDebugContext('Debug'); | |
| 392 | + process.noDeprecation = originalValue; | ||
| 389 | 393 | } | |
| 390 | 394 | } | |
| 391 | 395 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,7 +27,7 @@ const { | |||
| 27 | 27 | ||
| 28 | 28 | makeContext, | |
| 29 | 29 | isContext, | |
| 30 | - runInDebugContext | ||
| 30 | + runInDebugContext: runInDebugContext_ | ||
| 31 | 31 | } = process.binding('contextify'); | |
| 32 | 32 | ||
| 33 | 33 | // The binding provides a few useful primitives: | |
@@ -105,6 +105,19 @@ function sigintHandlersWrap(fn, thisArg, argsArray) { | |||
| 105 | 105 | } | |
| 106 | 106 | } | |
| 107 | 107 | ||
| 108 | + let runInDebugContextWarned = false; | ||
| 109 | + function runInDebugContext(code) { | ||
| 110 | + if (runInDebugContextWarned === false) { | ||
| 111 | + runInDebugContextWarned = true; | ||
| 112 | + process.emitWarning( | ||
| 113 | + 'DebugContext has been deprecated and will be removed in a ' + | ||
| 114 | + 'future version.', | ||
| 115 | + 'DeprecationWarning', | ||
| 116 | + 'DEP0069'); | ||
| 117 | + } | ||
| 118 | + return runInDebugContext_(code); | ||
| 119 | + } | ||
| 120 | + | ||
| 108 | 121 | function runInContext(code, contextifiedSandbox, options) { | |
| 109 | 122 | if (typeof options === 'string') { | |
| 110 | 123 | options = { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,6 +27,11 @@ const vm = require('vm'); | |||
| 27 | 27 | const { spawn } = require('child_process'); | |
| 28 | 28 | const fixtures = require('../common/fixtures'); | |
| 29 | 29 | ||
| 30 | + const msg = 'DebugContext has been deprecated and will be removed in ' + | ||
| 31 | + 'a future version.'; | ||
| 32 | + common.expectWarning('DeprecationWarning', msg); | ||
| 33 | + vm.runInDebugContext(); | ||
| 34 | + | ||
| 30 | 35 | assert.throws(function() { | |
| 31 | 36 | vm.runInDebugContext('*'); | |
| 32 | 37 | }, /SyntaxError/); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments