@absolutejs/beacon 0.6.29 → 0.6.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +12 -3
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1998,6 +1998,12 @@ var createBeacon = (options) => {
|
|
|
1998
1998
|
}
|
|
1999
1999
|
return visible;
|
|
2000
2000
|
};
|
|
2001
|
+
const isExtensionOwnedCover = (element) => {
|
|
2002
|
+
if (element.tagName !== "IFRAME")
|
|
2003
|
+
return false;
|
|
2004
|
+
const source = element.getAttribute("src")?.trim().toLowerCase() ?? "";
|
|
2005
|
+
return source.startsWith("chrome-extension:") || source.startsWith("moz-extension:") || source.startsWith("safari-web-extension:");
|
|
2006
|
+
};
|
|
2001
2007
|
const scanForOcclusion = () => {
|
|
2002
2008
|
if (typeof document.elementFromPoint !== "function")
|
|
2003
2009
|
return;
|
|
@@ -2020,7 +2026,7 @@ var createBeacon = (options) => {
|
|
|
2020
2026
|
continue;
|
|
2021
2027
|
sampled += 1;
|
|
2022
2028
|
const top = document.elementFromPoint((visibleRect.left + visibleRect.right) / 2, (visibleRect.top + visibleRect.bottom) / 2);
|
|
2023
|
-
if (top === null || top === control || control.contains(top) || top.contains(control)) {
|
|
2029
|
+
if (top === null || top === control || control.contains(top) || top.contains(control) || isExtensionOwnedCover(top)) {
|
|
2024
2030
|
continue;
|
|
2025
2031
|
}
|
|
2026
2032
|
const topRect = top.getBoundingClientRect();
|
|
@@ -3590,12 +3596,15 @@ var createBeacon = (options) => {
|
|
|
3590
3596
|
registration.addEventListener("updatefound", onUpdateFound);
|
|
3591
3597
|
serviceWorkerListenerCleanups.push(() => registration.removeEventListener("updatefound", onUpdateFound));
|
|
3592
3598
|
};
|
|
3599
|
+
const isServiceWorkerRegistration = (registration) => typeof registration === "object" && registration !== null && ("installing" in registration) && typeof registration.addEventListener === "function";
|
|
3593
3600
|
const originalRegister = container.register;
|
|
3594
3601
|
const wrappedRegister = async function(scriptURL, registrationOptions) {
|
|
3595
3602
|
const endpointLabel = shortUrl(String(scriptURL));
|
|
3596
3603
|
try {
|
|
3597
3604
|
const registration = await originalRegister.call(this, scriptURL, registrationOptions);
|
|
3598
|
-
|
|
3605
|
+
if (isServiceWorkerRegistration(registration)) {
|
|
3606
|
+
watchRegistration(registration);
|
|
3607
|
+
}
|
|
3599
3608
|
return registration;
|
|
3600
3609
|
} catch (error) {
|
|
3601
3610
|
reportServiceWorkerFailure(endpointLabel, "registration", toError(error));
|
|
@@ -3945,5 +3954,5 @@ export {
|
|
|
3945
3954
|
BEACON_ATTRIBUTE
|
|
3946
3955
|
};
|
|
3947
3956
|
|
|
3948
|
-
//# debugId=
|
|
3957
|
+
//# debugId=04B2D89C632EBE5464756E2164756E21
|
|
3949
3958
|
//# sourceMappingURL=index.js.map
|