Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v8::Object::CreationContext is deprecated #193

Closed
targos opened this issue Feb 20, 2021 · 4 comments
Closed

v8::Object::CreationContext is deprecated #193

targos opened this issue Feb 20, 2021 · 4 comments

Comments

@targos
Copy link
Member

targos commented Feb 20, 2021

See v8/v8@b38bf5b.

The new API returns a MaybeLocal. IIUC, it's up to us to handle the case when it's empty (for example throw an error).

@targos
Copy link
Member Author

targos commented Feb 20, 2021

Here are all the warnings:


[1961/3110] CXX obj/src/api/libnode.callback.o
../../src/api/callback.cc: In function ‘v8::MaybeLocal<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::String>, int, v8::Local<v8::Value>*, node::async_context)’:
../../src/api/callback.cc:226:68: warning: ‘v8::Local<v8::Context> v8::Object::CreationContext()’ is deprecated: Use MaybeLocal<Context> GetCreationContext() [-Wdeprecated-declarations]
   Environment* env = Environment::GetCurrent(recv->CreationContext());
                                                                    ^
In file included from ../../src/node.h:63,
                 from ../../src/api/callback.cc:1:
../../deps/v8/include/v8.h:4228:18: note: declared here
   Local<Context> CreationContext();
                  ^~~~~~~~~~~~~~~
../../src/api/callback.cc: In function ‘v8::MaybeLocal<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*, node::async_context)’:
../../src/api/callback.cc:255:72: warning: ‘v8::Local<v8::Context> v8::Object::CreationContext()’ is deprecated: Use MaybeLocal<Context> GetCreationContext() [-Wdeprecated-declarations]
   Environment* env = Environment::GetCurrent(callback->CreationContext());
                                                                        ^
In file included from ../../src/node.h:63,
                 from ../../src/api/callback.cc:1:
../../deps/v8/include/v8.h:4228:18: note: declared here
   Local<Context> CreationContext();
                  ^~~~~~~~~~~~~~~
../../src/api/callback.cc: In function ‘v8::MaybeLocal<v8::Value> node::MakeSyncCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)’:
../../src/api/callback.cc:277:72: warning: ‘v8::Local<v8::Context> v8::Object::CreationContext()’ is deprecated: Use MaybeLocal<Context> GetCreationContext() [-Wdeprecated-declarations]
   Environment* env = Environment::GetCurrent(callback->CreationContext());
                                                                        ^
In file included from ../../src/node.h:63,
                 from ../../src/api/callback.cc:1:
../../deps/v8/include/v8.h:4228:18: note: declared here
   Local<Context> CreationContext();
                  ^~~~~~~~~~~~~~~
[1978/3110] CXX obj/src/libnode.async_wrap.o
../../src/async_wrap.cc: In function ‘void node::FastPromiseHook(v8::PromiseHookType, v8::Local<v8::Promise>, v8::Local<v8::Value>)’:
../../src/async_wrap.cc:301:53: warning: ‘v8::Local<v8::Context> v8::Object::CreationContext()’ is deprecated: Use MaybeLocal<Context> GetCreationContext() [-Wdeprecated-declarations]
   Local<Context> context = promise->CreationContext();
                                                     ^
In file included from ../../src/util.h:27,
                 from ../../src/util-inl.h:29,
                 from ../../src/aliased_buffer.h:8,
                 from ../../src/memory_tracker.h:5,
                 from ../../src/base_object.h:28,
                 from ../../src/async_wrap.h:27,
                 from ../../src/async_wrap.cc:22:
../../deps/v8/include/v8.h:4228:18: note: declared here
   Local<Context> CreationContext();
                  ^~~~~~~~~~~~~~~
../../src/async_wrap.cc: In function ‘void node::FullPromiseHook(v8::PromiseHookType, v8::Local<v8::Promise>, v8::Local<v8::Value>)’:
../../src/async_wrap.cc:360:53: warning: ‘v8::Local<v8::Context> v8::Object::CreationContext()’ is deprecated: Use MaybeLocal<Context> GetCreationContext() [-Wdeprecated-declarations]
   Local<Context> context = promise->CreationContext();
                                                     ^
In file included from ../../src/util.h:27,
                 from ../../src/util-inl.h:29,
                 from ../../src/aliased_buffer.h:8,
                 from ../../src/memory_tracker.h:5,
                 from ../../src/base_object.h:28,
                 from ../../src/async_wrap.h:27,
                 from ../../src/async_wrap.cc:22:
../../deps/v8/include/v8.h:4228:18: note: declared here
   Local<Context> CreationContext();
                  ^~~~~~~~~~~~~~~
[1989/3110] CXX obj/src/libnode.module_wrap.o
../../src/module_wrap.cc: In member function ‘v8::Local<v8::Context> node::loader::ModuleWrap::context() const’:
../../src/module_wrap.cc:86:44: warning: ‘v8::Local<v8::Context> v8::Object::CreationContext()’ is deprecated: Use MaybeLocal<Context> GetCreationContext() [-Wdeprecated-declarations]
   return obj.As<Object>()->CreationContext();
                                            ^
In file included from ../../src/util.h:27,
                 from ../../src/util-inl.h:29,
                 from ../../src/aliased_buffer.h:8,
                 from ../../src/memory_tracker.h:5,
                 from ../../src/base_object.h:28,
                 from ../../src/module_wrap.h:9,
                 from ../../src/module_wrap.cc:1:
../../deps/v8/include/v8.h:4228:18: note: declared here
   Local<Context> CreationContext();
                  ^~~~~~~~~~~~~~~
../../src/module_wrap.cc: In static member function ‘static void node::loader::ModuleWrap::New(const v8::FunctionCallbackInfo<v8::Value>&)’:
../../src/module_wrap.cc:125:37: warning: ‘v8::Local<v8::Context> v8::Object::CreationContext()’ is deprecated: Use MaybeLocal<Context> GetCreationContext() [-Wdeprecated-declarations]
     context = that->CreationContext();
                                     ^
In file included from ../../src/util.h:27,
                 from ../../src/util-inl.h:29,
                 from ../../src/aliased_buffer.h:8,
                 from ../../src/memory_tracker.h:5,
                 from ../../src/base_object.h:28,
                 from ../../src/module_wrap.h:9,
                 from ../../src/module_wrap.cc:1:
../../deps/v8/include/v8.h:4228:18: note: declared here
   Local<Context> CreationContext();
                  ^~~~~~~~~~~~~~~
[2017/3110] CXX obj/src/libnode.node_messaging.o
../../src/node_messaging.cc: In member function ‘void node::worker::MessagePort::OnMessage()’:
../../src/node_messaging.cc:703:70: warning: ‘v8::Local<v8::Context> v8::Object::CreationContext()’ is deprecated: Use MaybeLocal<Context> GetCreationContext() [-Wdeprecated-declarations]
   Local<Context> context = object(env()->isolate())->CreationContext();
                                                                      ^
In file included from ../../src/util.h:27,
                 from ../../src/util-inl.h:29,
                 from ../../src/aliased_buffer.h:8,
                 from ../../src/env.h:27,
                 from ../../src/node_messaging.h:6,
                 from ../../src/node_messaging.cc:1:
../../deps/v8/include/v8.h:4228:18: note: declared here
   Local<Context> CreationContext();
                  ^~~~~~~~~~~~~~~
../../src/node_messaging.cc: In member function ‘v8::Maybe<bool> node::worker::MessagePort::PostMessage(node::Environment*, v8::Local<v8::Value>, const TransferList&)’:
../../src/node_messaging.cc:814:49: warning: ‘v8::Local<v8::Context> v8::Object::CreationContext()’ is deprecated: Use MaybeLocal<Context> GetCreationContext() [-Wdeprecated-declarations]
   Local<Context> context = obj->CreationContext();
                                                 ^
In file included from ../../src/util.h:27,
                 from ../../src/util-inl.h:29,
                 from ../../src/aliased_buffer.h:8,
                 from ../../src/env.h:27,
                 from ../../src/node_messaging.h:6,
                 from ../../src/node_messaging.cc:1:
../../deps/v8/include/v8.h:4228:18: note: declared here
   Local<Context> CreationContext();
                  ^~~~~~~~~~~~~~~
../../src/node_messaging.cc: In static member function ‘static void node::worker::MessagePort::PostMessage(const v8::FunctionCallbackInfo<v8::Value>&)’:
../../src/node_messaging.cc:912:49: warning: ‘v8::Local<v8::Context> v8::Object::CreationContext()’ is deprecated: Use MaybeLocal<Context> GetCreationContext() [-Wdeprecated-declarations]
   Local<Context> context = obj->CreationContext();
                                                 ^
In file included from ../../src/util.h:27,
                 from ../../src/util-inl.h:29,
                 from ../../src/aliased_buffer.h:8,
                 from ../../src/env.h:27,
                 from ../../src/node_messaging.h:6,
                 from ../../src/node_messaging.cc:1:
../../deps/v8/include/v8.h:4228:18: note: declared here
   Local<Context> CreationContext();
                  ^~~~~~~~~~~~~~~
../../src/node_messaging.cc: In static member function ‘static void node::worker::MessagePort::ReceiveMessage(const v8::FunctionCallbackInfo<v8::Value>&)’:
../../src/node_messaging.cc:1021:60: warning: ‘v8::Local<v8::Context> v8::Object::CreationContext()’ is deprecated: Use MaybeLocal<Context> GetCreationContext() [-Wdeprecated-declarations]
       port->ReceiveMessage(port->object()->CreationContext(), false);
                                                            ^
In file included from ../../src/util.h:27,
                 from ../../src/util-inl.h:29,
                 from ../../src/aliased_buffer.h:8,
                 from ../../src/env.h:27,
                 from ../../src/node_messaging.h:6,
                 from ../../src/node_messaging.cc:1:
../../deps/v8/include/v8.h:4228:18: note: declared here
   Local<Context> CreationContext();
                  ^~~~~~~~~~~~~~~
../../src/node_messaging.cc: In function ‘void node::worker::{anonymous}::MessageChannel(const v8::FunctionCallbackInfo<v8::Value>&)’:
../../src/node_messaging.cc:1380:57: warning: ‘v8::Local<v8::Context> v8::Object::CreationContext()’ is deprecated: Use MaybeLocal<Context> GetCreationContext() [-Wdeprecated-declarations]
   Local<Context> context = args.This()->CreationContext();
                                                         ^
In file included from ../../src/util.h:27,
                 from ../../src/util-inl.h:29,
                 from ../../src/aliased_buffer.h:8,
                 from ../../src/env.h:27,
                 from ../../src/node_messaging.h:6,
                 from ../../src/node_messaging.cc:1:
../../deps/v8/include/v8.h:4228:18: note: declared here
   Local<Context> CreationContext();
                  ^~~~~~~~~~~~~~~

@targos
Copy link
Member Author

targos commented Feb 28, 2021

@addaleax what do you think we should do?

@devsnek
Copy link
Member

devsnek commented Feb 28, 2021

For our purposes GetCreationContext().ToLocalChecked() should be fine. Inside V8 GetCreationContext().ToHandleChecked() is used a lot too.

targos added a commit to nodejs/node that referenced this issue Feb 28, 2021
@targos
Copy link
Member Author

targos commented Feb 28, 2021

Okay, I did that in nodejs/node@5db39ac

@targos targos closed this as completed Feb 28, 2021
ryzokuken pushed a commit to nodejs/node that referenced this issue Mar 1, 2021
ryzokuken pushed a commit to nodejs/node that referenced this issue Mar 2, 2021
targos added a commit to nodejs/node that referenced this issue Mar 3, 2021
targos added a commit to targos/node that referenced this issue Mar 3, 2021
targos added a commit to targos/node that referenced this issue Mar 3, 2021
targos added a commit to nodejs/node that referenced this issue Mar 7, 2021
targos added a commit to targos/node that referenced this issue Mar 8, 2021
targos added a commit to nodejs/node that referenced this issue Mar 9, 2021
targos added a commit to targos/node that referenced this issue Mar 12, 2021
targos added a commit to nodejs/node that referenced this issue Mar 12, 2021
targos added a commit to nodejs/node that referenced this issue Mar 15, 2021
Fixes: nodejs/node-v8#193

PR-URL: #37587
Reviewed-By: Jiawen Geng <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Myles Borins <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants