mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-02-02 10:25:26 +02:00
Fixed crash with relative paths that have ".."
Fixed compilation bug in Delphi 7
This commit is contained in:
parent
5e5b775608
commit
09685f56e1
@ -211,7 +211,7 @@ end;
|
|||||||
|
|
||||||
procedure TJSWindowBindingWithArrayBufferFrm.BrowserCreatedMsg(var aMessage : TMessage);
|
procedure TJSWindowBindingWithArrayBufferFrm.BrowserCreatedMsg(var aMessage : TMessage);
|
||||||
begin
|
begin
|
||||||
Caption := 'JSWindowBindingWithObject';
|
Caption := 'JSWindowBindingWithArrayBuffer';
|
||||||
CEFWindowParent1.UpdateSize;
|
CEFWindowParent1.UpdateSize;
|
||||||
NavControlPnl.Enabled := True;
|
NavControlPnl.Enabled := True;
|
||||||
GoBtn.Click;
|
GoBtn.Click;
|
||||||
|
@ -22,8 +22,8 @@
|
|||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<IsVisibleTab Value="True"/>
|
<IsVisibleTab Value="True"/>
|
||||||
<EditorIndex Value="1"/>
|
<EditorIndex Value="1"/>
|
||||||
<TopLine Value="127"/>
|
<TopLine Value="184"/>
|
||||||
<CursorPos X="81" Y="141"/>
|
<CursorPos X="45" Y="216"/>
|
||||||
<UsageCount Value="20"/>
|
<UsageCount Value="20"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
<LoadedDesigner Value="True"/>
|
<LoadedDesigner Value="True"/>
|
||||||
|
@ -213,7 +213,7 @@ end;
|
|||||||
|
|
||||||
procedure TJSWindowBindingWithArrayBufferFrm.BrowserCreatedMsg(var aMessage : TMessage);
|
procedure TJSWindowBindingWithArrayBufferFrm.BrowserCreatedMsg(var aMessage : TMessage);
|
||||||
begin
|
begin
|
||||||
Caption := 'JSWindowBindingWithObject';
|
Caption := 'JSWindowBindingWithArrayBuffer';
|
||||||
CEFWindowParent1.UpdateSize;
|
CEFWindowParent1.UpdateSize;
|
||||||
NavControlPnl.Enabled := True;
|
NavControlPnl.Enabled := True;
|
||||||
GoBtn.Click;
|
GoBtn.Click;
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<IsVisibleTab Value="True"/>
|
<IsVisibleTab Value="True"/>
|
||||||
<TopLine Value="116"/>
|
<TopLine Value="116"/>
|
||||||
<CursorPos X="77" Y="125"/>
|
<CursorPos X="41" Y="129"/>
|
||||||
<UsageCount Value="20"/>
|
<UsageCount Value="20"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
<LoadedDesigner Value="True"/>
|
<LoadedDesigner Value="True"/>
|
||||||
|
@ -822,76 +822,28 @@ end;
|
|||||||
|
|
||||||
procedure TCefApplication.SetCache(const aValue : ustring);
|
procedure TCefApplication.SetCache(const aValue : ustring);
|
||||||
begin
|
begin
|
||||||
if (length(aValue) > 0) then
|
FCache := CustomAbsolutePath(aValue);
|
||||||
begin
|
|
||||||
if CustomPathIsRelative(aValue) then
|
|
||||||
FCache := GetModulePath + aValue
|
|
||||||
else
|
|
||||||
FCache := aValue;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
FCache := '';
|
|
||||||
|
|
||||||
FDisableGPUCache := (length(FCache) = 0);
|
FDisableGPUCache := (length(FCache) = 0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCefApplication.SetRootCache(const aValue : ustring);
|
procedure TCefApplication.SetRootCache(const aValue : ustring);
|
||||||
begin
|
begin
|
||||||
if (length(aValue) > 0) then
|
FRootCache := CustomAbsolutePath(aValue);
|
||||||
begin
|
|
||||||
if CustomPathIsRelative(aValue) then
|
|
||||||
FRootCache := GetModulePath + aValue
|
|
||||||
else
|
|
||||||
FRootCache := aValue;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
FRootCache := '';
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCefApplication.SetUserDataPath(const aValue : ustring);
|
procedure TCefApplication.SetUserDataPath(const aValue : ustring);
|
||||||
begin
|
begin
|
||||||
if (length(aValue) > 0) then
|
FUserDataPath := CustomAbsolutePath(aValue);
|
||||||
begin
|
|
||||||
if CustomPathIsRelative(aValue) then
|
|
||||||
FUserDataPath := GetModulePath + aValue
|
|
||||||
else
|
|
||||||
FUserDataPath := aValue;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
FUserDataPath := '';
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCefApplication.SetBrowserSubprocessPath(const aValue : ustring);
|
procedure TCefApplication.SetBrowserSubprocessPath(const aValue : ustring);
|
||||||
begin
|
begin
|
||||||
if (length(aValue) > 0) then
|
FBrowserSubprocessPath := CustomAbsolutePath(aValue);
|
||||||
begin
|
|
||||||
if CustomPathIsRelative(aValue) then
|
|
||||||
FBrowserSubprocessPath := GetModulePath + aValue
|
|
||||||
else
|
|
||||||
FBrowserSubprocessPath := aValue;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
FBrowserSubprocessPath := '';
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCefApplication.SetFrameworkDirPath(const aValue : ustring);
|
procedure TCefApplication.SetFrameworkDirPath(const aValue : ustring);
|
||||||
var
|
|
||||||
TempPath : string;
|
|
||||||
begin
|
begin
|
||||||
if (length(aValue) > 0) then
|
FFrameworkDirPath := CustomAbsolutePath(aValue, True);
|
||||||
begin
|
|
||||||
if CustomPathIsRelative(aValue) then
|
|
||||||
TempPath := GetModulePath + aValue
|
|
||||||
else
|
|
||||||
TempPath := aValue;
|
|
||||||
|
|
||||||
if DirectoryExists(TempPath) then
|
|
||||||
FFrameworkDirPath := TempPath
|
|
||||||
else
|
|
||||||
FFrameworkDirPath := '';
|
|
||||||
end
|
|
||||||
else
|
|
||||||
FFrameworkDirPath := '';
|
|
||||||
|
|
||||||
{$IFDEF MSWINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
if (FProcessType = ptBrowser) then GetDLLVersion(ChromeElfPath, FChromeVersionInfo);
|
if (FProcessType = ptBrowser) then GetDLLVersion(ChromeElfPath, FChromeVersionInfo);
|
||||||
@ -899,43 +851,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCefApplication.SetResourcesDirPath(const aValue : ustring);
|
procedure TCefApplication.SetResourcesDirPath(const aValue : ustring);
|
||||||
var
|
|
||||||
TempPath : string;
|
|
||||||
begin
|
begin
|
||||||
if (length(aValue) > 0) then
|
FResourcesDirPath := CustomAbsolutePath(aValue, True);
|
||||||
begin
|
|
||||||
if CustomPathIsRelative(aValue) then
|
|
||||||
TempPath := GetModulePath + aValue
|
|
||||||
else
|
|
||||||
TempPath := aValue;
|
|
||||||
|
|
||||||
if DirectoryExists(TempPath) then
|
|
||||||
FResourcesDirPath := TempPath
|
|
||||||
else
|
|
||||||
FResourcesDirPath := '';
|
|
||||||
end
|
|
||||||
else
|
|
||||||
FResourcesDirPath := '';
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCefApplication.SetLocalesDirPath(const aValue : ustring);
|
procedure TCefApplication.SetLocalesDirPath(const aValue : ustring);
|
||||||
var
|
|
||||||
TempPath : string;
|
|
||||||
begin
|
begin
|
||||||
if (length(aValue) > 0) then
|
FLocalesDirPath := CustomAbsolutePath(aValue, True);
|
||||||
begin
|
|
||||||
if CustomPathIsRelative(aValue) then
|
|
||||||
TempPath := GetModulePath + aValue
|
|
||||||
else
|
|
||||||
TempPath := aValue;
|
|
||||||
|
|
||||||
if DirectoryExists(TempPath) then
|
|
||||||
FLocalesDirPath := TempPath
|
|
||||||
else
|
|
||||||
FLocalesDirPath := '';
|
|
||||||
end
|
|
||||||
else
|
|
||||||
FLocalesDirPath := '';
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCefApplication.CheckCEFLibrary : boolean;
|
function TCefApplication.CheckCEFLibrary : boolean;
|
||||||
|
@ -163,7 +163,7 @@ constructor TCefCustomCompletionCallback.Create(const aEvents : IChromiumEvents)
|
|||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
|
|
||||||
FEvents := aEvents;
|
FEvents := Pointer(aEvents);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TCefCustomCompletionCallback.Destroy;
|
destructor TCefCustomCompletionCallback.Destroy;
|
||||||
|
@ -123,10 +123,11 @@ procedure WindowInfoAsWindowless(var aWindowInfo : TCefWindowInfo; aParent : TCe
|
|||||||
function ProcessUnderWow64(hProcess: THandle; var Wow64Process: BOOL): BOOL; external Kernel32DLL name 'IsWow64Process';
|
function ProcessUnderWow64(hProcess: THandle; var Wow64Process: BOOL): BOOL; external Kernel32DLL name 'IsWow64Process';
|
||||||
function TzSpecificLocalTimeToSystemTime(lpTimeZoneInformation: PTimeZoneInformation; lpLocalTime, lpUniversalTime: PSystemTime): BOOL; stdcall; external Kernel32DLL;
|
function TzSpecificLocalTimeToSystemTime(lpTimeZoneInformation: PTimeZoneInformation; lpLocalTime, lpUniversalTime: PSystemTime): BOOL; stdcall; external Kernel32DLL;
|
||||||
function SystemTimeToTzSpecificLocalTime(lpTimeZoneInformation: PTimeZoneInformation; lpUniversalTime, lpLocalTime: PSystemTime): BOOL; stdcall; external Kernel32DLL;
|
function SystemTimeToTzSpecificLocalTime(lpTimeZoneInformation: PTimeZoneInformation; lpUniversalTime, lpLocalTime: PSystemTime): BOOL; stdcall; external Kernel32DLL;
|
||||||
|
|
||||||
function PathIsRelativeAnsi(pszPath: LPCSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsRelativeA';
|
function PathIsRelativeAnsi(pszPath: LPCSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsRelativeA';
|
||||||
function PathIsRelativeUnicode(pszPath: LPCWSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsRelativeW';
|
function PathIsRelativeUnicode(pszPath: LPCWSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsRelativeW';
|
||||||
function GetGlobalMemoryStatusEx(var Buffer: TMyMemoryStatusEx): BOOL; stdcall; external Kernel32DLL name 'GlobalMemoryStatusEx';
|
function GetGlobalMemoryStatusEx(var Buffer: TMyMemoryStatusEx): BOOL; stdcall; external Kernel32DLL name 'GlobalMemoryStatusEx';
|
||||||
|
function PathCanonicalizeAnsi(pszBuf: LPSTR; pszPath: LPCSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathCanonicalizeA';
|
||||||
|
function PathCanonicalizeUnicode(pszBuf: LPWSTR; pszPath: LPCWSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathCanonicalizeW';
|
||||||
|
|
||||||
{$IFNDEF DELPHI12_UP}
|
{$IFNDEF DELPHI12_UP}
|
||||||
{$IFDEF WIN64}
|
{$IFDEF WIN64}
|
||||||
@ -139,6 +140,8 @@ function GetGlobalMemoryStatusEx(var Buffer: TMyMemoryStatusEx): BOOL; stdcall;
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
function CustomPathIsRelative(const aPath : string) : boolean;
|
function CustomPathIsRelative(const aPath : string) : boolean;
|
||||||
|
function CustomPathCanonicalize(const aOriginalPath : string; var aCanonicalPath : string) : boolean;
|
||||||
|
function CustomAbsolutePath(const aPath : string; aMustExist : boolean = False) : string;
|
||||||
function GetModulePath : string;
|
function GetModulePath : string;
|
||||||
|
|
||||||
function CefIsCertStatusError(Status : TCefCertStatus) : boolean;
|
function CefIsCertStatusError(Status : TCefCertStatus) : boolean;
|
||||||
@ -879,14 +882,8 @@ begin
|
|||||||
|
|
||||||
if (length(aSrcPath) > 0) then
|
if (length(aSrcPath) > 0) then
|
||||||
begin
|
begin
|
||||||
aRsltPath := IncludeTrailingPathDelimiter(aSrcPath);
|
aRsltPath := IncludeTrailingPathDelimiter(CustomAbsolutePath(aSrcPath));
|
||||||
|
Result := DirectoryExists(aRsltPath);
|
||||||
if DirectoryExists(aSrcPath) then
|
|
||||||
begin
|
|
||||||
if CustomPathIsRelative(aRsltPath) then aRsltPath := GetModulePath + aRsltPath;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
Result := False;
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
aRsltPath := '';
|
aRsltPath := '';
|
||||||
@ -1010,7 +1007,7 @@ begin
|
|||||||
TempList.Add(TempDir + 'cef_100_percent.pak');
|
TempList.Add(TempDir + 'cef_100_percent.pak');
|
||||||
TempList.Add(TempDir + 'cef_200_percent.pak');
|
TempList.Add(TempDir + 'cef_200_percent.pak');
|
||||||
|
|
||||||
if aCheckExtensions then TempList.Add(TempDir + 'cef_extensions.pak');
|
if aCheckExtensions then TempList.Add(TempDir + 'cef_extensions.pak');
|
||||||
if aCheckDevResources then TempList.Add(TempDir + 'devtools_resources.pak');
|
if aCheckDevResources then TempList.Add(TempDir + 'devtools_resources.pak');
|
||||||
|
|
||||||
if TempExists then
|
if TempExists then
|
||||||
@ -1422,6 +1419,50 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function CustomPathCanonicalize(const aOriginalPath : string; var aCanonicalPath : string) : boolean;
|
||||||
|
var
|
||||||
|
TempBuffer: array [0..pred(MAX_PATH)] of Char;
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
aCanonicalPath := '';
|
||||||
|
|
||||||
|
FillChar(TempBuffer, MAX_PATH * SizeOf(Char), 0);
|
||||||
|
|
||||||
|
{$IFDEF MSWINDOWS}
|
||||||
|
{$IFDEF DELPHI12_UP}
|
||||||
|
if PathCanonicalizeUnicode(@TempBuffer[0], PChar(aOriginalPath)) then
|
||||||
|
begin
|
||||||
|
aCanonicalPath := TempBuffer;
|
||||||
|
Result := True;
|
||||||
|
end;
|
||||||
|
{$ELSE}
|
||||||
|
if PathCanonicalizeAnsi(@TempBuffer[0], PChar(aOriginalPath)) then
|
||||||
|
begin
|
||||||
|
aCanonicalPath := TempBuffer;
|
||||||
|
Result := True;
|
||||||
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
{$ENDIF}
|
||||||
|
end;
|
||||||
|
|
||||||
|
function CustomAbsolutePath(const aPath : string; aMustExist : boolean) : string;
|
||||||
|
var
|
||||||
|
TempPath : string;
|
||||||
|
begin
|
||||||
|
if (length(aPath) > 0) then
|
||||||
|
begin
|
||||||
|
if not(CustomPathIsRelative(aPath) and CustomPathCanonicalize(GetModulePath + aPath, TempPath)) then
|
||||||
|
TempPath := aPath;
|
||||||
|
|
||||||
|
if aMustExist and not(DirectoryExists(TempPath)) then
|
||||||
|
Result := ''
|
||||||
|
else
|
||||||
|
Result := TempPath;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := '';
|
||||||
|
end;
|
||||||
|
|
||||||
function GetModulePath : string;
|
function GetModulePath : string;
|
||||||
begin
|
begin
|
||||||
Result := IncludeTrailingPathDelimiter(ExtractFileDir(GetModuleName(HINSTANCE{$IFDEF FPC}(){$ENDIF})));
|
Result := IncludeTrailingPathDelimiter(ExtractFileDir(GetModuleName(HINSTANCE{$IFDEF FPC}(){$ENDIF})));
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"UpdateLazPackages" : [
|
"UpdateLazPackages" : [
|
||||||
{
|
{
|
||||||
"ForceNotify" : true,
|
"ForceNotify" : true,
|
||||||
"InternalVersion" : 30,
|
"InternalVersion" : 31,
|
||||||
"Name" : "cef4delphi_lazarus.lpk",
|
"Name" : "cef4delphi_lazarus.lpk",
|
||||||
"Version" : "76.1.13.0"
|
"Version" : "76.1.13.0"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user