SEBWIN-329: Fixed bug with custom URI scheme handling and blocked mailto URLs.
This commit is contained in:
parent
5599fceef6
commit
c38e57e081
1 changed files with 21 additions and 8 deletions
|
@ -33,6 +33,11 @@ namespace SafeExamBrowser.Browser.Handlers
|
||||||
// reactivated. See https://bitbucket.org/chromiumembedded/cef/issues/2622 for the current status of development.
|
// reactivated. See https://bitbucket.org/chromiumembedded/cef/issues/2622 for the current status of development.
|
||||||
// AppendCustomUserAgent(request);
|
// AppendCustomUserAgent(request);
|
||||||
|
|
||||||
|
if (IsMailtoUrl(request.Url))
|
||||||
|
{
|
||||||
|
return CefReturnValue.Cancel;
|
||||||
|
}
|
||||||
|
|
||||||
ReplaceCustomScheme(request);
|
ReplaceCustomScheme(request);
|
||||||
|
|
||||||
return base.OnBeforeResourceLoad(browserControl, browser, frame, request, callback);
|
return base.OnBeforeResourceLoad(browserControl, browser, frame, request, callback);
|
||||||
|
@ -47,7 +52,14 @@ namespace SafeExamBrowser.Browser.Handlers
|
||||||
request.Headers = headers;
|
request.Headers = headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool IsMailtoUrl(string url)
|
||||||
|
{
|
||||||
|
return url.StartsWith(Uri.UriSchemeMailto);
|
||||||
|
}
|
||||||
|
|
||||||
private void ReplaceCustomScheme(IRequest request)
|
private void ReplaceCustomScheme(IRequest request)
|
||||||
|
{
|
||||||
|
if (Uri.IsWellFormedUriString(request.Url, UriKind.RelativeOrAbsolute))
|
||||||
{
|
{
|
||||||
var uri = new Uri(request.Url);
|
var uri = new Uri(request.Url);
|
||||||
|
|
||||||
|
@ -61,4 +73,5 @@ namespace SafeExamBrowser.Browser.Handlers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue