| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d3eb1cb commit a30ae50
11 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1388,14 +1388,6 @@ added: v21.2.0 | |||
| 1388 | 1388 | ||
| 1389 | 1389 | Disable exposition of [Navigator API][] on the global scope. | |
| 1390 | 1390 | ||
| 1391 | - ### `--no-experimental-global-webcrypto` | ||
| 1392 | - | ||
| 1393 | - <!-- YAML | ||
| 1394 | - added: v19.0.0 | ||
| 1395 | - --> | ||
| 1396 | - | ||
| 1397 | - Disable exposition of [Web Crypto API][] on the global scope. | ||
| 1398 | - | ||
| 1399 | 1391 | ### `--no-experimental-repl-await` | |
| 1400 | 1392 | ||
| 1401 | 1393 | <!-- YAML | |
@@ -2699,7 +2691,6 @@ one is included in the list below. | |||
| 2699 | 2691 | * `--no-experimental-fetch` | |
| 2700 | 2692 | * `--no-experimental-global-customevent` | |
| 2701 | 2693 | * `--no-experimental-global-navigator` | |
| 2702 | - * `--no-experimental-global-webcrypto` | ||
| 2703 | 2694 | * `--no-experimental-repl-await` | |
| 2704 | 2695 | * `--no-experimental-websocket` | |
| 2705 | 2696 | * `--no-extra-info-on-fatal-exception` | |
@@ -3190,7 +3181,6 @@ node --stack-trace-limit=12 -p -e "Error.stackTraceLimit" # prints 12 | |||
| 3190 | 3181 | [Subresource Integrity]: https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity | |
| 3191 | 3182 | [V8 JavaScript code coverage]: https://v8project.blogspot.com/2017/12/javascript-code-coverage.html | |
| 3192 | 3183 | [V8 code cache]: https://v8.dev/blog/code-caching-for-devs | |
| 3193 | - [Web Crypto API]: webcrypto.md | ||
| 3194 | 3184 | [`"type"`]: packages.md#type | |
| 3195 | 3185 | [`--allow-child-process`]: #--allow-child-process | |
| 3196 | 3186 | [`--allow-fs-read`]: #--allow-fs-read | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -361,13 +361,15 @@ added: | |||
| 361 | 361 | - v17.6.0 | |
| 362 | 362 | - v16.15.0 | |
| 363 | 363 | changes: | |
| 364 | + - version: REPLACEME | ||
| 365 | + pr-url: https://github.com/nodejs/node/pull/52564 | ||
| 366 | + description: No longer experimental. | ||
| 364 | 367 | - version: v19.0.0 | |
| 365 | 368 | pr-url: https://github.com/nodejs/node/pull/42083 | |
| 366 | 369 | description: No longer behind `--experimental-global-webcrypto` CLI flag. | |
| 367 | 370 | --> | |
| 368 | 371 | ||
| 369 | - > Stability: 1 - Experimental. Disable this API with the | ||
| 370 | - > [`--no-experimental-global-webcrypto`][] CLI flag. | ||
| 372 | + > Stability: 2 - Stable. | ||
| 371 | 373 | ||
| 372 | 374 | A browser-compatible implementation of {Crypto}. This global is available | |
| 373 | 375 | only if the Node.js binary was compiled with including support for the | |
@@ -380,13 +382,15 @@ added: | |||
| 380 | 382 | - v17.6.0 | |
| 381 | 383 | - v16.15.0 | |
| 382 | 384 | changes: | |
| 385 | + - version: REPLACEME | ||
| 386 | + pr-url: https://github.com/nodejs/node/pull/52564 | ||
| 387 | + description: No longer experimental. | ||
| 383 | 388 | - version: v19.0.0 | |
| 384 | 389 | pr-url: https://github.com/nodejs/node/pull/42083 | |
| 385 | 390 | description: No longer behind `--experimental-global-webcrypto` CLI flag. | |
| 386 | 391 | --> | |
| 387 | 392 | ||
| 388 | - > Stability: 1 - Experimental. Disable this API with the | ||
| 389 | - > [`--no-experimental-global-webcrypto`][] CLI flag. | ||
| 393 | + > Stability: 2 - Stable. | ||
| 390 | 394 | ||
| 391 | 395 | A browser-compatible implementation of the [Web Crypto API][]. | |
| 392 | 396 | ||
@@ -397,13 +401,15 @@ added: | |||
| 397 | 401 | - v17.6.0 | |
| 398 | 402 | - v16.15.0 | |
| 399 | 403 | changes: | |
| 404 | + - version: REPLACEME | ||
| 405 | + pr-url: https://github.com/nodejs/node/pull/52564 | ||
| 406 | + description: No longer experimental. | ||
| 400 | 407 | - version: v19.0.0 | |
| 401 | 408 | pr-url: https://github.com/nodejs/node/pull/42083 | |
| 402 | 409 | description: No longer behind `--experimental-global-webcrypto` CLI flag. | |
| 403 | 410 | --> | |
| 404 | 411 | ||
| 405 | - > Stability: 1 - Experimental. Disable this API with the | ||
| 406 | - > [`--no-experimental-global-webcrypto`][] CLI flag. | ||
| 412 | + > Stability: 2 - Stable. | ||
| 407 | 413 | ||
| 408 | 414 | A browser-compatible implementation of {CryptoKey}. This global is available | |
| 409 | 415 | only if the Node.js binary was compiled with including support for the | |
@@ -981,8 +987,7 @@ changes: | |||
| 981 | 987 | description: No longer behind `--experimental-global-webcrypto` CLI flag. | |
| 982 | 988 | --> | |
| 983 | 989 | ||
| 984 | - > Stability: 1 - Experimental. Disable this API with the | ||
| 985 | - > [`--no-experimental-global-webcrypto`][] CLI flag. | ||
| 990 | + > Stability: 2 - Stable. | ||
| 986 | 991 | ||
| 987 | 992 | A browser-compatible implementation of {SubtleCrypto}. This global is available | |
| 988 | 993 | only if the Node.js binary was compiled with including support for the | |
@@ -1147,7 +1152,6 @@ A browser-compatible implementation of [`WritableStreamDefaultWriter`][]. | |||
| 1147 | 1152 | [Web Crypto API]: webcrypto.md | |
| 1148 | 1153 | [`--no-experimental-global-customevent`]: cli.md#--no-experimental-global-customevent | |
| 1149 | 1154 | [`--no-experimental-global-navigator`]: cli.md#--no-experimental-global-navigator | |
| 1150 | - [`--no-experimental-global-webcrypto`]: cli.md#--no-experimental-global-webcrypto | ||
| 1151 | 1155 | [`--no-experimental-websocket`]: cli.md#--no-experimental-websocket | |
| 1152 | 1156 | [`AbortController`]: https://developer.mozilla.org/en-US/docs/Web/API/AbortController | |
| 1153 | 1157 | [`ByteLengthQueuingStrategy`]: webstreams.md#class-bytelengthqueuingstrategy | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -192,9 +192,6 @@ Disable experimental support for the WebSocket API. | |||
| 192 | 192 | .It Fl -no-experimental-global-customevent | |
| 193 | 193 | Disable exposition of the CustomEvent on the global scope. | |
| 194 | 194 | . | |
| 195 | - .It Fl -no-experimental-global-webcrypto | ||
| 196 | - Disable exposition of the Web Crypto API on the global scope. | ||
| 197 | - . | ||
| 198 | 195 | .It Fl -no-experimental-repl-await | |
| 199 | 196 | Disable top-level await keyword support in REPL. | |
| 200 | 197 | . | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,6 +11,7 @@ | |||
| 11 | 11 | const { | |
| 12 | 12 | globalThis, | |
| 13 | 13 | ObjectDefineProperty, | |
| 14 | + ObjectGetOwnPropertyDescriptor, | ||
| 14 | 15 | } = primordials; | |
| 15 | 16 | ||
| 16 | 17 | const { | |
@@ -20,6 +21,11 @@ const { | |||
| 20 | 21 | exposeLazyInterfaces, | |
| 21 | 22 | } = require('internal/util'); | |
| 22 | 23 | ||
| 24 | + const { | ||
| 25 | + ERR_INVALID_THIS, | ||
| 26 | + ERR_NO_CRYPTO, | ||
| 27 | + } = require('internal/errors').codes; | ||
| 28 | + | ||
| 23 | 29 | // https://html.spec.whatwg.org/multipage/webappapis.html#windoworworkerglobalscope | |
| 24 | 30 | const timers = require('timers'); | |
| 25 | 31 | defineOperation(globalThis, 'clearInterval', timers.clearInterval); | |
@@ -89,3 +95,29 @@ exposeLazyInterfaces(globalThis, 'internal/deps/undici/undici', ['WebSocket']); | |||
| 89 | 95 | internalBinding('wasm_web_api').setImplementation((streamState, source) => { | |
| 90 | 96 | require('internal/wasm_web_api').wasmStreamingCallback(streamState, source); | |
| 91 | 97 | }); | |
| 98 | + | ||
| 99 | + // WebCryptoAPI | ||
| 100 | + if (internalBinding('config').hasOpenSSL) { | ||
| 101 | + defineReplaceableLazyAttribute( | ||
| 102 | + globalThis, | ||
| 103 | + 'internal/crypto/webcrypto', | ||
| 104 | + ['crypto'], | ||
| 105 | + false, | ||
| 106 | + function cryptoThisCheck() { | ||
| 107 | + if (this !== globalThis && this != null) | ||
| 108 | + throw new ERR_INVALID_THIS( | ||
| 109 | + 'nullish or must be the global object'); | ||
| 110 | + }, | ||
| 111 | + ); | ||
| 112 | + exposeLazyInterfaces( | ||
| 113 | + globalThis, 'internal/crypto/webcrypto', | ||
| 114 | + ['Crypto', 'CryptoKey', 'SubtleCrypto'], | ||
| 115 | + ); | ||
| 116 | + } else { | ||
| 117 | + ObjectDefineProperty(globalThis, 'crypto', | ||
| 118 | + { __proto__: null, ...ObjectGetOwnPropertyDescriptor({ | ||
| 119 | + get crypto() { | ||
| 120 | + throw new ERR_NO_CRYPTO(); | ||
| 121 | + }, | ||
| 122 | + }, 'crypto') }); | ||
| 123 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,7 +5,6 @@ const { | |||
| 5 | 5 | JSONParse, | |
| 6 | 6 | JSONStringify, | |
| 7 | 7 | ObjectDefineProperties, | |
| 8 | - ObjectDefineProperty, | ||
| 9 | 8 | ReflectApply, | |
| 10 | 9 | ReflectConstruct, | |
| 11 | 10 | SafeSet, | |
@@ -21,10 +20,6 @@ const { | |||
| 21 | 20 | kWebCryptoCipherDecrypt, | |
| 22 | 21 | } = internalBinding('crypto'); | |
| 23 | 22 | ||
| 24 | - const { | ||
| 25 | - getOptionValue, | ||
| 26 | - } = require('internal/options'); | ||
| 27 | - | ||
| 28 | 23 | const { TextDecoder, TextEncoder } = require('internal/encoding'); | |
| 29 | 24 | ||
| 30 | 25 | const { | |
@@ -1025,18 +1020,6 @@ ObjectDefineProperties( | |||
| 1025 | 1020 | }, | |
| 1026 | 1021 | }); | |
| 1027 | 1022 | ||
| 1028 | - if (getOptionValue('--no-experimental-global-webcrypto')) { | ||
| 1029 | - // For backward compatibility, keep exposing CryptoKey in the Crypto prototype | ||
| 1030 | - // when using the flag. | ||
| 1031 | - ObjectDefineProperty(Crypto.prototype, 'CryptoKey', { | ||
| 1032 | - __proto__: null, | ||
| 1033 | - enumerable: true, | ||
| 1034 | - configurable: true, | ||
| 1035 | - writable: true, | ||
| 1036 | - value: CryptoKey, | ||
| 1037 | - }); | ||
| 1038 | - } | ||
| 1039 | - | ||
| 1040 | 1023 | ObjectDefineProperties( | |
| 1041 | 1024 | SubtleCrypto.prototype, { | |
| 1042 | 1025 | [SymbolToStringTag]: { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -31,9 +31,7 @@ if (getOptionValue('--input-type') === 'module' || | |||
| 31 | 31 | } else { | |
| 32 | 32 | // For backward compatibility, we want the identifier crypto to be the | |
| 33 | 33 | // `node:crypto` module rather than WebCrypto. | |
| 34 | - const isUsingCryptoIdentifier = | ||
| 35 | - getOptionValue('--experimental-global-webcrypto') && | ||
| 36 | - RegExpPrototypeExec(/\bcrypto\b/, source) !== null; | ||
| 34 | + const isUsingCryptoIdentifier = RegExpPrototypeExec(/\bcrypto\b/, source) !== null; | ||
| 37 | 35 | const shouldDefineCrypto = isUsingCryptoIdentifier && internalBinding('config').hasOpenSSL; | |
| 38 | 36 | ||
| 39 | 37 | if (isUsingCryptoIdentifier && !shouldDefineCrypto) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,7 +12,6 @@ const { | |||
| 12 | 12 | NumberParseInt, | |
| 13 | 13 | ObjectDefineProperty, | |
| 14 | 14 | ObjectFreeze, | |
| 15 | - ObjectGetOwnPropertyDescriptor, | ||
| 16 | 15 | SafeMap, | |
| 17 | 16 | String, | |
| 18 | 17 | StringPrototypeStartsWith, | |
@@ -36,9 +35,7 @@ const { | |||
| 36 | 35 | } = require('internal/util'); | |
| 37 | 36 | ||
| 38 | 37 | const { | |
| 39 | - ERR_INVALID_THIS, | ||
| 40 | 38 | ERR_MANIFEST_ASSERT_INTEGRITY, | |
| 41 | - ERR_NO_CRYPTO, | ||
| 42 | 39 | ERR_MISSING_OPTION, | |
| 43 | 40 | ERR_ACCESS_DENIED, | |
| 44 | 41 | } = require('internal/errors').codes; | |
@@ -107,7 +104,6 @@ function prepareExecution(options) { | |||
| 107 | 104 | setupNavigator(); | |
| 108 | 105 | setupWarningHandler(); | |
| 109 | 106 | setupUndici(); | |
| 110 | - setupWebCrypto(); | ||
| 111 | 107 | setupCustomEvent(); | |
| 112 | 108 | setupCodeCoverage(); | |
| 113 | 109 | setupDebugEnv(); | |
@@ -341,41 +337,6 @@ function setupNavigator() { | |||
| 341 | 337 | defineReplaceableLazyAttribute(globalThis, 'internal/navigator', ['navigator'], false); | |
| 342 | 338 | } | |
| 343 | 339 | ||
| 344 | - // TODO(aduh95): move this to internal/bootstrap/web/* when the CLI flag is | ||
| 345 | - // removed. | ||
| 346 | - function setupWebCrypto() { | ||
| 347 | - if (getEmbedderOptions().noBrowserGlobals || | ||
| 348 | - getOptionValue('--no-experimental-global-webcrypto')) { | ||
| 349 | - return; | ||
| 350 | - } | ||
| 351 | - | ||
| 352 | - if (internalBinding('config').hasOpenSSL) { | ||
| 353 | - defineReplaceableLazyAttribute( | ||
| 354 | - globalThis, | ||
| 355 | - 'internal/crypto/webcrypto', | ||
| 356 | - ['crypto'], | ||
| 357 | - false, | ||
| 358 | - function cryptoThisCheck() { | ||
| 359 | - if (this !== globalThis && this != null) | ||
| 360 | - throw new ERR_INVALID_THIS( | ||
| 361 | - 'nullish or must be the global object'); | ||
| 362 | - }, | ||
| 363 | - ); | ||
| 364 | - exposeLazyInterfaces( | ||
| 365 | - globalThis, 'internal/crypto/webcrypto', | ||
| 366 | - ['Crypto', 'CryptoKey', 'SubtleCrypto'], | ||
| 367 | - ); | ||
| 368 | - } else { | ||
| 369 | - ObjectDefineProperty(globalThis, 'crypto', | ||
| 370 | - { __proto__: null, ...ObjectGetOwnPropertyDescriptor({ | ||
| 371 | - get crypto() { | ||
| 372 | - throw new ERR_NO_CRYPTO(); | ||
| 373 | - }, | ||
| 374 | - }, 'crypto') }); | ||
| 375 | - | ||
| 376 | - } | ||
| 377 | - } | ||
| 378 | - | ||
| 379 | 340 | function setupCodeCoverage() { | |
| 380 | 341 | // Resolve the coverage directory to an absolute path, and | |
| 381 | 342 | // overwrite process.env so that the original path gets passed | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -416,11 +416,7 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { | |||
| 416 | 416 | &EnvironmentOptions::experimental_global_navigator, | |
| 417 | 417 | kAllowedInEnvvar, | |
| 418 | 418 | true); | |
| 419 | - AddOption("--experimental-global-webcrypto", | ||
| 420 | - "expose experimental Web Crypto API on the global scope", | ||
| 421 | - &EnvironmentOptions::experimental_global_web_crypto, | ||
| 422 | - kAllowedInEnvvar, | ||
| 423 | - true); | ||
| 419 | + AddOption("--experimental-global-webcrypto", "", NoOp{}, kAllowedInEnvvar); | ||
| 424 | 420 | AddOption("--experimental-json-modules", "", NoOp{}, kAllowedInEnvvar); | |
| 425 | 421 | AddOption("--experimental-loader", | |
| 426 | 422 | "use the specified module as a custom loader", | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -348,12 +348,6 @@ child.exec( | |||
| 348 | 348 | common.mustSucceed((stdout) => { | |
| 349 | 349 | assert.match(stdout, /^number/); | |
| 350 | 350 | })); | |
| 351 | - child.exec( | ||
| 352 | - `${nodejs} --no-experimental-global-webcrypto ` + | ||
| 353 | - '-p "var crypto = {randomBytes:1};typeof crypto.randomBytes"', | ||
| 354 | - common.mustSucceed((stdout) => { | ||
| 355 | - assert.match(stdout, /^number/); | ||
| 356 | - })); | ||
| 357 | 351 | ||
| 358 | 352 | // Regression test for https://github.com/nodejs/node/issues/45336 | |
| 359 | 353 | child.execFile(process.execPath, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments