fix a pdf-viewer's parsing logic, and this should resolve the related issue at https://github.com/electron/electron/issues/10007

This commit is contained in:
Boik 2017-07-14 12:09:14 +08:00
parent 1d32f300f3
commit 9a7651a93f
2 changed files with 11 additions and 2 deletions

View file

@ -86,9 +86,10 @@ void OnPdfResourceIntercepted(
// The URL passes the original pdf resource url, that will be requested
// by the webui page.
// chrome://pdf-viewer/index.html?src=https://somepage/123.pdf
GURL escaped_url(net::EscapeUrlEncodedData(original_url.spec(), true));
content::NavigationController::LoadURLParams params(
GURL(base::StringPrintf("%sindex.html?%s=%s", kPdfViewerUIOrigin,
kPdfPluginSrc, original_url.spec().c_str())));
kPdfPluginSrc, escaped_url.spec().c_str())));
web_contents->GetController().LoadURLWithParams(params);
}