protocol: custom standard schemes should support cookies
This commit is contained in:
parent
32d9382417
commit
52431506ba
2 changed files with 29 additions and 0 deletions
|
@ -17,6 +17,7 @@
|
|||
#include "atom/common/options_switches.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "brightray/common/switches.h"
|
||||
#include "content/public/browser/child_process_security_policy.h"
|
||||
#include "native_mate/dictionary.h"
|
||||
#include "url/url_util.h"
|
||||
|
@ -209,6 +210,8 @@ void RegisterStandardSchemes(
|
|||
auto command_line = base::CommandLine::ForCurrentProcess();
|
||||
command_line->AppendSwitchASCII(atom::switches::kStandardSchemes,
|
||||
base::JoinString(schemes, ","));
|
||||
command_line->AppendSwitchASCII(brightray::switches::kCookieableSchemes,
|
||||
base::JoinString(schemes, ","));
|
||||
}
|
||||
|
||||
void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
||||
|
|
|
@ -153,6 +153,32 @@ describe('session module', function () {
|
|||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('should set cookie for standard scheme', function (done) {
|
||||
const standardScheme = remote.getGlobal('standardScheme')
|
||||
const origin = standardScheme + '://fake-host'
|
||||
session.defaultSession.cookies.set({
|
||||
url: origin,
|
||||
name: 'custom',
|
||||
value: '1'
|
||||
}, function (error) {
|
||||
if (error) {
|
||||
return done(error)
|
||||
}
|
||||
session.defaultSession.cookies.get({
|
||||
url: origin
|
||||
}, function (error, list) {
|
||||
if (error) {
|
||||
return done(error)
|
||||
}
|
||||
assert.equal(list.length, 1)
|
||||
assert.equal(list[0].name, 'custom')
|
||||
assert.equal(list[0].value, '1')
|
||||
assert.equal(list[0].domain, 'fake-host')
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('ses.clearStorageData(options)', function () {
|
||||
|
|
Loading…
Reference in a new issue