From: Cheng Zhao Date: Mon, 10 Aug 2015 07:31:29 +0000 (+0800) Subject: Force request context to initialize beforing incepting protocol X-Git-Tag: v0.30.4~1^2~1 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=3379641fe211b37e7264c2e56de5a9f7c3f57c84;p=electron.git Force request context to initialize beforing incepting protocol --- diff --git a/atom/browser/api/atom_api_protocol.cc b/atom/browser/api/atom_api_protocol.cc index fdc5ba42..d7d308b3 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;