fix: remove memory leak when using webFrame and spell checker (#16770)

* fix: do not create native api::WebFrame in webFrame

When reloading a page without restarting renderer process (for example
sandbox mode), the blink::WebFrame is not destroyed, but api::WebFrame
is always recreated for the new page context. This leaves a leak of
api::WebFrame.

* fix: remove spell checker when page context is released
This commit is contained in:
Cheng Zhao 2019-02-09 06:38:31 +09:00 committed by Samuel Attard
parent 3f52e18a38
commit d16b581140
5 changed files with 354 additions and 348 deletions

View file

@ -56,4 +56,28 @@ describe('webFrame module', function () {
expect(words).to.deep.equal(['spleling', 'test'])
expect(callback).to.be.true()
})
it('top is self for top frame', () => {
expect(webFrame.top.context).to.equal(webFrame.context)
})
it('opener is null for top frame', () => {
expect(webFrame.opener).to.be.null()
})
it('firstChild is null for top frame', () => {
expect(webFrame.firstChild).to.be.null()
})
it('getFrameForSelector() does not crash when not found', () => {
expect(webFrame.getFrameForSelector('unexist-selector')).to.be.null()
})
it('findFrameByName() does not crash when not found', () => {
expect(webFrame.findFrameByName('unexist-name')).to.be.null()
})
it('findFrameByRoutingId() does not crash when not found', () => {
expect(webFrame.findFrameByRoutingId(-1)).to.be.null()
})
})