refactor: use _loadURL(url, options ?? {}); (#37337)

This commit is contained in:
Milan Burda 2023-02-27 10:05:58 +01:00 committed by GitHub
parent 1ff7f098f1
commit edf887bdc5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -418,10 +418,6 @@ WebContents.prototype.loadFile = function (filePath, options = {}) {
};
WebContents.prototype.loadURL = function (url, options) {
if (!options) {
options = {};
}
const p = new Promise<void>((resolve, reject) => {
const resolveAndCleanup = () => {
removeListeners();
@ -488,7 +484,7 @@ WebContents.prototype.loadURL = function (url, options) {
});
// Add a no-op rejection handler to silence the unhandled rejection error.
p.catch(() => {});
this._loadURL(url, options);
this._loadURL(url, options ?? {});
return p;
};