Skip to content

Commit

Permalink
fix: webContents.navigationHistory should be enumerable (#42181)
Browse files Browse the repository at this point in the history
fix: webContents.navigationHistory should be enumerable

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
  • Loading branch information
trop[bot] and codebytere committed May 15, 2024
1 parent 2201664 commit 05ae671
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/browser/api/web-contents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,8 @@ WebContents.prototype._init = function () {
length: this._historyLength.bind(this),
getEntryAtIndex: this._getNavigationEntryAtIndex.bind(this)
},
writable: false
writable: false,
enumerable: true
});

// Dispatch IPC messages to the ipc module.
Expand Down
11 changes: 11 additions & 0 deletions spec/api-web-contents-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ describe('webContents module', () => {
});
});

describe('webContents properties', () => {
afterEach(closeAllWindows);

it('has expected additional enumerable properties', () => {
const w = new BrowserWindow({ show: false });
const properties = Object.getOwnPropertyNames(w.webContents);
expect(properties).to.include('ipc');
expect(properties).to.include('navigationHistory');
});
});

describe('fromId()', () => {
it('returns undefined for an unknown id', () => {
expect(webContents.fromId(12345)).to.be.undefined();
Expand Down

0 comments on commit 05ae671

Please sign in to comment.