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

feat: add a new contextBridge module #20639

Merged
merged 8 commits into from
Oct 21, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions atom/common/node_bindings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
V(atom_common_screen) \
V(atom_common_shell) \
V(atom_common_v8_util) \
V(atom_renderer_context_bridge) \
V(atom_renderer_ipc) \
V(atom_renderer_web_frame)

Expand Down
10 changes: 10 additions & 0 deletions atom/common/promise_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ class Promise {
return GetInner()->Reject(GetContext(), v8::Undefined(isolate()));
}

v8::Maybe<bool> Reject(v8::Local<v8::Value> exception) {
v8::HandleScope handle_scope(isolate());
v8::MicrotasksScope script_scope(isolate(),
v8::MicrotasksScope::kRunMicrotasks);
v8::Context::Scope context_scope(
v8::Local<v8::Context>::New(isolate(), GetContext()));

return GetInner()->Reject(GetContext(), exception);
}

// Please note that using Then is effectively the same as calling .then
// in javascript. This means (a) it is not type safe and (b) please note
// it is NOT type safe.
Expand Down