Skip to content

Commit

Permalink
address feedback from review
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Feb 12, 2019
1 parent 3b276c5 commit 1685c60
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions atom/browser/api/atom_api_web_contents.cc
Expand Up @@ -1305,9 +1305,9 @@ v8::Local<v8::Promise> WebContents::SavePage(
const content::SavePageType& save_type) {
scoped_refptr<util::Promise> promise = new util::Promise(isolate());
auto* handler = new SavePageHandler(web_contents(), promise);
bool success = handler->Handle(full_file_path, save_type);

if (!success)
const bool saveStarted = handler->Handle(full_file_path, save_type);
if (!saveStarted)
promise->RejectWithErrorMessage("Failed to save the page");

return promise->GetHandle();
Expand Down
4 changes: 2 additions & 2 deletions docs/api/web-contents.md
Expand Up @@ -1544,7 +1544,7 @@ the cursor when dragging.
* `HTMLComplete` - Save complete-html page.
* `MHTML` - Save complete-html page as MHTML.

Returns `Promise<void>` - resolves if the process of saving page has been initiated successfully.
Returns `Promise<void>` - resolves if the process of saving page has been successfully completed.

```javascript
const { BrowserWindow } = require('electron')
Expand All @@ -1554,7 +1554,7 @@ win.loadURL('https://github.com')

win.webContents.on('did-finish-load', async () => {
win.webContents.savePage('/tmp/test.html', 'HTMLComplete').then(() => {
console.log('Save page successfully')
console.log('Page was saved successfully.')
}).catch(err => {
console.log(err)
})
Expand Down

0 comments on commit 1685c60

Please sign in to comment.