aboutsummaryrefslogtreecommitdiffstats
path: root/components/script_bindings
diff options
context:
space:
mode:
Diffstat (limited to 'components/script_bindings')
-rw-r--r--components/script_bindings/build.rs59
-rw-r--r--components/script_bindings/codegen/Bindings.conf8
-rw-r--r--components/script_bindings/webidls/AbortController.webidl2
-rw-r--r--components/script_bindings/webidls/CanvasRenderingContext2D.webidl2
-rw-r--r--components/script_bindings/webidls/Element.webidl5
-rw-r--r--components/script_bindings/webidls/HTMLHRElement.webidl15
-rw-r--r--components/script_bindings/webidls/HTMLLinkElement.webidl2
-rw-r--r--components/script_bindings/webidls/HTMLScriptElement.webidl2
-rw-r--r--components/script_bindings/webidls/WebGLRenderingContext.webidl3
-rw-r--r--components/script_bindings/webidls/WindowOrWorkerGlobalScope.webidl5
10 files changed, 38 insertions, 65 deletions
diff --git a/components/script_bindings/build.rs b/components/script_bindings/build.rs
index b11e3d1cfdf..d2ff8ceb4a1 100644
--- a/components/script_bindings/build.rs
+++ b/components/script_bindings/build.rs
@@ -27,7 +27,7 @@ fn main() {
println!("cargo::rerun-if-changed=../../third_party/WebIDL/WebIDL.py");
// NB: We aren't handling changes in `third_party/ply` here.
- let status = Command::new(find_python())
+ let status = find_python()
.arg("codegen/run.py")
.arg(&css_properties_json)
.arg(&out_dir)
@@ -78,55 +78,20 @@ impl phf_shared::PhfHash for Bytes<'_> {
}
}
-/// Tries to find a suitable python
+/// Tries to find a suitable python, which in Servo is always `uv run python` unless we are running
+/// as a descendant of `uv run python`. In that case, we can use either `uv run python` or `python`
+/// (uv does not provide a `python3` on Windows).
///
-/// Algorithm
-/// 1. Trying to find python3/python in $VIRTUAL_ENV (this should be from Servo's venv)
-/// 2. Checking PYTHON3 (set by mach)
-/// 3. Falling back to the system installation.
+/// More details: <https://book.servo.org/hacking/setting-up-your-environment.html#check-tools>
///
-/// Note: This function should be kept in sync with the version in `components/servo/build.rs`
-fn find_python() -> PathBuf {
- let mut candidates = vec![];
- if let Some(venv) = env::var_os("VIRTUAL_ENV") {
- let bin_directory = PathBuf::from(venv).join("bin");
+/// Note: This function should be kept in sync with the version in `components/script/build.rs`
+fn find_python() -> Command {
+ let mut command = Command::new("uv");
+ command.args(["run", "python"]);
- let python3 = bin_directory.join("python3");
- if python3.exists() {
- candidates.push(python3);
- }
- let python = bin_directory.join("python");
- if python.exists() {
- candidates.push(python);
- }
- };
- if let Some(python3) = env::var_os("PYTHON3") {
- let python3 = PathBuf::from(python3);
- if python3.exists() {
- candidates.push(python3);
- }
+ if command.output().is_ok_and(|out| out.status.success()) {
+ return command;
}
- let system_python = ["python3", "python"].map(PathBuf::from);
- candidates.extend_from_slice(&system_python);
-
- for name in &candidates {
- // Command::new() allows us to omit the `.exe` suffix on windows
- if Command::new(name)
- .arg("--version")
- .output()
- .is_ok_and(|out| out.status.success())
- {
- return name.to_owned();
- }
- }
- let candidates = candidates
- .into_iter()
- .map(|c| c.into_os_string())
- .collect::<Vec<_>>();
- panic!(
- "Can't find python (tried {:?})! Try enabling Servo's Python venv, \
- setting the PYTHON3 env var or adding python3 to PATH.",
- candidates.join(", ".as_ref())
- )
+ panic!("Can't find python (tried `{command:?}`)! Is uv installed and in PATH?")
}
diff --git a/components/script_bindings/codegen/Bindings.conf b/components/script_bindings/codegen/Bindings.conf
index 7cc092e574e..edc099a823f 100644
--- a/components/script_bindings/codegen/Bindings.conf
+++ b/components/script_bindings/codegen/Bindings.conf
@@ -14,6 +14,10 @@
DOMInterfaces = {
+'AbortController': {
+ 'canGc':['Abort'],
+},
+
'AbstractRange': {
'weakReferenceable': True,
},
@@ -642,7 +646,7 @@ DOMInterfaces = {
},
'Window': {
- 'canGc': ['Stop', 'Fetch', 'Scroll', 'Scroll_','ScrollBy', 'ScrollBy_', 'Stop', 'Fetch', 'Open', 'CreateImageBitmap', 'TrustedTypes', 'WebdriverCallback', 'WebdriverException'],
+ 'canGc': ['Stop', 'Fetch', 'Scroll', 'Scroll_','ScrollBy', 'ScrollBy_', 'Stop', 'Fetch', 'Open', 'CreateImageBitmap', 'CreateImageBitmap_', 'TrustedTypes', 'WebdriverCallback', 'WebdriverException'],
'inRealms': ['Fetch', 'GetOpener', 'WebdriverCallback', 'WebdriverException'],
'additionalTraits': ['crate::interfaces::WindowHelpers'],
},
@@ -654,7 +658,7 @@ DOMInterfaces = {
'WorkerGlobalScope': {
'inRealms': ['Fetch'],
- 'canGc': ['Fetch', 'CreateImageBitmap', 'ImportScripts', 'TrustedTypes'],
+ 'canGc': ['Fetch', 'CreateImageBitmap', 'CreateImageBitmap_', 'ImportScripts', 'TrustedTypes'],
},
'Worklet': {
diff --git a/components/script_bindings/webidls/AbortController.webidl b/components/script_bindings/webidls/AbortController.webidl
index cef49010d3c..bb20ec24955 100644
--- a/components/script_bindings/webidls/AbortController.webidl
+++ b/components/script_bindings/webidls/AbortController.webidl
@@ -7,7 +7,7 @@
interface AbortController {
constructor();
- //[SameObject] readonly attribute AbortSignal signal;
+ [SameObject] readonly attribute AbortSignal signal;
undefined abort(optional any reason);
};
diff --git a/components/script_bindings/webidls/CanvasRenderingContext2D.webidl b/components/script_bindings/webidls/CanvasRenderingContext2D.webidl
index 47612a29937..b277ec2df41 100644
--- a/components/script_bindings/webidls/CanvasRenderingContext2D.webidl
+++ b/components/script_bindings/webidls/CanvasRenderingContext2D.webidl
@@ -11,7 +11,7 @@ typedef HTMLImageElement HTMLOrSVGImageElement;
typedef (HTMLOrSVGImageElement or
HTMLVideoElement or
HTMLCanvasElement or
- /*ImageBitmap or*/
+ ImageBitmap or
OffscreenCanvas or
/*VideoFrame or*/
/*CSSImageValue*/ CSSStyleValue) CanvasImageSource;
diff --git a/components/script_bindings/webidls/Element.webidl b/components/script_bindings/webidls/Element.webidl
index 4545b18d058..e0073f856ca 100644
--- a/components/script_bindings/webidls/Element.webidl
+++ b/components/script_bindings/webidls/Element.webidl
@@ -144,3 +144,8 @@ Element includes NonDocumentTypeChildNode;
Element includes ParentNode;
Element includes ActivatableElement;
Element includes ARIAMixin;
+
+// https://drafts.csswg.org/css-shadow-parts/#idl
+partial interface Element {
+ [SameObject, PutForwards=value] readonly attribute DOMTokenList part;
+};
diff --git a/components/script_bindings/webidls/HTMLHRElement.webidl b/components/script_bindings/webidls/HTMLHRElement.webidl
index 8963d5e8901..45828d4da76 100644
--- a/components/script_bindings/webidls/HTMLHRElement.webidl
+++ b/components/script_bindings/webidls/HTMLHRElement.webidl
@@ -12,14 +12,9 @@ interface HTMLHRElement : HTMLElement {
// https://html.spec.whatwg.org/multipage/#HTMLHRElement-partial
partial interface HTMLHRElement {
- [CEReactions]
- attribute DOMString align;
- [CEReactions]
- attribute DOMString color;
- // [CEReactions]
- // attribute boolean noShade;
- // [CEReactions]
- // attribute DOMString size;
- [CEReactions]
- attribute DOMString width;
+ [CEReactions] attribute DOMString align;
+ [CEReactions] attribute DOMString color;
+ [CEReactions] attribute boolean noShade;
+ [CEReactions] attribute DOMString size;
+ [CEReactions] attribute DOMString width;
};
diff --git a/components/script_bindings/webidls/HTMLLinkElement.webidl b/components/script_bindings/webidls/HTMLLinkElement.webidl
index 9182ef393f8..db858a022c2 100644
--- a/components/script_bindings/webidls/HTMLLinkElement.webidl
+++ b/components/script_bindings/webidls/HTMLLinkElement.webidl
@@ -13,7 +13,7 @@ interface HTMLLinkElement : HTMLElement {
attribute DOMString? crossOrigin;
[CEReactions]
attribute DOMString rel;
- // [CEReactions] attribute DOMString as;
+ [CEReactions] attribute DOMString as;
[SameObject, PutForwards=value] readonly attribute DOMTokenList relList;
[CEReactions]
attribute DOMString media;
diff --git a/components/script_bindings/webidls/HTMLScriptElement.webidl b/components/script_bindings/webidls/HTMLScriptElement.webidl
index 2c7b398b7e3..a21ae6007c4 100644
--- a/components/script_bindings/webidls/HTMLScriptElement.webidl
+++ b/components/script_bindings/webidls/HTMLScriptElement.webidl
@@ -32,6 +32,8 @@ interface HTMLScriptElement : HTMLElement {
[CEReactions]
attribute DOMString referrerPolicy;
+ static boolean supports(DOMString type);
+
// also has obsolete members
};
diff --git a/components/script_bindings/webidls/WebGLRenderingContext.webidl b/components/script_bindings/webidls/WebGLRenderingContext.webidl
index 6938e547cce..645eef0c23f 100644
--- a/components/script_bindings/webidls/WebGLRenderingContext.webidl
+++ b/components/script_bindings/webidls/WebGLRenderingContext.webidl
@@ -24,7 +24,8 @@ typedef unsigned long GLuint;
typedef unrestricted float GLfloat;
typedef unrestricted float GLclampf;
-typedef (ImageData or
+typedef (ImageBitmap or
+ ImageData or
HTMLImageElement or
HTMLCanvasElement or
HTMLVideoElement) TexImageSource;
diff --git a/components/script_bindings/webidls/WindowOrWorkerGlobalScope.webidl b/components/script_bindings/webidls/WindowOrWorkerGlobalScope.webidl
index deb3d5e2947..e329048b1fb 100644
--- a/components/script_bindings/webidls/WindowOrWorkerGlobalScope.webidl
+++ b/components/script_bindings/webidls/WindowOrWorkerGlobalScope.webidl
@@ -26,8 +26,9 @@ interface mixin WindowOrWorkerGlobalScope {
// ImageBitmap
[Pref="dom_imagebitmap_enabled"]
Promise<ImageBitmap> createImageBitmap(ImageBitmapSource image, optional ImageBitmapOptions options = {});
- // Promise<ImageBitmap> createImageBitmap(
- // ImageBitmapSource image, long sx, long sy, long sw, long sh, optional ImageBitmapOptions options);
+ [Pref="dom_imagebitmap_enabled"]
+ Promise<ImageBitmap> createImageBitmap(ImageBitmapSource image, long sx, long sy, long sw, long sh,
+ optional ImageBitmapOptions options = {});
// structured cloning
[Throws]