diff --git a/shell/browser/api/electron_api_web_request.cc b/shell/browser/api/electron_api_web_request.cc index fb1b8ebcdaf..a538901a1c9 100644 --- a/shell/browser/api/electron_api_web_request.cc +++ b/shell/browser/api/electron_api_web_request.cc @@ -115,13 +115,12 @@ bool MatchesFilterCondition(extensions::WebRequestInfo* info, // to pass the original keys. v8::Local HttpResponseHeadersToV8( net::HttpResponseHeaders* headers) { - base::DictionaryValue response_headers; + base::Value::Dict response_headers; if (headers) { size_t iter = 0; std::string key; std::string value; while (headers->EnumerateHeaderLines(&iter, &key, &value)) { - base::Value* values = response_headers.FindListKey(key); // Note that Web servers not developed with nodejs allow non-utf8 // characters in content-disposition's filename field. Use Chromium's // HttpContentDisposition class to decode the correct encoding instead of @@ -138,12 +137,14 @@ v8::Local HttpResponseHeadersToV8( std::string filename = "\"" + header.filename() + "\""; value = decodedFilename + "; filename=" + filename; } + base::Value::List* values = response_headers.FindList(key); if (!values) - values = response_headers.SetKey(key, base::ListValue()); - values->Append(value); + values = &response_headers.Set(key, base::Value::List())->GetList(); + values->Append(base::Value(value)); } } - return gin::ConvertToV8(v8::Isolate::GetCurrent(), response_headers); + return gin::ConvertToV8(v8::Isolate::GetCurrent(), + base::Value(std::move(response_headers))); } // Overloaded by multiple types to fill the |details| object.