Skip to content

Commit 593abe2

Browse files
ckerrMarshallOfSound
authored andcommitted
chore: bump ELECTRON_COMMIT for cookie promises api (#122)
BREAKING CHANGE: changed promise API * chore: bump ELECTRON_COMMIT for cookie promises api * chore: update cookie API in main.ts * chore: bump ELECTRON_COMMIT to fixed PR commit
1 parent 252f6a0 commit 593abe2

File tree

2 files changed

+33
-20
lines changed

2 files changed

+33
-20
lines changed

test-smoke/electron/test/main.ts

+32-19
Original file line numberDiff line numberDiff line change
@@ -1003,6 +1003,38 @@ shell.beep();
10031003

10041004
shell.writeShortcutLink("/home/user/Desktop/shortcut.lnk", "update", shell.readShortcutLink("/home/user/Desktop/shortcut.lnk"));
10051005

1006+
// cookies
1007+
// https://github.com/atom/electron/blob/master/docs/api/cookies.md
1008+
{
1009+
const { session } = require('electron')
1010+
1011+
// Query all cookies.
1012+
session.defaultSession.cookies.get({})
1013+
.then((cookies) => {
1014+
console.log(cookies)
1015+
}).catch((error) => {
1016+
console.log(error)
1017+
})
1018+
1019+
// Query all cookies associated with a specific url.
1020+
session.defaultSession.cookies.get({ url: 'http://www.github.com' })
1021+
.then((cookies) => {
1022+
console.log(cookies)
1023+
}).catch((error) => {
1024+
console.log(error)
1025+
})
1026+
1027+
// Set a cookie with the given cookie data;
1028+
// may overwrite equivalent cookies if they exist.
1029+
const cookie = { url: 'http://www.github.com', name: 'dummy_name', value: 'dummy' }
1030+
session.defaultSession.cookies.set(cookie)
1031+
.then(() => {
1032+
// success
1033+
}, (error) => {
1034+
console.error(error)
1035+
})
1036+
}
1037+
10061038
// session
10071039
// https://github.com/atom/electron/blob/master/docs/api/session.md
10081040

@@ -1013,25 +1045,6 @@ session.defaultSession.on("will-download", (event, item, webContents) => {
10131045
});
10141046
});
10151047

1016-
// Query all cookies.
1017-
session.defaultSession.cookies.get({}, (error, cookies) => {
1018-
console.log(cookies);
1019-
});
1020-
1021-
// Query all cookies associated with a specific url.
1022-
session.defaultSession.cookies.get({ url: "http://www.github.com" }, (error, cookies) => {
1023-
console.log(cookies);
1024-
});
1025-
1026-
// Set a cookie with the given cookie data;
1027-
// may overwrite equivalent cookies if they exist.
1028-
const cookie = { url: "http://www.github.com", name: "dummy_name", value: "dummy" };
1029-
session.defaultSession.cookies.set(cookie, (error) => {
1030-
if (error) {
1031-
console.error(error);
1032-
}
1033-
});
1034-
10351048
// In the main process.
10361049
session.defaultSession.on("will-download", (event, item, webContents) => {
10371050
// Set the save path, making Electron not to prompt a save dialog.

vendor/fetch-docs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const mkdirp = require('mkdirp').sync
77
const os = require('os')
88

99
const downloadPath = path.join(os.tmpdir(), 'electron-api-tmp')
10-
const ELECTRON_COMMIT = '5454cd01125b9abcf89a6ec1f8622bbe2107ea81'
10+
const ELECTRON_COMMIT = '0c96f14a5b702036559a8012ef0dd9649221d5d9'
1111

1212
rm(downloadPath)
1313

0 commit comments

Comments
 (0)