From 8919480ebcf66b36767f61d829c99c6b91fb9999 Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Mon, 25 Nov 2019 12:51:02 -0800 Subject: [PATCH] fix: reloadIgnoringCache() should ignore the cache (#21283) --- lib/browser/navigation-controller.js | 3 ++- shell/browser/api/atom_api_web_contents.cc | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/browser/navigation-controller.js b/lib/browser/navigation-controller.js index 5176c8ae54102..5b5547c550795 100644 --- a/lib/browser/navigation-controller.js +++ b/lib/browser/navigation-controller.js @@ -152,7 +152,8 @@ const NavigationController = (function () { NavigationController.prototype.reloadIgnoringCache = function () { this.pendingIndex = this.currentIndex return this.webContents._loadURL(this.getURL(), { - extraHeaders: 'pragma: no-cache\n' + extraHeaders: 'pragma: no-cache\n', + reloadIgnoringCache: true }) } diff --git a/shell/browser/api/atom_api_web_contents.cc b/shell/browser/api/atom_api_web_contents.cc index 25eeb85dab0cb..f6e9313a03a80 100644 --- a/shell/browser/api/atom_api_web_contents.cc +++ b/shell/browser/api/atom_api_web_contents.cc @@ -1386,6 +1386,12 @@ void WebContents::LoadURL(const GURL& url, const mate::Dictionary& options) { params.load_type = content::NavigationController::LOAD_TYPE_DATA; } + bool reload_ignoring_cache = false; + if (options.Get("reloadIgnoringCache", &reload_ignoring_cache) && + reload_ignoring_cache) { + params.reload_type = content::ReloadType::BYPASSING_CACHE; + } + // Calling LoadURLWithParams() can trigger JS which destroys |this|. auto weak_this = GetWeakPtr();