mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-04 23:31:28 +01:00
[PM-8869] Autofill features broken on Safari
This commit is contained in:
parent
2333059885
commit
2e2061e34a
@ -21,6 +21,7 @@ import {
|
|||||||
nodeIsFormElement,
|
nodeIsFormElement,
|
||||||
nodeIsInputElement,
|
nodeIsInputElement,
|
||||||
sendExtensionMessage,
|
sendExtensionMessage,
|
||||||
|
requestIdleCallbackPolyfill,
|
||||||
} from "../utils";
|
} from "../utils";
|
||||||
|
|
||||||
import { AutofillOverlayContentService } from "./abstractions/autofill-overlay-content.service";
|
import { AutofillOverlayContentService } from "./abstractions/autofill-overlay-content.service";
|
||||||
@ -1057,7 +1058,7 @@ class CollectAutofillContentService implements CollectAutofillContentServiceInte
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!this.mutationsQueue.length) {
|
if (!this.mutationsQueue.length) {
|
||||||
globalThis.requestIdleCallback(this.processMutations, { timeout: 500 });
|
requestIdleCallbackPolyfill(this.processMutations, { timeout: 500 });
|
||||||
}
|
}
|
||||||
this.mutationsQueue.push(mutations);
|
this.mutationsQueue.push(mutations);
|
||||||
};
|
};
|
||||||
@ -1194,7 +1195,7 @@ class CollectAutofillContentService implements CollectAutofillContentServiceInte
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
globalThis.requestIdleCallback(
|
requestIdleCallbackPolyfill(
|
||||||
// We are setting this item to a -1 index because we do not know its position in the DOM.
|
// We are setting this item to a -1 index because we do not know its position in the DOM.
|
||||||
// This value should be updated with the next call to collect page details.
|
// This value should be updated with the next call to collect page details.
|
||||||
() => void this.buildAutofillFieldItem(node as ElementWithOpId<FormFieldElement>, -1),
|
() => void this.buildAutofillFieldItem(node as ElementWithOpId<FormFieldElement>, -1),
|
||||||
|
@ -1,6 +1,14 @@
|
|||||||
import { AutofillPort } from "../enums/autofill-port.enums";
|
import { AutofillPort } from "../enums/autofill-port.enums";
|
||||||
import { FillableFormFieldElement, FormFieldElement } from "../types";
|
import { FillableFormFieldElement, FormFieldElement } from "../types";
|
||||||
|
|
||||||
|
export function requestIdleCallbackPolyfill(callback: () => void, options?: Record<string, any>) {
|
||||||
|
if ("requestIdleCallback" in globalThis) {
|
||||||
|
return globalThis.requestIdleCallback(() => callback(), options);
|
||||||
|
}
|
||||||
|
|
||||||
|
return globalThis.setTimeout(() => callback(), 1);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates a random string of characters that formatted as a custom element name.
|
* Generates a random string of characters that formatted as a custom element name.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user