commit 5f4ec896789cb31b7bb2c631c84d247b2976482b
parent a4722fa9a71c73d054fade6c7fe8be7ebb67fa1b
Author: Mark Banner <standard8@mozilla.com>
Date: Thu, 23 Oct 2025 09:30:20 +0000
Bug 1986898 - Include generated webidl files when generating type information. r=saschanaz
Differential Revision: https://phabricator.services.mozilla.com/D269612
Diffstat:
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/tools/ts/build_dom.js b/tools/ts/build_dom.js
@@ -17,6 +17,14 @@ const { RESERVED_WORDS } = require("peggy");
const TAGLIST = require.resolve("../../parser/htmlparser/nsHTMLTagList.h");
const BINDINGS = require.resolve("../../dom/bindings/Bindings.conf");
+// TODO Bug TBD: Ideally we should get details about the generated files from
+// the build system.
+const GENERATED_WEDIDL_FILES = [
+ "CSSPageDescriptors.webidl",
+ "CSSPositionTryDescriptors.webidl",
+ "CSSStyleProperties.webidl",
+];
+
const HEADER = `/**
* NOTE: Do not modify this file by hand.
* Content was generated from source .webidl files.
@@ -193,8 +201,12 @@ function postprocess(additionalExports, generated) {
}
// Build and save the dom lib.
-async function main(lib_dts, webidl_dir, ...webidl_files) {
- let dts = await emitDom(webidl_files.map(f => `${webidl_dir}/${f}`));
+async function main(lib_dts, webidl_dir, objdir_webidl, ...webidl_files) {
+ let files = [
+ ...GENERATED_WEDIDL_FILES.map(f => `${objdir_webidl}/${f}`),
+ ...webidl_files.map(f => `${webidl_dir}/${f}`),
+ ];
+ let dts = await emitDom(files);
console.log(`[INFO] ${lib_dts} (${dts.length.toLocaleString()} bytes)`);
fs.writeFileSync(lib_dts, dts);
}
diff --git a/tools/ts/mach_commands.py b/tools/ts/mach_commands.py
@@ -74,13 +74,14 @@ def build(ctx, lib):
if lib == "dom":
# Same as above, get all *.webidl files for now.
dir = mozpath.join(ctx.topsrcdir, "dom")
+ objdir_webidl = mozpath.join(ctx.topobjdir, "dom", "bindings")
files = []
for subdir in ["webidl", "chrome-webidl"]:
for file in os.listdir(mozpath.join(dir, subdir)):
if file.endswith(".webidl"):
files.append(subdir + "/" + file)
- return node(ctx, "build_dom", lib_dts, dir, *files)
+ return node(ctx, "build_dom", lib_dts, dir, objdir_webidl, *files)
raise ValueError(f"Unknown typelib: {lib}")