GeezerVison is showing github.com — src: do not use soon-to-be-deprecated V8 API · nodejs/node@bb8d293
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: src/node_process_object.cc +18-11Lines changed: 18 additions & 11 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 13 | 13 |
| 14 | 14 | namespace node { | 15 | 15 | using v8::Context; | 16 | | -using v8::DEFAULT; | 17 | 16 | using v8::EscapableHandleScope; | 18 | 17 | using v8::Function; | 19 | 18 | using v8::FunctionCallbackInfo; | @@ -183,13 +182,12 @@ void PatchProcessObject(const FunctionCallbackInfo<Value>& args) { | 183 | 182 |
| 184 | 183 | // process.title | 185 | 184 | CHECK(process | 186 | | - ->SetAccessor( | | 185 | + ->SetNativeDataProperty( | 187 | 186 | context, | 188 | 187 | FIXED_ONE_BYTE_STRING(isolate, "title"), | 189 | 188 | ProcessTitleGetter, | 190 | 189 | env->owns_process_state() ? ProcessTitleSetter : nullptr, | 191 | 190 | Local<Value>(), | 192 | | - DEFAULT, | 193 | 191 | None, | 194 | 192 | SideEffectType::kHasNoSideEffect) | 195 | 193 | .FromJust()); | @@ -208,9 +206,15 @@ void PatchProcessObject(const FunctionCallbackInfo<Value>& args) { | 208 | 206 | READONLY_PROPERTY(process, "pid", | 209 | 207 | Integer::New(isolate, uv_os_getpid())); | 210 | 208 |
| 211 | | - CHECK(process->SetAccessor(context, | 212 | | - FIXED_ONE_BYTE_STRING(isolate, "ppid"), | 213 | | - GetParentProcessId).FromJust()); | | 209 | + CHECK(process | | 210 | + ->SetNativeDataProperty(context, | | 211 | + FIXED_ONE_BYTE_STRING(isolate, "ppid"), | | 212 | + GetParentProcessId, | | 213 | + nullptr, | | 214 | + Local<Value>(), | | 215 | + None, | | 216 | + SideEffectType::kHasNoSideEffect) | | 217 | + .FromJust()); | 214 | 218 |
| 215 | 219 | // --security-revert flags | 216 | 220 | #define V(code, _, __) \ | @@ -235,11 +239,14 @@ void PatchProcessObject(const FunctionCallbackInfo<Value>& args) { | 235 | 239 |
| 236 | 240 | // process.debugPort | 237 | 241 | CHECK(process | 238 | | - ->SetAccessor(context, | 239 | | - FIXED_ONE_BYTE_STRING(isolate, "debugPort"), | 240 | | - DebugPortGetter, | 241 | | - env->owns_process_state() ? DebugPortSetter : nullptr, | 242 | | - Local<Value>()) | | 242 | + ->SetNativeDataProperty( | | 243 | + context, | | 244 | + FIXED_ONE_BYTE_STRING(isolate, "debugPort"), | | 245 | + DebugPortGetter, | | 246 | + env->owns_process_state() ? DebugPortSetter : nullptr, | | 247 | + Local<Value>(), | | 248 | + None, | | 249 | + SideEffectType::kHasNoSideEffect) | 243 | 250 | .FromJust()); | 244 | 251 | } | 245 | 252 |
| |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-worker-unsupported-things.js +6-4Lines changed: 6 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -14,14 +14,16 @@ if (!process.env.HAS_STARTED_WORKER) { | 14 | 14 | } else { | 15 | 15 | { | 16 | 16 | const before = process.title; | 17 | | - process.title += ' in worker'; | 18 | | - assert.strictEqual(process.title, before); | | 17 | + const after = before + ' in worker'; | | 18 | + process.title = after; | | 19 | + assert.strictEqual(process.title, after); | 19 | 20 | } | 20 | 21 |
| 21 | 22 | { | 22 | 23 | const before = process.debugPort; | 23 | | - process.debugPort++; | 24 | | - assert.strictEqual(process.debugPort, before); | | 24 | + const after = before + 1; | | 25 | + process.debugPort = after; | | 26 | + assert.strictEqual(process.debugPort, after); | 25 | 27 | } | 26 | 28 |
| 27 | 29 | { | |
|