-
Notifications
You must be signed in to change notification settings - Fork 16.2k
feat: promisify webContents.printToPDF() #16795
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
Conversation
9065704
to
8d8fac3
Compare
v8::Exception::Error(error_message), v8::Null(isolate)); | ||
} | ||
print_to_pdf_callback_map_.erase(request_id); | ||
v8::MicrotasksScope script_scope(isolate, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the util file deals with scoping prior to resolution; this can be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will remove the script_scope
, should I keep the context_scope
though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we handle it in the util, so i think you can remove that too!
v8::Maybe<bool> Resolve() {
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()->Resolve(GetContext(), v8::Undefined(isolate()));
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know, but don't we need that because we are creating the v8::Local<v8::Value> buffer
before calling the util?
8d8fac3
to
a9ac096
Compare
3490bc6
to
398faec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Lets rerun the osx test suite, to rule out flakiness before merging. Thanks! |
398faec
to
0ff629c
Compare
I re-ran the macOS CI and the same test failed 🤔 |
0ff629c
to
a9fa543
Compare
} else { | ||
console.error('Error: Printing feature is disabled.') | ||
return Promise.reject(new Error('Printing feature is disabled')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
Release Notes Persisted
|
/trop run backport-to 5-0-x |
The backport process for this PR has been manually initiated, |
I was unable to backport this PR to "5-0-x" cleanly; |
Description of Change
This PR promisifies
webContents.printToPDF()
/cc @codebytere
Checklist
npm test
passesRelease Notes
Notes: Converted
webContents.printToPDF()
to return a Promise instead of taking a callback.