diff --git a/demos/Delphi_VCL/JavaScript/JSWindowBindingWithArrayBuffer/uJSWindowBindingWithArrayBuffer.pas b/demos/Delphi_VCL/JavaScript/JSWindowBindingWithArrayBuffer/uJSWindowBindingWithArrayBuffer.pas
index 36a2709a..59170d0b 100644
--- a/demos/Delphi_VCL/JavaScript/JSWindowBindingWithArrayBuffer/uJSWindowBindingWithArrayBuffer.pas
+++ b/demos/Delphi_VCL/JavaScript/JSWindowBindingWithArrayBuffer/uJSWindowBindingWithArrayBuffer.pas
@@ -211,7 +211,7 @@ end;
procedure TJSWindowBindingWithArrayBufferFrm.BrowserCreatedMsg(var aMessage : TMessage);
begin
- Caption := 'JSWindowBindingWithObject';
+ Caption := 'JSWindowBindingWithArrayBuffer';
CEFWindowParent1.UpdateSize;
NavControlPnl.Enabled := True;
GoBtn.Click;
diff --git a/demos/Lazarus/JavaScript/JSWindowBindingWithArrayBuffer/JSWindowBindingWithArrayBuffer.lps b/demos/Lazarus/JavaScript/JSWindowBindingWithArrayBuffer/JSWindowBindingWithArrayBuffer.lps
index 7dad1c3f..9d5b79d2 100644
--- a/demos/Lazarus/JavaScript/JSWindowBindingWithArrayBuffer/JSWindowBindingWithArrayBuffer.lps
+++ b/demos/Lazarus/JavaScript/JSWindowBindingWithArrayBuffer/JSWindowBindingWithArrayBuffer.lps
@@ -22,8 +22,8 @@
-
-
+
+
diff --git a/demos/Lazarus/JavaScript/JSWindowBindingWithArrayBuffer/uJSWindowBindingWithArrayBuffer.pas b/demos/Lazarus/JavaScript/JSWindowBindingWithArrayBuffer/uJSWindowBindingWithArrayBuffer.pas
index 447acc6f..f8e2af7b 100644
--- a/demos/Lazarus/JavaScript/JSWindowBindingWithArrayBuffer/uJSWindowBindingWithArrayBuffer.pas
+++ b/demos/Lazarus/JavaScript/JSWindowBindingWithArrayBuffer/uJSWindowBindingWithArrayBuffer.pas
@@ -213,7 +213,7 @@ end;
procedure TJSWindowBindingWithArrayBufferFrm.BrowserCreatedMsg(var aMessage : TMessage);
begin
- Caption := 'JSWindowBindingWithObject';
+ Caption := 'JSWindowBindingWithArrayBuffer';
CEFWindowParent1.UpdateSize;
NavControlPnl.Enabled := True;
GoBtn.Click;
diff --git a/demos/Lazarus/SimpleBrowser/SimpleBrowser.lps b/demos/Lazarus/SimpleBrowser/SimpleBrowser.lps
index 83330504..650bff98 100644
--- a/demos/Lazarus/SimpleBrowser/SimpleBrowser.lps
+++ b/demos/Lazarus/SimpleBrowser/SimpleBrowser.lps
@@ -23,7 +23,7 @@
-
+
diff --git a/source/uCEFApplication.pas b/source/uCEFApplication.pas
index 1ad44dae..810b1b49 100644
--- a/source/uCEFApplication.pas
+++ b/source/uCEFApplication.pas
@@ -822,76 +822,28 @@ end;
procedure TCefApplication.SetCache(const aValue : ustring);
begin
- if (length(aValue) > 0) then
- begin
- if CustomPathIsRelative(aValue) then
- FCache := GetModulePath + aValue
- else
- FCache := aValue;
- end
- else
- FCache := '';
-
+ FCache := CustomAbsolutePath(aValue);
FDisableGPUCache := (length(FCache) = 0);
end;
procedure TCefApplication.SetRootCache(const aValue : ustring);
begin
- if (length(aValue) > 0) then
- begin
- if CustomPathIsRelative(aValue) then
- FRootCache := GetModulePath + aValue
- else
- FRootCache := aValue;
- end
- else
- FRootCache := '';
+ FRootCache := CustomAbsolutePath(aValue);
end;
procedure TCefApplication.SetUserDataPath(const aValue : ustring);
begin
- if (length(aValue) > 0) then
- begin
- if CustomPathIsRelative(aValue) then
- FUserDataPath := GetModulePath + aValue
- else
- FUserDataPath := aValue;
- end
- else
- FUserDataPath := '';
+ FUserDataPath := CustomAbsolutePath(aValue);
end;
procedure TCefApplication.SetBrowserSubprocessPath(const aValue : ustring);
begin
- if (length(aValue) > 0) then
- begin
- if CustomPathIsRelative(aValue) then
- FBrowserSubprocessPath := GetModulePath + aValue
- else
- FBrowserSubprocessPath := aValue;
- end
- else
- FBrowserSubprocessPath := '';
+ FBrowserSubprocessPath := CustomAbsolutePath(aValue);
end;
procedure TCefApplication.SetFrameworkDirPath(const aValue : ustring);
-var
- TempPath : string;
begin
- if (length(aValue) > 0) then
- begin
- if CustomPathIsRelative(aValue) then
- TempPath := GetModulePath + aValue
- else
- TempPath := aValue;
-
- if DirectoryExists(TempPath) then
- FFrameworkDirPath := TempPath
- else
- FFrameworkDirPath := '';
- end
- else
- FFrameworkDirPath := '';
+ FFrameworkDirPath := CustomAbsolutePath(aValue, True);
{$IFDEF MSWINDOWS}
if (FProcessType = ptBrowser) then GetDLLVersion(ChromeElfPath, FChromeVersionInfo);
@@ -899,43 +851,13 @@ begin
end;
procedure TCefApplication.SetResourcesDirPath(const aValue : ustring);
-var
- TempPath : string;
begin
- if (length(aValue) > 0) then
- begin
- if CustomPathIsRelative(aValue) then
- TempPath := GetModulePath + aValue
- else
- TempPath := aValue;
-
- if DirectoryExists(TempPath) then
- FResourcesDirPath := TempPath
- else
- FResourcesDirPath := '';
- end
- else
- FResourcesDirPath := '';
+ FResourcesDirPath := CustomAbsolutePath(aValue, True);
end;
procedure TCefApplication.SetLocalesDirPath(const aValue : ustring);
-var
- TempPath : string;
begin
- if (length(aValue) > 0) then
- begin
- if CustomPathIsRelative(aValue) then
- TempPath := GetModulePath + aValue
- else
- TempPath := aValue;
-
- if DirectoryExists(TempPath) then
- FLocalesDirPath := TempPath
- else
- FLocalesDirPath := '';
- end
- else
- FLocalesDirPath := '';
+ FLocalesDirPath := CustomAbsolutePath(aValue, True);
end;
function TCefApplication.CheckCEFLibrary : boolean;
diff --git a/source/uCEFCompletionCallback.pas b/source/uCEFCompletionCallback.pas
index 86f30273..31ff81a5 100644
--- a/source/uCEFCompletionCallback.pas
+++ b/source/uCEFCompletionCallback.pas
@@ -163,7 +163,7 @@ constructor TCefCustomCompletionCallback.Create(const aEvents : IChromiumEvents)
begin
inherited Create;
- FEvents := aEvents;
+ FEvents := Pointer(aEvents);
end;
destructor TCefCustomCompletionCallback.Destroy;
diff --git a/source/uCEFMiscFunctions.pas b/source/uCEFMiscFunctions.pas
index 98c9824a..1d4214ce 100644
--- a/source/uCEFMiscFunctions.pas
+++ b/source/uCEFMiscFunctions.pas
@@ -123,10 +123,11 @@ procedure WindowInfoAsWindowless(var aWindowInfo : TCefWindowInfo; aParent : TCe
function ProcessUnderWow64(hProcess: THandle; var Wow64Process: BOOL): BOOL; external Kernel32DLL name 'IsWow64Process';
function TzSpecificLocalTimeToSystemTime(lpTimeZoneInformation: PTimeZoneInformation; lpLocalTime, lpUniversalTime: 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 PathIsRelativeUnicode(pszPath: LPCWSTR): BOOL; stdcall; external SHLWAPIDLL name 'PathIsRelativeW';
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}
{$IFDEF WIN64}
@@ -139,6 +140,8 @@ function GetGlobalMemoryStatusEx(var Buffer: TMyMemoryStatusEx): BOOL; stdcall;
{$ENDIF}
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 CefIsCertStatusError(Status : TCefCertStatus) : boolean;
@@ -879,14 +882,8 @@ begin
if (length(aSrcPath) > 0) then
begin
- aRsltPath := IncludeTrailingPathDelimiter(aSrcPath);
-
- if DirectoryExists(aSrcPath) then
- begin
- if CustomPathIsRelative(aRsltPath) then aRsltPath := GetModulePath + aRsltPath;
- end
- else
- Result := False;
+ aRsltPath := IncludeTrailingPathDelimiter(CustomAbsolutePath(aSrcPath));
+ Result := DirectoryExists(aRsltPath);
end
else
aRsltPath := '';
@@ -1010,7 +1007,7 @@ begin
TempList.Add(TempDir + 'cef_100_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 TempExists then
@@ -1422,6 +1419,50 @@ begin
{$ENDIF}
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;
begin
Result := IncludeTrailingPathDelimiter(ExtractFileDir(GetModuleName(HINSTANCE{$IFDEF FPC}(){$ENDIF})));
diff --git a/update_CEF4Delphi.json b/update_CEF4Delphi.json
index e3e2787b..61b21546 100644
--- a/update_CEF4Delphi.json
+++ b/update_CEF4Delphi.json
@@ -2,7 +2,7 @@
"UpdateLazPackages" : [
{
"ForceNotify" : true,
- "InternalVersion" : 30,
+ "InternalVersion" : 31,
"Name" : "cef4delphi_lazarus.lpk",
"Version" : "76.1.13.0"
}