<!DOCTYPE html>
<html>
<body>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
}
function getAllPropertyNames(obj) {
let props = Object.getOwnPropertyNames(obj);
let proto = Object.getPrototypeOf(obj);
if (proto === Object.prototype || proto === null) {
return props;
}
return [...props, ...getAllPropertyNames(proto)];
}
function logWorklets(global) {
let seen = new Set();
return (function recursiveFind(obj) {
if (seen.has(obj)) {
return;
}
seen.add(obj);
for (let name of getAllPropertyNames(obj)) {
// Some prototypes throw errors when accessing their properties,
// like DOMStringList.prototype.length.
let prop = null;
try {
prop = obj[name];
} catch (e) {
continue;
}
if (Worklet.isPrototypeOf(prop) || prop instanceof Worklet) {
console.log(name);
}
if (prop && typeof prop === "object") {
recursiveFind(prop);
}
}
}(global));
};
console.log("This test logs all exposed Worklets");
logWorklets(window);
console.log("IMPORTANT:");
console.log("If you have added a new Worklet, do not just update this expectation file.");
console.log("Instead, please add a new webexposed test for the global scope of your Worklet.");
console.log("You can find examples for other Worklets in this folder.");
</script>
</body>
</html>