1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-10-14 06:48:18 +02:00

[PM-9876] Safari Passkeys Prompt is Not Triggered (#11471)

This commit is contained in:
Cesar Gonzalez 2024-10-09 08:45:28 -05:00 committed by GitHub
parent f1dab68e46
commit 36c965c453
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -43,23 +43,17 @@ function buildRegisterContentScriptsPolyfill() {
function NestedProxy<T extends object>(target: T): T { function NestedProxy<T extends object>(target: T): T {
return new Proxy(target, { return new Proxy(target, {
get(target, prop) { get(target, prop) {
const propertyValue = target[prop as keyof T]; if (!target[prop as keyof T]) {
if (!propertyValue) {
return; return;
} }
if (typeof propertyValue === "object") { if (typeof target[prop as keyof T] !== "function") {
return NestedProxy<typeof propertyValue>(propertyValue); return NestedProxy(target[prop as keyof T] as object);
}
if (typeof propertyValue !== "function") {
return propertyValue;
} }
return (...arguments_: any[]) => return (...arguments_: any[]) =>
new Promise((resolve, reject) => { new Promise((resolve, reject) => {
propertyValue(...arguments_, (result: any) => { (target[prop as keyof T] as CallableFunction)(...arguments_, (result: any) => {
if (chrome.runtime.lastError) { if (chrome.runtime.lastError) {
reject(new Error(chrome.runtime.lastError.message)); reject(new Error(chrome.runtime.lastError.message));
} else { } else {