Don't attempt to access permissions.request if no such method exists

The font database on WASM attempts to call navigator.permissions.request
which might not exist on certain browsers. Check for undefined before
calling.

Change-Id: I079c8a127339cf6b83bc3f9c3106c752226e5d84
Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
This commit is contained in:
Mikolaj Boc 2022-09-01 13:59:32 +02:00
parent 9b6e79abbe
commit ff92c4c3d8

View File

@ -58,9 +58,9 @@ void QWasmFontDatabase::populateFontDatabase()
if (fonts.isUndefined())
return;
val navigator = val::global("navigator");
val permissions = navigator["permissions"];
val permissions = val::global("navigator")["permissions"];
if (permissions["request"].isUndefined())
return;
val requestLocalFontsPermission = val::object();
requestLocalFontsPermission.set("name", std::string("local-fonts"));