mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2024-11-24 08:02:15 +02:00
CefRegisterSchemeHandlerFactory bug fix
CefRegisterSchemeHandlerFactory can have an empty DomainName and a nil handler.
This commit is contained in:
parent
33946d12d5
commit
b701fc99e8
@ -151,7 +151,7 @@ procedure CefDebugLog(const aMessage : string);
|
|||||||
procedure OutputDebugMessage(const aMessage : string);
|
procedure OutputDebugMessage(const aMessage : string);
|
||||||
function CustomExceptionHandler(const aFunctionName : string; const aException : exception) : boolean;
|
function CustomExceptionHandler(const aFunctionName : string; const aException : exception) : boolean;
|
||||||
|
|
||||||
function CefRegisterSchemeHandlerFactory(const SchemeName, HostName: ustring; const handler: TCefResourceHandlerClass): Boolean;
|
function CefRegisterSchemeHandlerFactory(const SchemeName, DomainName : ustring; const handler: TCefResourceHandlerClass = nil): Boolean;
|
||||||
function CefClearSchemeHandlerFactories : boolean;
|
function CefClearSchemeHandlerFactories : boolean;
|
||||||
|
|
||||||
function CefAddCrossOriginWhitelistEntry(const SourceOrigin, TargetProtocol, TargetDomain: ustring; AllowTargetSubdomains: Boolean): Boolean;
|
function CefAddCrossOriginWhitelistEntry(const SourceOrigin, TargetProtocol, TargetDomain: ustring; AllowTargetSubdomains: Boolean): Boolean;
|
||||||
@ -670,21 +670,31 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function CefRegisterSchemeHandlerFactory(const SchemeName : ustring;
|
function CefRegisterSchemeHandlerFactory(const SchemeName : ustring;
|
||||||
const HostName : ustring;
|
const DomainName : ustring;
|
||||||
const handler : TCefResourceHandlerClass) : boolean;
|
const handler : TCefResourceHandlerClass) : boolean;
|
||||||
var
|
var
|
||||||
TempScheme, TempHostName : TCefString;
|
TempScheme, TempDomainName : TCefString;
|
||||||
TempFactory : ICefSchemeHandlerFactory;
|
TempFactory : ICefSchemeHandlerFactory;
|
||||||
|
TempDomainNamePtr : PCefString;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
|
|
||||||
try
|
try
|
||||||
if (GlobalCEFApp <> nil) and GlobalCEFApp.LibLoaded then
|
if (GlobalCEFApp <> nil) and
|
||||||
|
GlobalCEFApp.LibLoaded and
|
||||||
|
(length(SchemeName) > 0) then
|
||||||
begin
|
begin
|
||||||
TempScheme := CefString(SchemeName);
|
if (length(DomainName) > 0) then
|
||||||
TempHostName := CefString(HostName);
|
begin
|
||||||
TempFactory := TCefSchemeHandlerFactoryOwn.Create(handler);
|
TempDomainName := CefString(DomainName);
|
||||||
Result := cef_register_scheme_handler_factory(@TempScheme, @TempHostName, TempFactory.Wrap) <> 0;
|
TempDomainNamePtr := @TempDomainName;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
TempDomainNamePtr := nil;
|
||||||
|
|
||||||
|
TempScheme := CefString(SchemeName);
|
||||||
|
TempFactory := TCefSchemeHandlerFactoryOwn.Create(handler);
|
||||||
|
Result := cef_register_scheme_handler_factory(@TempScheme, TempDomainNamePtr, TempFactory.Wrap) <> 0;
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
TempFactory := nil;
|
TempFactory := nil;
|
||||||
|
@ -101,7 +101,10 @@ function TCefSchemeHandlerFactoryOwn.New(const browser : ICefBrowser;
|
|||||||
const schemeName : ustring;
|
const schemeName : ustring;
|
||||||
const request : ICefRequest): ICefResourceHandler;
|
const request : ICefRequest): ICefResourceHandler;
|
||||||
begin
|
begin
|
||||||
Result := FClass.Create(browser, frame, schemeName, request);
|
if (FClass <> nil) then
|
||||||
|
Result := FClass.Create(browser, frame, schemeName, request)
|
||||||
|
else
|
||||||
|
Result := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user