fix: screen module should still be creatable if the first create is before the ready event (#22895)

This commit is contained in:
Samuel Attard 2020-03-31 14:49:15 -07:00 committed by GitHub
parent 765c08c600
commit 4ba91c938e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,6 +14,7 @@
#include "shell/common/gin_converters/callback_converter.h" #include "shell/common/gin_converters/callback_converter.h"
#include "shell/common/gin_converters/gfx_converter.h" #include "shell/common/gin_converters/gfx_converter.h"
#include "shell/common/gin_converters/native_window_converter.h" #include "shell/common/gin_converters/native_window_converter.h"
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/gin_helper/object_template_builder.h" #include "shell/common/gin_helper/object_template_builder.h"
#include "shell/common/node_includes.h" #include "shell/common/node_includes.h"
#include "ui/display/display.h" #include "ui/display/display.h"
@ -184,8 +185,8 @@ void Initialize(v8::Local<v8::Object> exports,
v8::Local<v8::Context> context, v8::Local<v8::Context> context,
void* priv) { void* priv) {
v8::Isolate* isolate = context->GetIsolate(); v8::Isolate* isolate = context->GetIsolate();
gin::Dictionary dict(isolate, exports); gin_helper::Dictionary dict(isolate, exports);
dict.Set("createScreen", base::BindRepeating(&Screen::Create)); dict.SetMethod("createScreen", base::BindRepeating(&Screen::Create));
dict.Set( dict.Set(
"Screen", "Screen",
Screen::GetConstructor(isolate)->GetFunction(context).ToLocalChecked()); Screen::GetConstructor(isolate)->GetFunction(context).ToLocalChecked());