From edf887bdc52bac4563ae3cba1bc02aa6d397d7ff Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Mon, 27 Feb 2023 10:05:58 +0100 Subject: [PATCH] refactor: use _loadURL(url, options ?? {}); (#37337) --- lib/browser/api/web-contents.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/browser/api/web-contents.ts b/lib/browser/api/web-contents.ts index 7f1fe3c9cb..14a9c086ac 100644 --- a/lib/browser/api/web-contents.ts +++ b/lib/browser/api/web-contents.ts @@ -418,10 +418,6 @@ WebContents.prototype.loadFile = function (filePath, options = {}) { }; WebContents.prototype.loadURL = function (url, options) { - if (!options) { - options = {}; - } - const p = new Promise((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; };