"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "spec-main/webview-spec.ts" between
electron-11.2.3.tar.gz and electron-11.3.0.tar.gz

About: Electron is a framework for creating native cross platform applications with web technologies like JavaScript, HTML, and CSS.

webview-spec.ts  (electron-11.2.3):webview-spec.ts  (electron-11.3.0)
import * as path from 'path'; import * as path from 'path';
import * as url from 'url';
import { BrowserWindow, session, ipcMain, app, WebContents } from 'electron/main '; import { BrowserWindow, session, ipcMain, app, WebContents } from 'electron/main ';
import { closeAllWindows } from './window-helpers'; import { closeAllWindows } from './window-helpers';
import { emittedOnce, emittedUntil } from './events-helpers'; import { emittedOnce, emittedUntil } from './events-helpers';
import { ifdescribe } from './spec-helpers'; import { ifdescribe } from './spec-helpers';
import { expect } from 'chai'; import { expect } from 'chai';
const features = process._linkedBinding('electron_common_features'); const features = process._linkedBinding('electron_common_features');
async function loadWebView (w: WebContents, attributes: Record<string, string>, openDevTools: boolean = false): Promise<void> { async function loadWebView (w: WebContents, attributes: Record<string, string>, openDevTools: boolean = false): Promise<void> {
await w.executeJavaScript(` await w.executeJavaScript(`
skipping to change at line 184 skipping to change at line 185
const didAttachWebview = emittedOnce(w.webContents, 'did-attach-webview'); const didAttachWebview = emittedOnce(w.webContents, 'did-attach-webview');
const webviewDomReady = emittedOnce(ipcMain, 'webview-dom-ready'); const webviewDomReady = emittedOnce(ipcMain, 'webview-dom-ready');
w.loadFile(path.join(fixtures, 'pages', 'webview-did-attach-event.html')); w.loadFile(path.join(fixtures, 'pages', 'webview-did-attach-event.html'));
const [, webContents] = await didAttachWebview; const [, webContents] = await didAttachWebview;
const [, id] = await webviewDomReady; const [, id] = await webviewDomReady;
expect(webContents.id).to.equal(id); expect(webContents.id).to.equal(id);
}); });
}); });
describe('did-change-theme-color event', () => {
it('emits when theme color changes', async () => {
const w = new BrowserWindow({
webPreferences: {
webviewTag: true
}
});
await w.loadURL('about:blank');
const src = url.format({
pathname: `${fixtures.replace(/\\/g, '/')}/pages/theme-color.html`,
protocol: 'file',
slashes: true
});
const message = await w.webContents.executeJavaScript(`new Promise((resolv
e, reject) => {
const webview = new WebView()
webview.setAttribute('src', '${src}')
webview.addEventListener('did-change-theme-color', (e) => {
resolve('ok')
})
document.body.appendChild(webview)
})`);
expect(message).to.equal('ok');
});
});
it('loads devtools extensions registered on the parent window', async () => { it('loads devtools extensions registered on the parent window', async () => {
const w = new BrowserWindow({ const w = new BrowserWindow({
show: false, show: false,
webPreferences: { webPreferences: {
webviewTag: true, webviewTag: true,
nodeIntegration: true nodeIntegration: true
} }
}); });
BrowserWindow.removeDevToolsExtension('foo'); BrowserWindow.removeDevToolsExtension('foo');
 End of changes. 2 change blocks. 
0 lines changed or deleted 27 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)