mirror of
https://github.com/lexmount/moli.git
synced 2026-11-22 08:02:23 +00:00
fix(geometry): expose legacy window aliases
This commit is contained in:
@@ -19,6 +19,7 @@ use crate::util::{
|
||||
const LEGACY_WINDOW_INTERFACE_ALIASES: &[(&str, &str)] = &[
|
||||
("webkitURL", "URL"),
|
||||
("SVGPoint", "DOMPoint"),
|
||||
("SVGMatrix", "DOMMatrix"),
|
||||
("webkitAudioContext", "AudioContext"),
|
||||
("WebKitCSSMatrix", "DOMMatrix"),
|
||||
];
|
||||
|
||||
@@ -897,7 +897,10 @@ fn worker_geometry_interfaces_use_worker_specific_matrix_surface() {
|
||||
windowOnly: [
|
||||
Object.hasOwn(DOMMatrixReadOnly.prototype, "toString"),
|
||||
"setMatrixValue" in DOMMatrix.prototype,
|
||||
"WebKitCSSMatrix" in globalThis
|
||||
"WebKitCSSMatrix" in globalThis,
|
||||
"SVGPoint" in globalThis,
|
||||
"SVGRect" in globalThis,
|
||||
"SVGMatrix" in globalThis
|
||||
].join(","),
|
||||
operations: operationSets.every(([owner, operationNames]) =>
|
||||
operationNames.every(name => hasWebIdlOperationDescriptor(owner, name))
|
||||
@@ -915,6 +918,6 @@ fn worker_geometry_interfaces_use_worker_specific_matrix_surface() {
|
||||
|
||||
assert_eq!(
|
||||
result,
|
||||
r#"{"constructors":"function,function,function,function,function,function,function","strings":"TypeError,TypeError","tags":"[object DOMMatrix],[object DOMMatrixReadOnly],[object DOMMatrix]","windowOnly":"false,false,false","operations":true,"lengths":"0,0"}"#
|
||||
r#"{"constructors":"function,function,function,function,function,function,function","strings":"TypeError,TypeError","tags":"[object DOMMatrix],[object DOMMatrixReadOnly],[object DOMMatrix]","windowOnly":"false,false,false,false,false,false","operations":true,"lengths":"0,0"}"#
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1211,6 +1211,8 @@ pub(super) fn build_svg_matrix<'s>(
|
||||
scope: &mut v8::PinScope<'s, '_>,
|
||||
components: SvgMatrixComponents,
|
||||
) -> v8::Local<'s, v8::Object> {
|
||||
super::super::ensure_intrinsic_interface_prototype(scope, "SVGMatrix")
|
||||
.expect("SVGMatrix compatibility prototype should materialize");
|
||||
SvgMatrixObjectDeclaration::new(
|
||||
components.a,
|
||||
components.b,
|
||||
|
||||
@@ -1061,3 +1061,63 @@ fn dom_point_matrix_transform_validates_matrix_init_and_returns_in_the_function_
|
||||
"0|true|false|30,52,12,10|TypeError|TypeError|no throw|no throw"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn geometry_exposes_legacy_window_aliases_without_replacing_native_svg_rect() {
|
||||
let mut vm = new_storage_test_vm("https://geometry-legacy-window-aliases.test/");
|
||||
|
||||
let result = vm
|
||||
.eval(
|
||||
r#"
|
||||
(() => {
|
||||
const interfaces = ["SVGPoint", "SVGRect", "SVGMatrix", "WebKitCSSMatrix"];
|
||||
const descriptorShape = name => {
|
||||
const descriptor = Object.getOwnPropertyDescriptor(globalThis, name);
|
||||
return [
|
||||
descriptor.value === globalThis[name],
|
||||
descriptor.writable,
|
||||
descriptor.enumerable,
|
||||
descriptor.configurable
|
||||
].join(",");
|
||||
};
|
||||
const point = new SVGPoint(1, 2);
|
||||
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
||||
const rect = svg.createSVGRect();
|
||||
rect.x = 3;
|
||||
rect.y = 4;
|
||||
rect.width = 5;
|
||||
rect.height = 6;
|
||||
const matrix = svg.createSVGMatrix();
|
||||
matrix.a = 2;
|
||||
return JSON.stringify({
|
||||
identities: [
|
||||
SVGPoint === DOMPoint,
|
||||
SVGRect === DOMRect,
|
||||
SVGMatrix === DOMMatrix,
|
||||
WebKitCSSMatrix === DOMMatrix
|
||||
].join(","),
|
||||
point: [point instanceof DOMPoint, point.x, point.y, String(point)].join(","),
|
||||
rect: [rect instanceof SVGRect, rect instanceof DOMRect, rect.x, rect.height, String(rect)].join(","),
|
||||
matrix: [
|
||||
matrix instanceof DOMMatrix,
|
||||
matrix instanceof SVGMatrix,
|
||||
DOMMatrix.prototype.isPrototypeOf(matrix),
|
||||
matrix.a,
|
||||
Object.prototype.toString.call(matrix)
|
||||
].join(","),
|
||||
descriptors: interfaces.map(descriptorShape).join("|")
|
||||
});
|
||||
})()
|
||||
"#,
|
||||
)
|
||||
.expect("Geometry legacy Window aliases should evaluate");
|
||||
|
||||
assert_eq!(
|
||||
result,
|
||||
concat!(
|
||||
r#"{"identities":"true,false,true,true","point":"true,1,2,[object DOMPoint]","rect":"true,false,3,6,[object SVGRect]","matrix":"true,true,true,2,[object SVGMatrix]","descriptors":""#,
|
||||
"true,true,false,true|true,true,false,true|",
|
||||
"true,true,false,true|true,true,false,true\"}"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
+147
-61
@@ -27,6 +27,92 @@ interfaces! {
|
||||
PublicKeyCredential: Credential;
|
||||
Credential;
|
||||
CredentialsContainer;
|
||||
Lock;
|
||||
LockManager;
|
||||
MIDIAccess: EventTarget;
|
||||
MIDIConnectionEvent: Event;
|
||||
MIDIInput: MIDIPort;
|
||||
MIDIInputMap;
|
||||
MIDIMessageEvent: Event;
|
||||
MIDIOutput: MIDIPort;
|
||||
MIDIOutputMap;
|
||||
MIDIPort: EventTarget;
|
||||
MediaKeyMessageEvent: Event;
|
||||
MediaKeySession: EventTarget;
|
||||
MediaKeyStatusMap;
|
||||
MediaKeyStatusMapIterator = "MediaKeyStatusMap Iterator";
|
||||
MediaKeySystemAccess;
|
||||
MediaKeys;
|
||||
PaymentMethodChangeEvent: PaymentRequestUpdateEvent;
|
||||
PaymentRequest: EventTarget;
|
||||
PaymentRequestUpdateEvent: Event;
|
||||
PaymentResponse: EventTarget;
|
||||
VideoDecoder: EventTarget;
|
||||
VideoEncoder: EventTarget;
|
||||
CSSAnimation: Animation;
|
||||
CSSTransition: Animation;
|
||||
ImageBitmapRenderingContext;
|
||||
MediaEncryptedEvent: Event;
|
||||
MediaMetadata;
|
||||
MediaRecorder: EventTarget;
|
||||
ChapterInformation;
|
||||
MediaSourceHandle;
|
||||
MediaStream: EventTarget;
|
||||
MediaStreamTrack: EventTarget;
|
||||
CanvasCaptureMediaStreamTrack: MediaStreamTrack;
|
||||
MediaSession;
|
||||
TimeRanges;
|
||||
VideoPlaybackQuality;
|
||||
MediaStreamTrackEvent: Event;
|
||||
OverconstrainedError: DOMException;
|
||||
PictureInPictureEvent: Event;
|
||||
PictureInPictureWindow: EventTarget;
|
||||
RemotePlayback: EventTarget;
|
||||
SourceBuffer: EventTarget;
|
||||
SourceBufferList: EventTarget;
|
||||
VideoColorSpace;
|
||||
VideoFrame;
|
||||
AudioListener;
|
||||
AudioParamMap;
|
||||
MediaStreamAudioDestinationNode: AudioNode;
|
||||
MediaStreamAudioSourceNode: AudioNode;
|
||||
PannerNode: AudioNode;
|
||||
ScriptProcessorNode: AudioNode;
|
||||
RTCCertificate;
|
||||
RTCDTMFSender: EventTarget;
|
||||
RTCDTMFToneChangeEvent: Event;
|
||||
RTCDtlsTransport: EventTarget;
|
||||
RTCEncodedAudioFrame;
|
||||
RTCEncodedVideoFrame;
|
||||
RTCError: DOMException;
|
||||
RTCErrorEvent: Event;
|
||||
RTCIceTransport: EventTarget;
|
||||
RTCPeerConnectionIceErrorEvent: Event;
|
||||
RTCRtpScriptTransform;
|
||||
RTCRtpScriptTransformer: EventTarget;
|
||||
RTCTransformEvent: Event;
|
||||
KeyFrameRequestEvent: Event;
|
||||
RTCRtpSender;
|
||||
RTCRtpTransceiver;
|
||||
RTCSctpTransport: EventTarget;
|
||||
RTCStatsReport;
|
||||
RTCTrackEvent: Event;
|
||||
EncodedVideoChunk;
|
||||
LargestContentfulPaint: PerformanceEntry;
|
||||
PerformanceEventTiming: PerformanceEntry;
|
||||
PerformancePaintTiming: PerformanceEntry;
|
||||
PerformanceServerTiming;
|
||||
Report;
|
||||
ReportBody;
|
||||
ReportingObserver;
|
||||
SpeechSynthesisErrorEvent: SpeechSynthesisEvent;
|
||||
SpeechSynthesisEvent: Event;
|
||||
WebTransport;
|
||||
WebTransportSendGroup;
|
||||
WebTransportDatagramsWritable: WritableStream;
|
||||
WebTransportBidirectionalStream;
|
||||
WebTransportDatagramDuplexStream;
|
||||
WebTransportError: DOMException;
|
||||
AbortController;
|
||||
AbortSignal: EventTarget;
|
||||
AbstractRange;
|
||||
@@ -42,8 +128,8 @@ interfaces! {
|
||||
AudioBufferSourceNode: AudioScheduledSourceNode;
|
||||
AudioContext: BaseAudioContext;
|
||||
AudioDestinationNode: AudioNode;
|
||||
AudioListener;
|
||||
AudioParamMap;
|
||||
|
||||
|
||||
AudioNode: EventTarget;
|
||||
AudioScheduledSourceNode: AudioNode;
|
||||
AudioParam;
|
||||
@@ -67,12 +153,12 @@ interfaces! {
|
||||
ConvolverNode: AudioNode;
|
||||
Blob;
|
||||
BlobEvent: Event;
|
||||
MIDIConnectionEvent: Event;
|
||||
MIDIMessageEvent: Event;
|
||||
|
||||
|
||||
BroadcastChannel: EventTarget;
|
||||
ByteLengthQueuingStrategy;
|
||||
CDATASection: Text;
|
||||
CSSAnimation: Animation;
|
||||
|
||||
CSSConditionRule: CSSGroupingRule;
|
||||
CSSContainerRule: CSSConditionRule;
|
||||
CSSCounterStyleRule: CSSRule;
|
||||
@@ -107,7 +193,7 @@ interfaces! {
|
||||
CSSStyleSheet: StyleSheet;
|
||||
CSSStyleValue;
|
||||
CSSSupportsRule: CSSConditionRule;
|
||||
CSSTransition: Animation;
|
||||
|
||||
CSSUnitValue: CSSNumericValue;
|
||||
Cache;
|
||||
CacheStorage;
|
||||
@@ -170,7 +256,7 @@ interfaces! {
|
||||
DynamicsCompressorNode: AudioNode;
|
||||
Element: Node;
|
||||
ElementInternals;
|
||||
EncodedVideoChunk;
|
||||
|
||||
ErrorEvent: Event;
|
||||
Event;
|
||||
EventCounts;
|
||||
@@ -211,10 +297,10 @@ interfaces! {
|
||||
Gamepad;
|
||||
GamepadButton;
|
||||
GamepadEvent: Event;
|
||||
PictureInPictureEvent: Event;
|
||||
PaymentRequestUpdateEvent: Event;
|
||||
PaymentMethodChangeEvent: PaymentRequestUpdateEvent;
|
||||
PictureInPictureWindow: EventTarget;
|
||||
|
||||
|
||||
|
||||
|
||||
GamepadHapticActuator;
|
||||
HTMLAllCollection;
|
||||
HTMLAnchorElement: HTMLElement;
|
||||
@@ -315,7 +401,7 @@ interfaces! {
|
||||
IdleDeadline;
|
||||
IdleDetector: EventTarget;
|
||||
Image;
|
||||
ImageBitmapRenderingContext;
|
||||
|
||||
ImageBitmap;
|
||||
ImageData;
|
||||
InputEvent: UIEvent;
|
||||
@@ -324,39 +410,39 @@ interfaces! {
|
||||
IntersectionObserverEntry;
|
||||
KeyboardEvent: UIEvent;
|
||||
KeyframeEffect: AnimationEffect;
|
||||
Lock;
|
||||
LockManager;
|
||||
|
||||
|
||||
Location;
|
||||
MathMLElement: Element;
|
||||
MediaCapabilities;
|
||||
MediaDeviceInfo;
|
||||
InputDeviceCapabilities;
|
||||
InputDeviceInfo: MediaDeviceInfo;
|
||||
MediaStreamTrack: EventTarget;
|
||||
CanvasCaptureMediaStreamTrack: MediaStreamTrack;
|
||||
|
||||
|
||||
MediaDevices: EventTarget;
|
||||
MediaElementAudioSourceNode: AudioNode;
|
||||
MediaError;
|
||||
MediaKeySession: EventTarget;
|
||||
MediaKeyStatusMap;
|
||||
MediaKeySystemAccess;
|
||||
MediaKeys;
|
||||
|
||||
|
||||
|
||||
|
||||
MediaList;
|
||||
MediaQueryList: EventTarget;
|
||||
MediaQueryListEvent: Event;
|
||||
MediaRecorder: EventTarget;
|
||||
MediaSession;
|
||||
MediaSourceHandle;
|
||||
SourceBuffer: EventTarget;
|
||||
SourceBufferList: EventTarget;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
MediaSource: EventTarget;
|
||||
MemoryInfo;
|
||||
MIDIPort: EventTarget;
|
||||
MIDIAccess: EventTarget;
|
||||
MIDIInput: MIDIPort;
|
||||
MIDIOutput: MIDIPort;
|
||||
MIDIInputMap;
|
||||
MIDIOutputMap;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
MessageChannel;
|
||||
MessageEvent: Event;
|
||||
MessagePort: EventTarget;
|
||||
@@ -394,11 +480,11 @@ interfaces! {
|
||||
PageRevealEvent: Event;
|
||||
PageTransitionEvent: Event;
|
||||
Path2D;
|
||||
PaymentResponse: EventTarget;
|
||||
LargestContentfulPaint: PerformanceEntry;
|
||||
PerformanceEventTiming: PerformanceEntry;
|
||||
PerformancePaintTiming: PerformanceEntry;
|
||||
PerformanceServerTiming;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Performance: EventTarget;
|
||||
PerformanceEntry;
|
||||
PerformanceMark: PerformanceEntry;
|
||||
@@ -426,26 +512,26 @@ interfaces! {
|
||||
PushSubscription;
|
||||
PushSubscriptionOptions;
|
||||
QuotaExceededError: DOMException;
|
||||
RTCCertificate;
|
||||
|
||||
RTCDataChannel: EventTarget;
|
||||
RTCDTMFSender: EventTarget;
|
||||
RTCDtlsTransport: EventTarget;
|
||||
RTCError: DOMException;
|
||||
RTCErrorEvent: Event;
|
||||
|
||||
|
||||
|
||||
|
||||
RTCIceCandidate;
|
||||
RTCIceTransport: EventTarget;
|
||||
RTCEncodedAudioFrame;
|
||||
RTCEncodedVideoFrame;
|
||||
|
||||
|
||||
|
||||
RTCPeerConnection: EventTarget;
|
||||
RTCPeerConnectionIceEvent: Event;
|
||||
RTCDataChannelEvent: Event;
|
||||
RTCPeerConnectionIceErrorEvent: Event;
|
||||
|
||||
RTCRtpReceiver;
|
||||
RTCRtpSender;
|
||||
RTCRtpTransceiver;
|
||||
RTCSctpTransport: EventTarget;
|
||||
|
||||
|
||||
|
||||
RTCSessionDescription;
|
||||
RTCStatsReport;
|
||||
|
||||
RadioNodeList: NodeList;
|
||||
Range: AbstractRange;
|
||||
ReadableByteStreamController;
|
||||
@@ -455,9 +541,9 @@ interfaces! {
|
||||
ReadableStreamBYOBRequest;
|
||||
ReadableStreamDefaultController;
|
||||
ReadableStreamDefaultReader;
|
||||
ReportBody;
|
||||
|
||||
Request;
|
||||
RemotePlayback: EventTarget;
|
||||
|
||||
ResizeObserver;
|
||||
ResizeObserverEntry;
|
||||
ResizeObserverSize;
|
||||
@@ -531,7 +617,7 @@ interfaces! {
|
||||
SVGLengthList;
|
||||
SVGLineElement: SVGGeometryElement;
|
||||
SVGLinearGradientElement: SVGGradientElement;
|
||||
SVGMatrix;
|
||||
SVGMatrix: DOMMatrix;
|
||||
SVGMetadataElement: SVGElement;
|
||||
SVGMPathElement: SVGElement;
|
||||
SVGNumber;
|
||||
@@ -570,8 +656,8 @@ interfaces! {
|
||||
SharedWorker: EventTarget;
|
||||
SharedWorkerGlobalScope: WorkerGlobalScope;
|
||||
SpeechSynthesis: EventTarget;
|
||||
SpeechSynthesisEvent: Event;
|
||||
SpeechSynthesisErrorEvent: SpeechSynthesisEvent;
|
||||
|
||||
|
||||
SpeechSynthesisUtterance: EventTarget;
|
||||
SpeechSynthesisVoice;
|
||||
StaticRange: AbstractRange;
|
||||
@@ -602,8 +688,8 @@ interfaces! {
|
||||
TextTrackCueList;
|
||||
TextTrackList: EventTarget;
|
||||
ToggleEvent: Event;
|
||||
TimeRanges;
|
||||
VideoPlaybackQuality;
|
||||
|
||||
|
||||
ToolActivatedEvent: Event;
|
||||
ToolCancelEvent: Event;
|
||||
Touch;
|
||||
@@ -624,8 +710,8 @@ interfaces! {
|
||||
URLSearchParams;
|
||||
URLSearchParamsIterator = "URLSearchParams Iterator";
|
||||
UserActivation;
|
||||
VideoDecoder: EventTarget;
|
||||
VideoEncoder: EventTarget;
|
||||
|
||||
|
||||
VTTCue: TextTrackCue;
|
||||
ValidityState;
|
||||
ViewTransition;
|
||||
@@ -652,9 +738,9 @@ interfaces! {
|
||||
WebGLTransformFeedback: WebGLObject;
|
||||
WebGLVertexArrayObject: WebGLObject;
|
||||
WebGLUniformLocation;
|
||||
WebTransportError: DOMException;
|
||||
WebTransportBidirectionalStream;
|
||||
WebTransportDatagramDuplexStream;
|
||||
|
||||
|
||||
|
||||
WebSocket: EventTarget;
|
||||
WebSocketError: DOMException;
|
||||
WebSocketStream;
|
||||
|
||||
Reference in New Issue
Block a user