Skip to content

Commit

Permalink
fix: reloadIgnoringCache() should ignore the cache (#21283)
Browse files Browse the repository at this point in the history
  • Loading branch information
trop[bot] authored and MarshallOfSound committed Nov 25, 2019
1 parent bb9e68b commit 8919480
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/browser/navigation-controller.js
Expand Up @@ -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
})
}

Expand Down
6 changes: 6 additions & 0 deletions shell/browser/api/atom_api_web_contents.cc
Expand Up @@ -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();

Expand Down

0 comments on commit 8919480

Please sign in to comment.