fix: remove undocumented feature and flaky test for webview resize event (#36154)
This commit is contained in:
parent
67a0c702fa
commit
b9464d89b8
2 changed files with 0 additions and 43 deletions
|
@ -24,7 +24,6 @@ export class WebViewImpl {
|
|||
public guestInstanceId?: number
|
||||
public hasFocus = false
|
||||
public internalInstanceId?: number;
|
||||
public resizeObserver?: ResizeObserver;
|
||||
public viewInstanceId: number
|
||||
|
||||
// on* Event handlers.
|
||||
|
@ -103,14 +102,6 @@ export class WebViewImpl {
|
|||
this.attributes.get(attributeName)!.handleMutation(oldValue, newValue);
|
||||
}
|
||||
|
||||
onElementResize () {
|
||||
const props = {
|
||||
newWidth: this.webviewNode.clientWidth,
|
||||
newHeight: this.webviewNode.clientHeight
|
||||
};
|
||||
this.dispatchEvent('resize', props);
|
||||
}
|
||||
|
||||
createGuest () {
|
||||
this.internalInstanceId = getNextId();
|
||||
this.hooks.guestViewInternal.createGuest(this.internalElement, this.internalInstanceId, this.buildParams())
|
||||
|
@ -203,10 +194,6 @@ export class WebViewImpl {
|
|||
}
|
||||
|
||||
this.guestInstanceId = guestInstanceId;
|
||||
// TODO(zcbenz): Should we deprecate the "resize" event? Wait, it is not
|
||||
// even documented.
|
||||
this.resizeObserver = new ResizeObserver(this.onElementResize.bind(this));
|
||||
this.resizeObserver.observe(this.internalElement);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1957,36 +1957,6 @@ describe('<webview> tag', function () {
|
|||
['with sandbox', true] as const
|
||||
]) {
|
||||
describe(description, () => {
|
||||
it('emits resize events', async () => {
|
||||
await loadWebViewAndWaitForEvent(w, {
|
||||
src: `file://${fixtures}/pages/a.html`,
|
||||
webpreferences: `sandbox=${sandbox ? 'yes' : 'no'}`
|
||||
}, 'dom-ready');
|
||||
|
||||
const firstResizeSignal = w.executeJavaScript(`new Promise((resolve, reject) => {
|
||||
webview.addEventListener('resize', (e) => resolve({...e}), {once: true})
|
||||
})`);
|
||||
|
||||
const insertedCSS = await w.insertCSS('webview { width: 100px; height: 10px; }');
|
||||
|
||||
const firstResizeEvent = await firstResizeSignal;
|
||||
expect(firstResizeEvent.newWidth).to.equal(100);
|
||||
expect(firstResizeEvent.newHeight).to.equal(10);
|
||||
|
||||
await w.removeInsertedCSS(insertedCSS);
|
||||
|
||||
const secondResizeSignal = w.executeJavaScript(`new Promise((resolve, reject) => {
|
||||
webview.addEventListener('resize', (e) => resolve({...e}), {once: true})
|
||||
})`);
|
||||
|
||||
const newWidth = 1234;
|
||||
const newHeight = 789;
|
||||
await w.insertCSS(`webview { width: ${newWidth}px; height: ${newHeight}px; }`);
|
||||
const secondResizeEvent = await secondResizeSignal;
|
||||
expect(secondResizeEvent.newWidth).to.equal(newWidth);
|
||||
expect(secondResizeEvent.newHeight).to.equal(newHeight);
|
||||
});
|
||||
|
||||
it('emits focus event', async () => {
|
||||
await loadWebViewAndWaitForEvent(w, {
|
||||
src: `file://${fixtures}/pages/a.html`,
|
||||
|
|
Loading…
Reference in a new issue