docs: move protocol-ns to protocol.md (#23883)

* docs: move protocol-ns to protocol.md

* chore: fix up tests and implement missing pieces required for tests
This commit is contained in:
Samuel Attard 2020-06-02 09:46:18 -07:00 committed by GitHub
parent edc5050a2e
commit d3fa5ed1e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 285 additions and 733 deletions

View file

@ -410,8 +410,6 @@ describe('chromium features', () => {
if (ext === '.js') type = 'application/javascript';
callback({ data: content, mimeType: type } as any);
}, (error) => {
if (error) done(error);
});
const w = new BrowserWindow({
@ -431,7 +429,8 @@ describe('chromium features', () => {
customSession.clearStorageData({
storages: ['serviceworkers']
}).then(() => {
customSession.protocol.uninterceptProtocol('file', error => done(error));
customSession.protocol.uninterceptProtocol('file');
done();
});
}
});
@ -840,8 +839,8 @@ describe('chromium features', () => {
];
const s = (url: string) => url.startsWith('file') ? 'file://...' : url;
before(async () => {
await promisify(protocol.registerFileProtocol)(scheme, (request, callback) => {
before(() => {
protocol.registerFileProtocol(scheme, (request, callback) => {
if (request.url.includes('blank')) {
callback(`${fixturesPath}/pages/blank.html`);
} else {
@ -849,8 +848,8 @@ describe('chromium features', () => {
}
});
});
after(async () => {
await promisify(protocol.unregisterProtocol)(scheme);
after(() => {
protocol.unregisterProtocol(scheme);
});
afterEach(closeAllWindows);
@ -929,7 +928,7 @@ describe('chromium features', () => {
describe('custom non standard schemes', () => {
const protocolName = 'storage';
let contents: WebContents;
before((done) => {
before(() => {
protocol.registerFileProtocol(protocolName, (request, callback) => {
const parsedUrl = url.parse(request.url);
let filename;
@ -942,11 +941,11 @@ describe('chromium features', () => {
default : filename = '';
}
callback({ path: `${fixturesPath}/pages/storage/${filename}` });
}, (error) => done(error));
});
});
after((done) => {
protocol.unregisterProtocol(protocolName, () => done());
after(() => {
protocol.unregisterProtocol(protocolName);
});
beforeEach(() => {