Merge pull request #11176 from electron/proxy-crash-race

Avoid proxy handler race condition crash
This commit is contained in:
Cheng Zhao 2017-11-20 20:15:02 +09:00 committed by GitHub
commit cb98ed8674
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -633,12 +633,17 @@ void App::OnLogin(LoginHandler* login_handler,
const base::DictionaryValue& request_details) { const base::DictionaryValue& request_details) {
v8::Locker locker(isolate()); v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate()); v8::HandleScope handle_scope(isolate());
bool prevent_default = Emit( bool prevent_default = false;
"login", content::WebContents* web_contents = login_handler->GetWebContents();
WebContents::CreateFrom(isolate(), login_handler->GetWebContents()), if (web_contents) {
request_details, prevent_default =
login_handler->auth_info(), Emit("login",
base::Bind(&PassLoginInformation, make_scoped_refptr(login_handler))); WebContents::CreateFrom(isolate(), web_contents),
request_details,
login_handler->auth_info(),
base::Bind(&PassLoginInformation,
make_scoped_refptr(login_handler)));
}
// Default behavior is to always cancel the auth. // Default behavior is to always cancel the auth.
if (!prevent_default) if (!prevent_default)