From eb8c47343a713e7aea2f1d55ada8c5f1dd19f0d6 Mon Sep 17 00:00:00 2001 From: Svyatoslav Kuzmich Date: Fri, 13 Jan 2023 18:13:19 +0100 Subject: [PATCH] [Wasm] Don't use js("code") in browser API Use internal newJsObject to create new objects instead. This is a preparation for restricted js("code") support (KT-56955) --- .../stdlib/wasm/src/kotlin/w3cSupport.kt | 8 +-- .../wasm/src/org.w3c/org.khronos.webgl.kt | 4 +- .../wasm/src/org.w3c/org.w3c.dom.clipboard.kt | 4 +- .../src/org.w3c/org.w3c.dom.encryptedmedia.kt | 8 +-- .../wasm/src/org.w3c/org.w3c.dom.events.kt | 16 ++--- .../stdlib/wasm/src/org.w3c/org.w3c.dom.kt | 70 +++++++++---------- .../src/org.w3c/org.w3c.dom.mediacapture.kt | 36 +++++----- .../src/org.w3c/org.w3c.dom.pointerevents.kt | 2 +- .../wasm/src/org.w3c/org.w3c.dom.svg.kt | 2 +- .../stdlib/wasm/src/org.w3c/org.w3c.fetch.kt | 4 +- .../stdlib/wasm/src/org.w3c/org.w3c.files.kt | 4 +- .../wasm/src/org.w3c/org.w3c.notifications.kt | 8 +-- .../wasm/src/org.w3c/org.w3c.workers.kt | 22 +++--- .../stdlib/wasm/src/org.w3c/org.w3c.xhr.kt | 2 +- .../kotlin/tools/dukat/launchWasm.kt | 2 + 15 files changed, 96 insertions(+), 96 deletions(-) diff --git a/libraries/stdlib/wasm/src/kotlin/w3cSupport.kt b/libraries/stdlib/wasm/src/kotlin/w3cSupport.kt index 7ba4c6cc2e8..0d7e3982d22 100644 --- a/libraries/stdlib/wasm/src/kotlin/w3cSupport.kt +++ b/libraries/stdlib/wasm/src/kotlin/w3cSupport.kt @@ -8,8 +8,6 @@ package kotlin.js @PublishedApi internal val undefined: Nothing? = null -/** - * Exposes the JavaScript [eval function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval) to Kotlin. - */ -@JsFun("(s) => eval(s)") -external fun js(code: String): Dynamic \ No newline at end of file +@PublishedApi +@JsFun("() => ({})") +internal external fun newJsObject(): Dynamic \ No newline at end of file diff --git a/libraries/stdlib/wasm/src/org.w3c/org.khronos.webgl.kt b/libraries/stdlib/wasm/src/org.w3c/org.khronos.webgl.kt index df43e87d6c7..f4b3e14ab10 100644 --- a/libraries/stdlib/wasm/src/org.w3c/org.khronos.webgl.kt +++ b/libraries/stdlib/wasm/src/org.w3c/org.khronos.webgl.kt @@ -42,7 +42,7 @@ public external interface WebGLContextAttributes { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun WebGLContextAttributes(alpha: Boolean? = true, depth: Boolean? = true, stencil: Boolean? = false, antialias: Boolean? = true, premultipliedAlpha: Boolean? = true, preserveDrawingBuffer: Boolean? = false, preferLowPowerToHighPerformance: Boolean? = false, failIfMajorPerformanceCaveat: Boolean? = false): WebGLContextAttributes { - val o = js("({})") + val o = newJsObject() o["alpha"] = alpha o["depth"] = depth o["stencil"] = stencil @@ -895,7 +895,7 @@ public external interface WebGLContextEventInit : EventInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun WebGLContextEventInit(statusMessage: String? = "", bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): WebGLContextEventInit { - val o = js("({})") + val o = newJsObject() o["statusMessage"] = statusMessage o["bubbles"] = bubbles o["cancelable"] = cancelable diff --git a/libraries/stdlib/wasm/src/org.w3c/org.w3c.dom.clipboard.kt b/libraries/stdlib/wasm/src/org.w3c/org.w3c.dom.clipboard.kt index 89f25971d33..5aea29f7407 100644 --- a/libraries/stdlib/wasm/src/org.w3c/org.w3c.dom.clipboard.kt +++ b/libraries/stdlib/wasm/src/org.w3c/org.w3c.dom.clipboard.kt @@ -22,7 +22,7 @@ public external interface ClipboardEventInit : EventInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun ClipboardEventInit(clipboardData: DataTransfer? = null, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ClipboardEventInit { - val o = js("({})") + val o = newJsObject() o["clipboardData"] = clipboardData o["bubbles"] = bubbles o["cancelable"] = cancelable @@ -64,7 +64,7 @@ public external interface ClipboardPermissionDescriptor { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun ClipboardPermissionDescriptor(allowWithoutGesture: Boolean? = false): ClipboardPermissionDescriptor { - val o = js("({})") + val o = newJsObject() o["allowWithoutGesture"] = allowWithoutGesture @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE") return o as ClipboardPermissionDescriptor diff --git a/libraries/stdlib/wasm/src/org.w3c/org.w3c.dom.encryptedmedia.kt b/libraries/stdlib/wasm/src/org.w3c/org.w3c.dom.encryptedmedia.kt index ba15686fa13..882e97f0b5d 100644 --- a/libraries/stdlib/wasm/src/org.w3c/org.w3c.dom.encryptedmedia.kt +++ b/libraries/stdlib/wasm/src/org.w3c/org.w3c.dom.encryptedmedia.kt @@ -43,7 +43,7 @@ public external interface MediaKeySystemConfiguration { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun MediaKeySystemConfiguration(label: String? = "", initDataTypes: Array? = arrayOf(), audioCapabilities: Array? = arrayOf(), videoCapabilities: Array? = arrayOf(), distinctiveIdentifier: MediaKeysRequirement? = MediaKeysRequirement.OPTIONAL, persistentState: MediaKeysRequirement? = MediaKeysRequirement.OPTIONAL, sessionTypes: Array? = undefined): MediaKeySystemConfiguration { - val o = js("({})") + val o = newJsObject() o["label"] = label o["initDataTypes"] = initDataTypes o["audioCapabilities"] = audioCapabilities @@ -67,7 +67,7 @@ public external interface MediaKeySystemMediaCapability { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun MediaKeySystemMediaCapability(contentType: String? = "", robustness: String? = ""): MediaKeySystemMediaCapability { - val o = js("({})") + val o = newJsObject() o["contentType"] = contentType o["robustness"] = robustness @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE") @@ -140,7 +140,7 @@ public external interface MediaKeyMessageEventInit : EventInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun MediaKeyMessageEventInit(messageType: MediaKeyMessageType?, message: ArrayBuffer?, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): MediaKeyMessageEventInit { - val o = js("({})") + val o = newJsObject() o["messageType"] = messageType o["message"] = message o["bubbles"] = bubbles @@ -174,7 +174,7 @@ public external interface MediaEncryptedEventInit : EventInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun MediaEncryptedEventInit(initDataType: String? = "", initData: ArrayBuffer? = null, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): MediaEncryptedEventInit { - val o = js("({})") + val o = newJsObject() o["initDataType"] = initDataType o["initData"] = initData o["bubbles"] = bubbles diff --git a/libraries/stdlib/wasm/src/org.w3c/org.w3c.dom.events.kt b/libraries/stdlib/wasm/src/org.w3c/org.w3c.dom.events.kt index 922409e41e9..8e687d241e5 100644 --- a/libraries/stdlib/wasm/src/org.w3c/org.w3c.dom.events.kt +++ b/libraries/stdlib/wasm/src/org.w3c/org.w3c.dom.events.kt @@ -39,7 +39,7 @@ public external interface UIEventInit : EventInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun UIEventInit(view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): UIEventInit { - val o = js("({})") + val o = newJsObject() o["view"] = view o["detail"] = detail o["bubbles"] = bubbles @@ -72,7 +72,7 @@ public external interface FocusEventInit : UIEventInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun FocusEventInit(relatedTarget: EventTarget? = null, view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): FocusEventInit { - val o = js("({})") + val o = newJsObject() o["relatedTarget"] = relatedTarget o["view"] = view o["detail"] = detail @@ -145,7 +145,7 @@ public external interface MouseEventInit : EventModifierInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun MouseEventInit(screenX: Int? = 0, screenY: Int? = 0, clientX: Int? = 0, clientY: Int? = 0, button: Short? = 0, buttons: Short? = 0, relatedTarget: EventTarget? = null, region: String? = null, ctrlKey: Boolean? = false, shiftKey: Boolean? = false, altKey: Boolean? = false, metaKey: Boolean? = false, modifierAltGraph: Boolean? = false, modifierCapsLock: Boolean? = false, modifierFn: Boolean? = false, modifierFnLock: Boolean? = false, modifierHyper: Boolean? = false, modifierNumLock: Boolean? = false, modifierScrollLock: Boolean? = false, modifierSuper: Boolean? = false, modifierSymbol: Boolean? = false, modifierSymbolLock: Boolean? = false, view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): MouseEventInit { - val o = js("({})") + val o = newJsObject() o["screenX"] = screenX o["screenY"] = screenY o["clientX"] = clientX @@ -225,7 +225,7 @@ public external interface EventModifierInit : UIEventInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun EventModifierInit(ctrlKey: Boolean? = false, shiftKey: Boolean? = false, altKey: Boolean? = false, metaKey: Boolean? = false, modifierAltGraph: Boolean? = false, modifierCapsLock: Boolean? = false, modifierFn: Boolean? = false, modifierFnLock: Boolean? = false, modifierHyper: Boolean? = false, modifierNumLock: Boolean? = false, modifierScrollLock: Boolean? = false, modifierSuper: Boolean? = false, modifierSymbol: Boolean? = false, modifierSymbolLock: Boolean? = false, view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): EventModifierInit { - val o = js("({})") + val o = newJsObject() o["ctrlKey"] = ctrlKey o["shiftKey"] = shiftKey o["altKey"] = altKey @@ -287,7 +287,7 @@ public external interface WheelEventInit : MouseEventInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun WheelEventInit(deltaX: Double? = 0.0, deltaY: Double? = 0.0, deltaZ: Double? = 0.0, deltaMode: Int? = 0, screenX: Int? = 0, screenY: Int? = 0, clientX: Int? = 0, clientY: Int? = 0, button: Short? = 0, buttons: Short? = 0, relatedTarget: EventTarget? = null, region: String? = null, ctrlKey: Boolean? = false, shiftKey: Boolean? = false, altKey: Boolean? = false, metaKey: Boolean? = false, modifierAltGraph: Boolean? = false, modifierCapsLock: Boolean? = false, modifierFn: Boolean? = false, modifierFnLock: Boolean? = false, modifierHyper: Boolean? = false, modifierNumLock: Boolean? = false, modifierScrollLock: Boolean? = false, modifierSuper: Boolean? = false, modifierSymbol: Boolean? = false, modifierSymbolLock: Boolean? = false, view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): WheelEventInit { - val o = js("({})") + val o = newJsObject() o["deltaX"] = deltaX o["deltaY"] = deltaY o["deltaZ"] = deltaZ @@ -350,7 +350,7 @@ public external interface InputEventInit : UIEventInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun InputEventInit(data: String? = "", isComposing: Boolean? = false, view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): InputEventInit { - val o = js("({})") + val o = newJsObject() o["data"] = data o["isComposing"] = isComposing o["view"] = view @@ -413,7 +413,7 @@ public external interface KeyboardEventInit : EventModifierInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun KeyboardEventInit(key: String? = "", code: String? = "", location: Int? = 0, repeat: Boolean? = false, isComposing: Boolean? = false, ctrlKey: Boolean? = false, shiftKey: Boolean? = false, altKey: Boolean? = false, metaKey: Boolean? = false, modifierAltGraph: Boolean? = false, modifierCapsLock: Boolean? = false, modifierFn: Boolean? = false, modifierFnLock: Boolean? = false, modifierHyper: Boolean? = false, modifierNumLock: Boolean? = false, modifierScrollLock: Boolean? = false, modifierSuper: Boolean? = false, modifierSymbol: Boolean? = false, modifierSymbolLock: Boolean? = false, view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): KeyboardEventInit { - val o = js("({})") + val o = newJsObject() o["key"] = key o["code"] = code o["location"] = location @@ -465,7 +465,7 @@ public external interface CompositionEventInit : UIEventInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun CompositionEventInit(data: String? = "", view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): CompositionEventInit { - val o = js("({})") + val o = newJsObject() o["data"] = data o["view"] = view o["detail"] = detail diff --git a/libraries/stdlib/wasm/src/org.w3c/org.w3c.dom.kt b/libraries/stdlib/wasm/src/org.w3c/org.w3c.dom.kt index eb85bf4be91..e1daf307d34 100644 --- a/libraries/stdlib/wasm/src/org.w3c/org.w3c.dom.kt +++ b/libraries/stdlib/wasm/src/org.w3c/org.w3c.dom.kt @@ -1501,7 +1501,7 @@ public external interface TrackEventInit : EventInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun TrackEventInit(track: UnionAudioTrackOrTextTrackOrVideoTrack? = null, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): TrackEventInit { - val o = js("({})") + val o = newJsObject() o["track"] = track o["bubbles"] = bubbles o["cancelable"] = cancelable @@ -2557,7 +2557,7 @@ public external interface RelatedEventInit : EventInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun RelatedEventInit(relatedTarget: EventTarget? = null, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): RelatedEventInit { - val o = js("({})") + val o = newJsObject() o["relatedTarget"] = relatedTarget o["bubbles"] = bubbles o["cancelable"] = cancelable @@ -2701,7 +2701,7 @@ public external interface AssignedNodesOptions { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun AssignedNodesOptions(flatten: Boolean? = false): AssignedNodesOptions { - val o = js("({})") + val o = newJsObject() o["flatten"] = flatten @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE") return o as AssignedNodesOptions @@ -2748,7 +2748,7 @@ public external interface CanvasRenderingContext2DSettings { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun CanvasRenderingContext2DSettings(alpha: Boolean? = true): CanvasRenderingContext2DSettings { - val o = js("({})") + val o = newJsObject() o["alpha"] = alpha @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE") return o as CanvasRenderingContext2DSettings @@ -2956,7 +2956,7 @@ public external interface HitRegionOptions { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun HitRegionOptions(path: Path2D? = null, fillRule: CanvasFillRule? = CanvasFillRule.NONZERO, id: String? = "", parentID: String? = null, cursor: String? = "inherit", control: Element? = null, label: String? = null, role: String? = null): HitRegionOptions { - val o = js("({})") + val o = newJsObject() o["path"] = path o["fillRule"] = fillRule o["id"] = id @@ -3017,7 +3017,7 @@ public external interface ImageBitmapRenderingContextSettings { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun ImageBitmapRenderingContextSettings(alpha: Boolean? = true): ImageBitmapRenderingContextSettings { - val o = js("({})") + val o = newJsObject() o["alpha"] = alpha @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE") return o as ImageBitmapRenderingContextSettings @@ -3041,7 +3041,7 @@ public external interface ElementDefinitionOptions { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun ElementDefinitionOptions(extends: String? = undefined): ElementDefinitionOptions { - val o = js("({})") + val o = newJsObject() o["extends"] = extends @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE") return o as ElementDefinitionOptions @@ -3115,7 +3115,7 @@ public external interface DragEventInit : MouseEventInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun DragEventInit(dataTransfer: DataTransfer? = null, screenX: Int? = 0, screenY: Int? = 0, clientX: Int? = 0, clientY: Int? = 0, button: Short? = 0, buttons: Short? = 0, relatedTarget: EventTarget? = null, region: String? = null, ctrlKey: Boolean? = false, shiftKey: Boolean? = false, altKey: Boolean? = false, metaKey: Boolean? = false, modifierAltGraph: Boolean? = false, modifierCapsLock: Boolean? = false, modifierFn: Boolean? = false, modifierFnLock: Boolean? = false, modifierHyper: Boolean? = false, modifierNumLock: Boolean? = false, modifierScrollLock: Boolean? = false, modifierSuper: Boolean? = false, modifierSymbol: Boolean? = false, modifierSymbolLock: Boolean? = false, view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): DragEventInit { - val o = js("({})") + val o = newJsObject() o["dataTransfer"] = dataTransfer o["screenX"] = screenX o["screenY"] = screenY @@ -3281,7 +3281,7 @@ public external interface PopStateEventInit : EventInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun PopStateEventInit(state: Any? = null, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): PopStateEventInit { - val o = js("({})") + val o = newJsObject() o["state"] = state o["bubbles"] = bubbles o["cancelable"] = cancelable @@ -3317,7 +3317,7 @@ public external interface HashChangeEventInit : EventInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun HashChangeEventInit(oldURL: String? = "", newURL: String? = "", bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): HashChangeEventInit { - val o = js("({})") + val o = newJsObject() o["oldURL"] = oldURL o["newURL"] = newURL o["bubbles"] = bubbles @@ -3350,7 +3350,7 @@ public external interface PageTransitionEventInit : EventInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun PageTransitionEventInit(persisted: Boolean? = false, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): PageTransitionEventInit { - val o = js("({})") + val o = newJsObject() o["persisted"] = persisted o["bubbles"] = bubbles o["cancelable"] = cancelable @@ -3443,7 +3443,7 @@ public external interface ErrorEventInit : EventInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun ErrorEventInit(message: String? = "", filename: String? = "", lineno: Int? = 0, colno: Int? = 0, error: Any? = null, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ErrorEventInit { - val o = js("({})") + val o = newJsObject() o["message"] = message o["filename"] = filename o["lineno"] = lineno @@ -3481,7 +3481,7 @@ public external interface PromiseRejectionEventInit : EventInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun PromiseRejectionEventInit(promise: Promise?, reason: Any? = undefined, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): PromiseRejectionEventInit { - val o = js("({})") + val o = newJsObject() o["promise"] = promise o["reason"] = reason o["bubbles"] = bubbles @@ -3945,7 +3945,7 @@ public external interface ImageBitmapOptions { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun ImageBitmapOptions(imageOrientation: ImageOrientation? = ImageOrientation.NONE, premultiplyAlpha: PremultiplyAlpha? = PremultiplyAlpha.DEFAULT, colorSpaceConversion: ColorSpaceConversion? = ColorSpaceConversion.DEFAULT, resizeWidth: Int? = undefined, resizeHeight: Int? = undefined, resizeQuality: ResizeQuality? = ResizeQuality.LOW): ImageBitmapOptions { - val o = js("({})") + val o = newJsObject() o["imageOrientation"] = imageOrientation o["premultiplyAlpha"] = premultiplyAlpha o["colorSpaceConversion"] = colorSpaceConversion @@ -3996,7 +3996,7 @@ public external interface MessageEventInit : EventInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun MessageEventInit(data: Any? = null, origin: String? = "", lastEventId: String? = "", source: UnionMessagePortOrWindowProxy? = null, ports: Array? = arrayOf(), bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): MessageEventInit { - val o = js("({})") + val o = newJsObject() o["data"] = data o["origin"] = origin o["lastEventId"] = lastEventId @@ -4037,7 +4037,7 @@ public external interface EventSourceInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun EventSourceInit(withCredentials: Boolean? = false): EventSourceInit { - val o = js("({})") + val o = newJsObject() o["withCredentials"] = withCredentials @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE") return o as EventSourceInit @@ -4102,7 +4102,7 @@ public external interface CloseEventInit : EventInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun CloseEventInit(wasClean: Boolean? = false, code: Short? = 0, reason: String? = "", bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): CloseEventInit { - val o = js("({})") + val o = newJsObject() o["wasClean"] = wasClean o["code"] = code o["reason"] = reason @@ -4207,7 +4207,7 @@ public external interface WorkerOptions { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun WorkerOptions(type: WorkerType? = WorkerType.CLASSIC, credentials: RequestCredentials? = RequestCredentials.OMIT): WorkerOptions { - val o = js("({})") + val o = newJsObject() o["type"] = type o["credentials"] = credentials @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE") @@ -4324,7 +4324,7 @@ public external interface StorageEventInit : EventInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun StorageEventInit(key: String? = null, oldValue: String? = null, newValue: String? = null, url: String? = "", storageArea: Storage? = null, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): StorageEventInit { - val o = js("({})") + val o = newJsObject() o["key"] = key o["oldValue"] = oldValue o["newValue"] = newValue @@ -4553,7 +4553,7 @@ public external interface EventInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun EventInit(bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): EventInit { - val o = js("({})") + val o = newJsObject() o["bubbles"] = bubbles o["cancelable"] = cancelable o["composed"] = composed @@ -4585,7 +4585,7 @@ public external interface CustomEventInit : EventInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun CustomEventInit(detail: Any? = null, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): CustomEventInit { - val o = js("({})") + val o = newJsObject() o["detail"] = detail o["bubbles"] = bubbles o["cancelable"] = cancelable @@ -4603,7 +4603,7 @@ public external interface EventListenerOptions { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun EventListenerOptions(capture: Boolean? = false): EventListenerOptions { - val o = js("({})") + val o = newJsObject() o["capture"] = capture @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE") return o as EventListenerOptions @@ -4621,7 +4621,7 @@ public external interface AddEventListenerOptions : EventListenerOptions { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun AddEventListenerOptions(passive: Boolean? = false, once: Boolean? = false, capture: Boolean? = false): AddEventListenerOptions { - val o = js("({})") + val o = newJsObject() o["passive"] = passive o["once"] = once o["capture"] = capture @@ -4751,7 +4751,7 @@ public external interface MutationObserverInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun MutationObserverInit(childList: Boolean? = false, attributes: Boolean? = undefined, characterData: Boolean? = undefined, subtree: Boolean? = false, attributeOldValue: Boolean? = undefined, characterDataOldValue: Boolean? = undefined, attributeFilter: Array? = undefined): MutationObserverInit { - val o = js("({})") + val o = newJsObject() o["childList"] = childList o["attributes"] = attributes o["characterData"] = characterData @@ -4843,7 +4843,7 @@ public external interface GetRootNodeOptions { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun GetRootNodeOptions(composed: Boolean? = false): GetRootNodeOptions { - val o = js("({})") + val o = newJsObject() o["composed"] = composed @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE") return o as GetRootNodeOptions @@ -5092,7 +5092,7 @@ public external interface ElementCreationOptions { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun ElementCreationOptions(param_is: String? = undefined): ElementCreationOptions { - val o = js("({})") + val o = newJsObject() o["is"] = param_is @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE") return o as ElementCreationOptions @@ -5297,7 +5297,7 @@ public external interface ShadowRootInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun ShadowRootInit(mode: ShadowRootMode?): ShadowRootInit { - val o = js("({})") + val o = newJsObject() o["mode"] = mode @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE") return o as ShadowRootInit @@ -5681,7 +5681,7 @@ public external interface DOMPointInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun DOMPointInit(x: Double? = 0.0, y: Double? = 0.0, z: Double? = 0.0, w: Double? = 1.0): DOMPointInit { - val o = js("({})") + val o = newJsObject() o["x"] = x o["y"] = y o["z"] = z @@ -5732,7 +5732,7 @@ public external interface DOMRectInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun DOMRectInit(x: Double? = 0.0, y: Double? = 0.0, width: Double? = 0.0, height: Double? = 0.0): DOMRectInit { - val o = js("({})") + val o = newJsObject() o["x"] = x o["y"] = y o["width"] = width @@ -5863,7 +5863,7 @@ public external interface ScrollOptions { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun ScrollOptions(behavior: ScrollBehavior? = ScrollBehavior.AUTO): ScrollOptions { - val o = js("({})") + val o = newJsObject() o["behavior"] = behavior @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE") return o as ScrollOptions @@ -5884,7 +5884,7 @@ public external interface ScrollToOptions : ScrollOptions { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun ScrollToOptions(left: Double? = undefined, top: Double? = undefined, behavior: ScrollBehavior? = ScrollBehavior.AUTO): ScrollToOptions { - val o = js("({})") + val o = newJsObject() o["left"] = left o["top"] = top o["behavior"] = behavior @@ -5932,7 +5932,7 @@ public external interface MediaQueryListEventInit : EventInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun MediaQueryListEventInit(media: String? = "", matches: Boolean? = false, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): MediaQueryListEventInit { - val o = js("({})") + val o = newJsObject() o["media"] = media o["matches"] = matches o["bubbles"] = bubbles @@ -5975,7 +5975,7 @@ public external interface ScrollIntoViewOptions : ScrollOptions { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun ScrollIntoViewOptions(block: ScrollLogicalPosition? = ScrollLogicalPosition.CENTER, inline: ScrollLogicalPosition? = ScrollLogicalPosition.CENTER, behavior: ScrollBehavior? = ScrollBehavior.AUTO): ScrollIntoViewOptions { - val o = js("({})") + val o = newJsObject() o["block"] = block o["inline"] = inline o["behavior"] = behavior @@ -5995,7 +5995,7 @@ public external interface BoxQuadOptions { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun BoxQuadOptions(box: CSSBoxType? = CSSBoxType.BORDER, relativeTo: Dynamic? = undefined): BoxQuadOptions { - val o = js("({})") + val o = newJsObject() o["box"] = box o["relativeTo"] = relativeTo @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE") @@ -6014,7 +6014,7 @@ public external interface ConvertCoordinateOptions { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun ConvertCoordinateOptions(fromBox: CSSBoxType? = CSSBoxType.BORDER, toBox: CSSBoxType? = CSSBoxType.BORDER): ConvertCoordinateOptions { - val o = js("({})") + val o = newJsObject() o["fromBox"] = fromBox o["toBox"] = toBox @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE") diff --git a/libraries/stdlib/wasm/src/org.w3c/org.w3c.dom.mediacapture.kt b/libraries/stdlib/wasm/src/org.w3c/org.w3c.dom.mediacapture.kt index 6a7d5d7d535..10b77100785 100644 --- a/libraries/stdlib/wasm/src/org.w3c/org.w3c.dom.mediacapture.kt +++ b/libraries/stdlib/wasm/src/org.w3c/org.w3c.dom.mediacapture.kt @@ -111,7 +111,7 @@ public external interface MediaTrackSupportedConstraints { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun MediaTrackSupportedConstraints(width: Boolean? = true, height: Boolean? = true, aspectRatio: Boolean? = true, frameRate: Boolean? = true, facingMode: Boolean? = true, resizeMode: Boolean? = true, volume: Boolean? = true, sampleRate: Boolean? = true, sampleSize: Boolean? = true, echoCancellation: Boolean? = true, autoGainControl: Boolean? = true, noiseSuppression: Boolean? = true, latency: Boolean? = true, channelCount: Boolean? = true, deviceId: Boolean? = true, groupId: Boolean? = true): MediaTrackSupportedConstraints { - val o = js("({})") + val o = newJsObject() o["width"] = width o["height"] = height o["aspectRatio"] = aspectRatio @@ -186,7 +186,7 @@ public external interface MediaTrackCapabilities { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun MediaTrackCapabilities(width: ULongRange? = undefined, height: ULongRange? = undefined, aspectRatio: DoubleRange? = undefined, frameRate: DoubleRange? = undefined, facingMode: Array? = undefined, resizeMode: Array? = undefined, volume: DoubleRange? = undefined, sampleRate: ULongRange? = undefined, sampleSize: ULongRange? = undefined, echoCancellation: Array? = undefined, autoGainControl: Array? = undefined, noiseSuppression: Array? = undefined, latency: DoubleRange? = undefined, channelCount: ULongRange? = undefined, deviceId: String? = undefined, groupId: String? = undefined): MediaTrackCapabilities { - val o = js("({})") + val o = newJsObject() o["width"] = width o["height"] = height o["aspectRatio"] = aspectRatio @@ -219,7 +219,7 @@ public external interface MediaTrackConstraints : MediaTrackConstraintSet { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun MediaTrackConstraints(advanced: Array? = undefined, width: Dynamic? = undefined, height: Dynamic? = undefined, aspectRatio: Dynamic? = undefined, frameRate: Dynamic? = undefined, facingMode: Dynamic? = undefined, resizeMode: Dynamic? = undefined, volume: Dynamic? = undefined, sampleRate: Dynamic? = undefined, sampleSize: Dynamic? = undefined, echoCancellation: Dynamic? = undefined, autoGainControl: Dynamic? = undefined, noiseSuppression: Dynamic? = undefined, latency: Dynamic? = undefined, channelCount: Dynamic? = undefined, deviceId: Dynamic? = undefined, groupId: Dynamic? = undefined): MediaTrackConstraints { - val o = js("({})") + val o = newJsObject() o["advanced"] = advanced o["width"] = width o["height"] = height @@ -295,7 +295,7 @@ public external interface MediaTrackConstraintSet { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun MediaTrackConstraintSet(width: Dynamic? = undefined, height: Dynamic? = undefined, aspectRatio: Dynamic? = undefined, frameRate: Dynamic? = undefined, facingMode: Dynamic? = undefined, resizeMode: Dynamic? = undefined, volume: Dynamic? = undefined, sampleRate: Dynamic? = undefined, sampleSize: Dynamic? = undefined, echoCancellation: Dynamic? = undefined, autoGainControl: Dynamic? = undefined, noiseSuppression: Dynamic? = undefined, latency: Dynamic? = undefined, channelCount: Dynamic? = undefined, deviceId: Dynamic? = undefined, groupId: Dynamic? = undefined): MediaTrackConstraintSet { - val o = js("({})") + val o = newJsObject() o["width"] = width o["height"] = height o["aspectRatio"] = aspectRatio @@ -373,7 +373,7 @@ public external interface MediaTrackSettings { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun MediaTrackSettings(width: Int? = undefined, height: Int? = undefined, aspectRatio: Double? = undefined, frameRate: Double? = undefined, facingMode: String? = undefined, resizeMode: String? = undefined, volume: Double? = undefined, sampleRate: Int? = undefined, sampleSize: Int? = undefined, echoCancellation: Boolean? = undefined, autoGainControl: Boolean? = undefined, noiseSuppression: Boolean? = undefined, latency: Double? = undefined, channelCount: Int? = undefined, deviceId: String? = undefined, groupId: String? = undefined): MediaTrackSettings { - val o = js("({})") + val o = newJsObject() o["width"] = width o["height"] = height o["aspectRatio"] = aspectRatio @@ -415,7 +415,7 @@ public external interface MediaStreamTrackEventInit : EventInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun MediaStreamTrackEventInit(track: MediaStreamTrack?, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): MediaStreamTrackEventInit { - val o = js("({})") + val o = newJsObject() o["track"] = track o["bubbles"] = bubbles o["cancelable"] = cancelable @@ -444,7 +444,7 @@ public external interface OverconstrainedErrorEventInit : EventInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun OverconstrainedErrorEventInit(error: Dynamic? = null.unsafeCast(), bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): OverconstrainedErrorEventInit { - val o = js("({})") + val o = newJsObject() o["error"] = error o["bubbles"] = bubbles o["cancelable"] = cancelable @@ -493,7 +493,7 @@ public external interface MediaStreamConstraints { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun MediaStreamConstraints(video: Dynamic? = false.unsafeCast(), audio: Dynamic? = false.unsafeCast()): MediaStreamConstraints { - val o = js("({})") + val o = newJsObject() o["video"] = video o["audio"] = audio @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE") @@ -525,7 +525,7 @@ public external interface DoubleRange { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun DoubleRange(max: Double? = undefined, min: Double? = undefined): DoubleRange { - val o = js("({})") + val o = newJsObject() o["max"] = max o["min"] = min @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE") @@ -544,7 +544,7 @@ public external interface ConstrainDoubleRange : DoubleRange { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun ConstrainDoubleRange(exact: Double? = undefined, ideal: Double? = undefined, max: Double? = undefined, min: Double? = undefined): ConstrainDoubleRange { - val o = js("({})") + val o = newJsObject() o["exact"] = exact o["ideal"] = ideal o["max"] = max @@ -565,7 +565,7 @@ public external interface ULongRange { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun ULongRange(max: Int? = undefined, min: Int? = undefined): ULongRange { - val o = js("({})") + val o = newJsObject() o["max"] = max o["min"] = min @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE") @@ -584,7 +584,7 @@ public external interface ConstrainULongRange : ULongRange { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun ConstrainULongRange(exact: Int? = undefined, ideal: Int? = undefined, max: Int? = undefined, min: Int? = undefined): ConstrainULongRange { - val o = js("({})") + val o = newJsObject() o["exact"] = exact o["ideal"] = ideal o["max"] = max @@ -608,7 +608,7 @@ public external interface ConstrainBooleanParameters { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun ConstrainBooleanParameters(exact: Boolean? = undefined, ideal: Boolean? = undefined): ConstrainBooleanParameters { - val o = js("({})") + val o = newJsObject() o["exact"] = exact o["ideal"] = ideal @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE") @@ -630,7 +630,7 @@ public external interface ConstrainDOMStringParameters { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun ConstrainDOMStringParameters(exact: Dynamic? = undefined, ideal: Dynamic? = undefined): ConstrainDOMStringParameters { - val o = js("({})") + val o = newJsObject() o["exact"] = exact o["ideal"] = ideal @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE") @@ -642,7 +642,7 @@ public external interface Capabilities @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun Capabilities(): Capabilities { - val o = js("({})") + val o = newJsObject() @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE") return o as Capabilities } @@ -652,7 +652,7 @@ public external interface Settings @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun Settings(): Settings { - val o = js("({})") + val o = newJsObject() @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE") return o as Settings } @@ -662,7 +662,7 @@ public external interface ConstraintSet @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun ConstraintSet(): ConstraintSet { - val o = js("({})") + val o = newJsObject() @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE") return o as ConstraintSet } @@ -676,7 +676,7 @@ public external interface Constraints : ConstraintSet { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun Constraints(advanced: Array? = undefined): Constraints { - val o = js("({})") + val o = newJsObject() o["advanced"] = advanced @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE") return o as Constraints diff --git a/libraries/stdlib/wasm/src/org.w3c/org.w3c.dom.pointerevents.kt b/libraries/stdlib/wasm/src/org.w3c/org.w3c.dom.pointerevents.kt index 313ceab64e0..4931ef64c43 100644 --- a/libraries/stdlib/wasm/src/org.w3c/org.w3c.dom.pointerevents.kt +++ b/libraries/stdlib/wasm/src/org.w3c/org.w3c.dom.pointerevents.kt @@ -49,7 +49,7 @@ public external interface PointerEventInit : MouseEventInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun PointerEventInit(pointerId: Int? = 0, width: Double? = 1.0, height: Double? = 1.0, pressure: Float? = 0f, tangentialPressure: Float? = 0f, tiltX: Int? = 0, tiltY: Int? = 0, twist: Int? = 0, pointerType: String? = "", isPrimary: Boolean? = false, screenX: Int? = 0, screenY: Int? = 0, clientX: Int? = 0, clientY: Int? = 0, button: Short? = 0, buttons: Short? = 0, relatedTarget: EventTarget? = null, region: String? = null, ctrlKey: Boolean? = false, shiftKey: Boolean? = false, altKey: Boolean? = false, metaKey: Boolean? = false, modifierAltGraph: Boolean? = false, modifierCapsLock: Boolean? = false, modifierFn: Boolean? = false, modifierFnLock: Boolean? = false, modifierHyper: Boolean? = false, modifierNumLock: Boolean? = false, modifierScrollLock: Boolean? = false, modifierSuper: Boolean? = false, modifierSymbol: Boolean? = false, modifierSymbolLock: Boolean? = false, view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): PointerEventInit { - val o = js("({})") + val o = newJsObject() o["pointerId"] = pointerId o["width"] = width o["height"] = height diff --git a/libraries/stdlib/wasm/src/org.w3c/org.w3c.dom.svg.kt b/libraries/stdlib/wasm/src/org.w3c/org.w3c.dom.svg.kt index 9e263d9b727..47ad789f906 100644 --- a/libraries/stdlib/wasm/src/org.w3c/org.w3c.dom.svg.kt +++ b/libraries/stdlib/wasm/src/org.w3c/org.w3c.dom.svg.kt @@ -64,7 +64,7 @@ public external interface SVGBoundingBoxOptions { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun SVGBoundingBoxOptions(fill: Boolean? = true, stroke: Boolean? = false, markers: Boolean? = false, clipped: Boolean? = false): SVGBoundingBoxOptions { - val o = js("({})") + val o = newJsObject() o["fill"] = fill o["stroke"] = stroke o["markers"] = markers diff --git a/libraries/stdlib/wasm/src/org.w3c/org.w3c.fetch.kt b/libraries/stdlib/wasm/src/org.w3c/org.w3c.fetch.kt index d039b7e626a..05dcf0e052c 100644 --- a/libraries/stdlib/wasm/src/org.w3c/org.w3c.fetch.kt +++ b/libraries/stdlib/wasm/src/org.w3c/org.w3c.fetch.kt @@ -104,7 +104,7 @@ public external interface RequestInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun RequestInit(method: String? = undefined, headers: Dynamic? = undefined, body: Dynamic? = undefined, referrer: String? = undefined, referrerPolicy: Dynamic? = undefined, mode: RequestMode? = undefined, credentials: RequestCredentials? = undefined, cache: RequestCache? = undefined, redirect: RequestRedirect? = undefined, integrity: String? = undefined, keepalive: Boolean? = undefined, window: Any? = undefined): RequestInit { - val o = js("({})") + val o = newJsObject() o["method"] = method o["headers"] = headers o["body"] = body @@ -163,7 +163,7 @@ public external interface ResponseInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun ResponseInit(status: Short? = 200, statusText: String? = "OK", headers: Dynamic? = undefined): ResponseInit { - val o = js("({})") + val o = newJsObject() o["status"] = status o["statusText"] = statusText o["headers"] = headers diff --git a/libraries/stdlib/wasm/src/org.w3c/org.w3c.files.kt b/libraries/stdlib/wasm/src/org.w3c/org.w3c.files.kt index beedffef9e2..f14e25cdb7a 100644 --- a/libraries/stdlib/wasm/src/org.w3c/org.w3c.files.kt +++ b/libraries/stdlib/wasm/src/org.w3c/org.w3c.files.kt @@ -34,7 +34,7 @@ public external interface BlobPropertyBag { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun BlobPropertyBag(type: String? = ""): BlobPropertyBag { - val o = js("({})") + val o = newJsObject() o["type"] = type @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE") return o as BlobPropertyBag @@ -57,7 +57,7 @@ public external interface FilePropertyBag : BlobPropertyBag { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun FilePropertyBag(lastModified: Int? = undefined, type: String? = ""): FilePropertyBag { - val o = js("({})") + val o = newJsObject() o["lastModified"] = lastModified o["type"] = type @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE") diff --git a/libraries/stdlib/wasm/src/org.w3c/org.w3c.notifications.kt b/libraries/stdlib/wasm/src/org.w3c/org.w3c.notifications.kt index c53ebfb6212..dc235ba0e1a 100644 --- a/libraries/stdlib/wasm/src/org.w3c/org.w3c.notifications.kt +++ b/libraries/stdlib/wasm/src/org.w3c/org.w3c.notifications.kt @@ -103,7 +103,7 @@ public external interface NotificationOptions { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun NotificationOptions(dir: NotificationDirection? = NotificationDirection.AUTO, lang: String? = "", body: String? = "", tag: String? = "", image: String? = undefined, icon: String? = undefined, badge: String? = undefined, sound: String? = undefined, vibrate: Dynamic? = undefined, timestamp: Number? = undefined, renotify: Boolean? = false, silent: Boolean? = false, noscreen: Boolean? = false, requireInteraction: Boolean? = false, sticky: Boolean? = false, data: Any? = null, actions: Array? = arrayOf()): NotificationOptions { - val o = js("({})") + val o = newJsObject() o["dir"] = dir o["lang"] = lang o["body"] = body @@ -136,7 +136,7 @@ public external interface NotificationAction { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun NotificationAction(action: String?, title: String?, icon: String? = undefined): NotificationAction { - val o = js("({})") + val o = newJsObject() o["action"] = action o["title"] = title o["icon"] = icon @@ -153,7 +153,7 @@ public external interface GetNotificationOptions { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun GetNotificationOptions(tag: String? = ""): GetNotificationOptions { - val o = js("({})") + val o = newJsObject() o["tag"] = tag @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE") return o as GetNotificationOptions @@ -184,7 +184,7 @@ public external interface NotificationEventInit : ExtendableEventInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun NotificationEventInit(notification: Notification?, action: String? = "", bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): NotificationEventInit { - val o = js("({})") + val o = newJsObject() o["notification"] = notification o["action"] = action o["bubbles"] = bubbles diff --git a/libraries/stdlib/wasm/src/org.w3c/org.w3c.workers.kt b/libraries/stdlib/wasm/src/org.w3c/org.w3c.workers.kt index 94bae068a9b..853bcc26ceb 100644 --- a/libraries/stdlib/wasm/src/org.w3c/org.w3c.workers.kt +++ b/libraries/stdlib/wasm/src/org.w3c/org.w3c.workers.kt @@ -68,7 +68,7 @@ public external interface RegistrationOptions { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun RegistrationOptions(scope: String? = undefined, type: WorkerType? = WorkerType.CLASSIC): RegistrationOptions { - val o = js("({})") + val o = newJsObject() o["scope"] = scope o["type"] = type @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE") @@ -114,7 +114,7 @@ public external interface ServiceWorkerMessageEventInit : EventInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun ServiceWorkerMessageEventInit(data: Any? = undefined, origin: String? = undefined, lastEventId: String? = undefined, source: UnionMessagePortOrServiceWorker? = undefined, ports: Array? = undefined, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ServiceWorkerMessageEventInit { - val o = js("({})") + val o = newJsObject() o["data"] = data o["origin"] = origin o["lastEventId"] = lastEventId @@ -186,7 +186,7 @@ public external interface ClientQueryOptions { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun ClientQueryOptions(includeUncontrolled: Boolean? = false, type: ClientType? = ClientType.WINDOW): ClientQueryOptions { - val o = js("({})") + val o = newJsObject() o["includeUncontrolled"] = includeUncontrolled o["type"] = type @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE") @@ -212,7 +212,7 @@ public external interface ExtendableEventInit : EventInit @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun ExtendableEventInit(bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ExtendableEventInit { - val o = js("({})") + val o = newJsObject() o["bubbles"] = bubbles o["cancelable"] = cancelable o["composed"] = composed @@ -242,7 +242,7 @@ public external interface ForeignFetchOptions { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun ForeignFetchOptions(scopes: Array?, origins: Array?): ForeignFetchOptions { - val o = js("({})") + val o = newJsObject() o["scopes"] = scopes o["origins"] = origins @Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE") @@ -279,7 +279,7 @@ public external interface FetchEventInit : ExtendableEventInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun FetchEventInit(request: Request?, clientId: String? = null, isReload: Boolean? = false, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): FetchEventInit { - val o = js("({})") + val o = newJsObject() o["request"] = request o["clientId"] = clientId o["isReload"] = isReload @@ -313,7 +313,7 @@ public external interface ForeignFetchEventInit : ExtendableEventInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun ForeignFetchEventInit(request: Request?, origin: String? = "null", bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ForeignFetchEventInit { - val o = js("({})") + val o = newJsObject() o["request"] = request o["origin"] = origin o["bubbles"] = bubbles @@ -336,7 +336,7 @@ public external interface ForeignFetchResponse { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun ForeignFetchResponse(response: Response?, origin: String? = undefined, headers: Array? = undefined): ForeignFetchResponse { - val o = js("({})") + val o = newJsObject() o["response"] = response o["origin"] = origin o["headers"] = headers @@ -383,7 +383,7 @@ public external interface ExtendableMessageEventInit : ExtendableEventInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun ExtendableMessageEventInit(data: Any? = undefined, origin: String? = undefined, lastEventId: String? = undefined, source: UnionClientOrMessagePortOrServiceWorker? = undefined, ports: Array? = undefined, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ExtendableMessageEventInit { - val o = js("({})") + val o = newJsObject() o["data"] = data o["origin"] = origin o["lastEventId"] = lastEventId @@ -427,7 +427,7 @@ public external interface CacheQueryOptions { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun CacheQueryOptions(ignoreSearch: Boolean? = false, ignoreMethod: Boolean? = false, ignoreVary: Boolean? = false, cacheName: String? = undefined): CacheQueryOptions { - val o = js("({})") + val o = newJsObject() o["ignoreSearch"] = ignoreSearch o["ignoreMethod"] = ignoreMethod o["ignoreVary"] = ignoreVary @@ -454,7 +454,7 @@ public external interface CacheBatchOperation { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun CacheBatchOperation(type: String? = undefined, request: Request? = undefined, response: Response? = undefined, options: CacheQueryOptions? = undefined): CacheBatchOperation { - val o = js("({})") + val o = newJsObject() o["type"] = type o["request"] = request o["response"] = response diff --git a/libraries/stdlib/wasm/src/org.w3c/org.w3c.xhr.kt b/libraries/stdlib/wasm/src/org.w3c/org.w3c.xhr.kt index ff8b0bfacd8..0ce2e4d605a 100644 --- a/libraries/stdlib/wasm/src/org.w3c/org.w3c.xhr.kt +++ b/libraries/stdlib/wasm/src/org.w3c/org.w3c.xhr.kt @@ -108,7 +108,7 @@ public external interface ProgressEventInit : EventInit { @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.InlineOnly public inline fun ProgressEventInit(lengthComputable: Boolean? = false, loaded: Number? = 0, total: Number? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ProgressEventInit { - val o = js("({})") + val o = newJsObject() o["lengthComputable"] = lengthComputable o["loaded"] = loaded o["total"] = total diff --git a/libraries/tools/dukat/src/main/kotlin/org/jetbrains/kotlin/tools/dukat/launchWasm.kt b/libraries/tools/dukat/src/main/kotlin/org/jetbrains/kotlin/tools/dukat/launchWasm.kt index aac3187d269..9cbc943b5dc 100644 --- a/libraries/tools/dukat/src/main/kotlin/org/jetbrains/kotlin/tools/dukat/launchWasm.kt +++ b/libraries/tools/dukat/src/main/kotlin/org/jetbrains/kotlin/tools/dukat/launchWasm.kt @@ -22,10 +22,12 @@ fun main() { } } +// TODO: Backport to dukat fun postProcessIdlBindings(source: String): String { return source .replace( Regex("( {4}return o as \\w+)"), " @Suppress(\"UNCHECKED_CAST_TO_EXTERNAL_INTERFACE\")\n\$1" ) + .replace("js(\"({})\")", "newJsObject()") } \ No newline at end of file