feat: add will-redirect (#13866)

* feat: add will-redirect to allow people to prevent 30X redirects

* spec: add tests for the will-redirect event

* refactor: implement will-redirect using NavigationThrottle instead of PostTask

This avoids a potential race condition and immediately cancels the
navigation

* docs: add docs for did-redirect-navigation

* refactor: move AtomNavigationThrottle out of net folder

* refactor: update header guard for atom_navigation_throttle.h

* refactor: fix chromium style errors in the GN build

* refactor: update throttle impl to NOTREACHED and std::make_unqique
This commit is contained in:
Samuel Attard 2018-09-16 01:42:43 +10:00 committed by GitHub
parent 6ad8583a8b
commit 7065093869
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 222 additions and 3 deletions

View file

@ -16,6 +16,7 @@
#include "atom/browser/api/atom_api_web_contents.h"
#include "atom/browser/atom_browser_context.h"
#include "atom/browser/atom_browser_main_parts.h"
#include "atom/browser/atom_navigation_throttle.h"
#include "atom/browser/atom_quota_permission_context.h"
#include "atom/browser/atom_resource_dispatcher_host_delegate.h"
#include "atom/browser/atom_speech_recognition_manager_delegate.h"
@ -613,4 +614,12 @@ bool AtomBrowserClient::HandleExternalProtocol(
return true;
}
std::vector<std::unique_ptr<content::NavigationThrottle>>
AtomBrowserClient::CreateThrottlesForNavigation(
content::NavigationHandle* handle) {
std::vector<std::unique_ptr<content::NavigationThrottle>> throttles;
throttles.push_back(std::make_unique<AtomNavigationThrottle>(handle));
return throttles;
}
} // namespace atom