From 3379641fe211b37e7264c2e56de5a9f7c3f57c84 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 10 Aug 2015 15:31:29 +0800 Subject: [PATCH] Force request context to initialize beforing incepting protocol --- atom/browser/api/atom_api_protocol.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/atom/browser/api/atom_api_protocol.cc b/atom/browser/api/atom_api_protocol.cc index fdc5ba422bd3..d7d308b306ed 100644 --- a/atom/browser/api/atom_api_protocol.cc +++ b/atom/browser/api/atom_api_protocol.cc @@ -355,6 +355,10 @@ int Protocol::InterceptProtocolInIO(const std::string& scheme, const JsProtocolHandler& handler) { DCHECK_CURRENTLY_ON(BrowserThread::IO); + // Force the request context to initialize, otherwise we might have nothing + // to intercept. + request_context_getter_->GetURLRequestContext(); + if (!job_factory_->HasProtocolHandler(scheme)) return ERR_NO_SCHEME;