Merge pull request #9892 from electron/upgrade-pdf-viewer
Upgrade to electron/pdf-viewer@beb36874a6
This commit is contained in:
commit
04c87cd1c3
3 changed files with 10 additions and 12 deletions
|
@ -987,7 +987,7 @@ describe('chromium feature', function () {
|
|||
w = new BrowserWindow({
|
||||
show: false,
|
||||
webPreferences: {
|
||||
preload: path.join(fixtures, 'module', 'preload-inject-ipc.js'),
|
||||
preload: path.join(fixtures, 'module', 'preload-pdf-loaded.js'),
|
||||
plugins: plugins
|
||||
}
|
||||
})
|
||||
|
@ -995,23 +995,16 @@ describe('chromium feature', function () {
|
|||
|
||||
it('opens when loading a pdf resource as top level navigation', function (done) {
|
||||
createBrowserWindow({plugins: true})
|
||||
ipcMain.once('pdf-loaded', function (event, success) {
|
||||
if (success) done()
|
||||
ipcMain.once('pdf-loaded', function (event, state) {
|
||||
assert.equal(state, 'success')
|
||||
done()
|
||||
})
|
||||
w.webContents.on('page-title-updated', function () {
|
||||
const source = `
|
||||
if (window.viewer) {
|
||||
window.viewer.setLoadCallback(function(success) {
|
||||
window.ipcRenderer.send('pdf-loaded', success);
|
||||
});
|
||||
}
|
||||
`
|
||||
const parsedURL = url.parse(w.webContents.getURL(), true)
|
||||
assert.equal(parsedURL.protocol, 'chrome:')
|
||||
assert.equal(parsedURL.hostname, 'pdf-viewer')
|
||||
assert.equal(parsedURL.query.src, pdfSource)
|
||||
assert.equal(w.webContents.getTitle(), 'cat.pdf')
|
||||
w.webContents.executeJavaScript(source)
|
||||
})
|
||||
w.webContents.loadURL(pdfSource)
|
||||
})
|
||||
|
|
5
spec/fixtures/module/preload-pdf-loaded.js
vendored
Normal file
5
spec/fixtures/module/preload-pdf-loaded.js
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
const {ipcRenderer} = require('electron')
|
||||
|
||||
window.addEventListener('pdf-loaded', function (event) {
|
||||
ipcRenderer.send('pdf-loaded', event.detail)
|
||||
})
|
2
vendor/pdf_viewer
vendored
2
vendor/pdf_viewer
vendored
|
@ -1 +1 @@
|
|||
Subproject commit a050a339cfeabcfb5f07c313161d2ee27b6c3a39
|
||||
Subproject commit beb36874a6b61d7a18b92bf7dcd1f0661e4c59cf
|
Loading…
Reference in a new issue