finish implementation of {secure:true} opt on protocol.registerStandardScehesm, and add working test

This commit is contained in:
Paul Frazee 2016-11-14 10:20:04 -06:00 committed by Kevin Sawicki
parent 9d2e23413e
commit 99ea50649a
9 changed files with 46 additions and 14 deletions

View file

@ -985,5 +985,19 @@ describe('protocol module', function () {
ipcMain.once('file-system-error', (event, err) => done(err))
ipcMain.once('file-system-write-end', () => done())
})
it('registers secure, when {secure: true}', function (done) {
// the CacheStorage API will only work if secure == true
let filePath = path.join(__dirname, 'fixtures', 'pages', 'cache-storage.html')
const handler = function (request, callback) {
callback({path: filePath})
}
ipcMain.once('success', () => done())
ipcMain.once('failure', (event, err) => done(err))
protocol.registerFileProtocol(standardScheme, handler, function (error) {
if (error) return done(error)
w.loadURL(origin)
})
})
})
})