From 2dbc996ec1e2bc958939a6506872798e9f657e49 Mon Sep 17 00:00:00 2001 From: AnnAngela Date: Mon, 22 Jan 2024 10:21:42 +0800 Subject: [PATCH 01/16] =?UTF-8?q?chore:=20=E6=B5=8F=E8=A7=88=E5=99=A8?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E7=89=88=E6=9C=AC=E6=94=B9=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QQ 浏览器升到94了,所以同步到萌皮的 86 就够用了 --- .browserslistrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.browserslistrc b/.browserslistrc index 3984fc11..2a6839b4 100644 --- a/.browserslistrc +++ b/.browserslistrc @@ -1 +1 @@ -defaults, Chrome >= 70 \ No newline at end of file +defaults, Chrome >= 86 From b3471047868c3a45d129845b854b5c630265f498 Mon Sep 17 00:00:00 2001 From: AnnAngela Date: Mon, 22 Jan 2024 17:46:56 +0800 Subject: [PATCH 02/16] =?UTF-8?q?feat:=20=E5=88=9D=E8=A7=81=E6=96=B0=20pol?= =?UTF-8?q?yfill?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitattributes | 4 +- .github/workflows/generatePolyfill.yaml | 88 + .github/workflows/postCommit.yaml | 3 +- eslint.config.js | 7 +- scripts/generatePolyfill/config.yaml | 15 + scripts/generatePolyfill/index.js | 277 +- scripts/generatePolyfill/template.js | 32 - .../unrecognizableFeatures.json | 2425 ----------------- src/gadgets/libPolyfill/.eslintrc.yaml | 2 - 9 files changed, 220 insertions(+), 2633 deletions(-) create mode 100644 .github/workflows/generatePolyfill.yaml create mode 100644 scripts/generatePolyfill/config.yaml delete mode 100644 scripts/generatePolyfill/template.js delete mode 100644 scripts/generatePolyfill/unrecognizableFeatures.json delete mode 100644 src/gadgets/libPolyfill/.eslintrc.yaml diff --git a/.gitattributes b/.gitattributes index 9cb2a2a1..47e7deac 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4,9 +4,7 @@ src/**/*.json linguist-generated=false src/*.json linguist-generated=false src/**/*.yaml linguist-generated=false src/*.yaml linguist-generated=false - -# From generatePolyfill -src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill.js linguist-generated=true +src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill.*.js linguist-generated=true # From ganerateCommitsHistory src/global/zh/MediaWiki:GHIAHistory.json linguist-generated=true diff --git a/.github/workflows/generatePolyfill.yaml b/.github/workflows/generatePolyfill.yaml new file mode 100644 index 00000000..f8685479 --- /dev/null +++ b/.github/workflows/generatePolyfill.yaml @@ -0,0 +1,88 @@ +name: Generate Polyfill + +on: + push: + paths: + - scripts/generatePolyfill/config.yaml + - scripts/generatePolyfill/index.js + merge_group: + pull_request: + paths: + - scripts/generatePolyfill/config.yaml + - scripts/generatePolyfill/index.js + workflow_dispatch: + schedule: + - cron: 0 23 * * 0 # Every 07:00 CST Mon + +concurrency: + group: ${{ github.workflow_ref }}-${{ github.ref }} + +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +permissions: + actions: read + checks: read + contents: write + deployments: read + issues: write + discussions: read + packages: read + pages: read + pull-requests: read + repository-projects: read + security-events: write + statuses: write + +jobs: + generatePolyfill: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + name: Checkout main repo + with: + fetch-depth: 0 + show-progress: false + - name: Get toe polyfill config + id: polyfillConfig + run: | + echo "TARGET_POLYFILL_VERSION=$(yq '.TARGET_POLYFILL_VERSION' scripts/generatePolyfill/config.yaml)" >> $GITHUB_OUTPUT + cat $GITHUB_OUTPUT + - uses: actions/checkout@v4 + name: Checkout polyfill.io + with: + show-progress: false + repository: JakeChampion/polyfill-service + path: polyfill-service + sparse-checkout: | + polyfill-libraries/${{ steps.polyfillConfig.outputs.TARGET_POLYFILL_VERSION }}/ + polyfill-libraries/${{ steps.polyfillConfig.outputs.TARGET_POLYFILL_VERSION }}.json + sparse-checkout-cone-mode: false + - name: Move polyfill.io + id: polyfill + run: | + POLYFILL_PATH="${{ runner.temp }}/$(uuidgen)" + echo "POLYFILL_PATH=$POLYFILL_PATH" >> $GITHUB_OUTPUT + cat $GITHUB_OUTPUT + mv polyfill-service/polyfill-libraries/${{ steps.polyfillConfig.outputs.TARGET_POLYFILL_VERSION }}.json $POLYFILL_PATH/main.json + mv polyfill-service/polyfill-libraries/${{ steps.polyfillConfig.outputs.TARGET_POLYFILL_VERSION }}/ $POLYFILL_PATH/library + rm -rf polyfill-service + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: lts/* + check-latest: true + cache: npm + - name: Installing the dependencies + uses: AnnAngela/cached_node-modules@v2 + with: + command: npm run ci + - name: Git config + run: node scripts/postCommit/prepareGit.js + - name: Gadget-polyfill generator + run: node scripts/generatePolyfill/index.js + env: + POLYFILL_PATH: ${{ steps.polyfill.outputs.POLYFILL_PATH }} + - name: Show git status & push + id: output + run: node scripts/postCommit/push.js diff --git a/.github/workflows/postCommit.yaml b/.github/workflows/postCommit.yaml index 62b2ee13..ef2663db 100644 --- a/.github/workflows/postCommit.yaml +++ b/.github/workflows/postCommit.yaml @@ -92,6 +92,7 @@ jobs: if: always() && needs.skipCI.result == 'success' && needs.skipCI.outputs.skip != 'true' steps: - uses: actions/checkout@v4 + name: Checkout main repo with: fetch-depth: 0 show-progress: false @@ -113,8 +114,6 @@ jobs: run: node scripts/browserify/index.js - name: Auto prefetch run: node scripts/prefetch/index.js - - name: Gadget-polyfill generator - run: node scripts/generatePolyfill/index.js - name: Gadgets-definition Generator run: node scripts/generateGadgetsDefinition/index.js - name: Conventional Commits scopes generator diff --git a/eslint.config.js b/eslint.config.js index ba633db9..28fd66a1 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -11,6 +11,7 @@ const ignores = [ "**/dist/**", "**/.*/**", "node_modules", + "src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill.*.js", ]; const srcESlintrcFiles = (await readDir("./src")).filter((n) => path.basename(n) === ".eslintrc.yaml"); @@ -34,7 +35,6 @@ const fileSpec = { browser: { files: [ "src/**/*", - "scripts/generatePolyfill/template.js", ], ignores, }, @@ -43,10 +43,7 @@ const fileSpec = { "scripts/**/*", "eslint.config.js", ], - ignores: [ - ...ignores, - "scripts/generatePolyfill/template.js", - ], + ignores, }, }; diff --git a/scripts/generatePolyfill/config.yaml b/scripts/generatePolyfill/config.yaml new file mode 100644 index 00000000..d7e310d2 --- /dev/null +++ b/scripts/generatePolyfill/config.yaml @@ -0,0 +1,15 @@ +TARGET_CHROMIUM_VERSION: 86 + +TARGET_POLYFILL_VERSION: 3.111.0 + +TARGET_ALIASES: + - default + - dom4 + - es2015 + - es2016 + - es2017 + - es2018 + - es2019 + - es2020 + - es2021 + - es2022 diff --git a/scripts/generatePolyfill/index.js b/scripts/generatePolyfill/index.js index 8fcaa443..507d06c2 100644 --- a/scripts/generatePolyfill/index.js +++ b/scripts/generatePolyfill/index.js @@ -1,30 +1,44 @@ import console from "../modules/console.js"; console.info("Initialization done."); -import exec from "../modules/exec.js"; -import mkdtmp from "../modules/mkdtmp.js"; -import createCommit from "../modules/createCommit.js"; -import fs from "fs"; -import path from "path"; +import fs from "node:fs"; +import path from "node:path"; +import semver from "semver"; import jsonModule from "../modules/jsonModule.js"; import yamlModule from "../modules/yamlModule.js"; -import { exportVariable, startGroup, endGroup } from "@actions/core"; -import { createIssue, isInGithubActions } from "../modules/octokit.js"; -import artifactClient from "../modules/artifact.js"; +import { startGroup, endGroup } from "@actions/core"; -exportVariable("linguist-generated-generatePolyfill", JSON.stringify(["src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill.js"])); +const polyfillGadgetDefinitionPath = "src/gadgets/libPolyfill/definition.yaml"; +const polyfillGadgetDefinition = await yamlModule.readFile(polyfillGadgetDefinitionPath); +const getPolyfillGadgetFiles = async () => (await fs.promises.readdir("src/gadgets/libPolyfill/")).filter((file) => file.startsWith("MediaWiki:Gadget-libPolyfill") && file.endsWith(".js")); -const unrecognizableFeatures = await jsonModule.readFile("scripts/generatePolyfill/unrecognizableFeatures.json"); +/** + * @type { { TARGET_CHROMIUM_VERSION: string | number, TARGET_ALIASES: string[] } } + */ +const { TARGET_CHROMIUM_VERSION, TARGET_ALIASES } = await yamlModule.readFile("./scripts/generatePolyfill/config.yaml"); -const TARGET_CHROMIUM_VERSION = "70.0.3538.0"; -const TARGET_UA = `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${TARGET_CHROMIUM_VERSION} Safari/537.36`; -const labels = ["ci:generatePolyfill"]; +const TARGET_VERSION = `${TARGET_CHROMIUM_VERSION}.0.0`; +const { POLYFILL_PATH } = process.env; -// const findPolyfillFiles = async () => (await fs.promises.readdir("src/gadgets/libPolyfill/")).filter((file) => file.startsWith("MediaWiki:Gadget-libPolyfill")); -const polyfillFiles = ["MediaWiki:Gadget-libPolyfill.js"]; +if (!POLYFILL_PATH) { + throw new Error("No POLYFILL_PATH env variable."); +} + +startGroup("Config:"); +console.info("TARGET_CHROMIUM_VERSION:", TARGET_CHROMIUM_VERSION); +console.info("TARGET_ALIASES:", TARGET_ALIASES); +console.info("TARGET_VERSION:", TARGET_VERSION); +console.info("POLYFILL_PATH:", POLYFILL_PATH); +endGroup(); + +const polyfillGadgetFiles = await getPolyfillGadgetFiles(); +const polyfillMainJSONPath = path.join(POLYFILL_PATH, "main.json"); +const polyfillLibraryPath = path.join(POLYFILL_PATH, "library"); console.info("Start to delete old polyfill files:"); -const tempPath = await mkdtmp(); -for (const file of polyfillFiles) { +for (const file of polyfillGadgetFiles) { + if (file.startsWith("MediaWiki:Gadget-libPolyfill-")) { + continue; + } console.info("\tDeleteting", file); await fs.promises.rm(path.join("src/gadgets/libPolyfill/", file), { force: true, @@ -32,157 +46,92 @@ for (const file of polyfillFiles) { }); console.info("\tDeleteting", file, "done."); } -console.info("Start to compile src/ to temporary bundle file..."); -const bundlePath = path.join(tempPath, "bundle.js"); -console.log("bundlePath:", bundlePath); -await exec(`npx tsc --project tsconfig.production.json --outFile ${bundlePath}`); -console.info("\tDone."); -console.info("Start to analyse the temporary bundle file..."); -const analysisReport = [...new Set(JSON.parse(await exec(`npx @financial-times/js-features-analyser analyse --file ${path.relative(".", bundlePath)}`)))].sort(); -const features = analysisReport.filter((feature) => !unrecognizableFeatures.includes(feature)); -console.info("\tDone."); -console.info("\tfeatures:"); -startGroup("features:"); -console.info(JSON.stringify(features, null, 4)); -endGroup(); -const newUnrecognizableFeatures = []; -console.info("Start to download polyfill file..."); -const url = new URL("https://polyfill.io/v3/polyfill.js"); -url.searchParams.set("features", features.join(",")); -url.searchParams.set("ua", TARGET_UA); -const dataResponse = await fetch(url, { - method: "GET", - headers: { - "user-agent": TARGET_UA, - }, -}); -const data = await dataResponse.text(); -const codeFilePath = path.join(tempPath, "polyfillGeneratedCode.js"); -await fs.promises.writeFile(codeFilePath, data, { - encoding: "utf-8", -}); -console.info("\tDone, upload it as a artifact..."); -if (isInGithubActions) { - await artifactClient.uploadArtifact("polyfillGeneratedCode.js", [codeFilePath], tempPath); -} -console.info("\tDone."); -console.info("Start to find unrecognizable features..."); -let hasUnparsableUnrecognizableFeatures = false; -if (data.includes("These features were not recognised")) { - const match = data.match(/(?<=\n \* These features were not recognised:\n \* - )[^\n]+?(?=\s*\*\/)/)?.[0]?.split?.(/,-\s*/); - if (Array.isArray(match)) { - newUnrecognizableFeatures.push(...match); - } else { - hasUnparsableUnrecognizableFeatures = true; - } -} +console.info("Start to read polyfill JSON..."); +const polyfillMainJSONArray = Object.entries(await jsonModule.readFile(polyfillMainJSONPath)).map(([id, v]) => ({ + id, + ...JSON.parse(v), +})); +const polyfillMainJSON = Object.fromEntries(polyfillMainJSONArray.map((v) => [v.id, v])); +console.info("Get", polyfillMainJSONArray.length, "polyfill entries."); +const polyfillList = polyfillMainJSONArray.filter(({ aliases }) => Array.isArray(aliases) && TARGET_ALIASES.some((targetAliases) => aliases.includes(targetAliases))); +console.info("Get", polyfillList.length, "polyfill entries with aliases."); +const polyfillListAllowed = polyfillList.filter(({ browsers }) => browsers?.chrome && semver.satisfies(TARGET_VERSION, browsers?.chrome)); +console.info("Get", polyfillListAllowed.length, "polyfill entries with aliases and target browsers."); -if (newUnrecognizableFeatures.length === 0 && !hasUnparsableUnrecognizableFeatures) { - console.info("\tNone, done."); -} else { - if (newUnrecognizableFeatures.length > 0) { - console.info("New unrecognizable features found:", newUnrecognizableFeatures); - await createIssue( - "[generatePolyfill] New unrecognizable features detected from polyfill.io", - "These new unrecognizable features detected from polyfill.io:", - labels, - `newUnrecognizableFeatures:\n\`\`\`json\n${JSON.stringify(newUnrecognizableFeatures, null, 4)}\n\`\`\``, - ); +const readPolyfillRawJS = async (dir) => { + console.info("\t[readPolyfillRawJS]", "Testing", dir); + if (await fs.promises.access(dir).then(() => true).catch(() => false)) { + console.info("\t[readPolyfillRawJS]", dir, "exist, reading raw js."); + return (await fs.promises.readFile(path.join(dir, "raw.js"), { encoding: "utf-8" })).split("\n"); } - if (hasUnparsableUnrecognizableFeatures) { - console.info("New unparsable unrecognizable features found."); - await createIssue( - "[generatePolyfill] New unparsable unrecognizable features detected from polyfill.io", - "Found new unparsable unrecognizable features detected from polyfill.io, please check it manually.", - labels, - ); + console.info("\t[readPolyfillRawJS]", dir, "not exist, return false."); + return false; +}; +const polyfillAlreadyInjected = {}; +const getPolyfillContent = async (polyfill, _rootPolyfillID = false) => { + const rootPolyfillID = _rootPolyfillID || polyfill.id; + if (!Array.isArray(polyfillAlreadyInjected[rootPolyfillID])) { + polyfillAlreadyInjected[rootPolyfillID] = []; } -} -console.info("Start to write polyfill file to gadget-libPolyfill ..."); -const flaggableFeatures = features.filter((feature) => !newUnrecognizableFeatures.includes(feature)); -const code = `${await fs.promises.readFile("scripts/generatePolyfill/template.js")}`.replace("$$$TARGET_CHROMIUM_VERSION$$$", TARGET_CHROMIUM_VERSION).replace("$$$TARGET_UA$$$", TARGET_UA).replace("$$$FLAGGABLE_FEATURES$$$", JSON.stringify(flaggableFeatures, null, 1).replace(/\n */g, " ")).replace("$$$FEATURES$$$", flaggableFeatures.join(",")); -await fs.promises.writeFile("src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill.js", code); -console.info("\tDone."); -console.info("Start to generate .eslintrc.yaml ..."); -const eslintrc = await yamlModule.readFile("src/gadgets/libPolyfill/.eslintrc.yaml").catch(() => ({})); -eslintrc.ignorePatterns = polyfillFiles; -console.info("New .eslintrc.yaml:", eslintrc); -await yamlModule.writeFile("src/gadgets/libPolyfill/.eslintrc.yaml", eslintrc); -await createCommit("auto(Gadget-libPolyfill): new polyfill generated by generatePolyfill"); -console.info("Done."); -console.info("Start to test the generated url..."); -const generatedUrl = code.match(/(?<=script.src = ")[^"]+/)?.[0]; -if (typeof generatedUrl !== "string") { - await createIssue( - "[generatePolyfill] Unable to retrieve the generated url", - "Unable to retrieve the generated url via `/(?<=script.src = \")[^\"]+/`, please check [`src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill.js`](src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill.js)", - labels, - ); - process.exit(0); -} -console.info("generatedUrl:"); -startGroup("generatedUrl:"); -console.info(generatedUrl); -endGroup(); -const polyfillIOUrl = new URL(generatedUrl); -polyfillIOUrl.hostname = "polyfill.io"; -console.info("polyfillIOUrl:"); -startGroup("polyfillIOUrl:"); -console.info(polyfillIOUrl); -endGroup(); -/** - * @type {(Response | TypeError)[]} - */ -const [generatedUrlResponse, polyfillIOUrlResponse] = await Promise.all([ - ["generatedUrl", generatedUrl], - ["polyfillIOUrl", polyfillIOUrl], -].map(([type, url]) => fetch(url, { - method: "HEAD", - headers: { - "user-agent": TARGET_UA, - }, -}).catch((e) => { - console.error("Unable to fetch", type, ":", e); - return e; -}))); -if (generatedUrlResponse instanceof TypeError && polyfillIOUrlResponse instanceof TypeError) { - console.error("Both generatedUrl and polyfillIOUrl is not able to be fetched!"); - await createIssue( - "[generatePolyfill] Unable to fetch the generated url", - `Unable to fetch the generated url \`${generatedUrl}\` and polyfill.io's one, please check it manually.`, - labels, - `Reason:\n* generatedUrl: ${generatedUrlResponse.name} - ${generatedUrlResponse.message}\n* polyfillIOUrl: ${polyfillIOUrlResponse.name} - ${polyfillIOUrlResponse.message}`, - ); - process.exit(0); -} -if (generatedUrlResponse?.status >= 400 && polyfillIOUrlResponse?.status >= 400) { - console.error("Unable to fetch generatedUrl: network failed -", generatedUrlResponse.status, generatedUrlResponse.statusText); - console.error("Unable to fetch polyfillIOUrl: network failed -", polyfillIOUrlResponse.status, polyfillIOUrlResponse.statusText); - await createIssue( - "[generatePolyfill] Unable to fetch the generated url", - `Unable to fetch the generated url \`${generatedUrl}\` and polyfill.io's one, please check it manually.`, - labels, - `Status:\n* generatedUrl: ${generatedUrlResponse.status} - ${generatedUrlResponse.statusText}\n* polyfillIOUrl: ${polyfillIOUrlResponse.status} - ${polyfillIOUrlResponse.statusText}`, - ); - process.exit(0); -} -console.info("Success:"); -/** - * @type {[string, Response | TypeError][]} - */ -const results = [ - ["generatedUrl", generatedUrlResponse], - ["polyfillIOUrl", polyfillIOUrlResponse], -]; -for (const [type, response] of results) { - const msg = []; - if (response instanceof TypeError) { - msg.push("network failed -", response.name, response.message); - } else if (response.status >= 400) { - msg.push("backend failed -", response.status, response.statusText); + if (polyfillAlreadyInjected[rootPolyfillID].includes(polyfill.id)) { + console.info("\t[getPolyfillContent]", `[${polyfill.id}@${rootPolyfillID}]`, "Already injected, skip."); + return []; + } + polyfillAlreadyInjected[rootPolyfillID].push(polyfill.id); + console.info("\t[getPolyfillContent]", `[${polyfill.id}@${rootPolyfillID}]`, "Processing", polyfill.id); + const content = []; + const detectSource = polyfill.detectSource?.trim(); + console.info("\t[getPolyfillContent]", `[${polyfill.id}@${rootPolyfillID}]`, "detectSource:", detectSource); + if (detectSource) { + content.push(`if (!(${detectSource})) {`); + } + console.info("\t[getPolyfillContent]", `[${polyfill.id}@${rootPolyfillID}]`, "dependencies:", polyfill.dependencies); + if (Array.isArray(polyfill.dependencies)) { + for (const dependency of polyfill.dependencies) { + content.push(...await getPolyfillContent(polyfillMainJSON[dependency], rootPolyfillID)); + } + } + const polyfillRawJSFromBaseDir = await readPolyfillRawJS(path.join(polyfillLibraryPath, polyfill.baseDir)); + if (Array.isArray(polyfillRawJSFromBaseDir)) { + console.info("\t[getPolyfillContent]", `[${polyfill.id}@${rootPolyfillID}]`, "polyfillRawJSFromBaseDir exist."); + content.push(...polyfillRawJSFromBaseDir); } else { - msg.push("success -", response.status, response.statusText, "Content-Length:", response.headers.get("content-length")); + const polyfillRawJSFromID = await readPolyfillRawJS(path.join(polyfillLibraryPath, polyfill.id)); + if (Array.isArray(polyfillRawJSFromID)) { + console.info("\t[getPolyfillContent]", `[${polyfill.id}@${rootPolyfillID}]`, "polyfillRawJSFromID exist."); + content.push(...polyfillRawJSFromID); + } else { + throw new Error(`No raw.js found in ${path.join(polyfillLibraryPath, polyfill.baseDir)} or ${path.join(polyfillLibraryPath, polyfill.id)}`); + } + } + if (detectSource) { + content.push("}"); } - console.info(`\t${type}`, ...msg); + console.info("\t[getPolyfillContent]", `[${polyfill.id}@${rootPolyfillID}]`, "Done."); + return content; +}; +for (const polyfill of polyfillListAllowed) { + startGroup(`Parsing polyfill: ${polyfill.id}`); + const content = [ + "\"use strict\";", + "/**", + " * Generated by scripts/generatePolyfill/index.js", + " * Options:", + ` * polyfillFeature: ${polyfill.id}`, + ` * polyfillAliases: ${Array.isArray(polyfill.aliases) ? polyfill.aliases.join(", ") : null}`, + ` * targetChromiumVersion: ${TARGET_VERSION}`, + ` * polyfillVersionRange: ${polyfill.browsers?.chrome ? `${semver.validRange(polyfill.browsers.chrome)} (${polyfill.browsers.chrome})` : null}`, + " */", + "(() => {", + ...await getPolyfillContent(polyfill), + "})();", + ]; + const gadgetFilePath = path.join("src/gadgets/libPolyfill/", `MediaWiki:Gadget-libPolyfill.${polyfill.id}.js`); + console.info("Start to write polyfill file:", polyfill.id, "@", gadgetFilePath); + await fs.promises.writeFile(gadgetFilePath, content.join("\n")); + console.info("Done."); + endGroup(); } +polyfillGadgetDefinition._files = await getPolyfillGadgetFiles(); +await yamlModule.writeFile(polyfillGadgetDefinitionPath, polyfillGadgetDefinition); console.info("Done."); diff --git a/scripts/generatePolyfill/template.js b/scripts/generatePolyfill/template.js deleted file mode 100644 index 5ca3f0e6..00000000 --- a/scripts/generatePolyfill/template.js +++ /dev/null @@ -1,32 +0,0 @@ -"use strict"; -/** - * Generated by scripts/generatePolyfill/index.js - * Options: - * targetChromiumVersion: "$$$TARGET_CHROMIUM_VERSION$$$" - * targetUA: "$$$TARGET_UA$$$" - * unrecognizableFeaturesFeatures: "scripts/generatePolyfill/unrecognizableFeatures.json" - * flaggableFeatures: $$$FLAGGABLE_FEATURES$$$ - */ -(() => { - const script = document.createElement("script"); - const url = new URL("https://polyfill.alicdn.com/v3/polyfill.js"); - url.searchParams.set("features", "$$$FEATURES$$$"); - url.searchParams.set("_", btoa(navigator.userAgent)); - script.src = url.toString(); - script.async = false; - const polyfillPromise = new Promise((res) => { - script.addEventListener("load", () => res(), { - once: true, - }); - script.addEventListener("error", () => res(), { - once: true, - }); - }); - Reflect.defineProperty(window, "polyfillPromise", { - configurable: false, - enumerable: true, - writable: false, - value: polyfillPromise, - }); - document.head.appendChild(script); -})(); diff --git a/scripts/generatePolyfill/unrecognizableFeatures.json b/scripts/generatePolyfill/unrecognizableFeatures.json deleted file mode 100644 index 2fa3e6ab..00000000 --- a/scripts/generatePolyfill/unrecognizableFeatures.json +++ /dev/null @@ -1,2425 +0,0 @@ -[ - "AbortController.prototype.abort", - "AbortController.prototype.constructor", - "AbortSignal.prototype.aborted", - "AbortSignal.prototype.constructor", - "AbsoluteOrientationSensor.prototype.constructor", - "Accelerometer.prototype.constructor", - "Accelerometer.prototype.x", - "Accelerometer.prototype.y", - "AnalyserNode.prototype.constructor", - "Animation.prototype.cancel", - "Animation.prototype.constructor", - "Animation.prototype.finish", - "Animation.prototype.id", - "Animation.prototype.reverse", - "AnimationEffect.prototype.constructor", - "AnimationEvent.prototype.constructor", - "ApplicationCache.prototype.abort", - "ApplicationCache.prototype.constructor", - "ApplicationCache.prototype.status", - "ApplicationCache.prototype.update", - "ApplicationCacheErrorEvent.prototype.constructor", - "ApplicationCacheErrorEvent.prototype.message", - "ApplicationCacheErrorEvent.prototype.reason", - "ApplicationCacheErrorEvent.prototype.status", - "ApplicationCacheErrorEvent.prototype.url", - "Array", - "Array.prototype", - "Array.prototype.concat", - "Array.prototype.constructor", - "Array.prototype.join", - "Array.prototype.length", - "Array.prototype.pop", - "Array.prototype.push", - "Array.prototype.reverse", - "Array.prototype.shift", - "Array.prototype.slice", - "Array.prototype.splice", - "Array.prototype.toLocaleString", - "Array.prototype.toString", - "Array.prototype.unshift", - "ArrayBuffer.prototype.byteLength", - "ArrayBuffer.prototype.constructor", - "ArrayBuffer.prototype.slice", - "Attr.prototype.constructor", - "Attr.prototype.name", - "Attr.prototype.prefix", - "Attr.prototype.value", - "Audio.prototype.constructor", - "AudioBuffer.prototype.constructor", - "AudioBuffer.prototype.duration", - "AudioBuffer.prototype.length", - "AudioBufferSourceNode.prototype.buffer", - "AudioBufferSourceNode.prototype.constructor", - "AudioBufferSourceNode.prototype.start", - "AudioContext.prototype.close", - "AudioContext.prototype.constructor", - "AudioDestinationNode.prototype.constructor", - "AudioListener.prototype.constructor", - "AudioListener.prototype.setPosition", - "AudioNode.prototype.connect", - "AudioNode.prototype.constructor", - "AudioNode.prototype.disconnect", - "AudioParam.prototype.constructor", - "AudioParam.prototype.value", - "AudioParamMap.prototype.constructor", - "AudioParamMap.prototype.entries", - "AudioParamMap.prototype.forEach", - "AudioParamMap.prototype.get", - "AudioParamMap.prototype.has", - "AudioParamMap.prototype.keys", - "AudioParamMap.prototype.size", - "AudioParamMap.prototype.values", - "AudioProcessingEvent.prototype.constructor", - "AudioScheduledSourceNode.prototype.constructor", - "AudioScheduledSourceNode.prototype.start", - "AudioScheduledSourceNode.prototype.stop", - "AudioWorklet.prototype.constructor", - "AudioWorkletNode.prototype.constructor", - "AudioWorkletNode.prototype.port", - "AuthenticatorAssertionResponse.prototype.constructor", - "AuthenticatorAttestationResponse.prototype.constructor", - "AuthenticatorResponse.prototype.constructor", - "BackgroundFetchManager.prototype.constructor", - "BackgroundFetchManager.prototype.get", - "BackgroundFetchRecord.prototype.constructor", - "BackgroundFetchRegistration.prototype.abort", - "BackgroundFetchRegistration.prototype.constructor", - "BackgroundFetchRegistration.prototype.id", - "BackgroundFetchRegistration.prototype.match", - "BackgroundFetchRegistration.prototype.result", - "BarProp.prototype.constructor", - "BarProp.prototype.visible", - "BaseAudioContext.prototype.constructor", - "BaseAudioContext.prototype.state", - "BatteryManager.prototype.constructor", - "BeforeUnloadEvent.prototype.constructor", - "BigInt", - "BigInt.prototype.constructor", - "BigInt.prototype.toLocaleString", - "BigInt.prototype.toString", - "BigInt.prototype.valueOf", - "BigInt64Array.prototype.constructor", - "BigUint64Array.prototype.constructor", - "BiquadFilterNode.prototype.constructor", - "BiquadFilterNode.prototype.type", - "Blob.prototype.constructor", - "Blob.prototype.size", - "Blob.prototype.slice", - "Blob.prototype.type", - "BlobEvent.prototype.constructor", - "BlobEvent.prototype.data", - "Boolean", - "Boolean.prototype.constructor", - "Boolean.prototype.toString", - "Boolean.prototype.valueOf", - "BroadcastChannel.prototype.close", - "BroadcastChannel.prototype.constructor", - "BroadcastChannel.prototype.name", - "BroadcastChannel.prototype.postMessage", - "ByteLengthQueuingStrategy.prototype.constructor", - "ByteLengthQueuingStrategy.prototype.size", - "CSS.prototype.constructor", - "CSSConditionRule.prototype.constructor", - "CSSFontFaceRule.prototype.constructor", - "CSSFontFaceRule.prototype.style", - "CSSGroupingRule.prototype.constructor", - "CSSImageValue.prototype.constructor", - "CSSImportRule.prototype.constructor", - "CSSImportRule.prototype.href", - "CSSKeyframeRule.prototype.constructor", - "CSSKeyframeRule.prototype.style", - "CSSKeyframesRule.prototype.constructor", - "CSSKeyframesRule.prototype.name", - "CSSKeywordValue.prototype.constructor", - "CSSKeywordValue.prototype.value", - "CSSMathInvert.prototype.constructor", - "CSSMathInvert.prototype.value", - "CSSMathMax.prototype.constructor", - "CSSMathMax.prototype.values", - "CSSMathMin.prototype.constructor", - "CSSMathMin.prototype.values", - "CSSMathNegate.prototype.constructor", - "CSSMathNegate.prototype.value", - "CSSMathProduct.prototype.constructor", - "CSSMathProduct.prototype.values", - "CSSMathSum.prototype.constructor", - "CSSMathSum.prototype.values", - "CSSMathValue.prototype.constructor", - "CSSMatrixComponent.prototype.constructor", - "CSSMediaRule.prototype.constructor", - "CSSNamespaceRule.prototype.constructor", - "CSSNamespaceRule.prototype.prefix", - "CSSNumericArray.prototype.constructor", - "CSSNumericArray.prototype.entries", - "CSSNumericArray.prototype.forEach", - "CSSNumericArray.prototype.keys", - "CSSNumericArray.prototype.length", - "CSSNumericArray.prototype.values", - "CSSNumericValue.prototype.add", - "CSSNumericValue.prototype.constructor", - "CSSNumericValue.prototype.max", - "CSSNumericValue.prototype.min", - "CSSNumericValue.prototype.to", - "CSSNumericValue.prototype.type", - "CSSPageRule.prototype.constructor", - "CSSPageRule.prototype.style", - "CSSPerspective.prototype.constructor", - "CSSPerspective.prototype.length", - "CSSPositionValue.prototype.constructor", - "CSSPositionValue.prototype.x", - "CSSPositionValue.prototype.y", - "CSSRotate.prototype.constructor", - "CSSRotate.prototype.x", - "CSSRotate.prototype.y", - "CSSRule.prototype.constructor", - "CSSRule.prototype.type", - "CSSRuleList.prototype.constructor", - "CSSRuleList.prototype.item", - "CSSRuleList.prototype.length", - "CSSScale.prototype.constructor", - "CSSScale.prototype.x", - "CSSScale.prototype.y", - "CSSSkew.prototype.constructor", - "CSSSkewX.prototype.constructor", - "CSSSkewY.prototype.constructor", - "CSSStyleDeclaration.prototype.constructor", - "CSSStyleDeclaration.prototype.getPropertyValue", - "CSSStyleDeclaration.prototype.item", - "CSSStyleDeclaration.prototype.length", - "CSSStyleRule.prototype.constructor", - "CSSStyleRule.prototype.style", - "CSSStyleSheet.prototype.constructor", - "CSSStyleSheet.prototype.replace", - "CSSStyleValue.prototype.constructor", - "CSSStyleValue.prototype.toString", - "CSSSupportsRule.prototype.constructor", - "CSSTransformComponent.prototype.constructor", - "CSSTransformComponent.prototype.toString", - "CSSTransformValue.prototype.constructor", - "CSSTransformValue.prototype.entries", - "CSSTransformValue.prototype.forEach", - "CSSTransformValue.prototype.keys", - "CSSTransformValue.prototype.length", - "CSSTransformValue.prototype.values", - "CSSTranslate.prototype.constructor", - "CSSTranslate.prototype.x", - "CSSTranslate.prototype.y", - "CSSUnitValue.prototype.constructor", - "CSSUnitValue.prototype.value", - "CSSUnparsedValue.prototype.constructor", - "CSSUnparsedValue.prototype.entries", - "CSSUnparsedValue.prototype.forEach", - "CSSUnparsedValue.prototype.keys", - "CSSUnparsedValue.prototype.length", - "CSSUnparsedValue.prototype.values", - "CSSVariableReferenceValue.prototype.constructor", - "Cache.prototype.add", - "Cache.prototype.constructor", - "Cache.prototype.delete", - "Cache.prototype.keys", - "Cache.prototype.match", - "Cache.prototype.put", - "CacheStorage.prototype.constructor", - "CacheStorage.prototype.delete", - "CacheStorage.prototype.has", - "CacheStorage.prototype.keys", - "CacheStorage.prototype.match", - "CacheStorage.prototype.open", - "CanvasCaptureMediaStreamTrack.prototype.constructor", - "CanvasGradient.prototype.constructor", - "CanvasPattern.prototype.constructor", - "CanvasRenderingContext2D.prototype.clip", - "CanvasRenderingContext2D.prototype.constructor", - "CanvasRenderingContext2D.prototype.fill", - "CanvasRenderingContext2D.prototype.filter", - "CanvasRenderingContext2D.prototype.rect", - "CanvasRenderingContext2D.prototype.restore", - "CanvasRenderingContext2D.prototype.save", - "ChannelMergerNode.prototype.constructor", - "ChannelSplitterNode.prototype.constructor", - "CharacterData.prototype.after", - "CharacterData.prototype.before", - "CharacterData.prototype.constructor", - "CharacterData.prototype.data", - "CharacterData.prototype.length", - "CharacterData.prototype.nextElementSibling", - "CharacterData.prototype.remove", - "CharacterData.prototype.replaceWith", - "Clipboard.prototype.constructor", - "Clipboard.prototype.writeText", - "ClipboardEvent.prototype.constructor", - "CloseEvent.prototype.code", - "CloseEvent.prototype.constructor", - "CloseEvent.prototype.reason", - "Comment.prototype.constructor", - "CompositionEvent.prototype.constructor", - "CompositionEvent.prototype.data", - "ConstantSourceNode.prototype.constructor", - "ConstantSourceNode.prototype.offset", - "ConvolverNode.prototype.buffer", - "ConvolverNode.prototype.constructor", - "CountQueuingStrategy.prototype.constructor", - "CountQueuingStrategy.prototype.size", - "Credential.prototype.constructor", - "Credential.prototype.id", - "Credential.prototype.type", - "CredentialsContainer.prototype.constructor", - "CredentialsContainer.prototype.create", - "CredentialsContainer.prototype.get", - "Crypto.prototype.constructor", - "Crypto.prototype.getRandomValues", - "CryptoKey.prototype.constructor", - "CryptoKey.prototype.type", - "CustomElementRegistry.prototype.constructor", - "CustomElementRegistry.prototype.get", - "CustomEvent.prototype.constructor", - "CustomEvent.prototype.detail", - "DOMError.prototype.constructor", - "DOMError.prototype.message", - "DOMError.prototype.name", - "DOMException.prototype.SYNTAX_ERR", - "DOMException.prototype.code", - "DOMException.prototype.constructor", - "DOMException.prototype.message", - "DOMException.prototype.name", - "DOMImplementation.prototype.constructor", - "DOMMatrix.prototype.a", - "DOMMatrix.prototype.b", - "DOMMatrix.prototype.c", - "DOMMatrix.prototype.constructor", - "DOMMatrix.prototype.f", - "DOMMatrixReadOnly.prototype.a", - "DOMMatrixReadOnly.prototype.b", - "DOMMatrixReadOnly.prototype.c", - "DOMMatrixReadOnly.prototype.constructor", - "DOMMatrixReadOnly.prototype.f", - "DOMMatrixReadOnly.prototype.toJSON", - "DOMMatrixReadOnly.prototype.toString", - "DOMParser", - "DOMParser.prototype.constructor", - "DOMParser.prototype.parseFromString", - "DOMPoint.prototype.constructor", - "DOMPoint.prototype.x", - "DOMPoint.prototype.y", - "DOMPointReadOnly.prototype.constructor", - "DOMPointReadOnly.prototype.toJSON", - "DOMPointReadOnly.prototype.x", - "DOMPointReadOnly.prototype.y", - "DOMQuad.prototype.constructor", - "DOMQuad.prototype.toJSON", - "DOMRect.prototype.constructor", - "DOMRect.prototype.height", - "DOMRect.prototype.width", - "DOMRect.prototype.x", - "DOMRect.prototype.y", - "DOMRectList.prototype.constructor", - "DOMRectList.prototype.item", - "DOMRectList.prototype.length", - "DOMRectReadOnly.prototype.bottom", - "DOMRectReadOnly.prototype.constructor", - "DOMRectReadOnly.prototype.height", - "DOMRectReadOnly.prototype.left", - "DOMRectReadOnly.prototype.right", - "DOMRectReadOnly.prototype.toJSON", - "DOMRectReadOnly.prototype.top", - "DOMRectReadOnly.prototype.width", - "DOMRectReadOnly.prototype.x", - "DOMRectReadOnly.prototype.y", - "DOMStringList.prototype.constructor", - "DOMStringList.prototype.contains", - "DOMStringList.prototype.item", - "DOMStringList.prototype.length", - "DOMStringMap.prototype.constructor", - "DOMTokenList.prototype.add", - "DOMTokenList.prototype.constructor", - "DOMTokenList.prototype.contains", - "DOMTokenList.prototype.entries", - "DOMTokenList.prototype.item", - "DOMTokenList.prototype.keys", - "DOMTokenList.prototype.length", - "DOMTokenList.prototype.remove", - "DOMTokenList.prototype.supports", - "DOMTokenList.prototype.toString", - "DOMTokenList.prototype.toggle", - "DOMTokenList.prototype.value", - "DOMTokenList.prototype.values", - "DataTransfer.prototype.constructor", - "DataTransfer.prototype.getData", - "DataTransfer.prototype.setData", - "DataTransfer.prototype.types", - "DataTransferItem.prototype.constructor", - "DataTransferItem.prototype.type", - "DataTransferItemList.prototype.add", - "DataTransferItemList.prototype.clear", - "DataTransferItemList.prototype.constructor", - "DataTransferItemList.prototype.length", - "DataTransferItemList.prototype.remove", - "DataView.prototype.buffer", - "DataView.prototype.byteLength", - "DataView.prototype.byteOffset", - "DataView.prototype.constructor", - "DataView.prototype.getUint32", - "Date", - "Date.prototype.constructor", - "Date.prototype.getDate", - "Date.prototype.getFullYear", - "Date.prototype.getHours", - "Date.prototype.getMilliseconds", - "Date.prototype.getMinutes", - "Date.prototype.getMonth", - "Date.prototype.getSeconds", - "Date.prototype.getTime", - "Date.prototype.getUTCDate", - "Date.prototype.getUTCFullYear", - "Date.prototype.getUTCHours", - "Date.prototype.getUTCMinutes", - "Date.prototype.getUTCMonth", - "Date.prototype.getUTCSeconds", - "Date.prototype.toJSON", - "Date.prototype.toLocaleDateString", - "Date.prototype.toLocaleString", - "Date.prototype.toLocaleTimeString", - "Date.prototype.toString", - "Date.prototype.valueOf", - "DelayNode.prototype.constructor", - "DeviceMotionEvent.prototype.constructor", - "DeviceMotionEventAcceleration.prototype.constructor", - "DeviceMotionEventAcceleration.prototype.x", - "DeviceMotionEventAcceleration.prototype.y", - "DeviceMotionEventRotationRate.prototype.constructor", - "DeviceOrientationEvent.prototype.constructor", - "Document.prototype.activeElement", - "Document.prototype.all", - "Document.prototype.append", - "Document.prototype.body", - "Document.prototype.children", - "Document.prototype.clear", - "Document.prototype.close", - "Document.prototype.constructor", - "Document.prototype.cookie", - "Document.prototype.createDocumentFragment", - "Document.prototype.createElement", - "Document.prototype.createNodeIterator", - "Document.prototype.createRange", - "Document.prototype.createTextNode", - "Document.prototype.defaultView", - "Document.prototype.dir", - "Document.prototype.documentElement", - "Document.prototype.domain", - "Document.prototype.evaluate", - "Document.prototype.execCommand", - "Document.prototype.getElementById", - "Document.prototype.getElementsByClassName", - "Document.prototype.getElementsByTagName", - "Document.prototype.getSelection", - "Document.prototype.head", - "Document.prototype.hidden", - "Document.prototype.images", - "Document.prototype.lastModified", - "Document.prototype.links", - "Document.prototype.onclick", - "Document.prototype.onkeypress", - "Document.prototype.onmousedown", - "Document.prototype.onmousemove", - "Document.prototype.onmouseover", - "Document.prototype.onsubmit", - "Document.prototype.open", - "Document.prototype.plugins", - "Document.prototype.prepend", - "Document.prototype.querySelector", - "Document.prototype.querySelectorAll", - "Document.prototype.readyState", - "Document.prototype.referrer", - "Document.prototype.title", - "Document.prototype.write", - "DocumentFragment.prototype.children", - "DocumentFragment.prototype.constructor", - "DocumentFragment.prototype.getElementById", - "DocumentFragment.prototype.querySelector", - "DocumentFragment.prototype.querySelectorAll", - "DocumentType.prototype.after", - "DocumentType.prototype.before", - "DocumentType.prototype.constructor", - "DocumentType.prototype.name", - "DocumentType.prototype.remove", - "DocumentType.prototype.replaceWith", - "DragEvent.prototype.constructor", - "DynamicsCompressorNode.prototype.constructor", - "DynamicsCompressorNode.prototype.threshold", - "Element.prototype.children", - "Element.prototype.className", - "Element.prototype.clientWidth", - "Element.prototype.constructor", - "Element.prototype.getAttribute", - "Element.prototype.getBoundingClientRect", - "Element.prototype.getClientRects", - "Element.prototype.getElementsByClassName", - "Element.prototype.getElementsByTagName", - "Element.prototype.id", - "Element.prototype.innerHTML", - "Element.prototype.outerHTML", - "Element.prototype.prefix", - "Element.prototype.querySelector", - "Element.prototype.querySelectorAll", - "Element.prototype.removeAttribute", - "Element.prototype.scrollHeight", - "Element.prototype.scrollLeft", - "Element.prototype.scrollTo", - "Element.prototype.scrollTop", - "Element.prototype.setAttribute", - "Element.prototype.tagName", - "EnterPictureInPictureEvent.prototype.constructor", - "Error", - "Error.prototype", - "Error.prototype.constructor", - "Error.prototype.message", - "Error.prototype.name", - "Error.prototype.toString", - "ErrorEvent.prototype.constructor", - "ErrorEvent.prototype.error", - "ErrorEvent.prototype.message", - "Event.prototype.composedPath", - "Event.prototype.constructor", - "Event.prototype.path", - "Event.prototype.preventDefault", - "Event.prototype.stopImmediatePropagation", - "Event.prototype.stopPropagation", - "Event.prototype.target", - "Event.prototype.type", - "EventSource.prototype.OPEN", - "EventSource.prototype.close", - "EventSource.prototype.constructor", - "EventSource.prototype.readyState", - "EventSource.prototype.url", - "EventTarget.prototype.addEventListener", - "EventTarget.prototype.constructor", - "EventTarget.prototype.removeEventListener", - "External.prototype.constructor", - "FederatedCredential.prototype.constructor", - "FederatedCredential.prototype.name", - "FederatedCredential.prototype.protocol", - "File.prototype.constructor", - "File.prototype.lastModified", - "File.prototype.name", - "FileList.prototype.constructor", - "FileList.prototype.item", - "FileList.prototype.length", - "FileReader", - "FileReader.prototype.abort", - "FileReader.prototype.constructor", - "FileReader.prototype.error", - "FileReader.prototype.readAsArrayBuffer", - "FileReader.prototype.readAsBinaryString", - "FileReader.prototype.readyState", - "FileReader.prototype.result", - "Float32Array.prototype.constructor", - "Float32Array.prototype.copyWithin", - "Float32Array.prototype.entries", - "Float32Array.prototype.fill", - "Float32Array.prototype.filter", - "Float32Array.prototype.find", - "Float32Array.prototype.forEach", - "Float32Array.prototype.includes", - "Float32Array.prototype.indexOf", - "Float32Array.prototype.join", - "Float32Array.prototype.keys", - "Float32Array.prototype.lastIndexOf", - "Float32Array.prototype.map", - "Float32Array.prototype.reduce", - "Float32Array.prototype.reverse", - "Float32Array.prototype.set", - "Float32Array.prototype.slice", - "Float32Array.prototype.some", - "Float32Array.prototype.sort", - "Float32Array.prototype.subarray", - "Float32Array.prototype.toLocaleString", - "Float32Array.prototype.toString", - "Float32Array.prototype.values", - "Float64Array.prototype.constructor", - "Float64Array.prototype.copyWithin", - "Float64Array.prototype.entries", - "Float64Array.prototype.fill", - "Float64Array.prototype.filter", - "Float64Array.prototype.find", - "Float64Array.prototype.forEach", - "Float64Array.prototype.includes", - "Float64Array.prototype.indexOf", - "Float64Array.prototype.join", - "Float64Array.prototype.keys", - "Float64Array.prototype.lastIndexOf", - "Float64Array.prototype.map", - "Float64Array.prototype.reduce", - "Float64Array.prototype.reverse", - "Float64Array.prototype.set", - "Float64Array.prototype.slice", - "Float64Array.prototype.some", - "Float64Array.prototype.sort", - "Float64Array.prototype.subarray", - "Float64Array.prototype.toLocaleString", - "Float64Array.prototype.toString", - "Float64Array.prototype.values", - "FocusEvent.prototype.constructor", - "FocusEvent.prototype.relatedTarget", - "FontFace.prototype.constructor", - "FontFace.prototype.display", - "FontFace.prototype.family", - "FontFace.prototype.load", - "FontFace.prototype.loaded", - "FontFace.prototype.status", - "FontFace.prototype.style", - "FontFaceSetLoadEvent.prototype.constructor", - "FormData", - "FormData.prototype.append", - "FormData.prototype.constructor", - "FormData.prototype.delete", - "FormData.prototype.entries", - "FormData.prototype.forEach", - "FormData.prototype.get", - "FormData.prototype.has", - "FormData.prototype.keys", - "FormData.prototype.set", - "FormData.prototype.values", - "Function", - "Function.prototype", - "Function.prototype.apply", - "Function.prototype.call", - "Function.prototype.constructor", - "Function.prototype.length", - "Function.prototype.toString", - "GainNode.prototype.constructor", - "Gamepad.prototype.constructor", - "Gamepad.prototype.id", - "Gamepad.prototype.index", - "Gamepad.prototype.timestamp", - "GamepadButton.prototype.constructor", - "GamepadButton.prototype.value", - "GamepadEvent.prototype.constructor", - "GamepadHapticActuator.prototype.constructor", - "GamepadHapticActuator.prototype.type", - "Gyroscope.prototype.constructor", - "Gyroscope.prototype.x", - "Gyroscope.prototype.y", - "HTMLAllCollection.prototype.constructor", - "HTMLAllCollection.prototype.item", - "HTMLAllCollection.prototype.length", - "HTMLAnchorElement", - "HTMLAnchorElement.prototype.constructor", - "HTMLAnchorElement.prototype.hash", - "HTMLAnchorElement.prototype.host", - "HTMLAnchorElement.prototype.hostname", - "HTMLAnchorElement.prototype.href", - "HTMLAnchorElement.prototype.name", - "HTMLAnchorElement.prototype.pathname", - "HTMLAnchorElement.prototype.ping", - "HTMLAnchorElement.prototype.port", - "HTMLAnchorElement.prototype.protocol", - "HTMLAnchorElement.prototype.search", - "HTMLAnchorElement.prototype.target", - "HTMLAnchorElement.prototype.text", - "HTMLAnchorElement.prototype.toString", - "HTMLAnchorElement.prototype.type", - "HTMLAnchorElement.prototype.username", - "HTMLAreaElement.prototype.alt", - "HTMLAreaElement.prototype.constructor", - "HTMLAreaElement.prototype.hash", - "HTMLAreaElement.prototype.host", - "HTMLAreaElement.prototype.hostname", - "HTMLAreaElement.prototype.href", - "HTMLAreaElement.prototype.pathname", - "HTMLAreaElement.prototype.ping", - "HTMLAreaElement.prototype.port", - "HTMLAreaElement.prototype.protocol", - "HTMLAreaElement.prototype.search", - "HTMLAreaElement.prototype.target", - "HTMLAreaElement.prototype.toString", - "HTMLAreaElement.prototype.username", - "HTMLAudioElement.prototype.constructor", - "HTMLBRElement.prototype.clear", - "HTMLBRElement.prototype.constructor", - "HTMLBaseElement.prototype.constructor", - "HTMLBaseElement.prototype.href", - "HTMLBaseElement.prototype.target", - "HTMLBodyElement.prototype.constructor", - "HTMLBodyElement.prototype.link", - "HTMLBodyElement.prototype.text", - "HTMLButtonElement.prototype.constructor", - "HTMLButtonElement.prototype.disabled", - "HTMLButtonElement.prototype.form", - "HTMLButtonElement.prototype.name", - "HTMLButtonElement.prototype.type", - "HTMLButtonElement.prototype.value", - "HTMLCanvasElement.prototype.constructor", - "HTMLCanvasElement.prototype.height", - "HTMLCanvasElement.prototype.width", - "HTMLCollection.prototype.constructor", - "HTMLCollection.prototype.item", - "HTMLCollection.prototype.length", - "HTMLContentElement.prototype.constructor", - "HTMLContentElement.prototype.select", - "HTMLDListElement.prototype.constructor", - "HTMLDataElement.prototype.constructor", - "HTMLDataElement.prototype.value", - "HTMLDataListElement.prototype.constructor", - "HTMLDataListElement.prototype.options", - "HTMLDetailsElement.prototype.constructor", - "HTMLDetailsElement.prototype.open", - "HTMLDialogElement.prototype.close", - "HTMLDialogElement.prototype.constructor", - "HTMLDialogElement.prototype.open", - "HTMLDialogElement.prototype.show", - "HTMLDirectoryElement.prototype.constructor", - "HTMLDivElement.prototype.align", - "HTMLDivElement.prototype.constructor", - "HTMLDocument.prototype.constructor", - "HTMLElement", - "HTMLElement.prototype.blur", - "HTMLElement.prototype.click", - "HTMLElement.prototype.constructor", - "HTMLElement.prototype.dataset", - "HTMLElement.prototype.dir", - "HTMLElement.prototype.focus", - "HTMLElement.prototype.hidden", - "HTMLElement.prototype.innerText", - "HTMLElement.prototype.lang", - "HTMLElement.prototype.offsetHeight", - "HTMLElement.prototype.offsetLeft", - "HTMLElement.prototype.offsetParent", - "HTMLElement.prototype.offsetTop", - "HTMLElement.prototype.offsetWidth", - "HTMLElement.prototype.onclick", - "HTMLElement.prototype.onkeypress", - "HTMLElement.prototype.onmousedown", - "HTMLElement.prototype.onmousemove", - "HTMLElement.prototype.onmouseover", - "HTMLElement.prototype.onsubmit", - "HTMLElement.prototype.style", - "HTMLElement.prototype.title", - "HTMLEmbedElement.prototype.align", - "HTMLEmbedElement.prototype.constructor", - "HTMLEmbedElement.prototype.height", - "HTMLEmbedElement.prototype.name", - "HTMLEmbedElement.prototype.src", - "HTMLEmbedElement.prototype.type", - "HTMLEmbedElement.prototype.width", - "HTMLEscape.prototype.constructor", - "HTMLFieldSetElement.prototype.constructor", - "HTMLFieldSetElement.prototype.disabled", - "HTMLFieldSetElement.prototype.form", - "HTMLFieldSetElement.prototype.name", - "HTMLFieldSetElement.prototype.type", - "HTMLFontElement.prototype.constructor", - "HTMLFontElement.prototype.size", - "HTMLFormControlsCollection.prototype.constructor", - "HTMLFormElement.prototype.action", - "HTMLFormElement.prototype.autocomplete", - "HTMLFormElement.prototype.constructor", - "HTMLFormElement.prototype.length", - "HTMLFormElement.prototype.method", - "HTMLFormElement.prototype.name", - "HTMLFormElement.prototype.target", - "HTMLFrameElement.prototype.constructor", - "HTMLFrameElement.prototype.name", - "HTMLFrameElement.prototype.src", - "HTMLFrameSetElement.prototype.constructor", - "HTMLFrameSetElement.prototype.rows", - "HTMLHRElement.prototype.align", - "HTMLHRElement.prototype.constructor", - "HTMLHRElement.prototype.size", - "HTMLHRElement.prototype.width", - "HTMLHeadElement.prototype.constructor", - "HTMLHeadingElement.prototype.align", - "HTMLHeadingElement.prototype.constructor", - "HTMLHtmlElement.prototype.constructor", - "HTMLHtmlElement.prototype.version", - "HTMLIFrameElement.prototype.align", - "HTMLIFrameElement.prototype.allowFullscreen", - "HTMLIFrameElement.prototype.constructor", - "HTMLIFrameElement.prototype.height", - "HTMLIFrameElement.prototype.name", - "HTMLIFrameElement.prototype.src", - "HTMLIFrameElement.prototype.width", - "HTMLImageElement.prototype.align", - "HTMLImageElement.prototype.alt", - "HTMLImageElement.prototype.constructor", - "HTMLImageElement.prototype.decode", - "HTMLImageElement.prototype.height", - "HTMLImageElement.prototype.name", - "HTMLImageElement.prototype.sizes", - "HTMLImageElement.prototype.src", - "HTMLImageElement.prototype.srcset", - "HTMLImageElement.prototype.width", - "HTMLImageElement.prototype.x", - "HTMLImageElement.prototype.y", - "HTMLInputElement.prototype.accept", - "HTMLInputElement.prototype.align", - "HTMLInputElement.prototype.alt", - "HTMLInputElement.prototype.autocomplete", - "HTMLInputElement.prototype.checked", - "HTMLInputElement.prototype.constructor", - "HTMLInputElement.prototype.disabled", - "HTMLInputElement.prototype.form", - "HTMLInputElement.prototype.height", - "HTMLInputElement.prototype.list", - "HTMLInputElement.prototype.max", - "HTMLInputElement.prototype.min", - "HTMLInputElement.prototype.name", - "HTMLInputElement.prototype.pattern", - "HTMLInputElement.prototype.readOnly", - "HTMLInputElement.prototype.required", - "HTMLInputElement.prototype.select", - "HTMLInputElement.prototype.selectionEnd", - "HTMLInputElement.prototype.selectionStart", - "HTMLInputElement.prototype.setSelectionRange", - "HTMLInputElement.prototype.size", - "HTMLInputElement.prototype.src", - "HTMLInputElement.prototype.type", - "HTMLInputElement.prototype.value", - "HTMLInputElement.prototype.width", - "HTMLLIElement.prototype.constructor", - "HTMLLIElement.prototype.type", - "HTMLLIElement.prototype.value", - "HTMLLabelElement.prototype.constructor", - "HTMLLabelElement.prototype.form", - "HTMLLegendElement.prototype.align", - "HTMLLegendElement.prototype.constructor", - "HTMLLegendElement.prototype.form", - "HTMLLinkElement.prototype.constructor", - "HTMLLinkElement.prototype.disabled", - "HTMLLinkElement.prototype.href", - "HTMLLinkElement.prototype.sizes", - "HTMLLinkElement.prototype.target", - "HTMLLinkElement.prototype.type", - "HTMLMapElement.prototype.constructor", - "HTMLMapElement.prototype.name", - "HTMLMarqueeElement.prototype.constructor", - "HTMLMarqueeElement.prototype.direction", - "HTMLMarqueeElement.prototype.height", - "HTMLMarqueeElement.prototype.start", - "HTMLMarqueeElement.prototype.stop", - "HTMLMarqueeElement.prototype.width", - "HTMLMediaElement.prototype.constructor", - "HTMLMediaElement.prototype.duration", - "HTMLMediaElement.prototype.error", - "HTMLMediaElement.prototype.load", - "HTMLMediaElement.prototype.readyState", - "HTMLMediaElement.prototype.src", - "HTMLMenuElement.prototype.constructor", - "HTMLMetaElement.prototype.constructor", - "HTMLMetaElement.prototype.content", - "HTMLMetaElement.prototype.name", - "HTMLMeterElement.prototype.constructor", - "HTMLMeterElement.prototype.max", - "HTMLMeterElement.prototype.min", - "HTMLMeterElement.prototype.value", - "HTMLModElement.prototype.constructor", - "HTMLOListElement.prototype.constructor", - "HTMLOListElement.prototype.start", - "HTMLOListElement.prototype.type", - "HTMLObjectElement.prototype.align", - "HTMLObjectElement.prototype.code", - "HTMLObjectElement.prototype.constructor", - "HTMLObjectElement.prototype.data", - "HTMLObjectElement.prototype.form", - "HTMLObjectElement.prototype.height", - "HTMLObjectElement.prototype.name", - "HTMLObjectElement.prototype.type", - "HTMLObjectElement.prototype.width", - "HTMLOptGroupElement.prototype.constructor", - "HTMLOptGroupElement.prototype.disabled", - "HTMLOptGroupElement.prototype.label", - "HTMLOptionElement.prototype.constructor", - "HTMLOptionElement.prototype.disabled", - "HTMLOptionElement.prototype.form", - "HTMLOptionElement.prototype.index", - "HTMLOptionElement.prototype.label", - "HTMLOptionElement.prototype.text", - "HTMLOptionElement.prototype.value", - "HTMLOptionsCollection.prototype.add", - "HTMLOptionsCollection.prototype.constructor", - "HTMLOptionsCollection.prototype.length", - "HTMLOptionsCollection.prototype.remove", - "HTMLOptionsCollection.prototype.selectedIndex", - "HTMLOutputElement.prototype.constructor", - "HTMLOutputElement.prototype.form", - "HTMLOutputElement.prototype.name", - "HTMLOutputElement.prototype.type", - "HTMLOutputElement.prototype.value", - "HTMLParagraphElement.prototype.align", - "HTMLParagraphElement.prototype.constructor", - "HTMLParamElement.prototype.constructor", - "HTMLParamElement.prototype.name", - "HTMLParamElement.prototype.type", - "HTMLParamElement.prototype.value", - "HTMLPictureElement.prototype.constructor", - "HTMLPreElement.prototype.constructor", - "HTMLPreElement.prototype.width", - "HTMLProgressElement.prototype.constructor", - "HTMLProgressElement.prototype.max", - "HTMLProgressElement.prototype.position", - "HTMLProgressElement.prototype.value", - "HTMLQuoteElement.prototype.constructor", - "HTMLScriptElement.prototype.async", - "HTMLScriptElement.prototype.constructor", - "HTMLScriptElement.prototype.event", - "HTMLScriptElement.prototype.src", - "HTMLScriptElement.prototype.text", - "HTMLScriptElement.prototype.type", - "HTMLSelectElement.prototype.add", - "HTMLSelectElement.prototype.autocomplete", - "HTMLSelectElement.prototype.constructor", - "HTMLSelectElement.prototype.disabled", - "HTMLSelectElement.prototype.form", - "HTMLSelectElement.prototype.item", - "HTMLSelectElement.prototype.length", - "HTMLSelectElement.prototype.name", - "HTMLSelectElement.prototype.options", - "HTMLSelectElement.prototype.remove", - "HTMLSelectElement.prototype.required", - "HTMLSelectElement.prototype.selectedIndex", - "HTMLSelectElement.prototype.size", - "HTMLSelectElement.prototype.type", - "HTMLSelectElement.prototype.value", - "HTMLShadowElement.prototype.constructor", - "HTMLSlotElement.prototype.constructor", - "HTMLSlotElement.prototype.name", - "HTMLSourceElement.prototype.constructor", - "HTMLSourceElement.prototype.sizes", - "HTMLSourceElement.prototype.src", - "HTMLSourceElement.prototype.srcset", - "HTMLSourceElement.prototype.type", - "HTMLSpanElement.prototype.constructor", - "HTMLStyleElement.prototype.constructor", - "HTMLStyleElement.prototype.disabled", - "HTMLStyleElement.prototype.type", - "HTMLTableCaptionElement.prototype.align", - "HTMLTableCaptionElement.prototype.constructor", - "HTMLTableCellElement.prototype.align", - "HTMLTableCellElement.prototype.constructor", - "HTMLTableCellElement.prototype.height", - "HTMLTableCellElement.prototype.width", - "HTMLTableColElement.prototype.align", - "HTMLTableColElement.prototype.constructor", - "HTMLTableColElement.prototype.span", - "HTMLTableColElement.prototype.width", - "HTMLTableElement.prototype.align", - "HTMLTableElement.prototype.constructor", - "HTMLTableElement.prototype.insertRow", - "HTMLTableElement.prototype.rows", - "HTMLTableElement.prototype.summary", - "HTMLTableElement.prototype.width", - "HTMLTableRowElement.prototype.align", - "HTMLTableRowElement.prototype.constructor", - "HTMLTableSectionElement.prototype.align", - "HTMLTableSectionElement.prototype.constructor", - "HTMLTableSectionElement.prototype.insertRow", - "HTMLTableSectionElement.prototype.rows", - "HTMLTemplateElement.prototype.constructor", - "HTMLTemplateElement.prototype.content", - "HTMLTextAreaElement.prototype.autocomplete", - "HTMLTextAreaElement.prototype.constructor", - "HTMLTextAreaElement.prototype.disabled", - "HTMLTextAreaElement.prototype.form", - "HTMLTextAreaElement.prototype.name", - "HTMLTextAreaElement.prototype.readOnly", - "HTMLTextAreaElement.prototype.required", - "HTMLTextAreaElement.prototype.rows", - "HTMLTextAreaElement.prototype.select", - "HTMLTextAreaElement.prototype.selectionEnd", - "HTMLTextAreaElement.prototype.selectionStart", - "HTMLTextAreaElement.prototype.setSelectionRange", - "HTMLTextAreaElement.prototype.type", - "HTMLTextAreaElement.prototype.value", - "HTMLTimeElement.prototype.constructor", - "HTMLTitleElement.prototype.constructor", - "HTMLTitleElement.prototype.text", - "HTMLTrackElement.prototype.constructor", - "HTMLTrackElement.prototype.default", - "HTMLTrackElement.prototype.label", - "HTMLTrackElement.prototype.readyState", - "HTMLTrackElement.prototype.src", - "HTMLTrackElement.prototype.track", - "HTMLUListElement.prototype.constructor", - "HTMLUListElement.prototype.type", - "HTMLUnknownElement.prototype.constructor", - "HTMLVideoElement.prototype.constructor", - "HTMLVideoElement.prototype.height", - "HTMLVideoElement.prototype.width", - "HashChangeEvent.prototype.constructor", - "Headers.prototype.append", - "Headers.prototype.constructor", - "Headers.prototype.delete", - "Headers.prototype.entries", - "Headers.prototype.forEach", - "Headers.prototype.get", - "Headers.prototype.has", - "Headers.prototype.keys", - "Headers.prototype.set", - "Headers.prototype.values", - "History.prototype.constructor", - "History.prototype.go", - "History.prototype.length", - "History.prototype.state", - "IDBCursor.prototype.advance", - "IDBCursor.prototype.constructor", - "IDBCursor.prototype.continue", - "IDBCursor.prototype.delete", - "IDBCursor.prototype.direction", - "IDBCursor.prototype.key", - "IDBCursor.prototype.source", - "IDBCursor.prototype.update", - "IDBCursorWithValue.prototype.constructor", - "IDBCursorWithValue.prototype.value", - "IDBDatabase.prototype.close", - "IDBDatabase.prototype.constructor", - "IDBDatabase.prototype.createObjectStore", - "IDBDatabase.prototype.deleteObjectStore", - "IDBDatabase.prototype.name", - "IDBDatabase.prototype.objectStoreNames", - "IDBDatabase.prototype.transaction", - "IDBDatabase.prototype.version", - "IDBFactory.prototype.constructor", - "IDBFactory.prototype.deleteDatabase", - "IDBFactory.prototype.open", - "IDBIndex.prototype.constructor", - "IDBIndex.prototype.count", - "IDBIndex.prototype.get", - "IDBIndex.prototype.getAllKeys", - "IDBIndex.prototype.name", - "IDBIndex.prototype.objectStore", - "IDBIndex.prototype.openCursor", - "IDBIndex.prototype.openKeyCursor", - "IDBKeyRange", - "IDBKeyRange.prototype.constructor", - "IDBKeyRange.prototype.includes", - "IDBObjectStore.prototype.add", - "IDBObjectStore.prototype.clear", - "IDBObjectStore.prototype.constructor", - "IDBObjectStore.prototype.count", - "IDBObjectStore.prototype.delete", - "IDBObjectStore.prototype.get", - "IDBObjectStore.prototype.getAllKeys", - "IDBObjectStore.prototype.index", - "IDBObjectStore.prototype.name", - "IDBObjectStore.prototype.openCursor", - "IDBObjectStore.prototype.openKeyCursor", - "IDBObjectStore.prototype.put", - "IDBObjectStore.prototype.transaction", - "IDBOpenDBRequest.prototype.constructor", - "IDBRequest.prototype.constructor", - "IDBRequest.prototype.error", - "IDBRequest.prototype.readyState", - "IDBRequest.prototype.result", - "IDBRequest.prototype.source", - "IDBRequest.prototype.transaction", - "IDBTransaction.prototype.abort", - "IDBTransaction.prototype.constructor", - "IDBTransaction.prototype.db", - "IDBTransaction.prototype.error", - "IDBTransaction.prototype.objectStore", - "IDBTransaction.prototype.objectStoreNames", - "IDBVersionChangeEvent.prototype.constructor", - "IDBVersionChangeEvent.prototype.newVersion", - "IDBVersionChangeEvent.prototype.oldVersion", - "IIRFilterNode.prototype.constructor", - "IdleDeadline.prototype.constructor", - "Image", - "Image.prototype.align", - "Image.prototype.alt", - "Image.prototype.constructor", - "Image.prototype.decode", - "Image.prototype.height", - "Image.prototype.name", - "Image.prototype.sizes", - "Image.prototype.src", - "Image.prototype.srcset", - "Image.prototype.width", - "Image.prototype.x", - "Image.prototype.y", - "ImageBitmap.prototype.close", - "ImageBitmap.prototype.constructor", - "ImageBitmap.prototype.height", - "ImageBitmap.prototype.width", - "ImageBitmapRenderingContext.prototype.constructor", - "ImageCapture.prototype.constructor", - "ImageCapture.prototype.track", - "ImageData.prototype.constructor", - "ImageData.prototype.data", - "ImageData.prototype.height", - "ImageData.prototype.width", - "Infinity", - "InputDeviceInfo.prototype.constructor", - "InputEvent.prototype.constructor", - "InputEvent.prototype.data", - "Int16Array.prototype.constructor", - "Int16Array.prototype.copyWithin", - "Int16Array.prototype.entries", - "Int16Array.prototype.fill", - "Int16Array.prototype.filter", - "Int16Array.prototype.find", - "Int16Array.prototype.forEach", - "Int16Array.prototype.includes", - "Int16Array.prototype.indexOf", - "Int16Array.prototype.join", - "Int16Array.prototype.keys", - "Int16Array.prototype.lastIndexOf", - "Int16Array.prototype.map", - "Int16Array.prototype.reduce", - "Int16Array.prototype.reverse", - "Int16Array.prototype.set", - "Int16Array.prototype.slice", - "Int16Array.prototype.some", - "Int16Array.prototype.sort", - "Int16Array.prototype.subarray", - "Int16Array.prototype.toLocaleString", - "Int16Array.prototype.toString", - "Int16Array.prototype.values", - "Int32Array.prototype.constructor", - "Int32Array.prototype.copyWithin", - "Int32Array.prototype.entries", - "Int32Array.prototype.fill", - "Int32Array.prototype.filter", - "Int32Array.prototype.find", - "Int32Array.prototype.forEach", - "Int32Array.prototype.includes", - "Int32Array.prototype.indexOf", - "Int32Array.prototype.join", - "Int32Array.prototype.keys", - "Int32Array.prototype.lastIndexOf", - "Int32Array.prototype.map", - "Int32Array.prototype.reduce", - "Int32Array.prototype.reverse", - "Int32Array.prototype.set", - "Int32Array.prototype.slice", - "Int32Array.prototype.some", - "Int32Array.prototype.sort", - "Int32Array.prototype.subarray", - "Int32Array.prototype.toLocaleString", - "Int32Array.prototype.toString", - "Int32Array.prototype.values", - "Int8Array.prototype.constructor", - "Int8Array.prototype.copyWithin", - "Int8Array.prototype.entries", - "Int8Array.prototype.fill", - "Int8Array.prototype.filter", - "Int8Array.prototype.find", - "Int8Array.prototype.forEach", - "Int8Array.prototype.includes", - "Int8Array.prototype.indexOf", - "Int8Array.prototype.join", - "Int8Array.prototype.keys", - "Int8Array.prototype.lastIndexOf", - "Int8Array.prototype.map", - "Int8Array.prototype.reduce", - "Int8Array.prototype.reverse", - "Int8Array.prototype.set", - "Int8Array.prototype.slice", - "Int8Array.prototype.some", - "Int8Array.prototype.sort", - "Int8Array.prototype.subarray", - "Int8Array.prototype.toLocaleString", - "Int8Array.prototype.toString", - "Int8Array.prototype.values", - "IntersectionObserver.prototype.constructor", - "IntersectionObserver.prototype.delay", - "IntersectionObserver.prototype.disconnect", - "IntersectionObserver.prototype.observe", - "IntersectionObserver.prototype.root", - "IntersectionObserver.prototype.rootMargin", - "IntersectionObserver.prototype.unobserve", - "IntersectionObserverEntry.prototype.constructor", - "IntersectionObserverEntry.prototype.isIntersecting", - "IntersectionObserverEntry.prototype.isVisible", - "IntersectionObserverEntry.prototype.target", - "IntersectionObserverEntry.prototype.time", - "JSON.parse", - "JSON.stringify", - "Keyboard.prototype.constructor", - "Keyboard.prototype.lock", - "KeyboardEvent.prototype.code", - "KeyboardEvent.prototype.constructor", - "KeyboardEvent.prototype.ctrlKey", - "KeyboardEvent.prototype.key", - "KeyboardEvent.prototype.keyCode", - "KeyboardEvent.prototype.location", - "KeyboardEvent.prototype.metaKey", - "KeyboardEvent.prototype.repeat", - "KeyboardEvent.prototype.shiftKey", - "KeyboardLayoutMap.prototype.constructor", - "KeyboardLayoutMap.prototype.entries", - "KeyboardLayoutMap.prototype.forEach", - "KeyboardLayoutMap.prototype.get", - "KeyboardLayoutMap.prototype.has", - "KeyboardLayoutMap.prototype.keys", - "KeyboardLayoutMap.prototype.size", - "KeyboardLayoutMap.prototype.values", - "KeyframeEffect.prototype.constructor", - "KeyframeEffect.prototype.target", - "LinearAccelerationSensor.prototype.constructor", - "Location.prototype.constructor", - "Lock.prototype.constructor", - "Lock.prototype.name", - "LockManager.prototype.constructor", - "LockManager.prototype.query", - "MIDIAccess.prototype.constructor", - "MIDIConnectionEvent.prototype.constructor", - "MIDIConnectionEvent.prototype.port", - "MIDIInput.prototype.constructor", - "MIDIInputMap.prototype.constructor", - "MIDIInputMap.prototype.entries", - "MIDIInputMap.prototype.forEach", - "MIDIInputMap.prototype.get", - "MIDIInputMap.prototype.has", - "MIDIInputMap.prototype.keys", - "MIDIInputMap.prototype.size", - "MIDIInputMap.prototype.values", - "MIDIMessageEvent.prototype.constructor", - "MIDIMessageEvent.prototype.data", - "MIDIOutput.prototype.constructor", - "MIDIOutput.prototype.send", - "MIDIOutputMap.prototype.constructor", - "MIDIOutputMap.prototype.entries", - "MIDIOutputMap.prototype.forEach", - "MIDIOutputMap.prototype.get", - "MIDIOutputMap.prototype.has", - "MIDIOutputMap.prototype.keys", - "MIDIOutputMap.prototype.size", - "MIDIOutputMap.prototype.values", - "MIDIPort.prototype.close", - "MIDIPort.prototype.constructor", - "MIDIPort.prototype.id", - "MIDIPort.prototype.name", - "MIDIPort.prototype.open", - "MIDIPort.prototype.state", - "MIDIPort.prototype.type", - "MIDIPort.prototype.version", - "Map.prototype.clear", - "Map.prototype.constructor", - "Map.prototype.delete", - "Map.prototype.entries", - "Map.prototype.forEach", - "Map.prototype.get", - "Map.prototype.has", - "Map.prototype.keys", - "Map.prototype.set", - "Map.prototype.size", - "Map.prototype.values", - "Math", - "Math.LN2", - "Math.abs", - "Math.ceil", - "Math.floor", - "Math.log", - "Math.max", - "Math.min", - "Math.pow", - "Math.random", - "Math.round", - "MediaCapabilities.prototype.constructor", - "MediaDeviceInfo.prototype.constructor", - "MediaDeviceInfo.prototype.label", - "MediaDeviceInfo.prototype.toJSON", - "MediaDevices.prototype.constructor", - "MediaElementAudioSourceNode.prototype.constructor", - "MediaEncryptedEvent.prototype.constructor", - "MediaError.prototype.code", - "MediaError.prototype.constructor", - "MediaError.prototype.message", - "MediaKeyMessageEvent.prototype.constructor", - "MediaKeyMessageEvent.prototype.message", - "MediaKeySession.prototype.close", - "MediaKeySession.prototype.closed", - "MediaKeySession.prototype.constructor", - "MediaKeySession.prototype.load", - "MediaKeySession.prototype.remove", - "MediaKeySession.prototype.sessionId", - "MediaKeySession.prototype.update", - "MediaKeyStatusMap.prototype.constructor", - "MediaKeyStatusMap.prototype.entries", - "MediaKeyStatusMap.prototype.forEach", - "MediaKeyStatusMap.prototype.get", - "MediaKeyStatusMap.prototype.has", - "MediaKeyStatusMap.prototype.keys", - "MediaKeyStatusMap.prototype.size", - "MediaKeyStatusMap.prototype.values", - "MediaKeySystemAccess.prototype.constructor", - "MediaKeys.prototype.constructor", - "MediaList.prototype.constructor", - "MediaList.prototype.item", - "MediaList.prototype.length", - "MediaList.prototype.toString", - "MediaMetadata.prototype.constructor", - "MediaMetadata.prototype.title", - "MediaQueryList.prototype.addListener", - "MediaQueryList.prototype.constructor", - "MediaQueryList.prototype.matches", - "MediaQueryListEvent.prototype.constructor", - "MediaQueryListEvent.prototype.matches", - "MediaRecorder.prototype.constructor", - "MediaRecorder.prototype.start", - "MediaRecorder.prototype.state", - "MediaRecorder.prototype.stop", - "MediaSession.prototype.constructor", - "MediaSettingsRange.prototype.constructor", - "MediaSettingsRange.prototype.max", - "MediaSettingsRange.prototype.min", - "MediaSource.prototype.constructor", - "MediaSource.prototype.duration", - "MediaSource.prototype.readyState", - "MediaStream.prototype.active", - "MediaStream.prototype.clone", - "MediaStream.prototype.constructor", - "MediaStream.prototype.id", - "MediaStreamAudioDestinationNode.prototype.constructor", - "MediaStreamAudioSourceNode.prototype.constructor", - "MediaStreamEvent.prototype.constructor", - "MediaStreamTrack.prototype.clone", - "MediaStreamTrack.prototype.constructor", - "MediaStreamTrack.prototype.enabled", - "MediaStreamTrack.prototype.id", - "MediaStreamTrack.prototype.label", - "MediaStreamTrack.prototype.readyState", - "MediaStreamTrack.prototype.stop", - "MediaStreamTrackEvent.prototype.constructor", - "MediaStreamTrackEvent.prototype.track", - "MessageChannel.prototype.constructor", - "MessageChannel.prototype.port1", - "MessageChannel.prototype.port2", - "MessageEvent.prototype.constructor", - "MessageEvent.prototype.data", - "MessageEvent.prototype.source", - "MessagePort.prototype.close", - "MessagePort.prototype.constructor", - "MessagePort.prototype.postMessage", - "MessagePort.prototype.start", - "MimeType.prototype.constructor", - "MimeType.prototype.description", - "MimeType.prototype.type", - "MimeTypeArray.prototype.constructor", - "MimeTypeArray.prototype.item", - "MimeTypeArray.prototype.length", - "MouseEvent.prototype.button", - "MouseEvent.prototype.clientX", - "MouseEvent.prototype.clientY", - "MouseEvent.prototype.constructor", - "MouseEvent.prototype.ctrlKey", - "MouseEvent.prototype.layerX", - "MouseEvent.prototype.layerY", - "MouseEvent.prototype.metaKey", - "MouseEvent.prototype.offsetX", - "MouseEvent.prototype.offsetY", - "MouseEvent.prototype.pageX", - "MouseEvent.prototype.pageY", - "MouseEvent.prototype.relatedTarget", - "MouseEvent.prototype.shiftKey", - "MouseEvent.prototype.x", - "MouseEvent.prototype.y", - "MutationEvent.prototype.constructor", - "MutationObserver.prototype.constructor", - "MutationObserver.prototype.disconnect", - "MutationObserver.prototype.observe", - "MutationRecord.prototype.constructor", - "MutationRecord.prototype.nextSibling", - "MutationRecord.prototype.oldValue", - "MutationRecord.prototype.previousSibling", - "MutationRecord.prototype.target", - "MutationRecord.prototype.type", - "NaN", - "NamedNodeMap.prototype.constructor", - "NamedNodeMap.prototype.item", - "NamedNodeMap.prototype.length", - "NavigationPreloadManager.prototype.constructor", - "NavigationPreloadManager.prototype.disable", - "NavigationPreloadManager.prototype.enable", - "NavigationPreloadManager.prototype.getState", - "Navigator.prototype.clipboard", - "Navigator.prototype.constructor", - "Navigator.prototype.language", - "Navigator.prototype.platform", - "Navigator.prototype.plugins", - "Navigator.prototype.storage", - "Navigator.prototype.userAgent", - "NetworkInformation.prototype.constructor", - "Node", - "Node.ELEMENT_NODE", - "Node.TEXT_NODE", - "Node.prototype.ELEMENT_NODE", - "Node.prototype.TEXT_NODE", - "Node.prototype.appendChild", - "Node.prototype.childNodes", - "Node.prototype.cloneNode", - "Node.prototype.constructor", - "Node.prototype.firstChild", - "Node.prototype.insertBefore", - "Node.prototype.nextSibling", - "Node.prototype.nodeName", - "Node.prototype.nodeType", - "Node.prototype.nodeValue", - "Node.prototype.ownerDocument", - "Node.prototype.parentElement", - "Node.prototype.parentNode", - "Node.prototype.previousSibling", - "Node.prototype.removeChild", - "Node.prototype.replaceChild", - "Node.prototype.textContent", - "NodeFilter", - "NodeFilter.FILTER_ACCEPT", - "NodeFilter.FILTER_REJECT", - "NodeFilter.SHOW_TEXT", - "NodeIterator.prototype.constructor", - "NodeIterator.prototype.detach", - "NodeIterator.prototype.filter", - "NodeIterator.prototype.nextNode", - "NodeIterator.prototype.root", - "NodeList.prototype.constructor", - "NodeList.prototype.entries", - "NodeList.prototype.item", - "NodeList.prototype.keys", - "NodeList.prototype.length", - "NodeList.prototype.values", - "Notification.prototype.actions", - "Notification.prototype.body", - "Notification.prototype.close", - "Notification.prototype.constructor", - "Notification.prototype.data", - "Notification.prototype.dir", - "Notification.prototype.icon", - "Notification.prototype.lang", - "Notification.prototype.onclick", - "Notification.prototype.timestamp", - "Notification.prototype.title", - "Number", - "Number.prototype.constructor", - "Number.prototype.toLocaleString", - "Number.prototype.toString", - "Number.prototype.valueOf", - "Object", - "Object.prototype", - "Object.prototype.constructor", - "Object.prototype.hasOwnProperty", - "Object.prototype.toLocaleString", - "Object.prototype.toString", - "Object.prototype.valueOf", - "OfflineAudioCompletionEvent.prototype.constructor", - "OfflineAudioContext.prototype.constructor", - "OfflineAudioContext.prototype.length", - "OffscreenCanvas.prototype.constructor", - "OffscreenCanvas.prototype.height", - "OffscreenCanvas.prototype.width", - "OffscreenCanvasRenderingContext2D.prototype.clip", - "OffscreenCanvasRenderingContext2D.prototype.constructor", - "OffscreenCanvasRenderingContext2D.prototype.direction", - "OffscreenCanvasRenderingContext2D.prototype.fill", - "OffscreenCanvasRenderingContext2D.prototype.filter", - "OffscreenCanvasRenderingContext2D.prototype.rect", - "OffscreenCanvasRenderingContext2D.prototype.restore", - "OffscreenCanvasRenderingContext2D.prototype.save", - "Option", - "Option.prototype.constructor", - "Option.prototype.disabled", - "Option.prototype.form", - "Option.prototype.index", - "Option.prototype.label", - "Option.prototype.text", - "Option.prototype.value", - "OrientationSensor.prototype.constructor", - "OscillatorNode.prototype.constructor", - "OscillatorNode.prototype.type", - "OverconstrainedError.prototype.constructor", - "OverconstrainedError.prototype.message", - "OverconstrainedError.prototype.name", - "PageTransitionEvent.prototype.constructor", - "PannerNode.prototype.constructor", - "PannerNode.prototype.setPosition", - "PasswordCredential.prototype.constructor", - "PasswordCredential.prototype.name", - "Path2D.prototype.constructor", - "Path2D.prototype.rect", - "PaymentAddress.prototype.constructor", - "PaymentAddress.prototype.toJSON", - "PaymentInstruments.prototype.clear", - "PaymentInstruments.prototype.constructor", - "PaymentInstruments.prototype.delete", - "PaymentInstruments.prototype.get", - "PaymentInstruments.prototype.has", - "PaymentInstruments.prototype.keys", - "PaymentInstruments.prototype.set", - "PaymentManager.prototype.constructor", - "PaymentRequest.prototype.abort", - "PaymentRequest.prototype.constructor", - "PaymentRequest.prototype.id", - "PaymentRequest.prototype.show", - "PaymentRequestUpdateEvent.prototype.constructor", - "PaymentResponse.prototype.constructor", - "PaymentResponse.prototype.details", - "PaymentResponse.prototype.toJSON", - "Performance.prototype.constructor", - "Performance.prototype.memory", - "Performance.prototype.now", - "Performance.prototype.toJSON", - "PerformanceEntry.prototype.constructor", - "PerformanceEntry.prototype.duration", - "PerformanceEntry.prototype.name", - "PerformanceEntry.prototype.toJSON", - "PerformanceLongTaskTiming.prototype.constructor", - "PerformanceLongTaskTiming.prototype.toJSON", - "PerformanceMark.prototype.constructor", - "PerformanceMeasure.prototype.constructor", - "PerformanceNavigation.prototype.constructor", - "PerformanceNavigation.prototype.toJSON", - "PerformanceNavigation.prototype.type", - "PerformanceNavigationTiming.prototype.constructor", - "PerformanceNavigationTiming.prototype.toJSON", - "PerformanceNavigationTiming.prototype.type", - "PerformanceObserver.prototype.constructor", - "PerformanceObserver.prototype.disconnect", - "PerformanceObserver.prototype.observe", - "PerformanceObserverEntryList.prototype.constructor", - "PerformancePaintTiming.prototype.constructor", - "PerformanceResourceTiming.prototype.constructor", - "PerformanceResourceTiming.prototype.toJSON", - "PerformanceServerTiming.prototype.constructor", - "PerformanceServerTiming.prototype.description", - "PerformanceServerTiming.prototype.duration", - "PerformanceServerTiming.prototype.name", - "PerformanceServerTiming.prototype.toJSON", - "PerformanceTiming.prototype.constructor", - "PerformanceTiming.prototype.toJSON", - "PeriodicWave.prototype.constructor", - "PermissionStatus.prototype.constructor", - "PermissionStatus.prototype.state", - "Permissions.prototype.constructor", - "Permissions.prototype.query", - "PhotoCapabilities.prototype.constructor", - "PictureInPictureWindow.prototype.constructor", - "PictureInPictureWindow.prototype.height", - "PictureInPictureWindow.prototype.width", - "Plugin.prototype.constructor", - "Plugin.prototype.description", - "Plugin.prototype.item", - "Plugin.prototype.length", - "Plugin.prototype.name", - "PluginArray.prototype.constructor", - "PluginArray.prototype.item", - "PluginArray.prototype.length", - "PointerEvent.prototype.constructor", - "PointerEvent.prototype.height", - "PointerEvent.prototype.width", - "PopStateEvent.prototype.constructor", - "PopStateEvent.prototype.state", - "Presentation.prototype.constructor", - "PresentationAvailability.prototype.constructor", - "PresentationAvailability.prototype.value", - "PresentationConnection.prototype.close", - "PresentationConnection.prototype.constructor", - "PresentationConnection.prototype.id", - "PresentationConnection.prototype.send", - "PresentationConnection.prototype.state", - "PresentationConnection.prototype.url", - "PresentationConnectionAvailableEvent.prototype.constructor", - "PresentationConnectionCloseEvent.prototype.constructor", - "PresentationConnectionCloseEvent.prototype.message", - "PresentationConnectionCloseEvent.prototype.reason", - "PresentationConnectionList.prototype.constructor", - "PresentationReceiver.prototype.constructor", - "PresentationRequest.prototype.constructor", - "PresentationRequest.prototype.start", - "ProcessingInstruction.prototype.constructor", - "ProcessingInstruction.prototype.target", - "ProgressEvent.prototype.constructor", - "ProgressEvent.prototype.loaded", - "Promise.all", - "Promise.prototype", - "Promise.prototype.catch", - "Promise.prototype.constructor", - "Promise.prototype.then", - "Promise.reject", - "Promise.resolve", - "PromiseRejectionEvent.prototype.constructor", - "PromiseRejectionEvent.prototype.promise", - "PromiseRejectionEvent.prototype.reason", - "Proxy", - "PublicKeyCredential.prototype.constructor", - "PushManager.prototype.constructor", - "PushSubscription.prototype.constructor", - "PushSubscription.prototype.options", - "PushSubscription.prototype.toJSON", - "PushSubscriptionOptions.prototype.constructor", - "RTCCertificate.prototype.constructor", - "RTCDTMFSender.prototype.constructor", - "RTCDTMFToneChangeEvent.prototype.constructor", - "RTCDataChannel.prototype.close", - "RTCDataChannel.prototype.constructor", - "RTCDataChannel.prototype.id", - "RTCDataChannel.prototype.label", - "RTCDataChannel.prototype.protocol", - "RTCDataChannel.prototype.readyState", - "RTCDataChannel.prototype.send", - "RTCDataChannelEvent.prototype.constructor", - "RTCDtlsTransport.prototype.constructor", - "RTCDtlsTransport.prototype.state", - "RTCError.prototype.constructor", - "RTCErrorEvent.prototype.constructor", - "RTCErrorEvent.prototype.error", - "RTCIceCandidate.prototype.address", - "RTCIceCandidate.prototype.constructor", - "RTCIceCandidate.prototype.port", - "RTCIceCandidate.prototype.protocol", - "RTCIceCandidate.prototype.toJSON", - "RTCIceCandidate.prototype.type", - "RTCIceTransport.prototype.constructor", - "RTCIceTransport.prototype.state", - "RTCPeerConnection.prototype.close", - "RTCPeerConnection.prototype.constructor", - "RTCPeerConnectionIceEvent.prototype.constructor", - "RTCRtpReceiver.prototype.constructor", - "RTCRtpReceiver.prototype.track", - "RTCRtpSender.prototype.constructor", - "RTCRtpSender.prototype.track", - "RTCRtpTransceiver.prototype.constructor", - "RTCRtpTransceiver.prototype.direction", - "RTCSessionDescription.prototype.constructor", - "RTCSessionDescription.prototype.toJSON", - "RTCSessionDescription.prototype.type", - "RTCStatsReport.prototype.constructor", - "RTCStatsReport.prototype.entries", - "RTCStatsReport.prototype.forEach", - "RTCStatsReport.prototype.get", - "RTCStatsReport.prototype.has", - "RTCStatsReport.prototype.keys", - "RTCStatsReport.prototype.size", - "RTCStatsReport.prototype.values", - "RTCTrackEvent.prototype.constructor", - "RTCTrackEvent.prototype.track", - "RadioNodeList.prototype.constructor", - "RadioNodeList.prototype.value", - "Range.prototype.collapse", - "Range.prototype.constructor", - "Range.prototype.detach", - "Range.prototype.getBoundingClientRect", - "Range.prototype.getClientRects", - "Range.prototype.toString", - "RangeError", - "RangeError.prototype.constructor", - "RangeError.prototype.message", - "RangeError.prototype.name", - "RangeError.prototype.toString", - "ReadableStream.prototype.cancel", - "ReadableStream.prototype.constructor", - "RegExp", - "RegExp.prototype.compile", - "RegExp.prototype.constructor", - "RegExp.prototype.exec", - "RegExp.prototype.global", - "RegExp.prototype.ignoreCase", - "RegExp.prototype.multiline", - "RegExp.prototype.source", - "RegExp.prototype.test", - "RegExp.prototype.toString", - "RelativeOrientationSensor.prototype.constructor", - "RemotePlayback.prototype.constructor", - "RemotePlayback.prototype.prompt", - "RemotePlayback.prototype.state", - "ReportingObserver.prototype.constructor", - "ReportingObserver.prototype.disconnect", - "ReportingObserver.prototype.observe", - "Request.prototype.cache", - "Request.prototype.clone", - "Request.prototype.constructor", - "Request.prototype.method", - "Request.prototype.redirect", - "Request.prototype.referrer", - "Request.prototype.text", - "Request.prototype.url", - "ResizeObserver.prototype.constructor", - "ResizeObserver.prototype.disconnect", - "ResizeObserver.prototype.observe", - "ResizeObserver.prototype.unobserve", - "ResizeObserverEntry.prototype.constructor", - "ResizeObserverEntry.prototype.target", - "Response.prototype.body", - "Response.prototype.clone", - "Response.prototype.constructor", - "Response.prototype.ok", - "Response.prototype.status", - "Response.prototype.statusText", - "Response.prototype.text", - "Response.prototype.type", - "Response.prototype.url", - "SVGAElement.prototype.constructor", - "SVGAElement.prototype.href", - "SVGAElement.prototype.target", - "SVGAngle.prototype.constructor", - "SVGAngle.prototype.value", - "SVGAnimateElement.prototype.constructor", - "SVGAnimateMotionElement.prototype.constructor", - "SVGAnimateTransformElement.prototype.constructor", - "SVGAnimatedAngle.prototype.constructor", - "SVGAnimatedBoolean.prototype.constructor", - "SVGAnimatedEnumeration.prototype.constructor", - "SVGAnimatedInteger.prototype.constructor", - "SVGAnimatedLength.prototype.constructor", - "SVGAnimatedLengthList.prototype.constructor", - "SVGAnimatedNumber.prototype.constructor", - "SVGAnimatedNumberList.prototype.constructor", - "SVGAnimatedPreserveAspectRatio.prototype.constructor", - "SVGAnimatedRect.prototype.constructor", - "SVGAnimatedString.prototype.constructor", - "SVGAnimatedTransformList.prototype.constructor", - "SVGAnimationElement.prototype.constructor", - "SVGCircleElement.prototype.constructor", - "SVGClipPathElement.prototype.constructor", - "SVGComponentTransferFunctionElement.prototype.constructor", - "SVGComponentTransferFunctionElement.prototype.offset", - "SVGComponentTransferFunctionElement.prototype.type", - "SVGDefsElement.prototype.constructor", - "SVGDescElement.prototype.constructor", - "SVGDiscardElement.prototype.constructor", - "SVGElement.prototype.blur", - "SVGElement.prototype.className", - "SVGElement.prototype.constructor", - "SVGElement.prototype.dataset", - "SVGElement.prototype.focus", - "SVGElement.prototype.onclick", - "SVGElement.prototype.onkeypress", - "SVGElement.prototype.onmousedown", - "SVGElement.prototype.onmousemove", - "SVGElement.prototype.onmouseover", - "SVGElement.prototype.onsubmit", - "SVGElement.prototype.style", - "SVGEllipseElement.prototype.constructor", - "SVGFEBlendElement.prototype.constructor", - "SVGFEBlendElement.prototype.height", - "SVGFEBlendElement.prototype.result", - "SVGFEBlendElement.prototype.width", - "SVGFEBlendElement.prototype.x", - "SVGFEBlendElement.prototype.y", - "SVGFEColorMatrixElement.prototype.constructor", - "SVGFEColorMatrixElement.prototype.height", - "SVGFEColorMatrixElement.prototype.result", - "SVGFEColorMatrixElement.prototype.type", - "SVGFEColorMatrixElement.prototype.values", - "SVGFEColorMatrixElement.prototype.width", - "SVGFEColorMatrixElement.prototype.x", - "SVGFEColorMatrixElement.prototype.y", - "SVGFEComponentTransferElement.prototype.constructor", - "SVGFEComponentTransferElement.prototype.height", - "SVGFEComponentTransferElement.prototype.result", - "SVGFEComponentTransferElement.prototype.width", - "SVGFEComponentTransferElement.prototype.x", - "SVGFEComponentTransferElement.prototype.y", - "SVGFECompositeElement.prototype.constructor", - "SVGFECompositeElement.prototype.height", - "SVGFECompositeElement.prototype.result", - "SVGFECompositeElement.prototype.width", - "SVGFECompositeElement.prototype.x", - "SVGFECompositeElement.prototype.y", - "SVGFEConvolveMatrixElement.prototype.constructor", - "SVGFEConvolveMatrixElement.prototype.height", - "SVGFEConvolveMatrixElement.prototype.result", - "SVGFEConvolveMatrixElement.prototype.width", - "SVGFEConvolveMatrixElement.prototype.x", - "SVGFEConvolveMatrixElement.prototype.y", - "SVGFEDiffuseLightingElement.prototype.constructor", - "SVGFEDiffuseLightingElement.prototype.height", - "SVGFEDiffuseLightingElement.prototype.result", - "SVGFEDiffuseLightingElement.prototype.width", - "SVGFEDiffuseLightingElement.prototype.x", - "SVGFEDiffuseLightingElement.prototype.y", - "SVGFEDisplacementMapElement.prototype.constructor", - "SVGFEDisplacementMapElement.prototype.height", - "SVGFEDisplacementMapElement.prototype.result", - "SVGFEDisplacementMapElement.prototype.width", - "SVGFEDisplacementMapElement.prototype.x", - "SVGFEDisplacementMapElement.prototype.y", - "SVGFEDistantLightElement.prototype.constructor", - "SVGFEDropShadowElement.prototype.constructor", - "SVGFEDropShadowElement.prototype.height", - "SVGFEDropShadowElement.prototype.result", - "SVGFEDropShadowElement.prototype.width", - "SVGFEDropShadowElement.prototype.x", - "SVGFEDropShadowElement.prototype.y", - "SVGFEFloodElement.prototype.constructor", - "SVGFEFloodElement.prototype.height", - "SVGFEFloodElement.prototype.result", - "SVGFEFloodElement.prototype.width", - "SVGFEFloodElement.prototype.x", - "SVGFEFloodElement.prototype.y", - "SVGFEFuncAElement.prototype.constructor", - "SVGFEFuncBElement.prototype.constructor", - "SVGFEFuncGElement.prototype.constructor", - "SVGFEFuncRElement.prototype.constructor", - "SVGFEGaussianBlurElement.prototype.constructor", - "SVGFEGaussianBlurElement.prototype.height", - "SVGFEGaussianBlurElement.prototype.result", - "SVGFEGaussianBlurElement.prototype.width", - "SVGFEGaussianBlurElement.prototype.x", - "SVGFEGaussianBlurElement.prototype.y", - "SVGFEImageElement.prototype.constructor", - "SVGFEImageElement.prototype.height", - "SVGFEImageElement.prototype.href", - "SVGFEImageElement.prototype.result", - "SVGFEImageElement.prototype.width", - "SVGFEImageElement.prototype.x", - "SVGFEImageElement.prototype.y", - "SVGFEMergeElement.prototype.constructor", - "SVGFEMergeElement.prototype.height", - "SVGFEMergeElement.prototype.result", - "SVGFEMergeElement.prototype.width", - "SVGFEMergeElement.prototype.x", - "SVGFEMergeElement.prototype.y", - "SVGFEMergeNodeElement.prototype.constructor", - "SVGFEMorphologyElement.prototype.constructor", - "SVGFEMorphologyElement.prototype.height", - "SVGFEMorphologyElement.prototype.result", - "SVGFEMorphologyElement.prototype.width", - "SVGFEMorphologyElement.prototype.x", - "SVGFEMorphologyElement.prototype.y", - "SVGFEOffsetElement.prototype.constructor", - "SVGFEOffsetElement.prototype.height", - "SVGFEOffsetElement.prototype.result", - "SVGFEOffsetElement.prototype.width", - "SVGFEOffsetElement.prototype.x", - "SVGFEOffsetElement.prototype.y", - "SVGFEPointLightElement.prototype.constructor", - "SVGFEPointLightElement.prototype.x", - "SVGFEPointLightElement.prototype.y", - "SVGFESpecularLightingElement.prototype.constructor", - "SVGFESpecularLightingElement.prototype.height", - "SVGFESpecularLightingElement.prototype.result", - "SVGFESpecularLightingElement.prototype.width", - "SVGFESpecularLightingElement.prototype.x", - "SVGFESpecularLightingElement.prototype.y", - "SVGFESpotLightElement.prototype.constructor", - "SVGFESpotLightElement.prototype.x", - "SVGFESpotLightElement.prototype.y", - "SVGFETileElement.prototype.constructor", - "SVGFETileElement.prototype.height", - "SVGFETileElement.prototype.result", - "SVGFETileElement.prototype.width", - "SVGFETileElement.prototype.x", - "SVGFETileElement.prototype.y", - "SVGFETurbulenceElement.prototype.constructor", - "SVGFETurbulenceElement.prototype.height", - "SVGFETurbulenceElement.prototype.result", - "SVGFETurbulenceElement.prototype.type", - "SVGFETurbulenceElement.prototype.width", - "SVGFETurbulenceElement.prototype.x", - "SVGFETurbulenceElement.prototype.y", - "SVGFilterElement.prototype.constructor", - "SVGFilterElement.prototype.height", - "SVGFilterElement.prototype.href", - "SVGFilterElement.prototype.width", - "SVGFilterElement.prototype.x", - "SVGFilterElement.prototype.y", - "SVGForeignObjectElement.prototype.constructor", - "SVGForeignObjectElement.prototype.height", - "SVGForeignObjectElement.prototype.width", - "SVGForeignObjectElement.prototype.x", - "SVGForeignObjectElement.prototype.y", - "SVGGElement.prototype.constructor", - "SVGGeometryElement.prototype.constructor", - "SVGGradientElement.prototype.constructor", - "SVGGradientElement.prototype.href", - "SVGGraphicsElement.prototype.constructor", - "SVGImageElement.prototype.constructor", - "SVGImageElement.prototype.decode", - "SVGImageElement.prototype.height", - "SVGImageElement.prototype.href", - "SVGImageElement.prototype.width", - "SVGImageElement.prototype.x", - "SVGImageElement.prototype.y", - "SVGLength.prototype.constructor", - "SVGLength.prototype.value", - "SVGLengthList.prototype.clear", - "SVGLengthList.prototype.constructor", - "SVGLengthList.prototype.getItem", - "SVGLengthList.prototype.initialize", - "SVGLengthList.prototype.length", - "SVGLengthList.prototype.removeItem", - "SVGLineElement.prototype.constructor", - "SVGLinearGradientElement.prototype.constructor", - "SVGMPathElement.prototype.constructor", - "SVGMPathElement.prototype.href", - "SVGMarkerElement.prototype.constructor", - "SVGMaskElement.prototype.constructor", - "SVGMaskElement.prototype.height", - "SVGMaskElement.prototype.width", - "SVGMaskElement.prototype.x", - "SVGMaskElement.prototype.y", - "SVGMatrix.prototype.a", - "SVGMatrix.prototype.b", - "SVGMatrix.prototype.c", - "SVGMatrix.prototype.constructor", - "SVGMatrix.prototype.f", - "SVGMetadataElement.prototype.constructor", - "SVGNumber.prototype.constructor", - "SVGNumber.prototype.value", - "SVGNumberList.prototype.clear", - "SVGNumberList.prototype.constructor", - "SVGNumberList.prototype.getItem", - "SVGNumberList.prototype.initialize", - "SVGNumberList.prototype.length", - "SVGNumberList.prototype.removeItem", - "SVGPathElement.prototype.constructor", - "SVGPatternElement.prototype.constructor", - "SVGPatternElement.prototype.height", - "SVGPatternElement.prototype.href", - "SVGPatternElement.prototype.width", - "SVGPatternElement.prototype.x", - "SVGPatternElement.prototype.y", - "SVGPoint.prototype.constructor", - "SVGPoint.prototype.x", - "SVGPoint.prototype.y", - "SVGPointList.prototype.clear", - "SVGPointList.prototype.constructor", - "SVGPointList.prototype.getItem", - "SVGPointList.prototype.initialize", - "SVGPointList.prototype.length", - "SVGPointList.prototype.removeItem", - "SVGPolygonElement.prototype.constructor", - "SVGPolylineElement.prototype.constructor", - "SVGPreserveAspectRatio.prototype.align", - "SVGPreserveAspectRatio.prototype.constructor", - "SVGRadialGradientElement.prototype.constructor", - "SVGRect.prototype.constructor", - "SVGRect.prototype.height", - "SVGRect.prototype.width", - "SVGRect.prototype.x", - "SVGRect.prototype.y", - "SVGRectElement.prototype.constructor", - "SVGRectElement.prototype.height", - "SVGRectElement.prototype.width", - "SVGRectElement.prototype.x", - "SVGRectElement.prototype.y", - "SVGSVGElement.prototype.constructor", - "SVGSVGElement.prototype.getElementById", - "SVGSVGElement.prototype.height", - "SVGSVGElement.prototype.width", - "SVGSVGElement.prototype.x", - "SVGSVGElement.prototype.y", - "SVGScriptElement.prototype.constructor", - "SVGScriptElement.prototype.href", - "SVGScriptElement.prototype.type", - "SVGSetElement.prototype.constructor", - "SVGStopElement.prototype.constructor", - "SVGStopElement.prototype.offset", - "SVGStringList.prototype.clear", - "SVGStringList.prototype.constructor", - "SVGStringList.prototype.getItem", - "SVGStringList.prototype.initialize", - "SVGStringList.prototype.length", - "SVGStringList.prototype.removeItem", - "SVGStyleElement.prototype.constructor", - "SVGStyleElement.prototype.disabled", - "SVGStyleElement.prototype.title", - "SVGStyleElement.prototype.type", - "SVGSwitchElement.prototype.constructor", - "SVGSymbolElement.prototype.constructor", - "SVGTSpanElement.prototype.constructor", - "SVGTextContentElement.prototype.constructor", - "SVGTextElement.prototype.constructor", - "SVGTextPathElement.prototype.constructor", - "SVGTextPathElement.prototype.href", - "SVGTextPathElement.prototype.method", - "SVGTextPositioningElement.prototype.constructor", - "SVGTextPositioningElement.prototype.x", - "SVGTextPositioningElement.prototype.y", - "SVGTitleElement.prototype.constructor", - "SVGTransform.prototype.constructor", - "SVGTransform.prototype.type", - "SVGTransformList.prototype.clear", - "SVGTransformList.prototype.constructor", - "SVGTransformList.prototype.getItem", - "SVGTransformList.prototype.initialize", - "SVGTransformList.prototype.length", - "SVGTransformList.prototype.removeItem", - "SVGUnitTypes.prototype.constructor", - "SVGUseElement.prototype.constructor", - "SVGUseElement.prototype.height", - "SVGUseElement.prototype.href", - "SVGUseElement.prototype.width", - "SVGUseElement.prototype.x", - "SVGUseElement.prototype.y", - "SVGViewElement.prototype.constructor", - "Screen.prototype.constructor", - "Screen.prototype.height", - "Screen.prototype.orientation", - "Screen.prototype.width", - "ScreenOrientation.prototype.constructor", - "ScreenOrientation.prototype.lock", - "ScreenOrientation.prototype.type", - "ScriptProcessorNode.prototype.constructor", - "SecurityPolicyViolationEvent.prototype.constructor", - "SecurityPolicyViolationEvent.prototype.lineNumber", - "SecurityPolicyViolationEvent.prototype.referrer", - "Selection.prototype.addRange", - "Selection.prototype.anchorNode", - "Selection.prototype.collapse", - "Selection.prototype.constructor", - "Selection.prototype.empty", - "Selection.prototype.extend", - "Selection.prototype.focusNode", - "Selection.prototype.getRangeAt", - "Selection.prototype.rangeCount", - "Selection.prototype.removeAllRanges", - "Selection.prototype.selectAllChildren", - "Selection.prototype.setPosition", - "Selection.prototype.toString", - "Selection.prototype.type", - "Sensor.prototype.constructor", - "Sensor.prototype.start", - "Sensor.prototype.stop", - "Sensor.prototype.timestamp", - "SensorErrorEvent.prototype.constructor", - "SensorErrorEvent.prototype.error", - "ServiceWorker.prototype.constructor", - "ServiceWorker.prototype.postMessage", - "ServiceWorker.prototype.state", - "ServiceWorkerContainer.prototype.constructor", - "ServiceWorkerContainer.prototype.ready", - "ServiceWorkerContainer.prototype.register", - "ServiceWorkerRegistration.prototype.active", - "ServiceWorkerRegistration.prototype.constructor", - "ServiceWorkerRegistration.prototype.update", - "Set.prototype.add", - "Set.prototype.clear", - "Set.prototype.constructor", - "Set.prototype.delete", - "Set.prototype.entries", - "Set.prototype.forEach", - "Set.prototype.has", - "Set.prototype.keys", - "Set.prototype.size", - "Set.prototype.values", - "ShadowRoot.prototype.activeElement", - "ShadowRoot.prototype.constructor", - "ShadowRoot.prototype.getSelection", - "ShadowRoot.prototype.host", - "ShadowRoot.prototype.innerHTML", - "SharedWorker.prototype.constructor", - "SharedWorker.prototype.port", - "SourceBuffer.prototype.abort", - "SourceBuffer.prototype.constructor", - "SourceBuffer.prototype.remove", - "SourceBufferList.prototype.constructor", - "SourceBufferList.prototype.length", - "SpeechSynthesisErrorEvent.prototype.constructor", - "SpeechSynthesisErrorEvent.prototype.error", - "SpeechSynthesisEvent.prototype.constructor", - "SpeechSynthesisEvent.prototype.name", - "SpeechSynthesisUtterance.prototype.constructor", - "SpeechSynthesisUtterance.prototype.lang", - "SpeechSynthesisUtterance.prototype.text", - "StaticRange.prototype.constructor", - "StereoPannerNode.prototype.constructor", - "Storage.prototype.clear", - "Storage.prototype.constructor", - "Storage.prototype.getItem", - "Storage.prototype.key", - "Storage.prototype.length", - "Storage.prototype.removeItem", - "Storage.prototype.setItem", - "StorageEvent.prototype.constructor", - "StorageEvent.prototype.key", - "StorageEvent.prototype.oldValue", - "StorageEvent.prototype.url", - "StorageManager.prototype.constructor", - "String", - "String.fromCharCode", - "String.prototype", - "String.prototype.charAt", - "String.prototype.charCodeAt", - "String.prototype.concat", - "String.prototype.constructor", - "String.prototype.indexOf", - "String.prototype.lastIndexOf", - "String.prototype.length", - "String.prototype.match", - "String.prototype.replace", - "String.prototype.search", - "String.prototype.slice", - "String.prototype.split", - "String.prototype.substr", - "String.prototype.substring", - "String.prototype.toLowerCase", - "String.prototype.toString", - "String.prototype.toUpperCase", - "String.prototype.valueOf", - "StylePropertyMap.prototype.append", - "StylePropertyMap.prototype.clear", - "StylePropertyMap.prototype.constructor", - "StylePropertyMap.prototype.delete", - "StylePropertyMap.prototype.set", - "StylePropertyMapReadOnly.prototype.constructor", - "StylePropertyMapReadOnly.prototype.entries", - "StylePropertyMapReadOnly.prototype.forEach", - "StylePropertyMapReadOnly.prototype.get", - "StylePropertyMapReadOnly.prototype.has", - "StylePropertyMapReadOnly.prototype.keys", - "StylePropertyMapReadOnly.prototype.size", - "StylePropertyMapReadOnly.prototype.values", - "StyleSheet.prototype.constructor", - "StyleSheet.prototype.disabled", - "StyleSheet.prototype.href", - "StyleSheet.prototype.title", - "StyleSheet.prototype.type", - "StyleSheetList.prototype.constructor", - "StyleSheetList.prototype.item", - "StyleSheetList.prototype.length", - "SubtleCrypto.prototype.constructor", - "SubtleCrypto.prototype.digest", - "Symbol.prototype", - "Symbol.prototype.constructor", - "Symbol.prototype.toString", - "Symbol.prototype.valueOf", - "SyntaxError", - "SyntaxError.prototype.constructor", - "SyntaxError.prototype.message", - "SyntaxError.prototype.name", - "SyntaxError.prototype.toString", - "TaskAttributionTiming.prototype.constructor", - "TaskAttributionTiming.prototype.toJSON", - "Text.prototype.constructor", - "Text.prototype.splitText", - "TextDecoder.prototype.constructor", - "TextDecoder.prototype.decode", - "TextDecoderStream.prototype.constructor", - "TextEncoder.prototype.constructor", - "TextEncoder.prototype.encode", - "TextEncoderStream.prototype.constructor", - "TextEvent.prototype.constructor", - "TextEvent.prototype.data", - "TextMetrics.prototype.constructor", - "TextMetrics.prototype.width", - "TextTrack.prototype.constructor", - "TextTrack.prototype.id", - "TextTrack.prototype.label", - "TextTrack.prototype.language", - "TextTrackCue.prototype.constructor", - "TextTrackCue.prototype.id", - "TextTrackCue.prototype.track", - "TextTrackCueList.prototype.constructor", - "TextTrackCueList.prototype.length", - "TextTrackList.prototype.constructor", - "TextTrackList.prototype.length", - "TimeRanges.prototype.constructor", - "TimeRanges.prototype.end", - "TimeRanges.prototype.length", - "TimeRanges.prototype.start", - "Touch.prototype.clientX", - "Touch.prototype.clientY", - "Touch.prototype.constructor", - "Touch.prototype.pageX", - "Touch.prototype.pageY", - "Touch.prototype.target", - "TouchEvent.prototype.constructor", - "TouchEvent.prototype.ctrlKey", - "TouchEvent.prototype.metaKey", - "TouchEvent.prototype.shiftKey", - "TouchList.prototype.constructor", - "TouchList.prototype.item", - "TouchList.prototype.length", - "TrackEvent.prototype.constructor", - "TrackEvent.prototype.track", - "TransformStream.prototype.constructor", - "TransitionEvent.prototype.constructor", - "TreeWalker.prototype.constructor", - "TreeWalker.prototype.filter", - "TreeWalker.prototype.firstChild", - "TreeWalker.prototype.nextNode", - "TreeWalker.prototype.nextSibling", - "TreeWalker.prototype.parentNode", - "TreeWalker.prototype.previousSibling", - "TreeWalker.prototype.root", - "TypeError", - "TypeError.prototype.constructor", - "TypeError.prototype.message", - "TypeError.prototype.name", - "TypeError.prototype.toString", - "UIEvent.prototype.constructor", - "UIEvent.prototype.detail", - "UIEvent.prototype.which", - "URL.createObjectURL", - "URL.prototype.constructor", - "URL.prototype.hash", - "URL.prototype.host", - "URL.prototype.hostname", - "URL.prototype.href", - "URL.prototype.pathname", - "URL.prototype.port", - "URL.prototype.protocol", - "URL.prototype.search", - "URL.prototype.searchParams", - "URL.prototype.toString", - "URL.prototype.username", - "URLSearchParams.prototype.append", - "URLSearchParams.prototype.constructor", - "URLSearchParams.prototype.delete", - "URLSearchParams.prototype.entries", - "URLSearchParams.prototype.forEach", - "URLSearchParams.prototype.get", - "URLSearchParams.prototype.has", - "URLSearchParams.prototype.keys", - "URLSearchParams.prototype.set", - "URLSearchParams.prototype.sort", - "URLSearchParams.prototype.toString", - "URLSearchParams.prototype.values", - "Uint16Array.prototype.constructor", - "Uint16Array.prototype.copyWithin", - "Uint16Array.prototype.entries", - "Uint16Array.prototype.fill", - "Uint16Array.prototype.filter", - "Uint16Array.prototype.find", - "Uint16Array.prototype.forEach", - "Uint16Array.prototype.includes", - "Uint16Array.prototype.indexOf", - "Uint16Array.prototype.join", - "Uint16Array.prototype.keys", - "Uint16Array.prototype.lastIndexOf", - "Uint16Array.prototype.map", - "Uint16Array.prototype.reduce", - "Uint16Array.prototype.reverse", - "Uint16Array.prototype.set", - "Uint16Array.prototype.slice", - "Uint16Array.prototype.some", - "Uint16Array.prototype.sort", - "Uint16Array.prototype.subarray", - "Uint16Array.prototype.toLocaleString", - "Uint16Array.prototype.toString", - "Uint16Array.prototype.values", - "Uint32Array.prototype.constructor", - "Uint32Array.prototype.copyWithin", - "Uint32Array.prototype.entries", - "Uint32Array.prototype.fill", - "Uint32Array.prototype.filter", - "Uint32Array.prototype.find", - "Uint32Array.prototype.forEach", - "Uint32Array.prototype.includes", - "Uint32Array.prototype.indexOf", - "Uint32Array.prototype.join", - "Uint32Array.prototype.keys", - "Uint32Array.prototype.lastIndexOf", - "Uint32Array.prototype.map", - "Uint32Array.prototype.reduce", - "Uint32Array.prototype.reverse", - "Uint32Array.prototype.set", - "Uint32Array.prototype.slice", - "Uint32Array.prototype.some", - "Uint32Array.prototype.sort", - "Uint32Array.prototype.subarray", - "Uint32Array.prototype.toLocaleString", - "Uint32Array.prototype.toString", - "Uint32Array.prototype.values", - "Uint8Array.prototype", - "Uint8Array.prototype.constructor", - "Uint8Array.prototype.copyWithin", - "Uint8Array.prototype.entries", - "Uint8Array.prototype.fill", - "Uint8Array.prototype.filter", - "Uint8Array.prototype.find", - "Uint8Array.prototype.forEach", - "Uint8Array.prototype.includes", - "Uint8Array.prototype.indexOf", - "Uint8Array.prototype.join", - "Uint8Array.prototype.keys", - "Uint8Array.prototype.lastIndexOf", - "Uint8Array.prototype.map", - "Uint8Array.prototype.reduce", - "Uint8Array.prototype.reverse", - "Uint8Array.prototype.set", - "Uint8Array.prototype.slice", - "Uint8Array.prototype.some", - "Uint8Array.prototype.sort", - "Uint8Array.prototype.subarray", - "Uint8Array.prototype.toLocaleString", - "Uint8Array.prototype.toString", - "Uint8Array.prototype.values", - "Uint8ClampedArray.prototype.constructor", - "Uint8ClampedArray.prototype.copyWithin", - "Uint8ClampedArray.prototype.entries", - "Uint8ClampedArray.prototype.fill", - "Uint8ClampedArray.prototype.filter", - "Uint8ClampedArray.prototype.find", - "Uint8ClampedArray.prototype.forEach", - "Uint8ClampedArray.prototype.includes", - "Uint8ClampedArray.prototype.indexOf", - "Uint8ClampedArray.prototype.join", - "Uint8ClampedArray.prototype.keys", - "Uint8ClampedArray.prototype.lastIndexOf", - "Uint8ClampedArray.prototype.map", - "Uint8ClampedArray.prototype.reduce", - "Uint8ClampedArray.prototype.reverse", - "Uint8ClampedArray.prototype.set", - "Uint8ClampedArray.prototype.slice", - "Uint8ClampedArray.prototype.some", - "Uint8ClampedArray.prototype.sort", - "Uint8ClampedArray.prototype.subarray", - "Uint8ClampedArray.prototype.toLocaleString", - "Uint8ClampedArray.prototype.toString", - "Uint8ClampedArray.prototype.values", - "UserActivation.prototype.constructor", - "VTTCue.prototype.align", - "VTTCue.prototype.constructor", - "VTTCue.prototype.line", - "VTTCue.prototype.position", - "VTTCue.prototype.size", - "VTTCue.prototype.text", - "ValidityState.prototype.constructor", - "VisualViewport.prototype.constructor", - "VisualViewport.prototype.height", - "VisualViewport.prototype.offsetLeft", - "VisualViewport.prototype.offsetTop", - "VisualViewport.prototype.width", - "WaveShaperNode.prototype.constructor", - "WeakMap.prototype.constructor", - "WeakMap.prototype.delete", - "WeakMap.prototype.get", - "WeakMap.prototype.has", - "WeakMap.prototype.set", - "WeakSet.prototype.add", - "WeakSet.prototype.constructor", - "WeakSet.prototype.delete", - "WeakSet.prototype.has", - "WebAssembly", - "WebAssembly.compile", - "WebAssembly.instantiate", - "WebGL2RenderingContext.prototype.clear", - "WebGL2RenderingContext.prototype.constructor", - "WebGL2RenderingContext.prototype.disable", - "WebGL2RenderingContext.prototype.enable", - "WebGL2RenderingContext.prototype.finish", - "WebGL2RenderingContext.prototype.hint", - "WebGL2RenderingContext.prototype.isBuffer", - "WebGLActiveInfo.prototype.constructor", - "WebGLActiveInfo.prototype.name", - "WebGLActiveInfo.prototype.size", - "WebGLActiveInfo.prototype.type", - "WebGLBuffer.prototype.constructor", - "WebGLContextEvent.prototype.constructor", - "WebGLFramebuffer.prototype.constructor", - "WebGLProgram.prototype.constructor", - "WebGLQuery.prototype.constructor", - "WebGLRenderbuffer.prototype.constructor", - "WebGLRenderingContext.prototype.clear", - "WebGLRenderingContext.prototype.constructor", - "WebGLRenderingContext.prototype.disable", - "WebGLRenderingContext.prototype.enable", - "WebGLRenderingContext.prototype.finish", - "WebGLRenderingContext.prototype.hint", - "WebGLRenderingContext.prototype.isBuffer", - "WebGLSampler.prototype.constructor", - "WebGLShader.prototype.constructor", - "WebGLShaderPrecisionFormat.prototype.constructor", - "WebGLSync.prototype.constructor", - "WebGLTexture.prototype.constructor", - "WebGLTransformFeedback.prototype.constructor", - "WebGLUniformLocation.prototype.constructor", - "WebGLVertexArrayObject.prototype.constructor", - "WebSocket.prototype.OPEN", - "WebSocket.prototype.close", - "WebSocket.prototype.constructor", - "WebSocket.prototype.protocol", - "WebSocket.prototype.readyState", - "WebSocket.prototype.send", - "WebSocket.prototype.url", - "WheelEvent.prototype.constructor", - "Window.prototype.constructor", - "Worker.prototype.constructor", - "Worker.prototype.postMessage", - "Worklet.prototype.constructor", - "WritableStream.prototype.abort", - "WritableStream.prototype.constructor", - "XMLDocument.prototype.constructor", - "XMLHttpRequest.prototype", - "XMLHttpRequest.prototype.abort", - "XMLHttpRequest.prototype.constructor", - "XMLHttpRequest.prototype.getAllResponseHeaders", - "XMLHttpRequest.prototype.getResponseHeader", - "XMLHttpRequest.prototype.open", - "XMLHttpRequest.prototype.readyState", - "XMLHttpRequest.prototype.responseText", - "XMLHttpRequest.prototype.send", - "XMLHttpRequest.prototype.setRequestHeader", - "XMLHttpRequest.prototype.status", - "XMLHttpRequest.prototype.statusText", - "XMLHttpRequest.prototype.timeout", - "XMLHttpRequestEventTarget.prototype.constructor", - "XMLHttpRequestUpload.prototype.constructor", - "XMLSerializer.prototype.constructor", - "XPathEvaluator.prototype.constructor", - "XPathEvaluator.prototype.evaluate", - "XPathExpression.prototype.constructor", - "XPathExpression.prototype.evaluate", - "XPathResult.prototype.constructor", - "XSLTProcessor.prototype.constructor", - "alert", - "announceAccessibleMessage.prototype.constructor", - "appendParam.prototype.constructor", - "assert.prototype.constructor", - "assertInstanceof.prototype.constructor", - "assertNotReached.prototype.constructor", - "btoa", - "clearInterval", - "clearTimeout", - "createElementWithClassName.prototype.constructor", - "crypto", - "decodeURI", - "decodeURIComponent", - "disableTextSelectAndDrag.prototype.constructor", - "document.location", - "elide.prototype.constructor", - "encodeURI", - "encodeURIComponent", - "ensureTransitionEndEvent.prototype.constructor", - "eval", - "findAncestor.prototype.constructor", - "findAncestorByClass.prototype.constructor", - "getDeepActiveElement.prototype.constructor", - "getRequiredElement.prototype.constructor", - "getSVGElement.prototype.constructor", - "getUrlForCss.prototype.constructor", - "hasKeyModifiers.prototype.constructor", - "history", - "indexedDB", - "isFinite", - "isNaN", - "isRTL.prototype.constructor", - "isTextInputElement.prototype.constructor", - "listenOnce.prototype.constructor", - "location", - "location.hash", - "location.host", - "location.hostname", - "location.href", - "location.pathname", - "location.port", - "location.protocol", - "location.reload", - "location.replace", - "location.search", - "navigator", - "openDatabase", - "parent", - "parseFloat", - "parseInt", - "parseQueryParams.prototype.constructor", - "prompt", - "queryRequiredElement.prototype.constructor", - "quoteString.prototype.constructor", - "recomputeLayoutWidth.prototype.constructor", - "scrollLeftForDocument.prototype.constructor", - "scrollTopForDocument.prototype.constructor", - "self", - "setInterval", - "setQueryParam.prototype.constructor", - "setScrollLeftForDocument.prototype.constructor", - "setScrollTopForDocument.prototype.constructor", - "setTimeout", - "swapDomNodes.prototype.constructor", - "top", - "undefined", - "unescape", - "window" -] diff --git a/src/gadgets/libPolyfill/.eslintrc.yaml b/src/gadgets/libPolyfill/.eslintrc.yaml deleted file mode 100644 index 9b06323a..00000000 --- a/src/gadgets/libPolyfill/.eslintrc.yaml +++ /dev/null @@ -1,2 +0,0 @@ -ignorePatterns: - - MediaWiki:Gadget-libPolyfill.js From 1b2851a921ddbc5bcbac2ccd4b633804da63e07c Mon Sep 17 00:00:00 2001 From: AnnAngela Date: Mon, 22 Jan 2024 17:49:32 +0800 Subject: [PATCH 03/16] ci: Add directory creation for polyfill path --- .github/workflows/generatePolyfill.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/generatePolyfill.yaml b/.github/workflows/generatePolyfill.yaml index f8685479..5c8cc3a0 100644 --- a/.github/workflows/generatePolyfill.yaml +++ b/.github/workflows/generatePolyfill.yaml @@ -64,6 +64,7 @@ jobs: POLYFILL_PATH="${{ runner.temp }}/$(uuidgen)" echo "POLYFILL_PATH=$POLYFILL_PATH" >> $GITHUB_OUTPUT cat $GITHUB_OUTPUT + mkdir -pv $POLYFILL_PATH mv polyfill-service/polyfill-libraries/${{ steps.polyfillConfig.outputs.TARGET_POLYFILL_VERSION }}.json $POLYFILL_PATH/main.json mv polyfill-service/polyfill-libraries/${{ steps.polyfillConfig.outputs.TARGET_POLYFILL_VERSION }}/ $POLYFILL_PATH/library rm -rf polyfill-service From a982d32fd68d6a733737260a606c1aeb74707a8e Mon Sep 17 00:00:00 2001 From: AnnAngela Date: Mon, 22 Jan 2024 17:56:27 +0800 Subject: [PATCH 04/16] =?UTF-8?q?fix:=20=E7=AC=94=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/generatePolyfill/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/generatePolyfill/index.js b/scripts/generatePolyfill/index.js index 507d06c2..9d3f60d8 100644 --- a/scripts/generatePolyfill/index.js +++ b/scripts/generatePolyfill/index.js @@ -2,10 +2,11 @@ import console from "../modules/console.js"; console.info("Initialization done."); import fs from "node:fs"; import path from "node:path"; +import { startGroup, endGroup } from "@actions/core"; import semver from "semver"; import jsonModule from "../modules/jsonModule.js"; import yamlModule from "../modules/yamlModule.js"; -import { startGroup, endGroup } from "@actions/core"; +import createCommit from "../modules/createCommit.js"; const polyfillGadgetDefinitionPath = "src/gadgets/libPolyfill/definition.yaml"; const polyfillGadgetDefinition = await yamlModule.readFile(polyfillGadgetDefinitionPath); @@ -134,4 +135,5 @@ for (const polyfill of polyfillListAllowed) { } polyfillGadgetDefinition._files = await getPolyfillGadgetFiles(); await yamlModule.writeFile(polyfillGadgetDefinitionPath, polyfillGadgetDefinition); +await createCommit("auto: regenerated polyfill files by generatePolyfill"); console.info("Done."); From 734468b99df4f4ccd633ad028b8aff40ca82ea18 Mon Sep 17 00:00:00 2001 From: AnnAngela Date: Mon, 22 Jan 2024 17:56:43 +0800 Subject: [PATCH 05/16] =?UTF-8?q?chore:=20=E4=B8=8D=E5=86=8D=E9=9C=80?= =?UTF-8?q?=E8=A6=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/generateConfiguration.yaml | 39 --- package-lock.json | 297 ------------------ package.json | 1 - .../generateUnrecognizableFeatures/index.js | 44 --- 4 files changed, 381 deletions(-) delete mode 100644 .github/workflows/generateConfiguration.yaml delete mode 100644 scripts/generateUnrecognizableFeatures/index.js diff --git a/.github/workflows/generateConfiguration.yaml b/.github/workflows/generateConfiguration.yaml deleted file mode 100644 index 13941086..00000000 --- a/.github/workflows/generateConfiguration.yaml +++ /dev/null @@ -1,39 +0,0 @@ -name: Generate configuration - -on: - workflow_dispatch: - schedule: - - cron: 0 23 * * * # Every 07:00 CST - -concurrency: generateConfiguration - -env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - -jobs: - generateConfiguration: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - show-progress: false - - name: Use Node.js - uses: actions/setup-node@v4 - with: - node-version: lts/* - check-latest: true - cache: npm - - name: Installing the dependencies - uses: AnnAngela/cached_node-modules@v2 - with: - command: npm run ci - - name: Prepare git - run: node scripts/postCommit/prepareGit.js - - name: Expose GitHub Runtime - uses: crazy-max/ghaction-github-runtime@v3 - - name: Generate unrecognizable features - run: node scripts/generateUnrecognizableFeatures/index.js - - name: Generate user rights schema - run: node scripts/generateUserRightsSchema/index.js - - name: Show git status & push - run: node scripts/postCommit/push.js diff --git a/package-lock.json b/package-lock.json index 6c249bd0..2413676b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,6 @@ "@annangela/eslint-plugin-prefer-reflect": "^2.2.2", "@csstools/postcss-is-pseudo-class": "^4.0.4", "@csstools/postcss-media-minmax": "^1.1.2", - "@financial-times/js-features-analyser": "^0.4.3", "@octokit/auth-action": "^4.0.1", "@octokit/auth-app": "^6.0.3", "@octokit/auth-unauthenticated": "^5.0.1", @@ -1073,18 +1072,6 @@ "node": ">=14" } }, - "node_modules/@financial-times/js-features-analyser": { - "version": "0.4.3", - "resolved": "https://mirrors.cloud.tencent.com/npm/@financial-times/js-features-analyser/-/js-features-analyser-0.4.3.tgz", - "integrity": "sha512-ueckeqtj4Abn0FP6TuEkzCdVVET+Qq5k+4QvTJ+rKuTdqWPTTVuX2TUdTU2Zd+1IEJSz5E5yqKLjbWkM6dWjSg==", - "dependencies": { - "@babel/core": "^7.13.14", - "yargs": "^13.3.2" - }, - "bin": { - "js-features-analyser": "index.js" - } - }, "node_modules/@goto-bus-stop/common-shake": { "version": "2.4.1", "resolved": "https://mirrors.cloud.tencent.com/npm/@goto-bus-stop/common-shake/-/common-shake-2.4.1.tgz", @@ -3231,14 +3218,6 @@ "tslib": "^2.0.3" } }, - "node_modules/camelcase": { - "version": "5.3.1", - "resolved": "https://mirrors.cloud.tencent.com/npm/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "engines": { - "node": ">=6" - } - }, "node_modules/caniuse-lite": { "version": "1.0.30001578", "resolved": "https://mirrors.cloud.tencent.com/npm/caniuse-lite/-/caniuse-lite-1.0.30001578.tgz", @@ -3336,61 +3315,6 @@ "safe-buffer": "^5.0.1" } }, - "node_modules/cliui": { - "version": "5.0.0", - "resolved": "https://mirrors.cloud.tencent.com/npm/cliui/-/cliui-5.0.0.tgz", - "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", - "dependencies": { - "string-width": "^3.1.0", - "strip-ansi": "^5.2.0", - "wrap-ansi": "^5.1.0" - } - }, - "node_modules/cliui/node_modules/ansi-regex": { - "version": "4.1.1", - "resolved": "https://mirrors.cloud.tencent.com/npm/ansi-regex/-/ansi-regex-4.1.1.tgz", - "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", - "engines": { - "node": ">=6" - } - }, - "node_modules/cliui/node_modules/emoji-regex": { - "version": "7.0.3", - "resolved": "https://mirrors.cloud.tencent.com/npm/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==" - }, - "node_modules/cliui/node_modules/is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://mirrors.cloud.tencent.com/npm/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "engines": { - "node": ">=4" - } - }, - "node_modules/cliui/node_modules/string-width": { - "version": "3.1.0", - "resolved": "https://mirrors.cloud.tencent.com/npm/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dependencies": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/cliui/node_modules/strip-ansi": { - "version": "5.2.0", - "resolved": "https://mirrors.cloud.tencent.com/npm/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dependencies": { - "ansi-regex": "^4.1.0" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/color-convert": { "version": "1.9.3", "resolved": "https://mirrors.cloud.tencent.com/npm/color-convert/-/color-convert-1.9.3.tgz", @@ -6672,14 +6596,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/p-try": { - "version": "2.2.0", - "resolved": "https://mirrors.cloud.tencent.com/npm/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "engines": { - "node": ">=6" - } - }, "node_modules/pako": { "version": "1.0.11", "resolved": "https://mirrors.cloud.tencent.com/npm/pako/-/pako-1.0.11.tgz", @@ -7507,11 +7423,6 @@ "node": ">=0.10.0" } }, - "node_modules/require-main-filename": { - "version": "2.0.0", - "resolved": "https://mirrors.cloud.tencent.com/npm/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" - }, "node_modules/resolve": { "version": "1.22.8", "resolved": "https://mirrors.cloud.tencent.com/npm/resolve/-/resolve-1.22.8.tgz", @@ -7698,11 +7609,6 @@ "resolved": "https://mirrors.cloud.tencent.com/npm/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, - "node_modules/set-blocking": { - "version": "2.0.0", - "resolved": "https://mirrors.cloud.tencent.com/npm/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" - }, "node_modules/set-function-length": { "version": "1.2.0", "resolved": "https://mirrors.cloud.tencent.com/npm/set-function-length/-/set-function-length-1.2.0.tgz", @@ -9051,11 +8957,6 @@ "node": ">= 8" } }, - "node_modules/which-module": { - "version": "2.0.1", - "resolved": "https://mirrors.cloud.tencent.com/npm/which-module/-/which-module-2.0.1.tgz", - "integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==" - }, "node_modules/which-typed-array": { "version": "1.1.13", "resolved": "https://mirrors.cloud.tencent.com/npm/which-typed-array/-/which-typed-array-1.1.13.tgz", @@ -9074,19 +8975,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/wrap-ansi": { - "version": "5.1.0", - "resolved": "https://mirrors.cloud.tencent.com/npm/wrap-ansi/-/wrap-ansi-5.1.0.tgz", - "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", - "dependencies": { - "ansi-styles": "^3.2.0", - "string-width": "^3.0.0", - "strip-ansi": "^5.0.0" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/wrap-ansi-cjs": { "name": "wrap-ansi", "version": "7.0.0", @@ -9134,51 +9022,6 @@ "resolved": "https://mirrors.cloud.tencent.com/npm/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, - "node_modules/wrap-ansi/node_modules/ansi-regex": { - "version": "4.1.1", - "resolved": "https://mirrors.cloud.tencent.com/npm/ansi-regex/-/ansi-regex-4.1.1.tgz", - "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", - "engines": { - "node": ">=6" - } - }, - "node_modules/wrap-ansi/node_modules/emoji-regex": { - "version": "7.0.3", - "resolved": "https://mirrors.cloud.tencent.com/npm/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==" - }, - "node_modules/wrap-ansi/node_modules/is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://mirrors.cloud.tencent.com/npm/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "engines": { - "node": ">=4" - } - }, - "node_modules/wrap-ansi/node_modules/string-width": { - "version": "3.1.0", - "resolved": "https://mirrors.cloud.tencent.com/npm/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dependencies": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/wrap-ansi/node_modules/strip-ansi": { - "version": "5.2.0", - "resolved": "https://mirrors.cloud.tencent.com/npm/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dependencies": { - "ansi-regex": "^4.1.0" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/wrap-comment": { "version": "1.0.1", "resolved": "https://mirrors.cloud.tencent.com/npm/wrap-comment/-/wrap-comment-1.0.1.tgz", @@ -9229,11 +9072,6 @@ "node": ">=0.4" } }, - "node_modules/y18n": { - "version": "4.0.3", - "resolved": "https://mirrors.cloud.tencent.com/npm/y18n/-/y18n-4.0.3.tgz", - "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==" - }, "node_modules/yallist": { "version": "3.1.1", "resolved": "https://mirrors.cloud.tencent.com/npm/yallist/-/yallist-3.1.1.tgz", @@ -9247,141 +9085,6 @@ "node": ">= 14" } }, - "node_modules/yargs": { - "version": "13.3.2", - "resolved": "https://mirrors.cloud.tencent.com/npm/yargs/-/yargs-13.3.2.tgz", - "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", - "dependencies": { - "cliui": "^5.0.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^13.1.2" - } - }, - "node_modules/yargs-parser": { - "version": "13.1.2", - "resolved": "https://mirrors.cloud.tencent.com/npm/yargs-parser/-/yargs-parser-13.1.2.tgz", - "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", - "dependencies": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - }, - "node_modules/yargs-parser/node_modules/decamelize": { - "version": "1.2.0", - "resolved": "https://mirrors.cloud.tencent.com/npm/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/yargs/node_modules/ansi-regex": { - "version": "4.1.1", - "resolved": "https://mirrors.cloud.tencent.com/npm/ansi-regex/-/ansi-regex-4.1.1.tgz", - "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", - "engines": { - "node": ">=6" - } - }, - "node_modules/yargs/node_modules/emoji-regex": { - "version": "7.0.3", - "resolved": "https://mirrors.cloud.tencent.com/npm/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==" - }, - "node_modules/yargs/node_modules/find-up": { - "version": "3.0.0", - "resolved": "https://mirrors.cloud.tencent.com/npm/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "dependencies": { - "locate-path": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/yargs/node_modules/is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://mirrors.cloud.tencent.com/npm/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "engines": { - "node": ">=4" - } - }, - "node_modules/yargs/node_modules/locate-path": { - "version": "3.0.0", - "resolved": "https://mirrors.cloud.tencent.com/npm/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "dependencies": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/yargs/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://mirrors.cloud.tencent.com/npm/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/yargs/node_modules/p-locate": { - "version": "3.0.0", - "resolved": "https://mirrors.cloud.tencent.com/npm/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "dependencies": { - "p-limit": "^2.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/yargs/node_modules/path-exists": { - "version": "3.0.0", - "resolved": "https://mirrors.cloud.tencent.com/npm/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "engines": { - "node": ">=4" - } - }, - "node_modules/yargs/node_modules/string-width": { - "version": "3.1.0", - "resolved": "https://mirrors.cloud.tencent.com/npm/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dependencies": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/yargs/node_modules/strip-ansi": { - "version": "5.2.0", - "resolved": "https://mirrors.cloud.tencent.com/npm/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dependencies": { - "ansi-regex": "^4.1.0" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/yocto-queue": { "version": "0.1.0", "resolved": "https://mirrors.cloud.tencent.com/npm/yocto-queue/-/yocto-queue-0.1.0.tgz", diff --git a/package.json b/package.json index 60a3af99..c4d078bd 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,6 @@ "@annangela/eslint-plugin-prefer-reflect": "^2.2.2", "@csstools/postcss-is-pseudo-class": "^4.0.4", "@csstools/postcss-media-minmax": "^1.1.2", - "@financial-times/js-features-analyser": "^0.4.3", "@octokit/auth-action": "^4.0.1", "@octokit/auth-app": "^6.0.3", "@octokit/auth-unauthenticated": "^5.0.1", diff --git a/scripts/generateUnrecognizableFeatures/index.js b/scripts/generateUnrecognizableFeatures/index.js deleted file mode 100644 index 91f3b890..00000000 --- a/scripts/generateUnrecognizableFeatures/index.js +++ /dev/null @@ -1,44 +0,0 @@ -import console from "../modules/console.js"; -console.info("Initialization done."); -import exec from "../modules/exec.js"; -import mkdtmp from "../modules/mkdtmp.js"; -import path from "path"; -import createCommit from "../modules/createCommit.js"; -import jsonModule from "../modules/jsonModule.js"; - -const targetChromiumVersion = "70.0.3538.0"; -const targetUA = `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${targetChromiumVersion} Safari/537.36`; - -const unrecognizableFeatures = []; -const tempPath = await mkdtmp(); -console.info("Start to compile src/ to temporary bundle file..."); -const bundlePath = path.join(tempPath, "bundle.js"); -console.log("bundlePath:", bundlePath); -await exec(`npx tsc --project tsconfig.production.json --outFile ${bundlePath}`); -console.info("\tDone."); -console.info("Start to analyse the temporary bundle file..."); -const analysisReport = [...new Set(JSON.parse(await exec(`npx @financial-times/js-features-analyser analyse --file ${path.relative(".", bundlePath)}`)))].sort(); -const clone = [...analysisReport]; -console.info("\tDone."); -let i = 0; -while (analysisReport.length > 0) { - const piece = []; - while (analysisReport.length > 0 && piece.join(",").length <= 1973) { - piece.push(analysisReport.splice(0, 1)); - } - console.info(`Start to download polyfill file #${i}...`); - const url = new URL("https://polyfill.io/v3/polyfill.js"); - url.searchParams.set("features", piece.join(",")); - url.searchParams.set("ua", targetUA); - const dataResponse = await fetch(`${url}`, { - method: "GET", - }); - const data = await dataResponse.text(); - console.info("\tDone."); - const match = data.match(/(?<=\n \* These features were not recognised:\n \* - )[^\n]+?(?=\s*\*\/)/)?.[0]?.split?.(/,-\s*/); - unrecognizableFeatures.push(...match); - i++; -} -await jsonModule.writeFile("scripts/generatePolyfill/unrecognizableFeatures.json", unrecognizableFeatures); -console.info(clone.length - unrecognizableFeatures.length, "unrecognizable features remaining"); -await createCommit("auto: regenerated unrecognizable features list by generateUnrecognizableFeatures"); From 8177ae9113e391ea02592a519309f67f0917e9af Mon Sep 17 00:00:00 2001 From: AnnAngela Date: Mon, 22 Jan 2024 17:56:57 +0800 Subject: [PATCH 06/16] =?UTF-8?q?ci:=20=E6=9B=B4=E6=96=B0=E7=B4=A2?= =?UTF-8?q?=E5=BC=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/postCommit.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/postCommit.yaml b/.github/workflows/postCommit.yaml index ef2663db..78217586 100644 --- a/.github/workflows/postCommit.yaml +++ b/.github/workflows/postCommit.yaml @@ -6,7 +6,7 @@ on: - scripts/**/*.js - scripts/**/*.yaml - "!scripts/test/*.js" - - "!scripts/generateUnrecognizableFeatures/*.js" + - "!scripts/generatePolyfill/*.js" - "!scripts/detectHardcodedOutdatedNPMPackages/*.js" - "!scripts/detectHardcodedOutdatedNPMPackages/*.yaml" - "!scripts/autoAssign/*.js" @@ -25,7 +25,7 @@ on: - scripts/**/*.js - scripts/**/*.yaml - "!scripts/test/*.js" - - "!scripts/generateUnrecognizableFeatures/*.js" + - "!scripts/generatePolyfill/*.js" - "!scripts/detectHardcodedOutdatedNPMPackages/*.js" - "!scripts/detectHardcodedOutdatedNPMPackages/*.yaml" - "!scripts/autoAssign/*.js" From b86e39a0e9eaf82e1d8052e7710b813dedcfe6f9 Mon Sep 17 00:00:00 2001 From: AnnAngela Date: Mon, 22 Jan 2024 17:57:10 +0800 Subject: [PATCH 07/16] =?UTF-8?q?chore:=20=E4=BF=AE=E6=AD=A3=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index a1b9842a..022078f2 100644 --- a/README.md +++ b/README.md @@ -17,20 +17,19 @@
仓库架构详情 - [`.github`](.github) 文件夹用以保存 GitHub Dependabot 和 GitHub Actions 所需配置文件,其中: - - [`.github/workflows/postCommit.yaml`](.github/workflows/postCommit.yaml) 用以保存自动化流程,包含自动配置 Conventional Commits(约定式提交)所需 scope(作用域)信息、自动导入来自 npm 和指定页面的代码、自动补全小工具列表和自动生成 polyfill 文件; - - [`.github/workflows/generateUnrecognizableFeatures.yaml`](.github/workflows/generateUnrecognizableFeatures.yaml) 用以定时生成 [`scripts/generatePolyfill/unrecognizableFeatures.json`](scripts/generatePolyfill/unrecognizableFeatures.json) 以减少生成 polyfill 时的网络请求; - - [`.github/workflows/auto_assign.yaml`](.github/workflows/auto_assign.yaml) 用以自动对 pull request 和 issue 添加 assignees 和 reviewers(若有)。 + - [`.github/workflows/postCommit.yaml`](.github/workflows/postCommit.yaml) 用以保存自动化流程,包含自动配置 Conventional Commits(约定式提交)所需 scope(作用域)信息、自动导入来自 npm 和指定页面的代码、自动补全小工具列表;: + - [`.github/workflows/postCommit.yaml`](.github/workflows/postCommit.yaml) 用以自动生成 polyfill 文件; + - [`.github/workflows/auto_assign.yaml`](.github/workflows/auto_assign.yaml) 用以自动对 pull request 和 issue 添加 assignees 和 reviewers(若有)。 - [`.vscode/settings.json`](.vscode/settings.json) 用来保存 Conventional Commits(约定式提交)所需 scope(作用域)信息; - [`scripts`](scripts) 文件夹用以保存流程所需代码,其中: - [`scripts/postCommit/prepareGit.js`](scripts/postCommit/prepareGit.js) 用来准备 Github Actions 上的 git 环境,自动生成 author 和 committer 的相关信息; - [`scripts/browserify/index.js`](scripts/browserify/index.js) 用来通过 [browserify](https://browserify.org/) 库导入来自 npm 的代码,其目标在 [`scripts/browserify/targets.yaml`](scripts/browserify/targets.yaml) 中定义; - [`scripts/prefetch/index.js`](scripts/prefetch/index.js) 用来导入来自指定页面的代码,其目标在 [`scripts/prefetch/targets.yaml`](scripts/prefetch/targets.yaml) 中定义; - - [`scripts/generatePolyfill/index.js`](scripts/generatePolyfill/index.js) 用来自动生成 polyfill 文件,该代码使用了来自《金融时报》的 [polyfill.io](https://polyfill.io/v3/)([Financial-Times/polyfill-service](https://github.com/Financial-Times/polyfill-service))和 [Financial-Times/polyfill-library](https://github.com/Financial-Times/polyfill-library); + - [`scripts/generatePolyfill/index.js`](scripts/generatePolyfill/index.js) 用来自动生成 polyfill 文件,该代码使用了 [JakeChampion/polyfill-service 库](https://github.com/JakeChampion/polyfill-service); - [`scripts/generateGadgetsDefinition/index.js`](scripts/generateGadgetsDefinition/index.js) 用来自动补全小工具列表,当发现新增小工具时,该代码会自动将对应小工具插入到 [`src/gadgets/Gadgets-definition-list.yaml`](src/gadgets/Gadgets-definition-list.yaml) 的响应列表的末尾; - [`scripts/generateConventionalCommitsScopes/index.js`](scripts/generateConventionalCommitsScopes/index.js) 用来自动配置 Conventional Commits(约定式提交)所需 scope(作用域)信息; - [`scripts/postCommit/linguist-generated.js`](scripts/postCommit/linguist-generated.js) 用来自动生成 [`.gitattributes`](.gitattributes) 以告知 Github 如何区分代码是否自动生成; - [`scripts/postCommit/push.js`](scripts/postCommit/push.js) 用来推送由 Github Actions 做出的更改; - - [`scripts/generateUnrecognizableFeatures/index.js`](scripts/generateUnrecognizableFeatures/index.js) 用来生成 [`scripts/generatePolyfill/unrecognizableFeatures.json`](scripts/generatePolyfill/unrecognizableFeatures.json) 以减少生成 polyfill 时的网络请求; - [`scripts/emailmapChecker/index.js`](scripts/emailmapChecker/index.js) 用来检查相关用户是否将其萌娘百科用户名和邮箱地址添加到 [`.mailmap`](.mailmap),若当前环境为本地则检测 git 配置文件里的邮箱地址,若当前环境为 Github Actions 则检查相关 commits 的邮箱地址。 - [`scripts/ci/before.js`](scripts/ci/before.js) 和 [`scripts/ci/after.js`](scripts/ci/after.js) 用来在 `npm run ci` 里自动替换 [`package-lock.json`](package-lock.json) 里的 `resolved` 对应的 registry 为你本地设置的 registry,有助于加快安装速度。 - 自动化工具的配置文件: @@ -64,7 +63,7 @@ ## 自动化流程 -- 每周一 00:00 UTC 会自动触发一次 generateUnrecognizableFeatures CI; +- 每周日 23:00 UTC 会自动触发一次 Generate Polyfill CI; - 每天 00:15 UTC(但愿,Github Actions的 cron 延迟真的好高 \_(:з」∠)\_)会自动触发一次 postCommit CI; - 每提交一次 commit(包括提交 pull request 和在 pull request 里提交新的 commit),postCommit CI 会触发; - 当 postCommit CI 检测到新内容时,会自动触发一次 Linter test。 From 5e41ddac60f93f0d85aa213c8fbdf39525f319b0 Mon Sep 17 00:00:00 2001 From: AnnAngela Date: Mon, 22 Jan 2024 17:57:26 +0800 Subject: [PATCH 08/16] =?UTF-8?q?fix:=20=E6=97=A5=E5=BF=97=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/generateUserRightsSchema/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/generateUserRightsSchema/index.js b/scripts/generateUserRightsSchema/index.js index 6f1381ab..3a0d86c6 100644 --- a/scripts/generateUserRightsSchema/index.js +++ b/scripts/generateUserRightsSchema/index.js @@ -33,4 +33,4 @@ startGroup("new schema:"); console.info(schema); endGroup(); await jsonModule.writeFile(".vscode/json-schemas/user-rights-definition.json", schema); -await createCommit("auto: regenerated user-rights-definition.json by generateUnrecognizableFeatures"); +await createCommit("auto: regenerated user-rights-definition.json by generateUserRightsSchema"); From e0a4818e23ce19030f1e80c6219a6ea47ebbdde2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 22 Jan 2024 09:59:31 +0000 Subject: [PATCH 09/16] auto: regenerated polyfill files by generatePolyfill --- ...i:Gadget-libPolyfill.Array.prototype.at.js | 441 +++++ ...:Gadget-libPolyfill.String.prototype.at.js | 421 +++++ ...get-libPolyfill.TypedArray.prototype.at.js | 1494 +++++++++++++++++ .../MediaWiki:Gadget-libPolyfill.js | 32 - src/gadgets/libPolyfill/definition.yaml | 4 +- 5 files changed, 2359 insertions(+), 33 deletions(-) create mode 100644 src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill.Array.prototype.at.js create mode 100644 src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill.String.prototype.at.js create mode 100644 src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill.TypedArray.prototype.at.js delete mode 100644 src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill.js diff --git a/src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill.Array.prototype.at.js b/src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill.Array.prototype.at.js new file mode 100644 index 00000000..a603819e --- /dev/null +++ b/src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill.Array.prototype.at.js @@ -0,0 +1,441 @@ +"use strict"; +/** + * Generated by scripts/generatePolyfill/index.js + * Options: + * polyfillFeature: Array.prototype.at + * polyfillAliases: es2022 + * targetChromiumVersion: 86.0.0 + * polyfillVersionRange: <92.0.0-0 (< 92) + */ +(() => { +if (!("at"in Array.prototype)) { +if (!("defineProperty"in Object&&function(){try{var e={} +return Object.defineProperty(e,"test",{value:42}),!0}catch(t){return!1}}())) { + +// Object.defineProperty +(function (nativeDefineProperty) { + + var supportsAccessors = Object.prototype.hasOwnProperty.call(Object.prototype, '__defineGetter__'); + var ERR_ACCESSORS_NOT_SUPPORTED = 'Getters & setters cannot be defined on this javascript engine'; + var ERR_VALUE_ACCESSORS = 'A property cannot both have accessors and be writable or have a value'; + + // Polyfill.io - This does not use CreateMethodProperty because our CreateMethodProperty function uses Object.defineProperty. + Object.defineProperty = function defineProperty(object, property, descriptor) { + + // Where native support exists, assume it + if (nativeDefineProperty && (object === window || object === document || object === Element.prototype || object instanceof Element)) { + return nativeDefineProperty(object, property, descriptor); + } + + if (object === null || !(object instanceof Object || typeof object === 'object')) { + throw new TypeError('Object.defineProperty called on non-object'); + } + + if (!(descriptor instanceof Object)) { + throw new TypeError('Property description must be an object'); + } + + var propertyString = String(property); + var hasValueOrWritable = 'value' in descriptor || 'writable' in descriptor; + var getterType = 'get' in descriptor && typeof descriptor.get; + var setterType = 'set' in descriptor && typeof descriptor.set; + + // handle descriptor.get + if (getterType) { + if (getterType === undefined) { + return object; + } + if (getterType !== 'function') { + throw new TypeError('Getter must be a function'); + } + if (!supportsAccessors) { + throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED); + } + if (hasValueOrWritable) { + throw new TypeError(ERR_VALUE_ACCESSORS); + } + Object.__defineGetter__.call(object, propertyString, descriptor.get); + } else { + object[propertyString] = descriptor.value; + } + + // handle descriptor.set + if (setterType) { + if (setterType === undefined) { + return object; + } + if (setterType !== 'function') { + throw new TypeError('Setter must be a function'); + } + if (!supportsAccessors) { + throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED); + } + if (hasValueOrWritable) { + throw new TypeError(ERR_VALUE_ACCESSORS); + } + Object.__defineSetter__.call(object, propertyString, descriptor.set); + } + + // OK to define value unconditionally - if a getter has been specified as well, an error would be thrown above + if ('value' in descriptor) { + object[propertyString] = descriptor.value; + } + + return object; + }; +}(Object.defineProperty)); + +} + +// _ESAbstract.CreateMethodProperty +// 7.3.5. CreateMethodProperty ( O, P, V ) +function CreateMethodProperty(O, P, V) { // eslint-disable-line no-unused-vars + // 1. Assert: Type(O) is Object. + // 2. Assert: IsPropertyKey(P) is true. + // 3. Let newDesc be the PropertyDescriptor{[[Value]]: V, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true}. + var newDesc = { + value: V, + writable: true, + enumerable: false, + configurable: true + }; + // 4. Return ? O.[[DefineOwnProperty]](P, newDesc). + Object.defineProperty(O, P, newDesc); +} + + +// _ESAbstract.Get +// 7.3.1. Get ( O, P ) +function Get(O, P) { // eslint-disable-line no-unused-vars + // 1. Assert: Type(O) is Object. + // 2. Assert: IsPropertyKey(P) is true. + // 3. Return ? O.[[Get]](P, O). + return O[P]; +} + + +// _ESAbstract.Type +// "Type(x)" is used as shorthand for "the type of x"... +function Type(x) { // eslint-disable-line no-unused-vars + switch (typeof x) { + case 'undefined': + return 'undefined'; + case 'boolean': + return 'boolean'; + case 'number': + return 'number'; + case 'string': + return 'string'; + case 'symbol': + return 'symbol'; + default: + // typeof null is 'object' + if (x === null) return 'null'; + // Polyfill.io - This is here because a Symbol polyfill will have a typeof `object`. + if ('Symbol' in self && (x instanceof self.Symbol || x.constructor === self.Symbol)) return 'symbol'; + + return 'object'; + } +} + + +// _ESAbstract.ToInteger +/* global Type */ +// 7.1.4. ToInteger ( argument ) +function ToInteger(argument) { // eslint-disable-line no-unused-vars + if (Type(argument) === 'symbol') { + throw new TypeError('Cannot convert a Symbol value to a number'); + } + + // 1. Let number be ? ToNumber(argument). + var number = Number(argument); + // 2. If number is NaN, return +0. + if (isNaN(number)) { + return 0; + } + // 3. If number is +0, -0, +∞, or -∞, return number. + if (1/number === Infinity || 1/number === -Infinity || number === Infinity || number === -Infinity) { + return number; + } + // 4. Return the number value that is the same sign as number and whose magnitude is floor(abs(number)). + return ((number < 0) ? -1 : 1) * Math.floor(Math.abs(number)); +} + + +// _ESAbstract.ToLength +/* global ToInteger */ +// 7.1.15. ToLength ( argument ) +function ToLength(argument) { // eslint-disable-line no-unused-vars + // 1. Let len be ? ToInteger(argument). + var len = ToInteger(argument); + // 2. If len ≤ +0, return +0. + if (len <= 0) { + return 0; + } + // 3. Return min(len, 253-1). + return Math.min(len, Math.pow(2, 53) -1); +} + + +// _ESAbstract.LengthOfArrayLike +/* global Get, ToLength */ +// 7.3.19. LengthOfArrayLike ( obj ) +function LengthOfArrayLike(obj) { // eslint-disable-line no-unused-vars + // 1. Return ℝ(? ToLength(? Get(obj, "length"))). + return ToLength(Get(obj, 'length')); +} + + +// _ESAbstract.ToNumber +// 7.1.3. ToNumber ( argument ) +function ToNumber(argument) { // eslint-disable-line no-unused-vars + return Number(argument); +} + + +// _ESAbstract.ToIntegerOrInfinity +/* global ToNumber */ +// 7.1.5. ToIntegerOrInfinity ( argument ) +function ToIntegerOrInfinity(argument) { // eslint-disable-line no-unused-vars + // 1. Let number be ? ToNumber(argument). + var number = ToNumber(argument); + // 2. If number is NaN, +0𝔽, or -0𝔽, return 0. + if (isNaN(number) || number === 0 || 1/number === -Infinity) return 0; + // 3. If number is +∞𝔽, return +∞. + if (number === Infinity) return Infinity; + // 4. If number is -∞𝔽, return -∞. + if (number === -Infinity) return -Infinity; + // 5. Let integer be floor(abs(ℝ(number))). + var integer = Math.floor(Math.abs(number)); + // 6. If number < +0𝔽, set integer to -integer. + if (number < 0) integer = -integer; + // 7. Return integer. + return integer; +} + + +// _ESAbstract.ToObject +// 7.1.13 ToObject ( argument ) +// The abstract operation ToObject converts argument to a value of type Object according to Table 12: +// Table 12: ToObject Conversions +/* +|----------------------------------------------------------------------------------------------------------------------------------------------------| +| Argument Type | Result | +|----------------------------------------------------------------------------------------------------------------------------------------------------| +| Undefined | Throw a TypeError exception. | +| Null | Throw a TypeError exception. | +| Boolean | Return a new Boolean object whose [[BooleanData]] internal slot is set to argument. See 19.3 for a description of Boolean objects. | +| Number | Return a new Number object whose [[NumberData]] internal slot is set to argument. See 20.1 for a description of Number objects. | +| String | Return a new String object whose [[StringData]] internal slot is set to argument. See 21.1 for a description of String objects. | +| Symbol | Return a new Symbol object whose [[SymbolData]] internal slot is set to argument. See 19.4 for a description of Symbol objects. | +| Object | Return argument. | +|----------------------------------------------------------------------------------------------------------------------------------------------------| +*/ +function ToObject(argument) { // eslint-disable-line no-unused-vars + if (argument === null || argument === undefined) { + throw TypeError(); + } + return Object(argument); +} + + +// _ESAbstract.Call +/* global IsCallable */ +// 7.3.12. Call ( F, V [ , argumentsList ] ) +function Call(F, V /* [, argumentsList] */) { // eslint-disable-line no-unused-vars + // 1. If argumentsList is not present, set argumentsList to a new empty List. + var argumentsList = arguments.length > 2 ? arguments[2] : []; + // 2. If IsCallable(F) is false, throw a TypeError exception. + if (IsCallable(F) === false) { + throw new TypeError(Object.prototype.toString.call(F) + 'is not a function.'); + } + // 3. Return ? F.[[Call]](V, argumentsList). + return F.apply(V, argumentsList); +} + + +// _ESAbstract.GetV +/* global ToObject */ +// 7.3.2 GetV (V, P) +function GetV(v, p) { // eslint-disable-line no-unused-vars + // 1. Assert: IsPropertyKey(P) is true. + // 2. Let O be ? ToObject(V). + var o = ToObject(v); + // 3. Return ? O.[[Get]](P, V). + return o[p]; +} + + +// _ESAbstract.IsCallable +// 7.2.3. IsCallable ( argument ) +function IsCallable(argument) { // eslint-disable-line no-unused-vars + // 1. If Type(argument) is not Object, return false. + // 2. If argument has a [[Call]] internal method, return true. + // 3. Return false. + + // Polyfill.io - Only function objects have a [[Call]] internal method. This means we can simplify this function to check that the argument has a type of function. + return typeof argument === 'function'; +} + + +// _ESAbstract.GetMethod +/* global GetV, IsCallable */ +// 7.3.9. GetMethod ( V, P ) +function GetMethod(V, P) { // eslint-disable-line no-unused-vars + // 1. Assert: IsPropertyKey(P) is true. + // 2. Let func be ? GetV(V, P). + var func = GetV(V, P); + // 3. If func is either undefined or null, return undefined. + if (func === null || func === undefined) { + return undefined; + } + // 4. If IsCallable(func) is false, throw a TypeError exception. + if (IsCallable(func) === false) { + throw new TypeError('Method not callable: ' + P); + } + // 5. Return func. + return func; +} + + +// _ESAbstract.OrdinaryToPrimitive +/* global Get, IsCallable, Call, Type */ +// 7.1.1.1. OrdinaryToPrimitive ( O, hint ) +function OrdinaryToPrimitive(O, hint) { // eslint-disable-line no-unused-vars + // 1. Assert: Type(O) is Object. + // 2. Assert: Type(hint) is String and its value is either "string" or "number". + // 3. If hint is "string", then + if (hint === 'string') { + // a. Let methodNames be « "toString", "valueOf" ». + var methodNames = ['toString', 'valueOf']; + // 4. Else, + } else { + // a. Let methodNames be « "valueOf", "toString" ». + methodNames = ['valueOf', 'toString']; + } + // 5. For each name in methodNames in List order, do + for (var i = 0; i < methodNames.length; ++i) { + var name = methodNames[i]; + // a. Let method be ? Get(O, name). + var method = Get(O, name); + // b. If IsCallable(method) is true, then + if (IsCallable(method)) { + // i. Let result be ? Call(method, O). + var result = Call(method, O); + // ii. If Type(result) is not Object, return result. + if (Type(result) !== 'object') { + return result; + } + } + } + // 6. Throw a TypeError exception. + throw new TypeError('Cannot convert to primitive.'); +} + + +// _ESAbstract.ToPrimitive +/* global Type, GetMethod, Call, OrdinaryToPrimitive */ +// 7.1.1. ToPrimitive ( input [ , PreferredType ] ) +function ToPrimitive(input /* [, PreferredType] */) { // eslint-disable-line no-unused-vars + var PreferredType = arguments.length > 1 ? arguments[1] : undefined; + // 1. Assert: input is an ECMAScript language value. + // 2. If Type(input) is Object, then + if (Type(input) === 'object') { + // a. If PreferredType is not present, let hint be "default". + if (arguments.length < 2) { + var hint = 'default'; + // b. Else if PreferredType is hint String, let hint be "string". + } else if (PreferredType === String) { + hint = 'string'; + // c. Else PreferredType is hint Number, let hint be "number". + } else if (PreferredType === Number) { + hint = 'number'; + } + // d. Let exoticToPrim be ? GetMethod(input, @@toPrimitive). + var exoticToPrim = typeof self.Symbol === 'function' && typeof self.Symbol.toPrimitive === 'symbol' ? GetMethod(input, self.Symbol.toPrimitive) : undefined; + // e. If exoticToPrim is not undefined, then + if (exoticToPrim !== undefined) { + // i. Let result be ? Call(exoticToPrim, input, « hint »). + var result = Call(exoticToPrim, input, [hint]); + // ii. If Type(result) is not Object, return result. + if (Type(result) !== 'object') { + return result; + } + // iii. Throw a TypeError exception. + throw new TypeError('Cannot convert exotic object to primitive.'); + } + // f. If hint is "default", set hint to "number". + if (hint === 'default') { + hint = 'number'; + } + // g. Return ? OrdinaryToPrimitive(input, hint). + return OrdinaryToPrimitive(input, hint); + } + // 3. Return input + return input; +} + + +// _ESAbstract.ToString +/* global Type, ToPrimitive */ +// 7.1.12. ToString ( argument ) +// The abstract operation ToString converts argument to a value of type String according to Table 11: +// Table 11: ToString Conversions +/* +|---------------|--------------------------------------------------------| +| Argument Type | Result | +|---------------|--------------------------------------------------------| +| Undefined | Return "undefined". | +|---------------|--------------------------------------------------------| +| Null | Return "null". | +|---------------|--------------------------------------------------------| +| Boolean | If argument is true, return "true". | +| | If argument is false, return "false". | +|---------------|--------------------------------------------------------| +| Number | Return NumberToString(argument). | +|---------------|--------------------------------------------------------| +| String | Return argument. | +|---------------|--------------------------------------------------------| +| Symbol | Throw a TypeError exception. | +|---------------|--------------------------------------------------------| +| Object | Apply the following steps: | +| | Let primValue be ? ToPrimitive(argument, hint String). | +| | Return ? ToString(primValue). | +|---------------|--------------------------------------------------------| +*/ +function ToString(argument) { // eslint-disable-line no-unused-vars + switch(Type(argument)) { + case 'symbol': + throw new TypeError('Cannot convert a Symbol value to a string'); + case 'object': + var primValue = ToPrimitive(argument, String); + return ToString(primValue); // eslint-disable-line no-unused-vars + default: + return String(argument); + } +} + + +// Array.prototype.at +/* global CreateMethodProperty, Get, LengthOfArrayLike, ToIntegerOrInfinity, ToObject, ToString */ +// 23.1.3.1. Array.prototype.at ( index ) +CreateMethodProperty(Array.prototype, 'at', function at(index) { + // 1. Let O be ? ToObject(this value). + var O = ToObject(this); + // 2. Let len be ? LengthOfArrayLike(O). + var len = LengthOfArrayLike(O); + // 3. Let relativeIndex be ? ToIntegerOrInfinity(index). + var relativeIndex = ToIntegerOrInfinity(index); + // 4. If relativeIndex ≥ 0, then + // 4.a. Let k be relativeIndex. + // 5. Else, + // 5.a. Let k be len + relativeIndex. + var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex; + // 6. If k < 0 or k ≥ len, return undefined. + if (k < 0 || k >= len) return undefined; + // 7. Return ? Get(O, ! ToString(𝔽(k))). + return Get(O, ToString(k)); +}); + +} +})(); \ No newline at end of file diff --git a/src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill.String.prototype.at.js b/src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill.String.prototype.at.js new file mode 100644 index 00000000..21e71ca8 --- /dev/null +++ b/src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill.String.prototype.at.js @@ -0,0 +1,421 @@ +"use strict"; +/** + * Generated by scripts/generatePolyfill/index.js + * Options: + * polyfillFeature: String.prototype.at + * polyfillAliases: es2022 + * targetChromiumVersion: 86.0.0 + * polyfillVersionRange: <92.0.0-0 (< 92) + */ +(() => { +if (!("at"in String.prototype)) { +if (!("defineProperty"in Object&&function(){try{var e={} +return Object.defineProperty(e,"test",{value:42}),!0}catch(t){return!1}}())) { + +// Object.defineProperty +(function (nativeDefineProperty) { + + var supportsAccessors = Object.prototype.hasOwnProperty.call(Object.prototype, '__defineGetter__'); + var ERR_ACCESSORS_NOT_SUPPORTED = 'Getters & setters cannot be defined on this javascript engine'; + var ERR_VALUE_ACCESSORS = 'A property cannot both have accessors and be writable or have a value'; + + // Polyfill.io - This does not use CreateMethodProperty because our CreateMethodProperty function uses Object.defineProperty. + Object.defineProperty = function defineProperty(object, property, descriptor) { + + // Where native support exists, assume it + if (nativeDefineProperty && (object === window || object === document || object === Element.prototype || object instanceof Element)) { + return nativeDefineProperty(object, property, descriptor); + } + + if (object === null || !(object instanceof Object || typeof object === 'object')) { + throw new TypeError('Object.defineProperty called on non-object'); + } + + if (!(descriptor instanceof Object)) { + throw new TypeError('Property description must be an object'); + } + + var propertyString = String(property); + var hasValueOrWritable = 'value' in descriptor || 'writable' in descriptor; + var getterType = 'get' in descriptor && typeof descriptor.get; + var setterType = 'set' in descriptor && typeof descriptor.set; + + // handle descriptor.get + if (getterType) { + if (getterType === undefined) { + return object; + } + if (getterType !== 'function') { + throw new TypeError('Getter must be a function'); + } + if (!supportsAccessors) { + throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED); + } + if (hasValueOrWritable) { + throw new TypeError(ERR_VALUE_ACCESSORS); + } + Object.__defineGetter__.call(object, propertyString, descriptor.get); + } else { + object[propertyString] = descriptor.value; + } + + // handle descriptor.set + if (setterType) { + if (setterType === undefined) { + return object; + } + if (setterType !== 'function') { + throw new TypeError('Setter must be a function'); + } + if (!supportsAccessors) { + throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED); + } + if (hasValueOrWritable) { + throw new TypeError(ERR_VALUE_ACCESSORS); + } + Object.__defineSetter__.call(object, propertyString, descriptor.set); + } + + // OK to define value unconditionally - if a getter has been specified as well, an error would be thrown above + if ('value' in descriptor) { + object[propertyString] = descriptor.value; + } + + return object; + }; +}(Object.defineProperty)); + +} + +// _ESAbstract.CreateMethodProperty +// 7.3.5. CreateMethodProperty ( O, P, V ) +function CreateMethodProperty(O, P, V) { // eslint-disable-line no-unused-vars + // 1. Assert: Type(O) is Object. + // 2. Assert: IsPropertyKey(P) is true. + // 3. Let newDesc be the PropertyDescriptor{[[Value]]: V, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true}. + var newDesc = { + value: V, + writable: true, + enumerable: false, + configurable: true + }; + // 4. Return ? O.[[DefineOwnProperty]](P, newDesc). + Object.defineProperty(O, P, newDesc); +} + + +// _ESAbstract.RequireObjectCoercible +// 7.2.1. RequireObjectCoercible ( argument ) +// The abstract operation ToObject converts argument to a value of type Object according to Table 12: +// Table 12: ToObject Conversions +/* +|----------------------------------------------------------------------------------------------------------------------------------------------------| +| Argument Type | Result | +|----------------------------------------------------------------------------------------------------------------------------------------------------| +| Undefined | Throw a TypeError exception. | +| Null | Throw a TypeError exception. | +| Boolean | Return argument. | +| Number | Return argument. | +| String | Return argument. | +| Symbol | Return argument. | +| Object | Return argument. | +|----------------------------------------------------------------------------------------------------------------------------------------------------| +*/ +function RequireObjectCoercible(argument) { // eslint-disable-line no-unused-vars + if (argument === null || argument === undefined) { + throw TypeError(Object.prototype.toString.call(argument) + ' is not coercible to Object.'); + } + return argument; +} + + +// _ESAbstract.ToNumber +// 7.1.3. ToNumber ( argument ) +function ToNumber(argument) { // eslint-disable-line no-unused-vars + return Number(argument); +} + + +// _ESAbstract.ToIntegerOrInfinity +/* global ToNumber */ +// 7.1.5. ToIntegerOrInfinity ( argument ) +function ToIntegerOrInfinity(argument) { // eslint-disable-line no-unused-vars + // 1. Let number be ? ToNumber(argument). + var number = ToNumber(argument); + // 2. If number is NaN, +0𝔽, or -0𝔽, return 0. + if (isNaN(number) || number === 0 || 1/number === -Infinity) return 0; + // 3. If number is +∞𝔽, return +∞. + if (number === Infinity) return Infinity; + // 4. If number is -∞𝔽, return -∞. + if (number === -Infinity) return -Infinity; + // 5. Let integer be floor(abs(ℝ(number))). + var integer = Math.floor(Math.abs(number)); + // 6. If number < +0𝔽, set integer to -integer. + if (number < 0) integer = -integer; + // 7. Return integer. + return integer; +} + + +// _ESAbstract.Call +/* global IsCallable */ +// 7.3.12. Call ( F, V [ , argumentsList ] ) +function Call(F, V /* [, argumentsList] */) { // eslint-disable-line no-unused-vars + // 1. If argumentsList is not present, set argumentsList to a new empty List. + var argumentsList = arguments.length > 2 ? arguments[2] : []; + // 2. If IsCallable(F) is false, throw a TypeError exception. + if (IsCallable(F) === false) { + throw new TypeError(Object.prototype.toString.call(F) + 'is not a function.'); + } + // 3. Return ? F.[[Call]](V, argumentsList). + return F.apply(V, argumentsList); +} + + +// _ESAbstract.ToObject +// 7.1.13 ToObject ( argument ) +// The abstract operation ToObject converts argument to a value of type Object according to Table 12: +// Table 12: ToObject Conversions +/* +|----------------------------------------------------------------------------------------------------------------------------------------------------| +| Argument Type | Result | +|----------------------------------------------------------------------------------------------------------------------------------------------------| +| Undefined | Throw a TypeError exception. | +| Null | Throw a TypeError exception. | +| Boolean | Return a new Boolean object whose [[BooleanData]] internal slot is set to argument. See 19.3 for a description of Boolean objects. | +| Number | Return a new Number object whose [[NumberData]] internal slot is set to argument. See 20.1 for a description of Number objects. | +| String | Return a new String object whose [[StringData]] internal slot is set to argument. See 21.1 for a description of String objects. | +| Symbol | Return a new Symbol object whose [[SymbolData]] internal slot is set to argument. See 19.4 for a description of Symbol objects. | +| Object | Return argument. | +|----------------------------------------------------------------------------------------------------------------------------------------------------| +*/ +function ToObject(argument) { // eslint-disable-line no-unused-vars + if (argument === null || argument === undefined) { + throw TypeError(); + } + return Object(argument); +} + + +// _ESAbstract.GetV +/* global ToObject */ +// 7.3.2 GetV (V, P) +function GetV(v, p) { // eslint-disable-line no-unused-vars + // 1. Assert: IsPropertyKey(P) is true. + // 2. Let O be ? ToObject(V). + var o = ToObject(v); + // 3. Return ? O.[[Get]](P, V). + return o[p]; +} + + +// _ESAbstract.IsCallable +// 7.2.3. IsCallable ( argument ) +function IsCallable(argument) { // eslint-disable-line no-unused-vars + // 1. If Type(argument) is not Object, return false. + // 2. If argument has a [[Call]] internal method, return true. + // 3. Return false. + + // Polyfill.io - Only function objects have a [[Call]] internal method. This means we can simplify this function to check that the argument has a type of function. + return typeof argument === 'function'; +} + + +// _ESAbstract.GetMethod +/* global GetV, IsCallable */ +// 7.3.9. GetMethod ( V, P ) +function GetMethod(V, P) { // eslint-disable-line no-unused-vars + // 1. Assert: IsPropertyKey(P) is true. + // 2. Let func be ? GetV(V, P). + var func = GetV(V, P); + // 3. If func is either undefined or null, return undefined. + if (func === null || func === undefined) { + return undefined; + } + // 4. If IsCallable(func) is false, throw a TypeError exception. + if (IsCallable(func) === false) { + throw new TypeError('Method not callable: ' + P); + } + // 5. Return func. + return func; +} + + +// _ESAbstract.Get +// 7.3.1. Get ( O, P ) +function Get(O, P) { // eslint-disable-line no-unused-vars + // 1. Assert: Type(O) is Object. + // 2. Assert: IsPropertyKey(P) is true. + // 3. Return ? O.[[Get]](P, O). + return O[P]; +} + + +// _ESAbstract.Type +// "Type(x)" is used as shorthand for "the type of x"... +function Type(x) { // eslint-disable-line no-unused-vars + switch (typeof x) { + case 'undefined': + return 'undefined'; + case 'boolean': + return 'boolean'; + case 'number': + return 'number'; + case 'string': + return 'string'; + case 'symbol': + return 'symbol'; + default: + // typeof null is 'object' + if (x === null) return 'null'; + // Polyfill.io - This is here because a Symbol polyfill will have a typeof `object`. + if ('Symbol' in self && (x instanceof self.Symbol || x.constructor === self.Symbol)) return 'symbol'; + + return 'object'; + } +} + + +// _ESAbstract.OrdinaryToPrimitive +/* global Get, IsCallable, Call, Type */ +// 7.1.1.1. OrdinaryToPrimitive ( O, hint ) +function OrdinaryToPrimitive(O, hint) { // eslint-disable-line no-unused-vars + // 1. Assert: Type(O) is Object. + // 2. Assert: Type(hint) is String and its value is either "string" or "number". + // 3. If hint is "string", then + if (hint === 'string') { + // a. Let methodNames be « "toString", "valueOf" ». + var methodNames = ['toString', 'valueOf']; + // 4. Else, + } else { + // a. Let methodNames be « "valueOf", "toString" ». + methodNames = ['valueOf', 'toString']; + } + // 5. For each name in methodNames in List order, do + for (var i = 0; i < methodNames.length; ++i) { + var name = methodNames[i]; + // a. Let method be ? Get(O, name). + var method = Get(O, name); + // b. If IsCallable(method) is true, then + if (IsCallable(method)) { + // i. Let result be ? Call(method, O). + var result = Call(method, O); + // ii. If Type(result) is not Object, return result. + if (Type(result) !== 'object') { + return result; + } + } + } + // 6. Throw a TypeError exception. + throw new TypeError('Cannot convert to primitive.'); +} + + +// _ESAbstract.ToPrimitive +/* global Type, GetMethod, Call, OrdinaryToPrimitive */ +// 7.1.1. ToPrimitive ( input [ , PreferredType ] ) +function ToPrimitive(input /* [, PreferredType] */) { // eslint-disable-line no-unused-vars + var PreferredType = arguments.length > 1 ? arguments[1] : undefined; + // 1. Assert: input is an ECMAScript language value. + // 2. If Type(input) is Object, then + if (Type(input) === 'object') { + // a. If PreferredType is not present, let hint be "default". + if (arguments.length < 2) { + var hint = 'default'; + // b. Else if PreferredType is hint String, let hint be "string". + } else if (PreferredType === String) { + hint = 'string'; + // c. Else PreferredType is hint Number, let hint be "number". + } else if (PreferredType === Number) { + hint = 'number'; + } + // d. Let exoticToPrim be ? GetMethod(input, @@toPrimitive). + var exoticToPrim = typeof self.Symbol === 'function' && typeof self.Symbol.toPrimitive === 'symbol' ? GetMethod(input, self.Symbol.toPrimitive) : undefined; + // e. If exoticToPrim is not undefined, then + if (exoticToPrim !== undefined) { + // i. Let result be ? Call(exoticToPrim, input, « hint »). + var result = Call(exoticToPrim, input, [hint]); + // ii. If Type(result) is not Object, return result. + if (Type(result) !== 'object') { + return result; + } + // iii. Throw a TypeError exception. + throw new TypeError('Cannot convert exotic object to primitive.'); + } + // f. If hint is "default", set hint to "number". + if (hint === 'default') { + hint = 'number'; + } + // g. Return ? OrdinaryToPrimitive(input, hint). + return OrdinaryToPrimitive(input, hint); + } + // 3. Return input + return input; +} + + +// _ESAbstract.ToString +/* global Type, ToPrimitive */ +// 7.1.12. ToString ( argument ) +// The abstract operation ToString converts argument to a value of type String according to Table 11: +// Table 11: ToString Conversions +/* +|---------------|--------------------------------------------------------| +| Argument Type | Result | +|---------------|--------------------------------------------------------| +| Undefined | Return "undefined". | +|---------------|--------------------------------------------------------| +| Null | Return "null". | +|---------------|--------------------------------------------------------| +| Boolean | If argument is true, return "true". | +| | If argument is false, return "false". | +|---------------|--------------------------------------------------------| +| Number | Return NumberToString(argument). | +|---------------|--------------------------------------------------------| +| String | Return argument. | +|---------------|--------------------------------------------------------| +| Symbol | Throw a TypeError exception. | +|---------------|--------------------------------------------------------| +| Object | Apply the following steps: | +| | Let primValue be ? ToPrimitive(argument, hint String). | +| | Return ? ToString(primValue). | +|---------------|--------------------------------------------------------| +*/ +function ToString(argument) { // eslint-disable-line no-unused-vars + switch(Type(argument)) { + case 'symbol': + throw new TypeError('Cannot convert a Symbol value to a string'); + case 'object': + var primValue = ToPrimitive(argument, String); + return ToString(primValue); // eslint-disable-line no-unused-vars + default: + return String(argument); + } +} + + +// String.prototype.at +/* global CreateMethodProperty, RequireObjectCoercible, ToIntegerOrInfinity, ToString */ +// 22.1.3.1. String.prototype.at ( index ) +CreateMethodProperty(String.prototype, 'at', function at(index) { + // 1. Let O be ? RequireObjectCoercible(this value). + var O = RequireObjectCoercible(this); + // 2. Let S be ? ToString(O). + var S = ToString(O); + // 3. Let len be the length of S. + var len = S.length; + // 4. Let relativeIndex be ? ToIntegerOrInfinity(index). + var relativeIndex = ToIntegerOrInfinity(index); + // 5. If relativeIndex ≥ 0, then + // 5.a. Let k be relativeIndex. + // 6. Else, + // 6.a. Let k be len + relativeIndex. + var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex; + // 7. If k < 0 or k ≥ len, return undefined. + if (k < 0 || k >= len) return undefined; + // 8. Return the substring of S from k to k + 1. + return S.substring(k, k + 1); +}); + +} +})(); \ No newline at end of file diff --git a/src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill.TypedArray.prototype.at.js b/src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill.TypedArray.prototype.at.js new file mode 100644 index 00000000..56e62ef6 --- /dev/null +++ b/src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill.TypedArray.prototype.at.js @@ -0,0 +1,1494 @@ +"use strict"; +/** + * Generated by scripts/generatePolyfill/index.js + * Options: + * polyfillFeature: TypedArray.prototype.at + * polyfillAliases: es2022 + * targetChromiumVersion: 86.0.0 + * polyfillVersionRange: <92.0.0-0 (< 92) + */ +(() => { +if (!("Int8Array"in self&&"at"in self.Int8Array.prototype)) { +if (!("defineProperty"in Object&&function(){try{var e={} +return Object.defineProperty(e,"test",{value:42}),!0}catch(t){return!1}}())) { + +// Object.defineProperty +(function (nativeDefineProperty) { + + var supportsAccessors = Object.prototype.hasOwnProperty.call(Object.prototype, '__defineGetter__'); + var ERR_ACCESSORS_NOT_SUPPORTED = 'Getters & setters cannot be defined on this javascript engine'; + var ERR_VALUE_ACCESSORS = 'A property cannot both have accessors and be writable or have a value'; + + // Polyfill.io - This does not use CreateMethodProperty because our CreateMethodProperty function uses Object.defineProperty. + Object.defineProperty = function defineProperty(object, property, descriptor) { + + // Where native support exists, assume it + if (nativeDefineProperty && (object === window || object === document || object === Element.prototype || object instanceof Element)) { + return nativeDefineProperty(object, property, descriptor); + } + + if (object === null || !(object instanceof Object || typeof object === 'object')) { + throw new TypeError('Object.defineProperty called on non-object'); + } + + if (!(descriptor instanceof Object)) { + throw new TypeError('Property description must be an object'); + } + + var propertyString = String(property); + var hasValueOrWritable = 'value' in descriptor || 'writable' in descriptor; + var getterType = 'get' in descriptor && typeof descriptor.get; + var setterType = 'set' in descriptor && typeof descriptor.set; + + // handle descriptor.get + if (getterType) { + if (getterType === undefined) { + return object; + } + if (getterType !== 'function') { + throw new TypeError('Getter must be a function'); + } + if (!supportsAccessors) { + throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED); + } + if (hasValueOrWritable) { + throw new TypeError(ERR_VALUE_ACCESSORS); + } + Object.__defineGetter__.call(object, propertyString, descriptor.get); + } else { + object[propertyString] = descriptor.value; + } + + // handle descriptor.set + if (setterType) { + if (setterType === undefined) { + return object; + } + if (setterType !== 'function') { + throw new TypeError('Setter must be a function'); + } + if (!supportsAccessors) { + throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED); + } + if (hasValueOrWritable) { + throw new TypeError(ERR_VALUE_ACCESSORS); + } + Object.__defineSetter__.call(object, propertyString, descriptor.set); + } + + // OK to define value unconditionally - if a getter has been specified as well, an error would be thrown above + if ('value' in descriptor) { + object[propertyString] = descriptor.value; + } + + return object; + }; +}(Object.defineProperty)); + +} + +// _ESAbstract.CreateMethodProperty +// 7.3.5. CreateMethodProperty ( O, P, V ) +function CreateMethodProperty(O, P, V) { // eslint-disable-line no-unused-vars + // 1. Assert: Type(O) is Object. + // 2. Assert: IsPropertyKey(P) is true. + // 3. Let newDesc be the PropertyDescriptor{[[Value]]: V, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true}. + var newDesc = { + value: V, + writable: true, + enumerable: false, + configurable: true + }; + // 4. Return ? O.[[DefineOwnProperty]](P, newDesc). + Object.defineProperty(O, P, newDesc); +} + + +// _ESAbstract.ToNumber +// 7.1.3. ToNumber ( argument ) +function ToNumber(argument) { // eslint-disable-line no-unused-vars + return Number(argument); +} + + +// _ESAbstract.ToIntegerOrInfinity +/* global ToNumber */ +// 7.1.5. ToIntegerOrInfinity ( argument ) +function ToIntegerOrInfinity(argument) { // eslint-disable-line no-unused-vars + // 1. Let number be ? ToNumber(argument). + var number = ToNumber(argument); + // 2. If number is NaN, +0𝔽, or -0𝔽, return 0. + if (isNaN(number) || number === 0 || 1/number === -Infinity) return 0; + // 3. If number is +∞𝔽, return +∞. + if (number === Infinity) return Infinity; + // 4. If number is -∞𝔽, return -∞. + if (number === -Infinity) return -Infinity; + // 5. Let integer be floor(abs(ℝ(number))). + var integer = Math.floor(Math.abs(number)); + // 6. If number < +0𝔽, set integer to -integer. + if (number < 0) integer = -integer; + // 7. Return integer. + return integer; +} + + +// _ESAbstract.Call +/* global IsCallable */ +// 7.3.12. Call ( F, V [ , argumentsList ] ) +function Call(F, V /* [, argumentsList] */) { // eslint-disable-line no-unused-vars + // 1. If argumentsList is not present, set argumentsList to a new empty List. + var argumentsList = arguments.length > 2 ? arguments[2] : []; + // 2. If IsCallable(F) is false, throw a TypeError exception. + if (IsCallable(F) === false) { + throw new TypeError(Object.prototype.toString.call(F) + 'is not a function.'); + } + // 3. Return ? F.[[Call]](V, argumentsList). + return F.apply(V, argumentsList); +} + + +// _ESAbstract.ToObject +// 7.1.13 ToObject ( argument ) +// The abstract operation ToObject converts argument to a value of type Object according to Table 12: +// Table 12: ToObject Conversions +/* +|----------------------------------------------------------------------------------------------------------------------------------------------------| +| Argument Type | Result | +|----------------------------------------------------------------------------------------------------------------------------------------------------| +| Undefined | Throw a TypeError exception. | +| Null | Throw a TypeError exception. | +| Boolean | Return a new Boolean object whose [[BooleanData]] internal slot is set to argument. See 19.3 for a description of Boolean objects. | +| Number | Return a new Number object whose [[NumberData]] internal slot is set to argument. See 20.1 for a description of Number objects. | +| String | Return a new String object whose [[StringData]] internal slot is set to argument. See 21.1 for a description of String objects. | +| Symbol | Return a new Symbol object whose [[SymbolData]] internal slot is set to argument. See 19.4 for a description of Symbol objects. | +| Object | Return argument. | +|----------------------------------------------------------------------------------------------------------------------------------------------------| +*/ +function ToObject(argument) { // eslint-disable-line no-unused-vars + if (argument === null || argument === undefined) { + throw TypeError(); + } + return Object(argument); +} + + +// _ESAbstract.GetV +/* global ToObject */ +// 7.3.2 GetV (V, P) +function GetV(v, p) { // eslint-disable-line no-unused-vars + // 1. Assert: IsPropertyKey(P) is true. + // 2. Let O be ? ToObject(V). + var o = ToObject(v); + // 3. Return ? O.[[Get]](P, V). + return o[p]; +} + + +// _ESAbstract.IsCallable +// 7.2.3. IsCallable ( argument ) +function IsCallable(argument) { // eslint-disable-line no-unused-vars + // 1. If Type(argument) is not Object, return false. + // 2. If argument has a [[Call]] internal method, return true. + // 3. Return false. + + // Polyfill.io - Only function objects have a [[Call]] internal method. This means we can simplify this function to check that the argument has a type of function. + return typeof argument === 'function'; +} + + +// _ESAbstract.GetMethod +/* global GetV, IsCallable */ +// 7.3.9. GetMethod ( V, P ) +function GetMethod(V, P) { // eslint-disable-line no-unused-vars + // 1. Assert: IsPropertyKey(P) is true. + // 2. Let func be ? GetV(V, P). + var func = GetV(V, P); + // 3. If func is either undefined or null, return undefined. + if (func === null || func === undefined) { + return undefined; + } + // 4. If IsCallable(func) is false, throw a TypeError exception. + if (IsCallable(func) === false) { + throw new TypeError('Method not callable: ' + P); + } + // 5. Return func. + return func; +} + + +// _ESAbstract.Get +// 7.3.1. Get ( O, P ) +function Get(O, P) { // eslint-disable-line no-unused-vars + // 1. Assert: Type(O) is Object. + // 2. Assert: IsPropertyKey(P) is true. + // 3. Return ? O.[[Get]](P, O). + return O[P]; +} + + +// _ESAbstract.Type +// "Type(x)" is used as shorthand for "the type of x"... +function Type(x) { // eslint-disable-line no-unused-vars + switch (typeof x) { + case 'undefined': + return 'undefined'; + case 'boolean': + return 'boolean'; + case 'number': + return 'number'; + case 'string': + return 'string'; + case 'symbol': + return 'symbol'; + default: + // typeof null is 'object' + if (x === null) return 'null'; + // Polyfill.io - This is here because a Symbol polyfill will have a typeof `object`. + if ('Symbol' in self && (x instanceof self.Symbol || x.constructor === self.Symbol)) return 'symbol'; + + return 'object'; + } +} + + +// _ESAbstract.OrdinaryToPrimitive +/* global Get, IsCallable, Call, Type */ +// 7.1.1.1. OrdinaryToPrimitive ( O, hint ) +function OrdinaryToPrimitive(O, hint) { // eslint-disable-line no-unused-vars + // 1. Assert: Type(O) is Object. + // 2. Assert: Type(hint) is String and its value is either "string" or "number". + // 3. If hint is "string", then + if (hint === 'string') { + // a. Let methodNames be « "toString", "valueOf" ». + var methodNames = ['toString', 'valueOf']; + // 4. Else, + } else { + // a. Let methodNames be « "valueOf", "toString" ». + methodNames = ['valueOf', 'toString']; + } + // 5. For each name in methodNames in List order, do + for (var i = 0; i < methodNames.length; ++i) { + var name = methodNames[i]; + // a. Let method be ? Get(O, name). + var method = Get(O, name); + // b. If IsCallable(method) is true, then + if (IsCallable(method)) { + // i. Let result be ? Call(method, O). + var result = Call(method, O); + // ii. If Type(result) is not Object, return result. + if (Type(result) !== 'object') { + return result; + } + } + } + // 6. Throw a TypeError exception. + throw new TypeError('Cannot convert to primitive.'); +} + + +// _ESAbstract.ToPrimitive +/* global Type, GetMethod, Call, OrdinaryToPrimitive */ +// 7.1.1. ToPrimitive ( input [ , PreferredType ] ) +function ToPrimitive(input /* [, PreferredType] */) { // eslint-disable-line no-unused-vars + var PreferredType = arguments.length > 1 ? arguments[1] : undefined; + // 1. Assert: input is an ECMAScript language value. + // 2. If Type(input) is Object, then + if (Type(input) === 'object') { + // a. If PreferredType is not present, let hint be "default". + if (arguments.length < 2) { + var hint = 'default'; + // b. Else if PreferredType is hint String, let hint be "string". + } else if (PreferredType === String) { + hint = 'string'; + // c. Else PreferredType is hint Number, let hint be "number". + } else if (PreferredType === Number) { + hint = 'number'; + } + // d. Let exoticToPrim be ? GetMethod(input, @@toPrimitive). + var exoticToPrim = typeof self.Symbol === 'function' && typeof self.Symbol.toPrimitive === 'symbol' ? GetMethod(input, self.Symbol.toPrimitive) : undefined; + // e. If exoticToPrim is not undefined, then + if (exoticToPrim !== undefined) { + // i. Let result be ? Call(exoticToPrim, input, « hint »). + var result = Call(exoticToPrim, input, [hint]); + // ii. If Type(result) is not Object, return result. + if (Type(result) !== 'object') { + return result; + } + // iii. Throw a TypeError exception. + throw new TypeError('Cannot convert exotic object to primitive.'); + } + // f. If hint is "default", set hint to "number". + if (hint === 'default') { + hint = 'number'; + } + // g. Return ? OrdinaryToPrimitive(input, hint). + return OrdinaryToPrimitive(input, hint); + } + // 3. Return input + return input; +} + + +// _ESAbstract.ToString +/* global Type, ToPrimitive */ +// 7.1.12. ToString ( argument ) +// The abstract operation ToString converts argument to a value of type String according to Table 11: +// Table 11: ToString Conversions +/* +|---------------|--------------------------------------------------------| +| Argument Type | Result | +|---------------|--------------------------------------------------------| +| Undefined | Return "undefined". | +|---------------|--------------------------------------------------------| +| Null | Return "null". | +|---------------|--------------------------------------------------------| +| Boolean | If argument is true, return "true". | +| | If argument is false, return "false". | +|---------------|--------------------------------------------------------| +| Number | Return NumberToString(argument). | +|---------------|--------------------------------------------------------| +| String | Return argument. | +|---------------|--------------------------------------------------------| +| Symbol | Throw a TypeError exception. | +|---------------|--------------------------------------------------------| +| Object | Apply the following steps: | +| | Let primValue be ? ToPrimitive(argument, hint String). | +| | Return ? ToString(primValue). | +|---------------|--------------------------------------------------------| +*/ +function ToString(argument) { // eslint-disable-line no-unused-vars + switch(Type(argument)) { + case 'symbol': + throw new TypeError('Cannot convert a Symbol value to a string'); + case 'object': + var primValue = ToPrimitive(argument, String); + return ToString(primValue); // eslint-disable-line no-unused-vars + default: + return String(argument); + } +} + + +// ArrayBuffer +/* + Copyright (c) 2010, Linden Research, Inc. + Copyright (c) 2014, Joshua Bell + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + $/LicenseInfo$ + */ + +// Original can be found at: +// https://bitbucket.org/lindenlab/llsd +// Modifications by Joshua Bell inexorabletash@gmail.com +// https://github.com/inexorabletash/polyfill + +// ES3/ES5 implementation of the Krhonos Typed Array Specification +// Ref: http://www.khronos.org/registry/typedarray/specs/latest/ +// Date: 2011-02-01 +// +// Variations: +// * Allows typed_array.get/set() as alias for subscripts (typed_array[]) +// * Gradually migrating structure from Khronos spec to ES2015 spec +// +// Caveats: +// * Beyond 10000 or so entries, polyfilled array accessors (ta[0], +// etc) become memory-prohibitive, so array creation will fail. Set +// self.TYPED_ARRAY_POLYFILL_NO_ARRAY_ACCESSORS=true to disable +// creation of accessors. Your code will need to use the +// non-standard get()/set() instead, and will need to add those to +// native arrays for interop. +(function(global) { + 'use strict'; + var undefined = (void 0); // Paranoia + + // Beyond this value, index getters/setters (i.e. array[0], array[1]) are so slow to + // create, and consume so much memory, that the browser appears frozen. + var MAX_ARRAY_LENGTH = 1e5; + + // Approximations of internal ECMAScript conversion functions + function Type(v) { + switch(typeof v) { + case 'undefined': return 'undefined'; + case 'boolean': return 'boolean'; + case 'number': return 'number'; + case 'string': return 'string'; + default: return v === null ? 'null' : 'object'; + } + } + + // Class returns internal [[Class]] property, used to avoid cross-frame instanceof issues: + function Class(v) { return Object.prototype.toString.call(v).replace(/^\[object *|\]$/g, ''); } + function IsCallable(o) { return typeof o === 'function'; } + function ToObject(v) { + if (v === null || v === undefined) throw TypeError(); + return Object(v); + } + function ToInt32(v) { return v >> 0; } + function ToUint32(v) { return v >>> 0; } + + // Snapshot intrinsics + var LN2 = Math.LN2, + abs = Math.abs, + floor = Math.floor, + log = Math.log, + max = Math.max, + min = Math.min, + pow = Math.pow, + round = Math.round; + + // emulate ES5 getter/setter API using legacy APIs + // http://blogs.msdn.com/b/ie/archive/2010/09/07/transitioning-existing-code-to-the-es5-getter-setter-apis.aspx + // (second clause tests for Object.defineProperty() in IE<9 that only supports extending DOM prototypes, but + // note that IE<9 does not support __defineGetter__ or __defineSetter__ so it just renders the method harmless) + + (function() { + var orig = Object.defineProperty; + var dom_only = !(function(){try{return Object.defineProperty({},'x',{});}catch(_){return false;}}()); + + if (!orig || dom_only) { + Object.defineProperty = function (o, prop, desc) { + // In IE8 try built-in implementation for defining properties on DOM prototypes. + if (orig) + try { return orig(o, prop, desc); } catch (_) {} + if (o !== Object(o)) + throw TypeError('Object.defineProperty called on non-object'); + if (Object.prototype.__defineGetter__ && ('get' in desc)) + Object.prototype.__defineGetter__.call(o, prop, desc.get); + if (Object.prototype.__defineSetter__ && ('set' in desc)) + Object.prototype.__defineSetter__.call(o, prop, desc.set); + if ('value' in desc) + o[prop] = desc.value; + return o; + }; + } + }()); + + // ES5: Make obj[index] an alias for obj._getter(index)/obj._setter(index, value) + // for index in 0 ... obj.length + function makeArrayAccessors(obj) { + if ('TYPED_ARRAY_POLYFILL_NO_ARRAY_ACCESSORS' in global) + return; + + if (obj.length > MAX_ARRAY_LENGTH) throw RangeError('Array too large for polyfill'); + + function makeArrayAccessor(index) { + try { + Object.defineProperty(obj, index, { + 'get': function() { return obj._getter(index); }, + 'set': function(v) { obj._setter(index, v); }, + enumerable: true, + configurable: false + }); + } catch (_){ } + } + + var i; + for (i = 0; i < obj.length; i += 1) { + makeArrayAccessor(i); + } + } + + // Internal conversion functions: + // pack() - take a number (interpreted as Type), output a byte array + // unpack() - take a byte array, output a Type-like number + + function as_signed(value, bits) { var s = 32 - bits; return (value << s) >> s; } + function as_unsigned(value, bits) { var s = 32 - bits; return (value << s) >>> s; } + + function packI8(n) { return [n & 0xff]; } + function unpackI8(bytes) { return as_signed(bytes[0], 8); } + + function packU8(n) { return [n & 0xff]; } + function unpackU8(bytes) { return as_unsigned(bytes[0], 8); } + + function packU8Clamped(n) { n = round(Number(n)); return [n < 0 ? 0 : n > 0xff ? 0xff : n & 0xff]; } + + function packI16(n) { return [n & 0xff, (n >> 8) & 0xff]; } + function unpackI16(bytes) { return as_signed(bytes[1] << 8 | bytes[0], 16); } + + function packU16(n) { return [n & 0xff, (n >> 8) & 0xff]; } + function unpackU16(bytes) { return as_unsigned(bytes[1] << 8 | bytes[0], 16); } + + function packI32(n) { return [n & 0xff, (n >> 8) & 0xff, (n >> 16) & 0xff, (n >> 24) & 0xff]; } + function unpackI32(bytes) { return as_signed(bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0], 32); } + + function packU32(n) { return [n & 0xff, (n >> 8) & 0xff, (n >> 16) & 0xff, (n >> 24) & 0xff]; } + function unpackU32(bytes) { return as_unsigned(bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0], 32); } + + function packIEEE754(v, ebits, fbits) { + + var bias = (1 << (ebits - 1)) - 1; + + function roundToEven(n) { + var w = floor(n), f = n - w; + if (f < 0.5) + return w; + if (f > 0.5) + return w + 1; + return w % 2 ? w + 1 : w; + } + + // Compute sign, exponent, fraction + var s, e, f; + if (v !== v) { + // NaN + // http://dev.w3.org/2006/webapi/WebIDL/#es-type-mapping + e = (1 << ebits) - 1; f = pow(2, fbits - 1); s = 0; + } else if (v === Infinity || v === -Infinity) { + e = (1 << ebits) - 1; f = 0; s = (v < 0) ? 1 : 0; + } else if (v === 0) { + e = 0; f = 0; s = (1 / v === -Infinity) ? 1 : 0; + } else { + s = v < 0; + v = abs(v); + + if (v >= pow(2, 1 - bias)) { + // Normalized + e = min(floor(log(v) / LN2), 1023); + var significand = v / pow(2, e); + if (significand < 1) { + e -= 1; + significand *= 2; + } + if (significand >= 2) { + e += 1; + significand /= 2; + } + var d = pow(2, fbits); + f = roundToEven(significand * d) - d; + e += bias; + if (f / d >= 1) { + e += 1; + f = 0; + } + if (e > 2 * bias) { + // Overflow + e = (1 << ebits) - 1; + f = 0; + } + } else { + // Denormalized + e = 0; + f = roundToEven(v / pow(2, 1 - bias - fbits)); + } + } + + // Pack sign, exponent, fraction + var bits = [], i; + for (i = fbits; i; i -= 1) { bits.push(f % 2 ? 1 : 0); f = floor(f / 2); } + for (i = ebits; i; i -= 1) { bits.push(e % 2 ? 1 : 0); e = floor(e / 2); } + bits.push(s ? 1 : 0); + bits.reverse(); + var str = bits.join(''); + + // Bits to bytes + var bytes = []; + while (str.length) { + bytes.unshift(parseInt(str.substring(0, 8), 2)); + str = str.substring(8); + } + return bytes; + } + + function unpackIEEE754(bytes, ebits, fbits) { + // Bytes to bits + var bits = [], i, j, b, str, + bias, s, e, f; + + for (i = 0; i < bytes.length; ++i) { + b = bytes[i]; + for (j = 8; j; j -= 1) { + bits.push(b % 2 ? 1 : 0); b = b >> 1; + } + } + bits.reverse(); + str = bits.join(''); + + // Unpack sign, exponent, fraction + bias = (1 << (ebits - 1)) - 1; + s = parseInt(str.substring(0, 1), 2) ? -1 : 1; + e = parseInt(str.substring(1, 1 + ebits), 2); + f = parseInt(str.substring(1 + ebits), 2); + + // Produce number + if (e === (1 << ebits) - 1) { + return f !== 0 ? NaN : s * Infinity; + } else if (e > 0) { + // Normalized + return s * pow(2, e - bias) * (1 + f / pow(2, fbits)); + } else if (f !== 0) { + // Denormalized + return s * pow(2, -(bias - 1)) * (f / pow(2, fbits)); + } else { + return s < 0 ? -0 : 0; + } + } + + function unpackF64(b) { return unpackIEEE754(b, 11, 52); } + function packF64(v) { return packIEEE754(v, 11, 52); } + function unpackF32(b) { return unpackIEEE754(b, 8, 23); } + function packF32(v) { return packIEEE754(v, 8, 23); } + + // + // 3 The ArrayBuffer Type + // + + (function() { + + function ArrayBuffer(length) { + length = ToInt32(length); + if (length < 0) throw RangeError('ArrayBuffer size is not a small enough positive integer.'); + Object.defineProperty(this, 'byteLength', {value: length}); + Object.defineProperty(this, '_bytes', {value: Array(length)}); + + for (var i = 0; i < length; i += 1) + this._bytes[i] = 0; + } + + global.ArrayBuffer = global.ArrayBuffer || ArrayBuffer; + + // + // 5 The Typed Array View Types + // + + function $TypedArray$() { + + // %TypedArray% ( length ) + if (!arguments.length || typeof arguments[0] !== 'object') { + return (function(length) { + length = ToInt32(length); + if (length < 0) throw RangeError('length is not a small enough positive integer.'); + Object.defineProperty(this, 'length', {value: length}); + Object.defineProperty(this, 'byteLength', {value: length * this.BYTES_PER_ELEMENT}); + Object.defineProperty(this, 'buffer', {value: new ArrayBuffer(this.byteLength)}); + Object.defineProperty(this, 'byteOffset', {value: 0}); + + }).apply(this, arguments); + } + + // %TypedArray% ( typedArray ) + if (arguments.length >= 1 && + Type(arguments[0]) === 'object' && + arguments[0] instanceof $TypedArray$) { + return (function(typedArray){ + if (this.constructor !== typedArray.constructor) throw TypeError(); + + var byteLength = typedArray.length * this.BYTES_PER_ELEMENT; + Object.defineProperty(this, 'buffer', {value: new ArrayBuffer(byteLength)}); + Object.defineProperty(this, 'byteLength', {value: byteLength}); + Object.defineProperty(this, 'byteOffset', {value: 0}); + Object.defineProperty(this, 'length', {value: typedArray.length}); + + for (var i = 0; i < this.length; i += 1) + this._setter(i, typedArray._getter(i)); + + }).apply(this, arguments); + } + + // %TypedArray% ( array ) + if (arguments.length >= 1 && + Type(arguments[0]) === 'object' && + !(arguments[0] instanceof $TypedArray$) && + !(arguments[0] instanceof ArrayBuffer || Class(arguments[0]) === 'ArrayBuffer')) { + return (function(array) { + + var byteLength = array.length * this.BYTES_PER_ELEMENT; + Object.defineProperty(this, 'buffer', {value: new ArrayBuffer(byteLength)}); + Object.defineProperty(this, 'byteLength', {value: byteLength}); + Object.defineProperty(this, 'byteOffset', {value: 0}); + Object.defineProperty(this, 'length', {value: array.length}); + + for (var i = 0; i < this.length; i += 1) { + var s = array[i]; + this._setter(i, Number(s)); + } + }).apply(this, arguments); + } + + // %TypedArray% ( buffer, byteOffset=0, length=undefined ) + if (arguments.length >= 1 && + Type(arguments[0]) === 'object' && + (arguments[0] instanceof ArrayBuffer || Class(arguments[0]) === 'ArrayBuffer')) { + return (function(buffer, byteOffset, length) { + + byteOffset = ToUint32(byteOffset); + if (byteOffset > buffer.byteLength) + throw RangeError('byteOffset out of range'); + + // The given byteOffset must be a multiple of the element + // size of the specific type, otherwise an exception is raised. + if (byteOffset % this.BYTES_PER_ELEMENT) + throw RangeError('buffer length minus the byteOffset is not a multiple of the element size.'); + + if (length === undefined) { + var byteLength = buffer.byteLength - byteOffset; + if (byteLength % this.BYTES_PER_ELEMENT) + throw RangeError('length of buffer minus byteOffset not a multiple of the element size'); + length = byteLength / this.BYTES_PER_ELEMENT; + + } else { + length = ToUint32(length); + byteLength = length * this.BYTES_PER_ELEMENT; + } + + if ((byteOffset + byteLength) > buffer.byteLength) + throw RangeError('byteOffset and length reference an area beyond the end of the buffer'); + + Object.defineProperty(this, 'buffer', {value: buffer}); + Object.defineProperty(this, 'byteLength', {value: byteLength}); + Object.defineProperty(this, 'byteOffset', {value: byteOffset}); + Object.defineProperty(this, 'length', {value: length}); + + }).apply(this, arguments); + } + + // %TypedArray% ( all other argument combinations ) + throw TypeError(); + } + + // Properties of the %TypedArray Instrinsic Object + + // %TypedArray%.from ( source , mapfn=undefined, thisArg=undefined ) + Object.defineProperty($TypedArray$, 'from', {value: function(iterable) { + return new this(iterable); + }}); + + // %TypedArray%.of ( ...items ) + Object.defineProperty($TypedArray$, 'of', {value: function(/*...items*/) { + return new this(arguments); + }}); + + // %TypedArray%.prototype + var $TypedArrayPrototype$ = {}; + $TypedArray$.prototype = $TypedArrayPrototype$; + + // WebIDL: getter type (unsigned long index); + Object.defineProperty($TypedArray$.prototype, '_getter', {value: function(index) { + if (arguments.length < 1) throw SyntaxError('Not enough arguments'); + + index = ToUint32(index); + if (index >= this.length) + return undefined; + + var bytes = [], i, o; + for (i = 0, o = this.byteOffset + index * this.BYTES_PER_ELEMENT; + i < this.BYTES_PER_ELEMENT; + i += 1, o += 1) { + bytes.push(this.buffer._bytes[o]); + } + return this._unpack(bytes); + }}); + + // NONSTANDARD: convenience alias for getter: type get(unsigned long index); + Object.defineProperty($TypedArray$.prototype, 'get', {value: $TypedArray$.prototype._getter}); + + // WebIDL: setter void (unsigned long index, type value); + Object.defineProperty($TypedArray$.prototype, '_setter', {value: function(index, value) { + if (arguments.length < 2) throw SyntaxError('Not enough arguments'); + + index = ToUint32(index); + if (index >= this.length) + return; + + var bytes = this._pack(value), i, o; + for (i = 0, o = this.byteOffset + index * this.BYTES_PER_ELEMENT; + i < this.BYTES_PER_ELEMENT; + i += 1, o += 1) { + this.buffer._bytes[o] = bytes[i]; + } + }}); + + // get %TypedArray%.prototype.buffer + // get %TypedArray%.prototype.byteLength + // get %TypedArray%.prototype.byteOffset + // -- applied directly to the object in the constructor + + // %TypedArray%.prototype.constructor + Object.defineProperty($TypedArray$.prototype, 'constructor', {value: $TypedArray$}); + + // %TypedArray%.prototype.copyWithin (target, start, end = this.length ) + Object.defineProperty($TypedArray$.prototype, 'copyWithin', {value: function(target, start) { + var end = arguments[2]; + + var o = ToObject(this); + var lenVal = o.length; + var len = ToUint32(lenVal); + len = max(len, 0); + var relativeTarget = ToInt32(target); + var to; + if (relativeTarget < 0) + to = max(len + relativeTarget, 0); + else + to = min(relativeTarget, len); + var relativeStart = ToInt32(start); + var from; + if (relativeStart < 0) + from = max(len + relativeStart, 0); + else + from = min(relativeStart, len); + var relativeEnd; + if (end === undefined) + relativeEnd = len; + else + relativeEnd = ToInt32(end); + var final; + if (relativeEnd < 0) + final = max(len + relativeEnd, 0); + else + final = min(relativeEnd, len); + var count = min(final - from, len - to); + var direction; + if (from < to && to < from + count) { + direction = -1; + from = from + count - 1; + to = to + count - 1; + } else { + direction = 1; + } + while (count > 0) { + o._setter(to, o._getter(from)); + from = from + direction; + to = to + direction; + count = count - 1; + } + return o; + }}); + + // %TypedArray%.prototype.entries ( ) + // -- defined in es6.js to shim browsers w/ native TypedArrays + + // %TypedArray%.prototype.every ( callbackfn, thisArg = undefined ) + Object.defineProperty($TypedArray$.prototype, 'every', {value: function(callbackfn) { + if (this === undefined || this === null) throw TypeError(); + var t = Object(this); + var len = ToUint32(t.length); + if (!IsCallable(callbackfn)) throw TypeError(); + var thisArg = arguments[1]; + for (var i = 0; i < len; i++) { + if (!callbackfn.call(thisArg, t._getter(i), i, t)) + return false; + } + return true; + }}); + + // %TypedArray%.prototype.fill (value, start = 0, end = this.length ) + Object.defineProperty($TypedArray$.prototype, 'fill', {value: function(value) { + var start = arguments[1], + end = arguments[2]; + + var o = ToObject(this); + var lenVal = o.length; + var len = ToUint32(lenVal); + len = max(len, 0); + var relativeStart = ToInt32(start); + var k; + if (relativeStart < 0) + k = max((len + relativeStart), 0); + else + k = min(relativeStart, len); + var relativeEnd; + if (end === undefined) + relativeEnd = len; + else + relativeEnd = ToInt32(end); + var final; + if (relativeEnd < 0) + final = max((len + relativeEnd), 0); + else + final = min(relativeEnd, len); + while (k < final) { + o._setter(k, value); + k += 1; + } + return o; + }}); + + // %TypedArray%.prototype.filter ( callbackfn, thisArg = undefined ) + Object.defineProperty($TypedArray$.prototype, 'filter', {value: function(callbackfn) { + if (this === undefined || this === null) throw TypeError(); + var t = Object(this); + var len = ToUint32(t.length); + if (!IsCallable(callbackfn)) throw TypeError(); + var res = []; + var thisp = arguments[1]; + for (var i = 0; i < len; i++) { + var val = t._getter(i); // in case fun mutates this + if (callbackfn.call(thisp, val, i, t)) + res.push(val); + } + return new this.constructor(res); + }}); + + // %TypedArray%.prototype.find (predicate, thisArg = undefined) + Object.defineProperty($TypedArray$.prototype, 'find', {value: function(predicate) { + var o = ToObject(this); + var lenValue = o.length; + var len = ToUint32(lenValue); + if (!IsCallable(predicate)) throw TypeError(); + var t = arguments.length > 1 ? arguments[1] : undefined; + var k = 0; + while (k < len) { + var kValue = o._getter(k); + var testResult = predicate.call(t, kValue, k, o); + if (Boolean(testResult)) + return kValue; + ++k; + } + return undefined; + }}); + + // %TypedArray%.prototype.findIndex ( predicate, thisArg = undefined ) + Object.defineProperty($TypedArray$.prototype, 'findIndex', {value: function(predicate) { + var o = ToObject(this); + var lenValue = o.length; + var len = ToUint32(lenValue); + if (!IsCallable(predicate)) throw TypeError(); + var t = arguments.length > 1 ? arguments[1] : undefined; + var k = 0; + while (k < len) { + var kValue = o._getter(k); + var testResult = predicate.call(t, kValue, k, o); + if (Boolean(testResult)) + return k; + ++k; + } + return -1; + }}); + + // %TypedArray%.prototype.forEach ( callbackfn, thisArg = undefined ) + Object.defineProperty($TypedArray$.prototype, 'forEach', {value: function(callbackfn) { + if (this === undefined || this === null) throw TypeError(); + var t = Object(this); + var len = ToUint32(t.length); + if (!IsCallable(callbackfn)) throw TypeError(); + var thisp = arguments[1]; + for (var i = 0; i < len; i++) + callbackfn.call(thisp, t._getter(i), i, t); + }}); + + // %TypedArray%.prototype.indexOf (searchElement, fromIndex = 0 ) + Object.defineProperty($TypedArray$.prototype, 'indexOf', {value: function(searchElement) { + if (this === undefined || this === null) throw TypeError(); + var t = Object(this); + var len = ToUint32(t.length); + if (len === 0) return -1; + var n = 0; + if (arguments.length > 0) { + n = Number(arguments[1]); + if (n !== n) { + n = 0; + } else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0)) { + n = (n > 0 || -1) * floor(abs(n)); + } + } + if (n >= len) return -1; + var k = n >= 0 ? n : max(len - abs(n), 0); + for (; k < len; k++) { + if (t._getter(k) === searchElement) { + return k; + } + } + return -1; + }}); + + // %TypedArray%.prototype.join ( separator ) + Object.defineProperty($TypedArray$.prototype, 'join', {value: function(separator) { + if (this === undefined || this === null) throw TypeError(); + var t = Object(this); + var len = ToUint32(t.length); + var tmp = Array(len); + for (var i = 0; i < len; ++i) + tmp[i] = t._getter(i); + return tmp.join(separator === undefined ? ',' : separator); // Hack for IE7 + }}); + + // %TypedArray%.prototype.keys ( ) + // -- defined in es6.js to shim browsers w/ native TypedArrays + + // %TypedArray%.prototype.lastIndexOf ( searchElement, fromIndex = this.length-1 ) + Object.defineProperty($TypedArray$.prototype, 'lastIndexOf', {value: function(searchElement) { + if (this === undefined || this === null) throw TypeError(); + var t = Object(this); + var len = ToUint32(t.length); + if (len === 0) return -1; + var n = len; + if (arguments.length > 1) { + n = Number(arguments[1]); + if (n !== n) { + n = 0; + } else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0)) { + n = (n > 0 || -1) * floor(abs(n)); + } + } + var k = n >= 0 ? min(n, len - 1) : len - abs(n); + for (; k >= 0; k--) { + if (t._getter(k) === searchElement) + return k; + } + return -1; + }}); + + // get %TypedArray%.prototype.length + // -- applied directly to the object in the constructor + + // %TypedArray%.prototype.map ( callbackfn, thisArg = undefined ) + Object.defineProperty($TypedArray$.prototype, 'map', {value: function(callbackfn) { + if (this === undefined || this === null) throw TypeError(); + var t = Object(this); + var len = ToUint32(t.length); + if (!IsCallable(callbackfn)) throw TypeError(); + var res = []; res.length = len; + var thisp = arguments[1]; + for (var i = 0; i < len; i++) + res[i] = callbackfn.call(thisp, t._getter(i), i, t); + return new this.constructor(res); + }}); + + // %TypedArray%.prototype.reduce ( callbackfn [, initialValue] ) + Object.defineProperty($TypedArray$.prototype, 'reduce', {value: function(callbackfn) { + if (this === undefined || this === null) throw TypeError(); + var t = Object(this); + var len = ToUint32(t.length); + if (!IsCallable(callbackfn)) throw TypeError(); + // no value to return if no initial value and an empty array + if (len === 0 && arguments.length === 1) throw TypeError(); + var k = 0; + var accumulator; + if (arguments.length >= 2) { + accumulator = arguments[1]; + } else { + accumulator = t._getter(k++); + } + while (k < len) { + accumulator = callbackfn.call(undefined, accumulator, t._getter(k), k, t); + k++; + } + return accumulator; + }}); + + // %TypedArray%.prototype.reduceRight ( callbackfn [, initialValue] ) + Object.defineProperty($TypedArray$.prototype, 'reduceRight', {value: function(callbackfn) { + if (this === undefined || this === null) throw TypeError(); + var t = Object(this); + var len = ToUint32(t.length); + if (!IsCallable(callbackfn)) throw TypeError(); + // no value to return if no initial value, empty array + if (len === 0 && arguments.length === 1) throw TypeError(); + var k = len - 1; + var accumulator; + if (arguments.length >= 2) { + accumulator = arguments[1]; + } else { + accumulator = t._getter(k--); + } + while (k >= 0) { + accumulator = callbackfn.call(undefined, accumulator, t._getter(k), k, t); + k--; + } + return accumulator; + }}); + + // %TypedArray%.prototype.reverse ( ) + Object.defineProperty($TypedArray$.prototype, 'reverse', {value: function() { + if (this === undefined || this === null) throw TypeError(); + var t = Object(this); + var len = ToUint32(t.length); + var half = floor(len / 2); + for (var i = 0, j = len - 1; i < half; ++i, --j) { + var tmp = t._getter(i); + t._setter(i, t._getter(j)); + t._setter(j, tmp); + } + return t; + }}); + + // %TypedArray%.prototype.set(array, offset = 0 ) + // %TypedArray%.prototype.set(typedArray, offset = 0 ) + // WebIDL: void set(TypedArray array, optional unsigned long offset); + // WebIDL: void set(sequence array, optional unsigned long offset); + Object.defineProperty($TypedArray$.prototype, 'set', {value: function(index, value) { + if (arguments.length < 1) throw SyntaxError('Not enough arguments'); + var array, sequence, offset, len, + i, s, d, + byteOffset, byteLength, tmp; + + if (typeof arguments[0] === 'object' && arguments[0].constructor === this.constructor) { + // void set(TypedArray array, optional unsigned long offset); + array = arguments[0]; + offset = ToUint32(arguments[1]); + + if (offset + array.length > this.length) { + throw RangeError('Offset plus length of array is out of range'); + } + + byteOffset = this.byteOffset + offset * this.BYTES_PER_ELEMENT; + byteLength = array.length * this.BYTES_PER_ELEMENT; + + if (array.buffer === this.buffer) { + tmp = []; + for (i = 0, s = array.byteOffset; i < byteLength; i += 1, s += 1) { + tmp[i] = array.buffer._bytes[s]; + } + for (i = 0, d = byteOffset; i < byteLength; i += 1, d += 1) { + this.buffer._bytes[d] = tmp[i]; + } + } else { + for (i = 0, s = array.byteOffset, d = byteOffset; + i < byteLength; i += 1, s += 1, d += 1) { + this.buffer._bytes[d] = array.buffer._bytes[s]; + } + } + } else if (typeof arguments[0] === 'object' && typeof arguments[0].length !== 'undefined') { + // void set(sequence array, optional unsigned long offset); + sequence = arguments[0]; + len = ToUint32(sequence.length); + offset = ToUint32(arguments[1]); + + if (offset + len > this.length) { + throw RangeError('Offset plus length of array is out of range'); + } + + for (i = 0; i < len; i += 1) { + s = sequence[i]; + this._setter(offset + i, Number(s)); + } + } else { + throw TypeError('Unexpected argument type(s)'); + } + }}); + + // %TypedArray%.prototype.slice ( start, end ) + Object.defineProperty($TypedArray$.prototype, 'slice', {value: function(start, end) { + var o = ToObject(this); + var lenVal = o.length; + var len = ToUint32(lenVal); + var relativeStart = ToInt32(start); + var k = (relativeStart < 0) ? max(len + relativeStart, 0) : min(relativeStart, len); + var relativeEnd = (end === undefined) ? len : ToInt32(end); + var final = (relativeEnd < 0) ? max(len + relativeEnd, 0) : min(relativeEnd, len); + var count = final - k; + var c = o.constructor; + var a = new c(count); + var n = 0; + while (k < final) { + var kValue = o._getter(k); + a._setter(n, kValue); + ++k; + ++n; + } + return a; + }}); + + // %TypedArray%.prototype.some ( callbackfn, thisArg = undefined ) + Object.defineProperty($TypedArray$.prototype, 'some', {value: function(callbackfn) { + if (this === undefined || this === null) throw TypeError(); + var t = Object(this); + var len = ToUint32(t.length); + if (!IsCallable(callbackfn)) throw TypeError(); + var thisp = arguments[1]; + for (var i = 0; i < len; i++) { + if (callbackfn.call(thisp, t._getter(i), i, t)) { + return true; + } + } + return false; + }}); + + // %TypedArray%.prototype.sort ( comparefn ) + Object.defineProperty($TypedArray$.prototype, 'sort', {value: function(comparefn) { + if (this === undefined || this === null) throw TypeError(); + var t = Object(this); + var len = ToUint32(t.length); + var tmp = Array(len); + for (var i = 0; i < len; ++i) + tmp[i] = t._getter(i); + function sortCompare(x, y) { + if (x !== x && y !== y) return +0; + if (x !== x) return 1; + if (y !== y) return -1; + if (comparefn !== undefined) { + return comparefn(x, y); + } + if (x < y) return -1; + if (x > y) return 1; + return +0; + } + tmp.sort(sortCompare); + for (i = 0; i < len; ++i) + t._setter(i, tmp[i]); + return t; + }}); + + // %TypedArray%.prototype.subarray(begin = 0, end = this.length ) + // WebIDL: TypedArray subarray(long begin, optional long end); + Object.defineProperty($TypedArray$.prototype, 'subarray', {value: function(start, end) { + function clamp(v, min, max) { return v < min ? min : v > max ? max : v; } + + start = ToInt32(start); + end = ToInt32(end); + + if (arguments.length < 1) { start = 0; } + if (arguments.length < 2) { end = this.length; } + + if (start < 0) { start = this.length + start; } + if (end < 0) { end = this.length + end; } + + start = clamp(start, 0, this.length); + end = clamp(end, 0, this.length); + + var len = end - start; + if (len < 0) { + len = 0; + } + + return new this.constructor( + this.buffer, this.byteOffset + start * this.BYTES_PER_ELEMENT, len); + }}); + + // %TypedArray%.prototype.toLocaleString ( ) + // %TypedArray%.prototype.toString ( ) + // %TypedArray%.prototype.values ( ) + // %TypedArray%.prototype [ @@iterator ] ( ) + // get %TypedArray%.prototype [ @@toStringTag ] + // -- defined in es6.js to shim browsers w/ native TypedArrays + + function makeTypedArray(elementSize, pack, unpack) { + // Each TypedArray type requires a distinct constructor instance with + // identical logic, which this produces. + var TypedArray = function() { + Object.defineProperty(this, 'constructor', {value: TypedArray}); + $TypedArray$.apply(this, arguments); + makeArrayAccessors(this); + }; + if ('__proto__' in TypedArray) { + TypedArray.__proto__ = $TypedArray$; + } else { + TypedArray.from = $TypedArray$.from; + TypedArray.of = $TypedArray$.of; + } + + TypedArray.BYTES_PER_ELEMENT = elementSize; + + var TypedArrayPrototype = function() {}; + TypedArrayPrototype.prototype = $TypedArrayPrototype$; + + TypedArray.prototype = new TypedArrayPrototype(); + + Object.defineProperty(TypedArray.prototype, 'BYTES_PER_ELEMENT', {value: elementSize}); + Object.defineProperty(TypedArray.prototype, '_pack', {value: pack}); + Object.defineProperty(TypedArray.prototype, '_unpack', {value: unpack}); + + return TypedArray; + } + + var Int8Array = makeTypedArray(1, packI8, unpackI8); + var Uint8Array = makeTypedArray(1, packU8, unpackU8); + var Uint8ClampedArray = makeTypedArray(1, packU8Clamped, unpackU8); + var Int16Array = makeTypedArray(2, packI16, unpackI16); + var Uint16Array = makeTypedArray(2, packU16, unpackU16); + var Int32Array = makeTypedArray(4, packI32, unpackI32); + var Uint32Array = makeTypedArray(4, packU32, unpackU32); + var Float32Array = makeTypedArray(4, packF32, unpackF32); + var Float64Array = makeTypedArray(8, packF64, unpackF64); + + global.Int8Array = global.Int8Array || Int8Array; + global.Uint8Array = global.Uint8Array || Uint8Array; + global.Uint8ClampedArray = global.Uint8ClampedArray || Uint8ClampedArray; + global.Int16Array = global.Int16Array || Int16Array; + global.Uint16Array = global.Uint16Array || Uint16Array; + global.Int32Array = global.Int32Array || Int32Array; + global.Uint32Array = global.Uint32Array || Uint32Array; + global.Float32Array = global.Float32Array || Float32Array; + global.Float64Array = global.Float64Array || Float64Array; + }()); + + // + // 6 The DataView View Type + // + + (function() { + function r(array, index) { + return IsCallable(array.get) ? array.get(index) : array[index]; + } + + var IS_BIG_ENDIAN = (function() { + var u16array = new Uint16Array([0x1234]), + u8array = new Uint8Array(u16array.buffer); + return r(u8array, 0) === 0x12; + }()); + + // DataView(buffer, byteOffset=0, byteLength=undefined) + // WebIDL: Constructor(ArrayBuffer buffer, + // optional unsigned long byteOffset, + // optional unsigned long byteLength) + function DataView(buffer, byteOffset, byteLength) { + if (!(buffer instanceof ArrayBuffer || Class(buffer) === 'ArrayBuffer')) throw TypeError(); + + byteOffset = ToUint32(byteOffset); + if (byteOffset > buffer.byteLength) + throw RangeError('byteOffset out of range'); + + if (byteLength === undefined) + byteLength = buffer.byteLength - byteOffset; + else + byteLength = ToUint32(byteLength); + + if ((byteOffset + byteLength) > buffer.byteLength) + throw RangeError('byteOffset and length reference an area beyond the end of the buffer'); + + Object.defineProperty(this, 'buffer', {value: buffer}); + Object.defineProperty(this, 'byteLength', {value: byteLength}); + Object.defineProperty(this, 'byteOffset', {value: byteOffset}); + }; + + // get DataView.prototype.buffer + // get DataView.prototype.byteLength + // get DataView.prototype.byteOffset + // -- applied directly to instances by the constructor + + function makeGetter(arrayType) { + return function GetViewValue(byteOffset, littleEndian) { + byteOffset = ToUint32(byteOffset); + + if (byteOffset + arrayType.BYTES_PER_ELEMENT > this.byteLength) + throw RangeError('Array index out of range'); + + byteOffset += this.byteOffset; + + var uint8Array = new Uint8Array(this.buffer, byteOffset, arrayType.BYTES_PER_ELEMENT), + bytes = []; + for (var i = 0; i < arrayType.BYTES_PER_ELEMENT; i += 1) + bytes.push(r(uint8Array, i)); + + if (Boolean(littleEndian) === Boolean(IS_BIG_ENDIAN)) + bytes.reverse(); + + return r(new arrayType(new Uint8Array(bytes).buffer), 0); + }; + } + + Object.defineProperty(DataView.prototype, 'getUint8', {value: makeGetter(Uint8Array)}); + Object.defineProperty(DataView.prototype, 'getInt8', {value: makeGetter(Int8Array)}); + Object.defineProperty(DataView.prototype, 'getUint16', {value: makeGetter(Uint16Array)}); + Object.defineProperty(DataView.prototype, 'getInt16', {value: makeGetter(Int16Array)}); + Object.defineProperty(DataView.prototype, 'getUint32', {value: makeGetter(Uint32Array)}); + Object.defineProperty(DataView.prototype, 'getInt32', {value: makeGetter(Int32Array)}); + Object.defineProperty(DataView.prototype, 'getFloat32', {value: makeGetter(Float32Array)}); + Object.defineProperty(DataView.prototype, 'getFloat64', {value: makeGetter(Float64Array)}); + + function makeSetter(arrayType) { + return function SetViewValue(byteOffset, value, littleEndian) { + byteOffset = ToUint32(byteOffset); + if (byteOffset + arrayType.BYTES_PER_ELEMENT > this.byteLength) + throw RangeError('Array index out of range'); + + // Get bytes + var typeArray = new arrayType([value]), + byteArray = new Uint8Array(typeArray.buffer), + bytes = [], i, byteView; + + for (i = 0; i < arrayType.BYTES_PER_ELEMENT; i += 1) + bytes.push(r(byteArray, i)); + + // Flip if necessary + if (Boolean(littleEndian) === Boolean(IS_BIG_ENDIAN)) + bytes.reverse(); + + // Write them + byteView = new Uint8Array(this.buffer, byteOffset, arrayType.BYTES_PER_ELEMENT); + byteView.set(bytes); + }; + } + + Object.defineProperty(DataView.prototype, 'setUint8', {value: makeSetter(Uint8Array)}); + Object.defineProperty(DataView.prototype, 'setInt8', {value: makeSetter(Int8Array)}); + Object.defineProperty(DataView.prototype, 'setUint16', {value: makeSetter(Uint16Array)}); + Object.defineProperty(DataView.prototype, 'setInt16', {value: makeSetter(Int16Array)}); + Object.defineProperty(DataView.prototype, 'setUint32', {value: makeSetter(Uint32Array)}); + Object.defineProperty(DataView.prototype, 'setInt32', {value: makeSetter(Int32Array)}); + Object.defineProperty(DataView.prototype, 'setFloat32', {value: makeSetter(Float32Array)}); + Object.defineProperty(DataView.prototype, 'setFloat64', {value: makeSetter(Float64Array)}); + + global.DataView = global.DataView || DataView; + + }()); + +}(self)); + + +// TypedArray.prototype.at +/* global CreateMethodProperty, Uint8Array, ToIntegerOrInfinity, ToString */ +// 23.2.3.1. %TypedArray%.prototype.at ( index ) +(function () { + // In Internet Explorer 8 there is no support for square-bracket notation + // in the TypedArrays polyfill instead so we need to use the private `_getter` method + var typedArraysSupportIndexLookup = (function() { + var uint8 = new Uint8Array(2); + uint8[0] = 42; + return uint8[0] === 42 + }) + + function getTypedArrayIndex(array, index) { + if (typedArraysSupportIndexLookup) { + return array[index]; + } else { + return array._getter(index); + } + } + + function at(index) { + // 1. Let O be the this value. + var O = this; + // 2. Perform ? ValidateTypedArray(O). + // TODO: Add ValidateTypedArray + // 3. Let len be O.[[ArrayLength]]. + var len = O.length; + // 4. Let relativeIndex be ? ToIntegerOrInfinity(index). + var relativeIndex = ToIntegerOrInfinity(index); + // 5. If relativeIndex ≥ 0, then + // 5.a. Let k be relativeIndex. + // 6. Else, + // 6.a. Let k be len + relativeIndex. + var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex; + // 7. If k < 0 or k ≥ len, return undefined. + if (k < 0 || k >= len) return undefined; + // 8. Return ! Get(O, ! ToString(𝔽(k))). + // return Get(O, ToString(k)); + return getTypedArrayIndex(O, ToString(k)); + } + + if ('__proto__' in self.Int8Array.prototype) { + // set this on the underlying "TypedArrayPrototype", which is shared with all "TypedArray" subclasses + CreateMethodProperty(self.Int8Array.prototype.__proto__, 'at', at); + } else { + CreateMethodProperty(self.Int8Array.prototype, 'at', at); + CreateMethodProperty(self.Uint8Array.prototype, 'at', at); + CreateMethodProperty(self.Uint8ClampedArray.prototype, 'at', at); + CreateMethodProperty(self.Int16Array.prototype, 'at', at); + CreateMethodProperty(self.Uint16Array.prototype, 'at', at); + CreateMethodProperty(self.Int32Array.prototype, 'at', at); + CreateMethodProperty(self.Uint32Array.prototype, 'at', at); + CreateMethodProperty(self.Float32Array.prototype, 'at', at); + CreateMethodProperty(self.Float64Array.prototype, 'at', at); + } +})(); + +} +})(); \ No newline at end of file diff --git a/src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill.js b/src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill.js deleted file mode 100644 index 166d116a..00000000 --- a/src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill.js +++ /dev/null @@ -1,32 +0,0 @@ -"use strict"; -/** - * Generated by scripts/generatePolyfill/index.js - * Options: - * targetChromiumVersion: "70.0.3538.0" - * targetUA: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.0 Safari/537.36" - * unrecognizableFeaturesFeatures: "scripts/generatePolyfill/unrecognizableFeatures.json" - * flaggableFeatures: [ "Array.from", "Array.isArray", "Array.prototype.copyWithin", "Array.prototype.entries", "Array.prototype.fill", "Array.prototype.filter", "Array.prototype.find", "Array.prototype.flat", "Array.prototype.forEach", "Array.prototype.includes", "Array.prototype.indexOf", "Array.prototype.keys", "Array.prototype.lastIndexOf", "Array.prototype.map", "Array.prototype.reduce", "Array.prototype.some", "Array.prototype.sort", "Array.prototype.values", "ArrayBuffer", "ArrayBuffer.isView", "Blob", "DOMTokenList.prototype.forEach", "DOMTokenList.prototype.replace", "DataView", "Date.now", "Date.prototype.toISOString", "DocumentFragment.prototype.append", "DocumentFragment.prototype.prepend", "Element.prototype.after", "Element.prototype.animate", "Element.prototype.append", "Element.prototype.before", "Element.prototype.classList", "Element.prototype.closest", "Element.prototype.matches", "Element.prototype.nextElementSibling", "Element.prototype.prepend", "Element.prototype.remove", "Element.prototype.replaceWith", "Float32Array", "Float64Array", "Function.prototype.bind", "Function.prototype.name", "Int16Array", "Int32Array", "Int8Array", "IntersectionObserver", "Intl", "Intl.DateTimeFormat", "JSON", "Map", "MutationObserver", "Node.prototype.contains", "NodeList.prototype.forEach", "Number.MAX_SAFE_INTEGER", "Number.MIN_SAFE_INTEGER", "Number.isSafeInteger", "Object.assign", "Object.create", "Object.defineProperties", "Object.defineProperty", "Object.entries", "Object.fromEntries", "Object.keys", "Object.setPrototypeOf", "Object.values", "Promise", "Reflect", "Reflect.apply", "Reflect.defineProperty", "Reflect.deleteProperty", "Reflect.has", "Reflect.ownKeys", "RegExp.prototype.flags", "ResizeObserver", "Set", "String.fromCodePoint", "String.prototype.anchor", "String.prototype.codePointAt", "String.prototype.endsWith", "String.prototype.includes", "String.prototype.link", "String.prototype.padStart", "String.prototype.repeat", "String.prototype.startsWith", "String.prototype.trim", "Symbol", "Symbol.iterator", "Symbol.prototype.description", "Symbol.species", "Symbol.toPrimitive", "URL", "URL.prototype.toJSON", "URLSearchParams", "Uint16Array", "Uint32Array", "Uint8Array", "Uint8ClampedArray", "WeakMap", "WeakSet", "XMLHttpRequest", "atob", "console", "console.debug", "console.error", "console.info", "console.log", "console.warn", "document", "fetch", "getComputedStyle", "globalThis", "localStorage", "matchMedia" ] - */ -(() => { - const script = document.createElement("script"); - const url = new URL("https://polyfill.alicdn.com/v3/polyfill.js"); - url.searchParams.set("features", "Array.from,Array.isArray,Array.prototype.copyWithin,Array.prototype.entries,Array.prototype.fill,Array.prototype.filter,Array.prototype.find,Array.prototype.flat,Array.prototype.forEach,Array.prototype.includes,Array.prototype.indexOf,Array.prototype.keys,Array.prototype.lastIndexOf,Array.prototype.map,Array.prototype.reduce,Array.prototype.some,Array.prototype.sort,Array.prototype.values,ArrayBuffer,ArrayBuffer.isView,Blob,DOMTokenList.prototype.forEach,DOMTokenList.prototype.replace,DataView,Date.now,Date.prototype.toISOString,DocumentFragment.prototype.append,DocumentFragment.prototype.prepend,Element.prototype.after,Element.prototype.animate,Element.prototype.append,Element.prototype.before,Element.prototype.classList,Element.prototype.closest,Element.prototype.matches,Element.prototype.nextElementSibling,Element.prototype.prepend,Element.prototype.remove,Element.prototype.replaceWith,Float32Array,Float64Array,Function.prototype.bind,Function.prototype.name,Int16Array,Int32Array,Int8Array,IntersectionObserver,Intl,Intl.DateTimeFormat,JSON,Map,MutationObserver,Node.prototype.contains,NodeList.prototype.forEach,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.isSafeInteger,Object.assign,Object.create,Object.defineProperties,Object.defineProperty,Object.entries,Object.fromEntries,Object.keys,Object.setPrototypeOf,Object.values,Promise,Reflect,Reflect.apply,Reflect.defineProperty,Reflect.deleteProperty,Reflect.has,Reflect.ownKeys,RegExp.prototype.flags,ResizeObserver,Set,String.fromCodePoint,String.prototype.anchor,String.prototype.codePointAt,String.prototype.endsWith,String.prototype.includes,String.prototype.link,String.prototype.padStart,String.prototype.repeat,String.prototype.startsWith,String.prototype.trim,Symbol,Symbol.iterator,Symbol.prototype.description,Symbol.species,Symbol.toPrimitive,URL,URL.prototype.toJSON,URLSearchParams,Uint16Array,Uint32Array,Uint8Array,Uint8ClampedArray,WeakMap,WeakSet,XMLHttpRequest,atob,console,console.debug,console.error,console.info,console.log,console.warn,document,fetch,getComputedStyle,globalThis,localStorage,matchMedia"); - url.searchParams.set("_", btoa(navigator.userAgent)); - script.src = url.toString(); - script.async = false; - const polyfillPromise = new Promise((res) => { - script.addEventListener("load", () => res(), { - once: true, - }); - script.addEventListener("error", () => res(), { - once: true, - }); - }); - Reflect.defineProperty(window, "polyfillPromise", { - configurable: false, - enumerable: true, - writable: false, - value: polyfillPromise, - }); - document.head.appendChild(script); -})(); diff --git a/src/gadgets/libPolyfill/definition.yaml b/src/gadgets/libPolyfill/definition.yaml index 2cdc57ca..44d57476 100644 --- a/src/gadgets/libPolyfill/definition.yaml +++ b/src/gadgets/libPolyfill/definition.yaml @@ -29,5 +29,7 @@ _sites: _section: system _files: - - MediaWiki:Gadget-libPolyfill.js - MediaWiki:Gadget-libPolyfill-crypto.randomUUID.js + - MediaWiki:Gadget-libPolyfill.Array.prototype.at.js + - MediaWiki:Gadget-libPolyfill.String.prototype.at.js + - MediaWiki:Gadget-libPolyfill.TypedArray.prototype.at.js From a34c965a5506f1b7873a4f158a7514b93377b0fe Mon Sep 17 00:00:00 2001 From: AnnAngela Date: Mon, 22 Jan 2024 18:00:49 +0800 Subject: [PATCH 10/16] ci: typo --- .github/workflows/generatePolyfill.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generatePolyfill.yaml b/.github/workflows/generatePolyfill.yaml index 5c8cc3a0..15baa31a 100644 --- a/.github/workflows/generatePolyfill.yaml +++ b/.github/workflows/generatePolyfill.yaml @@ -43,7 +43,7 @@ jobs: with: fetch-depth: 0 show-progress: false - - name: Get toe polyfill config + - name: Get the polyfill config id: polyfillConfig run: | echo "TARGET_POLYFILL_VERSION=$(yq '.TARGET_POLYFILL_VERSION' scripts/generatePolyfill/config.yaml)" >> $GITHUB_OUTPUT From 4c3da010a5ca12a800e3d0e14f9cfd5753952f70 Mon Sep 17 00:00:00 2001 From: AnnAngela Date: Mon, 22 Jan 2024 18:02:23 +0800 Subject: [PATCH 11/16] ci: Update generatePolyfill.yaml workflow This commit updates the generatePolyfill.yaml workflow file. --- .github/workflows/generatePolyfill.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/generatePolyfill.yaml b/.github/workflows/generatePolyfill.yaml index 15baa31a..639f5898 100644 --- a/.github/workflows/generatePolyfill.yaml +++ b/.github/workflows/generatePolyfill.yaml @@ -3,11 +3,13 @@ name: Generate Polyfill on: push: paths: + - .github/workflows/generatePolyfill.yaml - scripts/generatePolyfill/config.yaml - scripts/generatePolyfill/index.js merge_group: pull_request: paths: + - .github/workflows/generatePolyfill.yaml - scripts/generatePolyfill/config.yaml - scripts/generatePolyfill/index.js workflow_dispatch: From d800730e1616e9650160079e85fd9acd8d2970d9 Mon Sep 17 00:00:00 2001 From: AnnAngela Date: Mon, 22 Jan 2024 18:05:48 +0800 Subject: [PATCH 12/16] =?UTF-8?q?chore:=20=E8=BF=99=E4=B8=AA=E4=B9=9F?= =?UTF-8?q?=E4=B8=8D=E9=9C=80=E8=A6=81=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .browserslistrc | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .browserslistrc diff --git a/.browserslistrc b/.browserslistrc deleted file mode 100644 index 2a6839b4..00000000 --- a/.browserslistrc +++ /dev/null @@ -1 +0,0 @@ -defaults, Chrome >= 86 From df7bb2497403aa2b0e81ad191b0f5b3fdfab9f6f Mon Sep 17 00:00:00 2001 From: AnnAngela Date: Tue, 23 Jan 2024 10:01:19 +0800 Subject: [PATCH 13/16] =?UTF-8?q?ci:=20=E8=B0=83=E6=95=B4=20polyfill=20?= =?UTF-8?q?=E7=94=9F=E6=88=90=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- eslint.config.js | 12 +++- .../library/crypto.randomUUID/raw.js | 55 +++++++++++++++++++ .../generatePolyfill/customPolyfill/main.json | 30 ++++++++++ .../customPolyfill/package.json | 3 + scripts/generatePolyfill/index.js | 47 +++++++++++----- scripts/modules/getUpstream.js | 6 +- tsconfig.json | 4 +- tsconfig.production.json | 6 ++ 8 files changed, 141 insertions(+), 22 deletions(-) create mode 100644 scripts/generatePolyfill/customPolyfill/library/crypto.randomUUID/raw.js create mode 100644 scripts/generatePolyfill/customPolyfill/main.json create mode 100644 scripts/generatePolyfill/customPolyfill/package.json diff --git a/eslint.config.js b/eslint.config.js index 28fd66a1..f3ee7f7e 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -11,7 +11,7 @@ const ignores = [ "**/dist/**", "**/.*/**", "node_modules", - "src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill.*.js", + "src/gadgets/libPolyfill/*", ]; const srcESlintrcFiles = (await readDir("./src")).filter((n) => path.basename(n) === ".eslintrc.yaml"); @@ -35,15 +35,21 @@ const fileSpec = { browser: { files: [ "src/**/*", + "scripts/generatePolyfill/customPolyfills/**/*", + ], + ignores: [ + ...ignores, ], - ignores, }, node: { files: [ "scripts/**/*", "eslint.config.js", ], - ignores, + ignores: [ + ...ignores, + "scripts/generatePolyfill/customPolyfills/**/*", + ], }, }; diff --git a/scripts/generatePolyfill/customPolyfill/library/crypto.randomUUID/raw.js b/scripts/generatePolyfill/customPolyfill/library/crypto.randomUUID/raw.js new file mode 100644 index 00000000..7004a5a1 --- /dev/null +++ b/scripts/generatePolyfill/customPolyfill/library/crypto.randomUUID/raw.js @@ -0,0 +1,55 @@ +/** + * 引自 uuid@9.0.0 + */ + +/** + * @source https://github.com/uuidjs/uuid/blob/v9.0.0/src/regex.js + */ +const REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i; + +/** + * @source https://github.com/uuidjs/uuid/blob/v9.0.0/src/validate.js + */ +const validate = (uuid) => "string" === typeof uuid && REGEX.test(uuid); + +/** + * @source https://github.com/uuidjs/uuid/blob/v9.0.0/src/rng-browser.js + */ +const rnds8 = new Uint8Array(16); +const rng = () => crypto.getRandomValues(rnds8); + +/** + * @source https://github.com/uuidjs/uuid/blob/v9.0.0/src/stringify.js + */ +const byteToHex = []; +for (let i = 0; i < 256; ++i) { + byteToHex.push((i + 256).toString(16).substring(1)); +} +const unsafeStringify = (arr, offset = 0) => `${byteToHex[arr[offset + 0]]}${byteToHex[arr[offset + 1]]}${byteToHex[arr[offset + 2]]}${byteToHex[arr[offset + 3]]}-${byteToHex[arr[offset + 4]]}${byteToHex[arr[offset + 5]]}-${byteToHex[arr[offset + 6]]}${byteToHex[arr[offset + 7]]}-${byteToHex[arr[offset + 8]]}${byteToHex[arr[offset + 9]]}-${byteToHex[arr[offset + 10]]}${byteToHex[arr[offset + 11]]}${byteToHex[arr[offset + 12]]}${byteToHex[arr[offset + 13]]}${byteToHex[arr[offset + 14]]}${byteToHex[arr[offset + 15]]}`.toLowerCase(); + +/** + * @source https://github.com/uuidjs/uuid/blob/v9.0.0/src/v4.js + */ +const v4 = (options = {}, buf, offset = 0) => { + const rnds = options.random || (options.rng || rng)(); + rnds[6] = rnds[6] & 0x0f | 0x40; + rnds[8] = rnds[8] & 0x3f | 0x80; + if (buf) { + for (let i = 0; i < 16; ++i) { + buf[offset + i] = rnds[i]; + } + return buf; + } + return unsafeStringify(rnds); +}; + +/** + * main polyfill + */ +try { + if (!validate(crypto.randomUUID())) { + throw void 0; + } +} catch { + crypto.randomUUID = () => v4(); +} diff --git a/scripts/generatePolyfill/customPolyfill/main.json b/scripts/generatePolyfill/customPolyfill/main.json new file mode 100644 index 00000000..b5ebe5e0 --- /dev/null +++ b/scripts/generatePolyfill/customPolyfill/main.json @@ -0,0 +1,30 @@ +{ + "crypto.randomUUID": { + "aliases": [ + "default" + ], + "spec": "https://w3c.github.io/webcrypto/#Crypto-method-randomUUID", + "docs": "https://developer.mozilla.org/en-US/docs/Web/API/Crypto/randomUUID", + "notes": [ + "In polyfill.io@3.111.0, there is no polyfill for this feature." + ], + "browsers": { + "android": "<92", + "chrome": "<92", + "edge": "<92", + "edge_mob": "<92", + "firefox": "<95", + "firefox_mob": "<95", + "ios_saf": "<15.4", + "op_mini": "<65", + "opera": "<78", + "safari": "<15.4", + "samsung_mob": "<16.0" + }, + "baseDir": "crypto.randomUUID", + "hasTests": false, + "isTestable": false, + "isPublic": true, + "size": 2063 + } +} diff --git a/scripts/generatePolyfill/customPolyfill/package.json b/scripts/generatePolyfill/customPolyfill/package.json new file mode 100644 index 00000000..1cd945a3 --- /dev/null +++ b/scripts/generatePolyfill/customPolyfill/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/scripts/generatePolyfill/index.js b/scripts/generatePolyfill/index.js index 9d3f60d8..e19f181b 100644 --- a/scripts/generatePolyfill/index.js +++ b/scripts/generatePolyfill/index.js @@ -10,7 +10,7 @@ import createCommit from "../modules/createCommit.js"; const polyfillGadgetDefinitionPath = "src/gadgets/libPolyfill/definition.yaml"; const polyfillGadgetDefinition = await yamlModule.readFile(polyfillGadgetDefinitionPath); -const getPolyfillGadgetFiles = async () => (await fs.promises.readdir("src/gadgets/libPolyfill/")).filter((file) => file.startsWith("MediaWiki:Gadget-libPolyfill") && file.endsWith(".js")); +const getPolyfillGadgetFiles = async () => (await fs.promises.readdir("src/gadgets/libPolyfill/")).filter((file) => path.extname(file) === ".js"); /** * @type { { TARGET_CHROMIUM_VERSION: string | number, TARGET_ALIASES: string[] } } @@ -33,7 +33,9 @@ endGroup(); const polyfillGadgetFiles = await getPolyfillGadgetFiles(); const polyfillMainJSONPath = path.join(POLYFILL_PATH, "main.json"); +const customPolyfillMainJSONPath = "./scripts/generatePolyfill/customPolyfill/main.json"; const polyfillLibraryPath = path.join(POLYFILL_PATH, "library"); +const customPolyfillLibraryPath = "./scripts/generatePolyfill/customPolyfill/library"; console.info("Start to delete old polyfill files:"); for (const file of polyfillGadgetFiles) { @@ -48,10 +50,20 @@ for (const file of polyfillGadgetFiles) { console.info("\tDeleteting", file, "done."); } console.info("Start to read polyfill JSON..."); -const polyfillMainJSONArray = Object.entries(await jsonModule.readFile(polyfillMainJSONPath)).map(([id, v]) => ({ - id, - ...JSON.parse(v), -})); +const polyfillMainJSONArray = [ + ...Object.entries(await jsonModule.readFile(polyfillMainJSONPath)).map(([id, v]) => ({ + id, + ...JSON.parse(v), + })), + ...Object.entries(await jsonModule.readFile(customPolyfillMainJSONPath)).map(([id, v]) => ({ + id, + ...v, + })), +]; +console.info("Start to merge custom polyfill..."); +for (const dir of await fs.promises.readdir(customPolyfillLibraryPath)) { + await fs.promises.cp(path.join(customPolyfillLibraryPath, dir), path.join(polyfillLibraryPath, dir), { recursive: true }); +} const polyfillMainJSON = Object.fromEntries(polyfillMainJSONArray.map((v) => [v.id, v])); console.info("Get", polyfillMainJSONArray.length, "polyfill entries."); const polyfillList = polyfillMainJSONArray.filter(({ aliases }) => Array.isArray(aliases) && TARGET_ALIASES.some((targetAliases) => aliases.includes(targetAliases))); @@ -60,13 +72,13 @@ const polyfillListAllowed = polyfillList.filter(({ browsers }) => browsers?.chro console.info("Get", polyfillListAllowed.length, "polyfill entries with aliases and target browsers."); const readPolyfillRawJS = async (dir) => { - console.info("\t[readPolyfillRawJS]", "Testing", dir); - if (await fs.promises.access(dir).then(() => true).catch(() => false)) { - console.info("\t[readPolyfillRawJS]", dir, "exist, reading raw js."); - return (await fs.promises.readFile(path.join(dir, "raw.js"), { encoding: "utf-8" })).split("\n"); + const rawJSPath = path.join(dir, "raw.js"); + try { + return (await fs.promises.readFile(rawJSPath, { encoding: "utf-8" })).trim().split("\n"); + } catch (e) { + console.info("\t[readPolyfillRawJS]", rawJSPath, "not exist, return false:", e); + return false; } - console.info("\t[readPolyfillRawJS]", dir, "not exist, return false."); - return false; }; const polyfillAlreadyInjected = {}; const getPolyfillContent = async (polyfill, _rootPolyfillID = false) => { @@ -80,7 +92,11 @@ const getPolyfillContent = async (polyfill, _rootPolyfillID = false) => { } polyfillAlreadyInjected[rootPolyfillID].push(polyfill.id); console.info("\t[getPolyfillContent]", `[${polyfill.id}@${rootPolyfillID}]`, "Processing", polyfill.id); - const content = []; + const content = [ + "", + `// Polyfill ${polyfill.id} start`, + "", + ]; const detectSource = polyfill.detectSource?.trim(); console.info("\t[getPolyfillContent]", `[${polyfill.id}@${rootPolyfillID}]`, "detectSource:", detectSource); if (detectSource) { @@ -108,6 +124,11 @@ const getPolyfillContent = async (polyfill, _rootPolyfillID = false) => { if (detectSource) { content.push("}"); } + content.push( + "", + `// Polyfill ${polyfill.id} end`, + "", + ); console.info("\t[getPolyfillContent]", `[${polyfill.id}@${rootPolyfillID}]`, "Done."); return content; }; @@ -127,7 +148,7 @@ for (const polyfill of polyfillListAllowed) { ...await getPolyfillContent(polyfill), "})();", ]; - const gadgetFilePath = path.join("src/gadgets/libPolyfill/", `MediaWiki:Gadget-libPolyfill.${polyfill.id}.js`); + const gadgetFilePath = path.join("src/gadgets/libPolyfill/", `MediaWiki:Gadget-libPolyfill-${polyfill.id}.js`); console.info("Start to write polyfill file:", polyfill.id, "@", gadgetFilePath); await fs.promises.writeFile(gadgetFilePath, content.join("\n")); console.info("Done."); diff --git a/scripts/modules/getUpstream.js b/scripts/modules/getUpstream.js index cbefed06..41c75ada 100644 --- a/scripts/modules/getUpstream.js +++ b/scripts/modules/getUpstream.js @@ -1,10 +1,6 @@ import console from "./console.js"; import git from "./git.js"; -import { isInGithubActions } from "./octokit.js"; -if (!isInGithubActions) { - console.info("Not running in github actions, exit."); - process.exit(0); -} + /** * @type { string | false } when false, it means the HEAD does not point to a branch. */ diff --git a/tsconfig.json b/tsconfig.json index df71252c..5ae8c18d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,8 @@ "./node_modules/@annangela/eslint-config/dist/tsconfigs/tsconfig.browser.json" ], "compilerOptions": { - "outDir": "dist/", + "outDir": "./dist/", + "baseUrl": ".", "lib": [ "ESNext", "DOM" @@ -12,6 +13,7 @@ }, "include": [ "src", + "scripts", ], "exclude": [ "dist", diff --git a/tsconfig.production.json b/tsconfig.production.json index 3f2dc61c..429312ca 100644 --- a/tsconfig.production.json +++ b/tsconfig.production.json @@ -1,7 +1,13 @@ { "extends": "./tsconfig.json", "compilerOptions": { + "outDir": "./dist/", + "baseUrl": "./", + "rootDir": "./src/", "target": "ES3", "ignoreDeprecations": "5.0", }, + "exclude": [ + "scripts", + ], } From c4fa5102574afea5b0e94338e7a6e1db538a9597 Mon Sep 17 00:00:00 2001 From: AnnAngela Date: Tue, 23 Jan 2024 10:12:13 +0800 Subject: [PATCH 14/16] ci: Add postCommit workflow dispatch --- .github/workflows/generatePolyfill.yaml | 2 ++ scripts/postCommit/push.js | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/generatePolyfill.yaml b/.github/workflows/generatePolyfill.yaml index 639f5898..d469d035 100644 --- a/.github/workflows/generatePolyfill.yaml +++ b/.github/workflows/generatePolyfill.yaml @@ -89,3 +89,5 @@ jobs: - name: Show git status & push id: output run: node scripts/postCommit/push.js + env: + DISPATCH_POST_COMMIT_WORKFLOW: true diff --git a/scripts/postCommit/push.js b/scripts/postCommit/push.js index 1fb61979..95c21257 100644 --- a/scripts/postCommit/push.js +++ b/scripts/postCommit/push.js @@ -2,7 +2,7 @@ import console from "../modules/console.js"; console.info("Initialization done."); import { startGroup, endGroup } from "@actions/core"; import git from "../modules/git.js"; -import { isInGithubActions } from "../modules/octokit.js"; +import { isInGithubActions, octokit } from "../modules/octokit.js"; import readWorkflowEvent from "../modules/workflowEvent.js"; import upstream from "../modules/getUpstream.js"; if (!isInGithubActions) { @@ -37,3 +37,10 @@ console.info("Pulling new commits..."); console.info("Successfully pulled the commits:", await git.pull(undefined, undefined, ["--rebase"])); console.info("Pushing these commits..."); console.info("Successfully pushed the commits:", await git.push()); +if (process.env.DISPATCH_POST_COMMIT_WORKFLOW === "true") { + console.info("Dispatching postCommit workflow..."); + await octokit.rest.actions.createWorkflowDispatch({ + workflow_id: ".github/workflows/postCommit.yaml", + ref: upstream, + }); +} From 308041037d6e3b99981fe14d063d55e95967d597 Mon Sep 17 00:00:00 2001 From: AnnAngela Date: Tue, 23 Jan 2024 10:15:56 +0800 Subject: [PATCH 15/16] ci: Update permissions in generatePolyfill.yaml --- .github/workflows/generatePolyfill.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generatePolyfill.yaml b/.github/workflows/generatePolyfill.yaml index d469d035..5b737ba3 100644 --- a/.github/workflows/generatePolyfill.yaml +++ b/.github/workflows/generatePolyfill.yaml @@ -23,7 +23,7 @@ env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} permissions: - actions: read + actions: write checks: read contents: write deployments: read From 5634db21717f1670d33a9e20a0a6772fd755068a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 23 Jan 2024 02:16:42 +0000 Subject: [PATCH 16/16] auto: regenerated polyfill files by generatePolyfill --- ...:Gadget-libPolyfill-Array.prototype.at.js} | 78 +++++++++++- ...Gadget-libPolyfill-String.prototype.at.js} | 70 ++++++++++- ...et-libPolyfill-TypedArray.prototype.at.js} | 70 ++++++++++- ...ki:Gadget-libPolyfill-crypto.randomUUID.js | 119 ++++++++++-------- src/gadgets/libPolyfill/definition.yaml | 6 +- 5 files changed, 279 insertions(+), 64 deletions(-) rename src/gadgets/libPolyfill/{MediaWiki:Gadget-libPolyfill.Array.prototype.at.js => MediaWiki:Gadget-libPolyfill-Array.prototype.at.js} (91%) rename src/gadgets/libPolyfill/{MediaWiki:Gadget-libPolyfill.String.prototype.at.js => MediaWiki:Gadget-libPolyfill-String.prototype.at.js} (92%) rename src/gadgets/libPolyfill/{MediaWiki:Gadget-libPolyfill.TypedArray.prototype.at.js => MediaWiki:Gadget-libPolyfill-TypedArray.prototype.at.js} (97%) diff --git a/src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill.Array.prototype.at.js b/src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill-Array.prototype.at.js similarity index 91% rename from src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill.Array.prototype.at.js rename to src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill-Array.prototype.at.js index a603819e..88c00b66 100644 --- a/src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill.Array.prototype.at.js +++ b/src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill-Array.prototype.at.js @@ -8,10 +8,18 @@ * polyfillVersionRange: <92.0.0-0 (< 92) */ (() => { + +// Polyfill Array.prototype.at start + if (!("at"in Array.prototype)) { + +// Polyfill _ESAbstract.CreateMethodProperty start + + +// Polyfill Object.defineProperty start + if (!("defineProperty"in Object&&function(){try{var e={} return Object.defineProperty(e,"test",{value:42}),!0}catch(t){return!1}}())) { - // Object.defineProperty (function (nativeDefineProperty) { @@ -84,9 +92,10 @@ return Object.defineProperty(e,"test",{value:42}),!0}catch(t){return!1}}())) { return object; }; }(Object.defineProperty)); - } +// Polyfill Object.defineProperty end + // _ESAbstract.CreateMethodProperty // 7.3.5. CreateMethodProperty ( O, P, V ) function CreateMethodProperty(O, P, V) { // eslint-disable-line no-unused-vars @@ -103,6 +112,10 @@ function CreateMethodProperty(O, P, V) { // eslint-disable-line no-unused-vars Object.defineProperty(O, P, newDesc); } +// Polyfill _ESAbstract.CreateMethodProperty end + + +// Polyfill _ESAbstract.Get start // _ESAbstract.Get // 7.3.1. Get ( O, P ) @@ -113,6 +126,19 @@ function Get(O, P) { // eslint-disable-line no-unused-vars return O[P]; } +// Polyfill _ESAbstract.Get end + + +// Polyfill _ESAbstract.LengthOfArrayLike start + + +// Polyfill _ESAbstract.ToLength start + + +// Polyfill _ESAbstract.ToInteger start + + +// Polyfill _ESAbstract.Type start // _ESAbstract.Type // "Type(x)" is used as shorthand for "the type of x"... @@ -138,6 +164,7 @@ function Type(x) { // eslint-disable-line no-unused-vars } } +// Polyfill _ESAbstract.Type end // _ESAbstract.ToInteger /* global Type */ @@ -161,6 +188,7 @@ function ToInteger(argument) { // eslint-disable-line no-unused-vars return ((number < 0) ? -1 : 1) * Math.floor(Math.abs(number)); } +// Polyfill _ESAbstract.ToInteger end // _ESAbstract.ToLength /* global ToInteger */ @@ -176,6 +204,7 @@ function ToLength(argument) { // eslint-disable-line no-unused-vars return Math.min(len, Math.pow(2, 53) -1); } +// Polyfill _ESAbstract.ToLength end // _ESAbstract.LengthOfArrayLike /* global Get, ToLength */ @@ -185,6 +214,13 @@ function LengthOfArrayLike(obj) { // eslint-disable-line no-unused-vars return ToLength(Get(obj, 'length')); } +// Polyfill _ESAbstract.LengthOfArrayLike end + + +// Polyfill _ESAbstract.ToIntegerOrInfinity start + + +// Polyfill _ESAbstract.ToNumber start // _ESAbstract.ToNumber // 7.1.3. ToNumber ( argument ) @@ -192,6 +228,7 @@ function ToNumber(argument) { // eslint-disable-line no-unused-vars return Number(argument); } +// Polyfill _ESAbstract.ToNumber end // _ESAbstract.ToIntegerOrInfinity /* global ToNumber */ @@ -213,6 +250,10 @@ function ToIntegerOrInfinity(argument) { // eslint-disable-line no-unused-vars return integer; } +// Polyfill _ESAbstract.ToIntegerOrInfinity end + + +// Polyfill _ESAbstract.ToObject start // _ESAbstract.ToObject // 7.1.13 ToObject ( argument ) @@ -238,6 +279,16 @@ function ToObject(argument) { // eslint-disable-line no-unused-vars return Object(argument); } +// Polyfill _ESAbstract.ToObject end + + +// Polyfill _ESAbstract.ToString start + + +// Polyfill _ESAbstract.ToPrimitive start + + +// Polyfill _ESAbstract.Call start // _ESAbstract.Call /* global IsCallable */ @@ -253,6 +304,13 @@ function Call(F, V /* [, argumentsList] */) { // eslint-disable-line no-unused-v return F.apply(V, argumentsList); } +// Polyfill _ESAbstract.Call end + + +// Polyfill _ESAbstract.GetMethod start + + +// Polyfill _ESAbstract.GetV start // _ESAbstract.GetV /* global ToObject */ @@ -265,6 +323,10 @@ function GetV(v, p) { // eslint-disable-line no-unused-vars return o[p]; } +// Polyfill _ESAbstract.GetV end + + +// Polyfill _ESAbstract.IsCallable start // _ESAbstract.IsCallable // 7.2.3. IsCallable ( argument ) @@ -277,6 +339,7 @@ function IsCallable(argument) { // eslint-disable-line no-unused-vars return typeof argument === 'function'; } +// Polyfill _ESAbstract.IsCallable end // _ESAbstract.GetMethod /* global GetV, IsCallable */ @@ -297,6 +360,10 @@ function GetMethod(V, P) { // eslint-disable-line no-unused-vars return func; } +// Polyfill _ESAbstract.GetMethod end + + +// Polyfill _ESAbstract.OrdinaryToPrimitive start // _ESAbstract.OrdinaryToPrimitive /* global Get, IsCallable, Call, Type */ @@ -332,6 +399,7 @@ function OrdinaryToPrimitive(O, hint) { // eslint-disable-line no-unused-vars throw new TypeError('Cannot convert to primitive.'); } +// Polyfill _ESAbstract.OrdinaryToPrimitive end // _ESAbstract.ToPrimitive /* global Type, GetMethod, Call, OrdinaryToPrimitive */ @@ -375,6 +443,7 @@ function ToPrimitive(input /* [, PreferredType] */) { // eslint-disable-line no- return input; } +// Polyfill _ESAbstract.ToPrimitive end // _ESAbstract.ToString /* global Type, ToPrimitive */ @@ -415,6 +484,7 @@ function ToString(argument) { // eslint-disable-line no-unused-vars } } +// Polyfill _ESAbstract.ToString end // Array.prototype.at /* global CreateMethodProperty, Get, LengthOfArrayLike, ToIntegerOrInfinity, ToObject, ToString */ @@ -436,6 +506,8 @@ CreateMethodProperty(Array.prototype, 'at', function at(index) { // 7. Return ? Get(O, ! ToString(𝔽(k))). return Get(O, ToString(k)); }); - } + +// Polyfill Array.prototype.at end + })(); \ No newline at end of file diff --git a/src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill.String.prototype.at.js b/src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill-String.prototype.at.js similarity index 92% rename from src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill.String.prototype.at.js rename to src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill-String.prototype.at.js index 21e71ca8..c558f639 100644 --- a/src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill.String.prototype.at.js +++ b/src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill-String.prototype.at.js @@ -8,10 +8,18 @@ * polyfillVersionRange: <92.0.0-0 (< 92) */ (() => { + +// Polyfill String.prototype.at start + if (!("at"in String.prototype)) { + +// Polyfill _ESAbstract.CreateMethodProperty start + + +// Polyfill Object.defineProperty start + if (!("defineProperty"in Object&&function(){try{var e={} return Object.defineProperty(e,"test",{value:42}),!0}catch(t){return!1}}())) { - // Object.defineProperty (function (nativeDefineProperty) { @@ -84,9 +92,10 @@ return Object.defineProperty(e,"test",{value:42}),!0}catch(t){return!1}}())) { return object; }; }(Object.defineProperty)); - } +// Polyfill Object.defineProperty end + // _ESAbstract.CreateMethodProperty // 7.3.5. CreateMethodProperty ( O, P, V ) function CreateMethodProperty(O, P, V) { // eslint-disable-line no-unused-vars @@ -103,6 +112,10 @@ function CreateMethodProperty(O, P, V) { // eslint-disable-line no-unused-vars Object.defineProperty(O, P, newDesc); } +// Polyfill _ESAbstract.CreateMethodProperty end + + +// Polyfill _ESAbstract.RequireObjectCoercible start // _ESAbstract.RequireObjectCoercible // 7.2.1. RequireObjectCoercible ( argument ) @@ -128,6 +141,13 @@ function RequireObjectCoercible(argument) { // eslint-disable-line no-unused-var return argument; } +// Polyfill _ESAbstract.RequireObjectCoercible end + + +// Polyfill _ESAbstract.ToIntegerOrInfinity start + + +// Polyfill _ESAbstract.ToNumber start // _ESAbstract.ToNumber // 7.1.3. ToNumber ( argument ) @@ -135,6 +155,7 @@ function ToNumber(argument) { // eslint-disable-line no-unused-vars return Number(argument); } +// Polyfill _ESAbstract.ToNumber end // _ESAbstract.ToIntegerOrInfinity /* global ToNumber */ @@ -156,6 +177,16 @@ function ToIntegerOrInfinity(argument) { // eslint-disable-line no-unused-vars return integer; } +// Polyfill _ESAbstract.ToIntegerOrInfinity end + + +// Polyfill _ESAbstract.ToString start + + +// Polyfill _ESAbstract.ToPrimitive start + + +// Polyfill _ESAbstract.Call start // _ESAbstract.Call /* global IsCallable */ @@ -171,6 +202,16 @@ function Call(F, V /* [, argumentsList] */) { // eslint-disable-line no-unused-v return F.apply(V, argumentsList); } +// Polyfill _ESAbstract.Call end + + +// Polyfill _ESAbstract.GetMethod start + + +// Polyfill _ESAbstract.GetV start + + +// Polyfill _ESAbstract.ToObject start // _ESAbstract.ToObject // 7.1.13 ToObject ( argument ) @@ -196,6 +237,7 @@ function ToObject(argument) { // eslint-disable-line no-unused-vars return Object(argument); } +// Polyfill _ESAbstract.ToObject end // _ESAbstract.GetV /* global ToObject */ @@ -208,6 +250,10 @@ function GetV(v, p) { // eslint-disable-line no-unused-vars return o[p]; } +// Polyfill _ESAbstract.GetV end + + +// Polyfill _ESAbstract.IsCallable start // _ESAbstract.IsCallable // 7.2.3. IsCallable ( argument ) @@ -220,6 +266,7 @@ function IsCallable(argument) { // eslint-disable-line no-unused-vars return typeof argument === 'function'; } +// Polyfill _ESAbstract.IsCallable end // _ESAbstract.GetMethod /* global GetV, IsCallable */ @@ -240,6 +287,13 @@ function GetMethod(V, P) { // eslint-disable-line no-unused-vars return func; } +// Polyfill _ESAbstract.GetMethod end + + +// Polyfill _ESAbstract.OrdinaryToPrimitive start + + +// Polyfill _ESAbstract.Get start // _ESAbstract.Get // 7.3.1. Get ( O, P ) @@ -250,6 +304,10 @@ function Get(O, P) { // eslint-disable-line no-unused-vars return O[P]; } +// Polyfill _ESAbstract.Get end + + +// Polyfill _ESAbstract.Type start // _ESAbstract.Type // "Type(x)" is used as shorthand for "the type of x"... @@ -275,6 +333,7 @@ function Type(x) { // eslint-disable-line no-unused-vars } } +// Polyfill _ESAbstract.Type end // _ESAbstract.OrdinaryToPrimitive /* global Get, IsCallable, Call, Type */ @@ -310,6 +369,7 @@ function OrdinaryToPrimitive(O, hint) { // eslint-disable-line no-unused-vars throw new TypeError('Cannot convert to primitive.'); } +// Polyfill _ESAbstract.OrdinaryToPrimitive end // _ESAbstract.ToPrimitive /* global Type, GetMethod, Call, OrdinaryToPrimitive */ @@ -353,6 +413,7 @@ function ToPrimitive(input /* [, PreferredType] */) { // eslint-disable-line no- return input; } +// Polyfill _ESAbstract.ToPrimitive end // _ESAbstract.ToString /* global Type, ToPrimitive */ @@ -393,6 +454,7 @@ function ToString(argument) { // eslint-disable-line no-unused-vars } } +// Polyfill _ESAbstract.ToString end // String.prototype.at /* global CreateMethodProperty, RequireObjectCoercible, ToIntegerOrInfinity, ToString */ @@ -416,6 +478,8 @@ CreateMethodProperty(String.prototype, 'at', function at(index) { // 8. Return the substring of S from k to k + 1. return S.substring(k, k + 1); }); - } + +// Polyfill String.prototype.at end + })(); \ No newline at end of file diff --git a/src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill.TypedArray.prototype.at.js b/src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill-TypedArray.prototype.at.js similarity index 97% rename from src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill.TypedArray.prototype.at.js rename to src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill-TypedArray.prototype.at.js index 56e62ef6..779c5fbd 100644 --- a/src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill.TypedArray.prototype.at.js +++ b/src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill-TypedArray.prototype.at.js @@ -8,10 +8,18 @@ * polyfillVersionRange: <92.0.0-0 (< 92) */ (() => { + +// Polyfill TypedArray.prototype.at start + if (!("Int8Array"in self&&"at"in self.Int8Array.prototype)) { + +// Polyfill _ESAbstract.CreateMethodProperty start + + +// Polyfill Object.defineProperty start + if (!("defineProperty"in Object&&function(){try{var e={} return Object.defineProperty(e,"test",{value:42}),!0}catch(t){return!1}}())) { - // Object.defineProperty (function (nativeDefineProperty) { @@ -84,9 +92,10 @@ return Object.defineProperty(e,"test",{value:42}),!0}catch(t){return!1}}())) { return object; }; }(Object.defineProperty)); - } +// Polyfill Object.defineProperty end + // _ESAbstract.CreateMethodProperty // 7.3.5. CreateMethodProperty ( O, P, V ) function CreateMethodProperty(O, P, V) { // eslint-disable-line no-unused-vars @@ -103,6 +112,13 @@ function CreateMethodProperty(O, P, V) { // eslint-disable-line no-unused-vars Object.defineProperty(O, P, newDesc); } +// Polyfill _ESAbstract.CreateMethodProperty end + + +// Polyfill _ESAbstract.ToIntegerOrInfinity start + + +// Polyfill _ESAbstract.ToNumber start // _ESAbstract.ToNumber // 7.1.3. ToNumber ( argument ) @@ -110,6 +126,7 @@ function ToNumber(argument) { // eslint-disable-line no-unused-vars return Number(argument); } +// Polyfill _ESAbstract.ToNumber end // _ESAbstract.ToIntegerOrInfinity /* global ToNumber */ @@ -131,6 +148,16 @@ function ToIntegerOrInfinity(argument) { // eslint-disable-line no-unused-vars return integer; } +// Polyfill _ESAbstract.ToIntegerOrInfinity end + + +// Polyfill _ESAbstract.ToString start + + +// Polyfill _ESAbstract.ToPrimitive start + + +// Polyfill _ESAbstract.Call start // _ESAbstract.Call /* global IsCallable */ @@ -146,6 +173,16 @@ function Call(F, V /* [, argumentsList] */) { // eslint-disable-line no-unused-v return F.apply(V, argumentsList); } +// Polyfill _ESAbstract.Call end + + +// Polyfill _ESAbstract.GetMethod start + + +// Polyfill _ESAbstract.GetV start + + +// Polyfill _ESAbstract.ToObject start // _ESAbstract.ToObject // 7.1.13 ToObject ( argument ) @@ -171,6 +208,7 @@ function ToObject(argument) { // eslint-disable-line no-unused-vars return Object(argument); } +// Polyfill _ESAbstract.ToObject end // _ESAbstract.GetV /* global ToObject */ @@ -183,6 +221,10 @@ function GetV(v, p) { // eslint-disable-line no-unused-vars return o[p]; } +// Polyfill _ESAbstract.GetV end + + +// Polyfill _ESAbstract.IsCallable start // _ESAbstract.IsCallable // 7.2.3. IsCallable ( argument ) @@ -195,6 +237,7 @@ function IsCallable(argument) { // eslint-disable-line no-unused-vars return typeof argument === 'function'; } +// Polyfill _ESAbstract.IsCallable end // _ESAbstract.GetMethod /* global GetV, IsCallable */ @@ -215,6 +258,13 @@ function GetMethod(V, P) { // eslint-disable-line no-unused-vars return func; } +// Polyfill _ESAbstract.GetMethod end + + +// Polyfill _ESAbstract.OrdinaryToPrimitive start + + +// Polyfill _ESAbstract.Get start // _ESAbstract.Get // 7.3.1. Get ( O, P ) @@ -225,6 +275,10 @@ function Get(O, P) { // eslint-disable-line no-unused-vars return O[P]; } +// Polyfill _ESAbstract.Get end + + +// Polyfill _ESAbstract.Type start // _ESAbstract.Type // "Type(x)" is used as shorthand for "the type of x"... @@ -250,6 +304,7 @@ function Type(x) { // eslint-disable-line no-unused-vars } } +// Polyfill _ESAbstract.Type end // _ESAbstract.OrdinaryToPrimitive /* global Get, IsCallable, Call, Type */ @@ -285,6 +340,7 @@ function OrdinaryToPrimitive(O, hint) { // eslint-disable-line no-unused-vars throw new TypeError('Cannot convert to primitive.'); } +// Polyfill _ESAbstract.OrdinaryToPrimitive end // _ESAbstract.ToPrimitive /* global Type, GetMethod, Call, OrdinaryToPrimitive */ @@ -328,6 +384,7 @@ function ToPrimitive(input /* [, PreferredType] */) { // eslint-disable-line no- return input; } +// Polyfill _ESAbstract.ToPrimitive end // _ESAbstract.ToString /* global Type, ToPrimitive */ @@ -368,6 +425,10 @@ function ToString(argument) { // eslint-disable-line no-unused-vars } } +// Polyfill _ESAbstract.ToString end + + +// Polyfill ArrayBuffer start // ArrayBuffer /* @@ -1432,6 +1493,7 @@ function ToString(argument) { // eslint-disable-line no-unused-vars }(self)); +// Polyfill ArrayBuffer end // TypedArray.prototype.at /* global CreateMethodProperty, Uint8Array, ToIntegerOrInfinity, ToString */ @@ -1489,6 +1551,8 @@ function ToString(argument) { // eslint-disable-line no-unused-vars CreateMethodProperty(self.Float64Array.prototype, 'at', at); } })(); - } + +// Polyfill TypedArray.prototype.at end + })(); \ No newline at end of file diff --git a/src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill-crypto.randomUUID.js b/src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill-crypto.randomUUID.js index f861a9d0..d7af2407 100644 --- a/src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill-crypto.randomUUID.js +++ b/src/gadgets/libPolyfill/MediaWiki:Gadget-libPolyfill-crypto.randomUUID.js @@ -1,57 +1,72 @@ +"use strict"; /** - * 引自 uuid@9.0.0 + * Generated by scripts/generatePolyfill/index.js + * Options: + * polyfillFeature: crypto.randomUUID + * polyfillAliases: default + * targetChromiumVersion: 86.0.0 + * polyfillVersionRange: <92.0.0-0 (<92) */ -"use strict"; (() => { - /** - * @source https://github.com/uuidjs/uuid/blob/v9.0.0/src/regex.js - */ - const REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i; - - /** - * @source https://github.com/uuidjs/uuid/blob/v9.0.0/src/validate.js - */ - const validate = (uuid) => "string" === typeof uuid && REGEX.test(uuid); - - /** - * @source https://github.com/uuidjs/uuid/blob/v9.0.0/src/rng-browser.js - */ - const rnds8 = new Uint8Array(16); - const rng = () => crypto.getRandomValues(rnds8); - - /** - * @source https://github.com/uuidjs/uuid/blob/v9.0.0/src/stringify.js - */ - const byteToHex = []; - for (let i = 0; i < 256; ++i) { - byteToHex.push((i + 256).toString(16).substring(1)); - } - const unsafeStringify = (arr, offset = 0) => `${byteToHex[arr[offset + 0]]}${byteToHex[arr[offset + 1]]}${byteToHex[arr[offset + 2]]}${byteToHex[arr[offset + 3]]}-${byteToHex[arr[offset + 4]]}${byteToHex[arr[offset + 5]]}-${byteToHex[arr[offset + 6]]}${byteToHex[arr[offset + 7]]}-${byteToHex[arr[offset + 8]]}${byteToHex[arr[offset + 9]]}-${byteToHex[arr[offset + 10]]}${byteToHex[arr[offset + 11]]}${byteToHex[arr[offset + 12]]}${byteToHex[arr[offset + 13]]}${byteToHex[arr[offset + 14]]}${byteToHex[arr[offset + 15]]}`.toLowerCase(); - - /** - * @source https://github.com/uuidjs/uuid/blob/v9.0.0/src/v4.js - */ - const v4 = (options = {}, buf, offset = 0) => { - const rnds = options.random || (options.rng || rng)(); - rnds[6] = rnds[6] & 0x0f | 0x40; - rnds[8] = rnds[8] & 0x3f | 0x80; - if (buf) { - for (let i = 0; i < 16; ++i) { - buf[offset + i] = rnds[i]; - } - return buf; - } - return unsafeStringify(rnds); - }; - - /** - * main polyfill - */ - try { - if (!validate(crypto.randomUUID())) { - throw void 0; + +// Polyfill crypto.randomUUID start + +/** + * 引自 uuid@9.0.0 + */ + +/** + * @source https://github.com/uuidjs/uuid/blob/v9.0.0/src/regex.js + */ +const REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i; + +/** + * @source https://github.com/uuidjs/uuid/blob/v9.0.0/src/validate.js + */ +const validate = (uuid) => "string" === typeof uuid && REGEX.test(uuid); + +/** + * @source https://github.com/uuidjs/uuid/blob/v9.0.0/src/rng-browser.js + */ +const rnds8 = new Uint8Array(16); +const rng = () => crypto.getRandomValues(rnds8); + +/** + * @source https://github.com/uuidjs/uuid/blob/v9.0.0/src/stringify.js + */ +const byteToHex = []; +for (let i = 0; i < 256; ++i) { + byteToHex.push((i + 256).toString(16).substring(1)); +} +const unsafeStringify = (arr, offset = 0) => `${byteToHex[arr[offset + 0]]}${byteToHex[arr[offset + 1]]}${byteToHex[arr[offset + 2]]}${byteToHex[arr[offset + 3]]}-${byteToHex[arr[offset + 4]]}${byteToHex[arr[offset + 5]]}-${byteToHex[arr[offset + 6]]}${byteToHex[arr[offset + 7]]}-${byteToHex[arr[offset + 8]]}${byteToHex[arr[offset + 9]]}-${byteToHex[arr[offset + 10]]}${byteToHex[arr[offset + 11]]}${byteToHex[arr[offset + 12]]}${byteToHex[arr[offset + 13]]}${byteToHex[arr[offset + 14]]}${byteToHex[arr[offset + 15]]}`.toLowerCase(); + +/** + * @source https://github.com/uuidjs/uuid/blob/v9.0.0/src/v4.js + */ +const v4 = (options = {}, buf, offset = 0) => { + const rnds = options.random || (options.rng || rng)(); + rnds[6] = rnds[6] & 0x0f | 0x40; + rnds[8] = rnds[8] & 0x3f | 0x80; + if (buf) { + for (let i = 0; i < 16; ++i) { + buf[offset + i] = rnds[i]; } - } catch { - crypto.randomUUID = () => v4(); + return buf; } -})(); + return unsafeStringify(rnds); +}; + +/** + * main polyfill + */ +try { + if (!validate(crypto.randomUUID())) { + throw void 0; + } +} catch { + crypto.randomUUID = () => v4(); +} + +// Polyfill crypto.randomUUID end + +})(); \ No newline at end of file diff --git a/src/gadgets/libPolyfill/definition.yaml b/src/gadgets/libPolyfill/definition.yaml index 44d57476..3a94e419 100644 --- a/src/gadgets/libPolyfill/definition.yaml +++ b/src/gadgets/libPolyfill/definition.yaml @@ -29,7 +29,7 @@ _sites: _section: system _files: + - MediaWiki:Gadget-libPolyfill-Array.prototype.at.js + - MediaWiki:Gadget-libPolyfill-String.prototype.at.js + - MediaWiki:Gadget-libPolyfill-TypedArray.prototype.at.js - MediaWiki:Gadget-libPolyfill-crypto.randomUUID.js - - MediaWiki:Gadget-libPolyfill.Array.prototype.at.js - - MediaWiki:Gadget-libPolyfill.String.prototype.at.js - - MediaWiki:Gadget-libPolyfill.TypedArray.prototype.at.js