### Preflight Checklist

* [x] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/master/CONTRIBUTING.md) for this project.
* [x] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) that this project adheres to.
* [x] I have searched the issue tracker for an issue that matches the one I want to file, without success.

### Issue Details

* **Electron Version:**
  * 5.0.6
* **Operating System:**
  * macOS 10.14.5
* **Last Known Working Electron version:**
  * 4.2.5

### Expected Behavior
When I click on a **button** who uses the `print()` method
The print dialog opens
Then I click on "Cancel" button
I must be able to go to another page by clicking on a link

### Actual Behavior
When I click on a **button** who uses the `print()` method
The print dialog opens
Then I click on "Cancel" button
I can not click on another link, I have to quit the application and open it again

### To Reproduce
You can download the PIA 2.1.0 version at this URL https://github.com/LINCnil/pia-app/releases/tag/2.1.0 then:
* Create a new PIA
* Click on the **Preview** icon
* Click on the **Printer** icon (Wait for the printer dialog box)
* Click on the **Cancel** button
* Try to go on another page of the application


shell/browser/api/atom_api_web_contents.cc
const std::string& channel,
                              blink::CloneableMessage arguments,
                              MessageSyncCallback callback) {
  // ws.emit('-ipc-message-sync', new Event(sender, message), internal,
  // channel, arguments);
  EmitWithSender("-ipc-message-sync", bindings_.dispatch_context(),
                 std::move(callback), internal, channel, std::move(arguments));
}
void Ws::MessageTo(bool internal,
                            bool send_to_all,
                            int32_t ontents_id,
                            const std::string& channel,
                            blink::CloneableMessage arguments) {
  auto* ontents = gin_helper::TrackableObject<Ws>::FromWeakMapID(
      isolate(), ontents_id);
  if (ontents) {
    ontents->SendIPCMessageWithSender(internal, send_to_all, channel,
                                           std::move(arguments), ID());
  }
}
void Ws::MessageHost(const std::string& channel,
                              blink::CloneableMessage arguments) {
  // ws.emit('ipc-message-host', new Event(), channel, args);
  EmitWithSender("ipc-message-host", bindings_.dispatch_context(),
                 InvokeCallback(), channel, std::move(arguments));
}
#if BUILDFLAG(ENABLE_REMOTE_MODULE)
void Ws::DereferenceRemoteJSObject(const std::string& context_id,