mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-16 01:13:08 +09:00
| .. | ||
| bundled-scripts | ||
| components | ||
| defaults/preferences | ||
| internaluserscripts.manifest | ||
| jar.mn | ||
| moz.build | ||
| README.md | ||
Internal Userscripts (Polyfills Only)
This directory contains a minimal, built-in userscript loader used to ship polyfill user scripts with Dactyloidae (forked from Basilisk's implementation of such). This originally started as a fork of GreaseMonkey, however at this point very little of GreaseMonkey remains.
How it works
- The XPCOM component
@internaluserscripts.mozdev.org/service;1observes document creation and, whenbrowser.internal-userscripts.enabledis true, injects bundled polyfill scripts into each page. - Bundled scripts live in
basilisk/internaluserscripts/bundled-scripts/and are packaged into the app. They are loaded in the page principal and can override missing APIs. - The only default pref is
browser.internal-userscripts.enabled(default: true). Toggle to disable all injection.
Bundled polyfills
elementfrompoint-finite-polyfill.user.js: wrapsDocument.elementFromPoint()andDocument.elementsFromPoint()to returnnull/[]when coordinates are not finite, avoiding page-breakingTypeErrors from non-finite inputs. It exposeswindow.__internalUserscriptsElementFromPointFinitePolyfill = truefor verification.getanimations-polyfill.user.js: minimalgetAnimations()shim forDocument,Element, andCSSPseudoElementthat returns an empty array when native support is unavailable. It exposeswindow.__internalUserscriptsGetAnimationsPolyfill = truefor verification.imagedecode-polyfill.user.js: best-effortHTMLImageElement.decode()shim that resolves on load and rejects on error. It exposeswindow.__internalUserscriptsImageDecodePolyfill = truefor verification.intl-displaynames-polyfill.user.js: minimal Intl.DisplayNames shim that validates options and returns the input code when display data is unavailable. It exposeswindow.__internalUserscriptsIntlDisplayNamesPolyfill = truefor verification.intl-listformat-polyfill.user.js: minimal Intl.ListFormat shim supportingformat()andformatToParts()with simple fallback separators. It exposeswindow.__internalUserscriptsIntlListFormatPolyfill = truefor verification.intl-relativetimeformat-formattoparts-polyfill.user.js: addsformatToParts()to native Intl.RelativeTimeFormat implementations that lack it. It exposeswindow.__internalUserscriptsIntlRelativeTimeFormatFormatToPartsPolyfill = truefor verification.intl-segmenter-polyfill.user.js: minimal Intl.Segmenter shim supportingsegment(),resolvedOptions(), andsupportedLocalesOf()with best-effort grapheme/word/sentence segmentation. It exposeswindow.__internalUserscriptsIntlSegmenterPolyfill = truefor verification.readablestream-pipethrough-polyfill.user.js: best-effort ReadableStreampipeThroughimplementation backed bypipeToor reader/writer pumping. It exposeswindow.__internalUserscriptsReadableStreamPipeThroughPolyfill = truefor verification.readablestream-pipeto-polyfill.user.js: best-effort ReadableStreampipeToimplementation using reader/writer pumping. It exposeswindow.__internalUserscriptsReadableStreamPipeToPolyfill = truefor verification.textencoderstream-polyfill.user.js: best-effort TextEncoderStream implementation backed by TransformStream. It exposeswindow.__internalUserscriptsTextEncoderStreamPolyfill = truefor verification.textdecoderstream-polyfill.user.js: best-effort TextDecoderStream implementation backed by TransformStream. It exposeswindow.__internalUserscriptsTextDecoderStreamPolyfill = truefor verification.transformstream-polyfill.user.js: minimal TransformStream polyfill backed by ReadableStream with a lightweight WritableStream shim. It exposeswindow.__internalUserscriptsTransformStreamPolyfill = truefor verification.webauthn-microsoft-shim.user.js: Microsoft-domain WebAuthn capability shim that reports WebAuthn as unsupported by providing rejectingnavigator.credentials.create/getstubs (whennavigator.credentialsis missing) and aPublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()fallback that resolvesfalse. It exposeswindow.__internalUserscriptsWebAuthnMicrosoftShim = truefor verification.
Adding new polyfills
- Drop a
*.user.jsfile intobundled-scripts/with the appropriate header. - List it in
moz.buildunderFINAL_TARGET_FILES['internal-userscripts']. - The loader will inject it automatically when enabled.