src: re-delete Atomics.wake
PR-URL: https://github.com/nodejs/node/pull/29586 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com>
This commit is contained in:
parent
954bf56c1e
commit
1ec4154e50
@ -15,8 +15,6 @@
|
||||
// many dependencies are invoked lazily.
|
||||
//
|
||||
// Scripts run before this file:
|
||||
// - `lib/internal/per_context/setup.js`: to setup the v8::Context with
|
||||
// Node.js-specific tweaks - this is also done in vm contexts.
|
||||
// - `lib/internal/per_context/primordials.js`: to save copies of JavaScript
|
||||
// builtins that won't be affected by user land monkey-patching for internal
|
||||
// modules to use.
|
||||
|
@ -1,15 +0,0 @@
|
||||
// This file is compiled as if it's wrapped in a function with arguments
|
||||
// passed by node::NewContext()
|
||||
/* global global */
|
||||
|
||||
'use strict';
|
||||
|
||||
// https://github.com/nodejs/node/issues/14909
|
||||
if (global.Intl) {
|
||||
delete global.Intl.v8BreakIterator;
|
||||
}
|
||||
|
||||
// https://github.com/nodejs/node/issues/21219
|
||||
if (global.Atomics) {
|
||||
delete global.Atomics.wake;
|
||||
}
|
1
node.gyp
1
node.gyp
@ -30,7 +30,6 @@
|
||||
'lib/internal/bootstrap/node.js',
|
||||
'lib/internal/bootstrap/pre_execution.js',
|
||||
'lib/internal/per_context/primordials.js',
|
||||
'lib/internal/per_context/setup.js',
|
||||
'lib/internal/per_context/domexception.js',
|
||||
'lib/async_hooks.js',
|
||||
'lib/assert.js',
|
||||
|
@ -357,9 +357,42 @@ Local<Context> NewContext(Isolate* isolate,
|
||||
if (!InitializeContext(context)) {
|
||||
return Local<Context>();
|
||||
}
|
||||
|
||||
InitializeContextRuntime(context);
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
// This runs at runtime, regardless of whether the context
|
||||
// is created from a snapshot.
|
||||
void InitializeContextRuntime(Local<Context> context) {
|
||||
Isolate* isolate = context->GetIsolate();
|
||||
HandleScope handle_scope(isolate);
|
||||
|
||||
// Delete `Intl.v8BreakIterator`
|
||||
// https://github.com/nodejs/node/issues/14909
|
||||
Local<String> intl_string = FIXED_ONE_BYTE_STRING(isolate, "Intl");
|
||||
Local<String> break_iter_string =
|
||||
FIXED_ONE_BYTE_STRING(isolate, "v8BreakIterator");
|
||||
Local<Value> intl_v;
|
||||
if (context->Global()->Get(context, intl_string).ToLocal(&intl_v) &&
|
||||
intl_v->IsObject()) {
|
||||
Local<Object> intl = intl_v.As<Object>();
|
||||
intl->Delete(context, break_iter_string).FromJust();
|
||||
}
|
||||
|
||||
// Delete `Atomics.wake`
|
||||
// https://github.com/nodejs/node/issues/21219
|
||||
Local<String> atomics_string = FIXED_ONE_BYTE_STRING(isolate, "Atomics");
|
||||
Local<String> wake_string = FIXED_ONE_BYTE_STRING(isolate, "wake");
|
||||
Local<Value> atomics_v;
|
||||
if (context->Global()->Get(context, atomics_string).ToLocal(&atomics_v) &&
|
||||
atomics_v->IsObject()) {
|
||||
Local<Object> atomics = atomics_v.As<Object>();
|
||||
atomics->Delete(context, wake_string).FromJust();
|
||||
}
|
||||
}
|
||||
|
||||
bool InitializeContext(Local<Context> context) {
|
||||
Isolate* isolate = context->GetIsolate();
|
||||
HandleScope handle_scope(isolate);
|
||||
@ -386,7 +419,6 @@ bool InitializeContext(Local<Context> context) {
|
||||
}
|
||||
|
||||
static const char* context_files[] = {"internal/per_context/primordials",
|
||||
"internal/per_context/setup",
|
||||
"internal/per_context/domexception",
|
||||
nullptr};
|
||||
|
||||
|
@ -99,6 +99,8 @@ void SignalExit(int signal, siginfo_t* info, void* ucontext);
|
||||
std::string GetHumanReadableProcessName();
|
||||
void GetHumanReadableProcessName(char (*name)[1024]);
|
||||
|
||||
void InitializeContextRuntime(v8::Local<v8::Context>);
|
||||
|
||||
namespace task_queue {
|
||||
void PromiseRejectCallback(v8::PromiseRejectMessage message);
|
||||
} // namespace task_queue
|
||||
|
@ -179,6 +179,7 @@ std::unique_ptr<Environment> NodeMainInstance::CreateMainEnvironment(
|
||||
if (deserialize_mode_) {
|
||||
context =
|
||||
Context::FromSnapshot(isolate_, kNodeContextIndex).ToLocalChecked();
|
||||
InitializeContextRuntime(context);
|
||||
SetIsolateUpForNode(isolate_, IsolateSettingCategories::kErrorHandlers);
|
||||
} else {
|
||||
context = NewContext(isolate_);
|
||||
|
7
test/parallel/test-atomics-wake.js
Normal file
7
test/parallel/test-atomics-wake.js
Normal file
@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
const assert = require('assert');
|
||||
|
||||
// https://github.com/nodejs/node/issues/21219
|
||||
assert.strictEqual(Atomics.wake, undefined);
|
Loading…
x
Reference in New Issue
Block a user