fix: set userAgent
on navigationHistory.restore()
(#46300)
fix: set userAgent on navigationHistory restore Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
parent
f9164968d6
commit
fe445869ca
2 changed files with 32 additions and 0 deletions
|
@ -887,6 +887,31 @@ describe('webContents module', () => {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should restore an overridden user agent', async () => {
|
||||
const partition = 'persist:wcvtest';
|
||||
const testUA = 'MyCustomUA';
|
||||
|
||||
const ses = session.fromPartition(partition);
|
||||
ses.setUserAgent(testUA);
|
||||
|
||||
const wcv = new WebContentsView({
|
||||
webPreferences: { partition }
|
||||
});
|
||||
|
||||
wcv.webContents.navigationHistory.restore({
|
||||
entries: [{
|
||||
url: urlPage1,
|
||||
title: 'url1'
|
||||
}],
|
||||
index: 0
|
||||
});
|
||||
|
||||
const ua = wcv.webContents.getUserAgent();
|
||||
const wcvua = await wcv.webContents.executeJavaScript('navigator.userAgent');
|
||||
|
||||
expect(ua).to.equal(wcvua);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getFocusedWebContents() API', () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue