Skip to content

Commit

Permalink
Added CefCustomScheme.IsCspBypassing
Browse files Browse the repository at this point in the history
Resolves cefsharp#2038
  • Loading branch information
merceyz committed Aug 29, 2017
1 parent b82ce07 commit 7e2594d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CefSharp.BrowserSubprocess.Core/CefAppUnmanagedWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ namespace CefSharp
{
for each (CefCustomScheme^ scheme in _schemes->AsReadOnly())
{
registrar->AddCustomScheme(StringUtils::ToNative(scheme->SchemeName), scheme->IsStandard, scheme->IsLocal, scheme->IsDisplayIsolated, scheme->IsSecure, scheme->IsCorsEnabled, false);
registrar->AddCustomScheme(StringUtils::ToNative(scheme->SchemeName), scheme->IsStandard, scheme->IsLocal, scheme->IsDisplayIsolated, scheme->IsSecure, scheme->IsCorsEnabled, scheme->IsCSPBypassing);
}
}
}
5 changes: 3 additions & 2 deletions CefSharp.Core/Internals/CefSharpApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ namespace CefSharp
argument += (scheme->IsLocal ? "T" : "F") + "|";
argument += (scheme->IsDisplayIsolated ? "T" : "F") + "|";
argument += (scheme->IsSecure ? "T" : "F") + "|";
argument += (scheme->IsCorsEnabled ? "T" : "F") + ";";
argument += (scheme->IsCorsEnabled ? "T" : "F") + "|";
argument += (scheme->IsCSPBypassing ? "T" : "F") + ";";
}

argument = argument->TrimEnd(';');
Expand Down Expand Up @@ -117,7 +118,7 @@ namespace CefSharp
{
for each (CefCustomScheme^ scheme in _cefSettings->CefCustomSchemes)
{
auto success = registrar->AddCustomScheme(StringUtils::ToNative(scheme->SchemeName), scheme->IsStandard, scheme->IsLocal, scheme->IsDisplayIsolated, scheme->IsSecure, scheme->IsCorsEnabled, false);
auto success = registrar->AddCustomScheme(StringUtils::ToNative(scheme->SchemeName), scheme->IsStandard, scheme->IsLocal, scheme->IsDisplayIsolated, scheme->IsSecure, scheme->IsCorsEnabled, scheme->IsCSPBypassing);

if (!success)
{
Expand Down
10 changes: 9 additions & 1 deletion CefSharp/CefCustomScheme.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ public sealed class CefCustomScheme
/// </summary>
public bool IsCorsEnabled { get; set; }

/// <summary>
/// If true the scheme can bypass Content-Security-Policy(CSP) checks.
/// This value should be false in most cases where IsStandard is true.
/// </summary>
public bool IsCSPBypassing { get; set; }

/// <summary>
/// Factory Class that creates <see cref="IResourceHandler"/> instances
/// for handling scheme requests.
Expand All @@ -103,6 +109,7 @@ public CefCustomScheme()
IsDisplayIsolated = false;
IsSecure = true;
IsCorsEnabled = true;
IsCSPBypassing = false;
}

/// <summary>
Expand All @@ -128,7 +135,8 @@ public static List<CefCustomScheme> ParseCommandLineArguments(IEnumerable<string
IsLocal = tokens[2] == "T",
IsDisplayIsolated = tokens[3] == "T",
IsSecure = tokens[4] == "T",
IsCorsEnabled = tokens[5] == "T"
IsCorsEnabled = tokens[5] == "T",
IsCSPBypassing = tokens[6] == "T"
};
customSchemes.Add(customScheme);
});
Expand Down

0 comments on commit 7e2594d

Please sign in to comment.