diff --git a/BUILD.gn b/BUILD.gn index 2bc91181776b..d6e2ad11e016 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -287,9 +287,13 @@ static_library("electron_lib") { "//third_party/blink/renderer", ] - defines = [] + defines = [ "V8_DEPRECATION_WARNINGS" ] libs = [] + if (is_linux) { + defines += [ "GDK_DISABLE_DEPRECATION_WARNINGS" ] + } + extra_source_filters = [] if (!is_linux) { extra_source_filters += [ diff --git a/atom/browser/ui/message_box_gtk.cc b/atom/browser/ui/message_box_gtk.cc index 4ab2fb8596b7..48c749dbbd39 100644 --- a/atom/browser/ui/message_box_gtk.cc +++ b/atom/browser/ui/message_box_gtk.cc @@ -68,8 +68,8 @@ class GtkMessageBox : public NativeWindowObserver { GtkWidget* w = gtk_image_new_from_pixbuf(scaled_pixbuf); gtk_message_dialog_set_image(GTK_MESSAGE_DIALOG(dialog_), w); gtk_widget_show(w); - g_clear_pointer(&scaled_pixbuf, gdk_pixbuf_unref); - g_clear_pointer(&pixbuf, gdk_pixbuf_unref); + g_clear_pointer(&scaled_pixbuf, g_object_unref); + g_clear_pointer(&pixbuf, g_object_unref); } if (!checkbox_label.empty()) { diff --git a/atom/common/api/atom_api_asar.cc b/atom/common/api/atom_api_asar.cc index d1b85d20856d..4ccf799a2203 100644 --- a/atom/common/api/atom_api_asar.cc +++ b/atom/common/api/atom_api_asar.cc @@ -122,9 +122,10 @@ void InitAsarSupport(v8::Isolate* isolate, v8::Local process, v8::Local require) { // Evaluate asar_init.js. - v8::Local asar_init = - v8::Script::Compile(node::asar_init_value.ToStringChecked(isolate)); - v8::Local result = asar_init->Run(); + auto context = isolate->GetCurrentContext(); + auto source = node::asar_init_value.ToStringChecked(isolate); + auto asar_init = v8::Script::Compile(context, source).ToLocalChecked(); + auto result = asar_init->Run(context).ToLocalChecked(); // Initialize asar support. if (result->IsFunction()) { diff --git a/atom/common/native_mate_converters/string16_converter.h b/atom/common/native_mate_converters/string16_converter.h index 38dd7001fa23..9df9ec21a730 100644 --- a/atom/common/native_mate_converters/string16_converter.h +++ b/atom/common/native_mate_converters/string16_converter.h @@ -24,7 +24,7 @@ struct Converter { if (!val->IsString()) return false; - v8::String::Value s(val); + v8::String::Value s(isolate, val); out->assign(reinterpret_cast(*s), s.length()); return true; } diff --git a/atom/common/native_mate_converters/v8_value_converter.cc b/atom/common/native_mate_converters/v8_value_converter.cc index 3fa070771d68..77360ee35be5 100644 --- a/atom/common/native_mate_converters/v8_value_converter.cc +++ b/atom/common/native_mate_converters/v8_value_converter.cc @@ -317,7 +317,8 @@ base::Value* V8ValueConverter::FromV8ValueImpl(FromV8ValueState* state, } if (val->IsString()) { - v8::String::Utf8Value utf8(val->ToString(context).ToLocalChecked()); + v8::String::Utf8Value utf8(isolate, + val->ToString(context).ToLocalChecked()); return new base::Value(std::string(*utf8, utf8.length())); } @@ -333,7 +334,8 @@ base::Value* V8ValueConverter::FromV8ValueImpl(FromV8ValueState* state, v8::Local result = toISOString.As()->Call(val, 0, nullptr); if (!result.IsEmpty()) { - v8::String::Utf8Value utf8(result->ToString(context).ToLocalChecked()); + v8::String::Utf8Value utf8(isolate, + result->ToString(context).ToLocalChecked()); return new base::Value(std::string(*utf8, utf8.length())); } } @@ -344,8 +346,8 @@ base::Value* V8ValueConverter::FromV8ValueImpl(FromV8ValueState* state, // JSON.stringify converts to an object. return FromV8Object(val->ToObject(context).ToLocalChecked(), state, isolate); - return new base::Value( - *v8::String::Utf8Value(val->ToString(context).ToLocalChecked())); + return new base::Value(*v8::String::Utf8Value( + isolate, val->ToString(context).ToLocalChecked())); } // v8::Value doesn't have a ToArray() method for some reason. @@ -442,14 +444,14 @@ base::Value* V8ValueConverter::FromV8Object(v8::Local val, // Extend this test to cover more types as necessary and if sensible. if (!key->IsString() && !key->IsNumber()) { - NOTREACHED() << "Key \"" << *v8::String::Utf8Value(key) + NOTREACHED() << "Key \"" << *v8::String::Utf8Value(isolate, key) << "\" " "is neither a string nor a number"; continue; } v8::String::Utf8Value name_utf8( - key->ToString(isolate->GetCurrentContext()).ToLocalChecked()); + isolate, key->ToString(isolate->GetCurrentContext()).ToLocalChecked()); v8::TryCatch try_catch(isolate); v8::Local child_v8 = val->Get(key); diff --git a/atom/common/promise_util.cc b/atom/common/promise_util.cc index a841be9fe8b5..fd5236e01d33 100644 --- a/atom/common/promise_util.cc +++ b/atom/common/promise_util.cc @@ -11,8 +11,10 @@ namespace atom { namespace util { Promise::Promise(v8::Isolate* isolate) { + auto context = isolate->GetCurrentContext(); + auto resolver = v8::Promise::Resolver::New(context).ToLocalChecked(); isolate_ = isolate; - resolver_.Reset(isolate, v8::Promise::Resolver::New(isolate)); + resolver_.Reset(isolate, resolver); } Promise::~Promise() = default; diff --git a/atom/renderer/atom_renderer_client.cc b/atom/renderer/atom_renderer_client.cc index 711955aeda58..9b43ff2bc552 100644 --- a/atom/renderer/atom_renderer_client.cc +++ b/atom/renderer/atom_renderer_client.cc @@ -198,10 +198,11 @@ void AtomRendererClient::SetupMainWorldOverrides( // an argument. std::string left = "(function (binding, require) {\n"; std::string right = "\n})"; - auto script = v8::Script::Compile(v8::String::Concat( + auto source = v8::String::Concat( mate::ConvertToV8(isolate, left)->ToString(), v8::String::Concat(node::isolated_bundle_value.ToStringChecked(isolate), - mate::ConvertToV8(isolate, right)->ToString()))); + mate::ConvertToV8(isolate, right)->ToString())); + auto script = v8::Script::Compile(context, source).ToLocalChecked(); auto func = v8::Handle::Cast(script->Run(context).ToLocalChecked()); diff --git a/atom/renderer/atom_sandboxed_renderer_client.cc b/atom/renderer/atom_sandboxed_renderer_client.cc index 940cc9b00b70..e19d945000be 100644 --- a/atom/renderer/atom_sandboxed_renderer_client.cc +++ b/atom/renderer/atom_sandboxed_renderer_client.cc @@ -87,8 +87,9 @@ v8::Local GetBinding(v8::Isolate* isolate, v8::Local CreatePreloadScript(v8::Isolate* isolate, v8::Local preloadSrc) { - auto script = v8::Script::Compile(preloadSrc); - auto func = script->Run(); + auto context = isolate->GetCurrentContext(); + auto script = v8::Script::Compile(context, preloadSrc).ToLocalChecked(); + auto func = script->Run(context).ToLocalChecked(); return func; } @@ -206,10 +207,11 @@ void AtomSandboxedRendererClient::DidCreateScriptContext( std::string left = "(function(binding, require) {\n"; std::string right = "\n})"; // Compile the wrapper and run it to get the function object - auto script = v8::Script::Compile(v8::String::Concat( + auto source = v8::String::Concat( mate::ConvertToV8(isolate, left)->ToString(), v8::String::Concat(node::preload_bundle_value.ToStringChecked(isolate), - mate::ConvertToV8(isolate, right)->ToString()))); + mate::ConvertToV8(isolate, right)->ToString())); + auto script = v8::Script::Compile(context, source).ToLocalChecked(); auto func = v8::Handle::Cast(script->Run(context).ToLocalChecked()); // Create and initialize the binding object diff --git a/native_mate/BUILD.gn b/native_mate/BUILD.gn index 453aa37a5dd8..f6f234cef8f8 100644 --- a/native_mate/BUILD.gn +++ b/native_mate/BUILD.gn @@ -1,7 +1,5 @@ config("native_mate_config") { include_dirs = [ "." ] - cflags_cc = [ "-Wno-deprecated-declarations" ] - cflags_objcc = cflags_cc } source_set("native_mate") {