GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — contextify: ignore getters during initialization · nodejs/node@def8dea

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • node_contextify.cc
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/node_contextify.cc‎

Copy file name to clipboardExpand all lines: src/node_contextify.cc
+23-1Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,10 @@ class ContextifyContext {
6565
explicit ContextifyContext(Environment* env, Local<Object> sandbox)
6666
: env_(env),
6767
sandbox_(env->isolate(), sandbox),
68-
context_(env->isolate(), CreateV8Context(env)),
6968
// Wait for sandbox_, proxy_global_, and context_ to die
7069
references_(0) {
70+
context_.Reset(env->isolate(), CreateV8Context(env));
71+
7172
sandbox_.SetWeak(this, WeakCallback<Object, kSandbox>);
7273
sandbox_.MarkIndependent();
7374
references_++;
@@ -355,6 +356,10 @@ class ContextifyContext {
355356
ContextifyContext* ctx =
356357
Unwrap<ContextifyContext>(args.Data().As<Object>());
357358

359+
// Stil initializing
360+
if (ctx->context_.IsEmpty())
361+
return;
362+
358363
Local<Object> sandbox = PersistentToLocal(isolate, ctx->sandbox_);
359364
MaybeLocal<Value> maybe_rv =
360365
sandbox->GetRealNamedProperty(ctx->context(), property);
@@ -383,6 +388,10 @@ class ContextifyContext {
383388
ContextifyContext* ctx =
384389
Unwrap<ContextifyContext>(args.Data().As<Object>());
385390

391+
// Stil initializing
392+
if (ctx->context_.IsEmpty())
393+
return;
394+
386395
PersistentToLocal(isolate, ctx->sandbox_)->Set(property, value);
387396
}
388397

@@ -395,6 +404,10 @@ class ContextifyContext {
395404
ContextifyContext* ctx =
396405
Unwrap<ContextifyContext>(args.Data().As<Object>());
397406

407+
// Stil initializing
408+
if (ctx->context_.IsEmpty())
409+
return;
410+
398411
Local<Object> sandbox = PersistentToLocal(isolate, ctx->sandbox_);
399412
Maybe<PropertyAttribute> maybe_prop_attr =
400413
sandbox->GetRealNamedPropertyAttributes(ctx->context(), property);
@@ -422,6 +435,11 @@ class ContextifyContext {
422435

423436
ContextifyContext* ctx =
424437
Unwrap<ContextifyContext>(args.Data().As<Object>());
438+
439+
// Stil initializing
440+
if (ctx->context_.IsEmpty())
441+
return;
442+
425443
Local<Object> sandbox = PersistentToLocal(isolate, ctx->sandbox_);
426444

427445
Maybe<bool> success = sandbox->Delete(ctx->context(), property);
@@ -436,6 +454,10 @@ class ContextifyContext {
436454
ContextifyContext* ctx =
437455
Unwrap<ContextifyContext>(args.Data().As<Object>());
438456

457+
// Stil initializing
458+
if (ctx->context_.IsEmpty())
459+
return;
460+
439461
Local<Object> sandbox = PersistentToLocal(args.GetIsolate(), ctx->sandbox_);
440462
args.GetReturnValue().Set(sandbox->GetPropertyNames());
441463
}

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.