Skip to content

Update to latest JavaScriptKit #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Dec 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Example/WebIDL-files/CommonDefinitions.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ typedef unsigned long long DOMTimeStamp;

callback Function = any (any... arguments);

callback VoidFunction = void ();
callback VoidFunction = undefined ();
4 changes: 2 additions & 2 deletions Example/WebIDL-files/DOMStringMap.webidl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

interface DOMStringMap {
getter DOMString (DOMString name);
[CEReactions] setter void (DOMString name, DOMString value);
[CEReactions] deleter void (DOMString name);
[CEReactions] setter undefined (DOMString name, DOMString value);
[CEReactions] deleter undefined (DOMString name);
};
12 changes: 6 additions & 6 deletions Example/WebIDL-files/FileAPI.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ interface FileList {
interface FileReader: EventTarget {
constructor();
// async read methods
void readAsArrayBuffer(Blob blob);
void readAsBinaryString(Blob blob);
void readAsText(Blob blob, optional DOMString encoding);
void readAsDataURL(Blob blob);
undefined readAsArrayBuffer(Blob blob);
undefined readAsBinaryString(Blob blob);
undefined readAsText(Blob blob, optional DOMString encoding);
undefined readAsDataURL(Blob blob);

void abort();
undefined abort();

// states
const unsigned short EMPTY = 0;
Expand Down Expand Up @@ -91,5 +91,5 @@ interface FileReaderSync {
[Exposed=(Window,DedicatedWorker,SharedWorker)]
partial interface URL {
static DOMString createObjectURL((Blob or MediaSource) obj);
static void revokeObjectURL(DOMString url);
static undefined revokeObjectURL(DOMString url);
};
10 changes: 5 additions & 5 deletions Example/WebIDL-files/FormData.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ typedef (File or USVString) FormDataEntryValue;
interface FormData {
constructor(optional HTMLFormElement form);

void append(USVString name, USVString value);
void append(USVString name, Blob blobValue, optional USVString filename);
void delete(USVString name);
undefined append(USVString name, USVString value);
undefined append(USVString name, Blob blobValue, optional USVString filename);
undefined delete(USVString name);
FormDataEntryValue? get(USVString name);
sequence<FormDataEntryValue> getAll(USVString name);
boolean has(USVString name);
void set(USVString name, USVString value);
void set(USVString name, Blob blobValue, optional USVString filename);
undefined set(USVString name, USVString value);
undefined set(USVString name, Blob blobValue, optional USVString filename);
iterable<USVString, FormDataEntryValue>;
};
12 changes: 6 additions & 6 deletions Example/WebIDL-files/HTMLFormElement.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ interface HTMLFormElement : HTMLElement {
getter Element (unsigned long index);
getter (RadioNodeList or Element) (DOMString name);

void submit();
void requestSubmit(optional HTMLElement? submitter = null);
[CEReactions] void reset();
undefined submit();
undefined requestSubmit(optional HTMLElement? submitter = null);
[CEReactions] undefined reset();
boolean checkValidity();
boolean reportValidity();
};
Expand All @@ -41,7 +41,7 @@ interface HTMLElement : Element {

// user interaction
[CEReactions] attribute boolean hidden;
void click();
undefined click();
[CEReactions] attribute DOMString accessKey;
readonly attribute DOMString accessKeyLabel;
[CEReactions] attribute boolean draggable;
Expand Down Expand Up @@ -76,12 +76,12 @@ interface RadioNodeList : NodeList {
interface ElementInternals {
// Form-associated custom elements

void setFormValue((File or USVString or FormData)? value,
undefined setFormValue((File or USVString or FormData)? value,
optional (File or USVString or FormData)? state);

readonly attribute HTMLFormElement? form;

void setValidity(ValidityStateFlags flags,
undefined setValidity(ValidityStateFlags flags,
optional DOMString message,
optional HTMLElement anchor);
readonly attribute boolean willValidate;
Expand Down
4 changes: 2 additions & 2 deletions Example/WebIDL-files/HTMLOrSVGElement.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ interface mixin HTMLOrSVGElement {

[CEReactions] attribute boolean autofocus;
[CEReactions] attribute long tabIndex;
void focus(optional FocusOptions options = {});
void blur();
undefined focus(optional FocusOptions options = {});
undefined blur();
};

dictionary FocusOptions {
Expand Down
38 changes: 19 additions & 19 deletions Example/WebIDL-files/console.webidl
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
[Exposed=(Window,Worker,Worklet)]
namespace console { // but see namespace object requirements below
// Logging
void assert(optional boolean condition = false, any... data);
void clear();
void debug(any... data);
void error(any... data);
void info(any... data);
void log(any... data);
void table(optional any tabularData, optional sequence<DOMString> properties);
void trace(any... data);
void warn(any... data);
void dir(optional any item, optional object? options);
void dirxml(any... data);
undefined assert(optional boolean condition = false, any... data);
undefined clear();
undefined debug(any... data);
undefined error(any... data);
undefined info(any... data);
undefined log(any... data);
undefined table(optional any tabularData, optional sequence<DOMString> properties);
undefined trace(any... data);
undefined warn(any... data);
undefined dir(optional any item, optional object? options);
undefined dirxml(any... data);

// Counting
void count(optional DOMString label = "default");
void countReset(optional DOMString label = "default");
undefined count(optional DOMString label = "default");
undefined countReset(optional DOMString label = "default");

// Grouping
void group(any... data);
void groupCollapsed(any... data);
void groupEnd();
undefined group(any... data);
undefined groupCollapsed(any... data);
undefined groupEnd();

// Timing
void time(optional DOMString label = "default");
void timeLog(optional DOMString label = "default", any... data);
void timeEnd(optional DOMString label = "default");
undefined time(optional DOMString label = "default");
undefined timeLog(optional DOMString label = "default", any... data);
undefined timeEnd(optional DOMString label = "default");
};
88 changes: 44 additions & 44 deletions Example/WebIDL-files/dom.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ interface Event {
const unsigned short BUBBLING_PHASE = 3;
readonly attribute unsigned short eventPhase;

void stopPropagation();
undefined stopPropagation();
attribute boolean cancelBubble; // historical alias of .stopPropagation
void stopImmediatePropagation();
undefined stopImmediatePropagation();

readonly attribute boolean bubbles;
readonly attribute boolean cancelable;
attribute boolean returnValue; // historical
void preventDefault();
undefined preventDefault();
readonly attribute boolean defaultPrevented;
readonly attribute boolean composed;

[Unforgeable] readonly attribute boolean isTrusted;
readonly attribute DOMHighResTimeStamp timeStamp;

void initEvent(DOMString type, optional boolean bubbles = false, optional boolean cancelable = false); // historical
undefined initEvent(DOMString type, optional boolean bubbles = false, optional boolean cancelable = false); // historical
};

dictionary EventInit {
Expand All @@ -47,7 +47,7 @@ interface CustomEvent : Event {

readonly attribute any detail;

void initCustomEvent(DOMString type, optional boolean bubbles = false, optional boolean cancelable = false, optional any detail = null); // historical
undefined initCustomEvent(DOMString type, optional boolean bubbles = false, optional boolean cancelable = false, optional any detail = null); // historical
};

dictionary CustomEventInit : EventInit {
Expand All @@ -58,13 +58,13 @@ dictionary CustomEventInit : EventInit {
interface EventTarget {
constructor();

void addEventListener(DOMString type, EventListener? callback, optional (AddEventListenerOptions or boolean) options = {});
void removeEventListener(DOMString type, EventListener? callback, optional (EventListenerOptions or boolean) options = {});
undefined addEventListener(DOMString type, EventListener? callback, optional (AddEventListenerOptions or boolean) options = {});
undefined removeEventListener(DOMString type, EventListener? callback, optional (EventListenerOptions or boolean) options = {});
boolean dispatchEvent(Event event);
};

callback interface EventListener {
void handleEvent(Event event);
undefined handleEvent(Event event);
};

dictionary EventListenerOptions {
Expand All @@ -82,7 +82,7 @@ interface AbortController {

[SameObject] readonly attribute AbortSignal signal;

void abort();
undefined abort();
};

[Exposed=(Window,Worker)]
Expand All @@ -108,8 +108,8 @@ interface mixin ParentNode {
readonly attribute Element? lastElementChild;
readonly attribute unsigned long childElementCount;

[CEReactions, Unscopable] void prepend((Node or DOMString)... nodes);
[CEReactions, Unscopable] void append((Node or DOMString)... nodes);
[CEReactions, Unscopable] undefined prepend((Node or DOMString)... nodes);
[CEReactions, Unscopable] undefined append((Node or DOMString)... nodes);

Element? querySelector(DOMString selectors);
[NewObject] NodeList querySelectorAll(DOMString selectors);
Expand All @@ -126,10 +126,10 @@ Element includes NonDocumentTypeChildNode;
CharacterData includes NonDocumentTypeChildNode;

interface mixin ChildNode {
[CEReactions, Unscopable] void before((Node or DOMString)... nodes);
[CEReactions, Unscopable] void after((Node or DOMString)... nodes);
[CEReactions, Unscopable] void replaceWith((Node or DOMString)... nodes);
[CEReactions, Unscopable] void remove();
[CEReactions, Unscopable] undefined before((Node or DOMString)... nodes);
[CEReactions, Unscopable] undefined after((Node or DOMString)... nodes);
[CEReactions, Unscopable] undefined replaceWith((Node or DOMString)... nodes);
[CEReactions, Unscopable] undefined remove();
};
DocumentType includes ChildNode;
Element includes ChildNode;
Expand Down Expand Up @@ -159,12 +159,12 @@ interface HTMLCollection {
interface MutationObserver {
constructor(MutationCallback callback);

void observe(Node target, optional MutationObserverInit options = {});
void disconnect();
undefined observe(Node target, optional MutationObserverInit options = {});
undefined disconnect();
sequence<MutationRecord> takeRecords();
};

callback MutationCallback = void (sequence<MutationRecord> mutations, MutationObserver observer);
callback MutationCallback = undefined (sequence<MutationRecord> mutations, MutationObserver observer);

dictionary MutationObserverInit {
boolean childList = false;
Expand Down Expand Up @@ -222,7 +222,7 @@ interface Node : EventTarget {

[CEReactions] attribute DOMString? nodeValue;
[CEReactions] attribute DOMString? textContent;
[CEReactions] void normalize();
[CEReactions] undefined normalize();

[CEReactions, NewObject] Node cloneNode(optional boolean deep = false);
boolean isEqualNode(Node? otherNode);
Expand Down Expand Up @@ -347,10 +347,10 @@ interface Element : Node {
sequence<DOMString> getAttributeNames();
DOMString? getAttribute(DOMString qualifiedName);
DOMString? getAttributeNS(DOMString? namespace, DOMString localName);
[CEReactions] void setAttribute(DOMString qualifiedName, DOMString value);
[CEReactions] void setAttributeNS(DOMString? namespace, DOMString qualifiedName, DOMString value);
[CEReactions] void removeAttribute(DOMString qualifiedName);
[CEReactions] void removeAttributeNS(DOMString? namespace, DOMString localName);
[CEReactions] undefined setAttribute(DOMString qualifiedName, DOMString value);
[CEReactions] undefined setAttributeNS(DOMString? namespace, DOMString qualifiedName, DOMString value);
[CEReactions] undefined removeAttribute(DOMString qualifiedName);
[CEReactions] undefined removeAttributeNS(DOMString? namespace, DOMString localName);
[CEReactions] boolean toggleAttribute(DOMString qualifiedName, optional boolean force);
boolean hasAttribute(DOMString qualifiedName);
boolean hasAttributeNS(DOMString? namespace, DOMString localName);
Expand All @@ -373,7 +373,7 @@ interface Element : Node {
HTMLCollection getElementsByClassName(DOMString classNames);

[CEReactions] Element? insertAdjacentElement(DOMString where, Element element); // historical
void insertAdjacentText(DOMString where, DOMString data); // historical
undefined insertAdjacentText(DOMString where, DOMString data); // historical
};

dictionary ShadowRootInit {
Expand Down Expand Up @@ -411,10 +411,10 @@ interface CharacterData : Node {
attribute [TreatNullAs=EmptyString] DOMString data;
readonly attribute unsigned long length;
DOMString substringData(unsigned long offset, unsigned long count);
void appendData(DOMString data);
void insertData(unsigned long offset, DOMString data);
void deleteData(unsigned long offset, unsigned long count);
void replaceData(unsigned long offset, unsigned long count, DOMString data);
undefined appendData(DOMString data);
undefined insertData(unsigned long offset, DOMString data);
undefined deleteData(unsigned long offset, unsigned long count);
undefined replaceData(unsigned long offset, unsigned long count, DOMString data);
};

[Exposed=Window]
Expand Down Expand Up @@ -464,30 +464,30 @@ interface Range : AbstractRange {

readonly attribute Node commonAncestorContainer;

void setStart(Node node, unsigned long offset);
void setEnd(Node node, unsigned long offset);
void setStartBefore(Node node);
void setStartAfter(Node node);
void setEndBefore(Node node);
void setEndAfter(Node node);
void collapse(optional boolean toStart = false);
void selectNode(Node node);
void selectNodeContents(Node node);
undefined setStart(Node node, unsigned long offset);
undefined setEnd(Node node, unsigned long offset);
undefined setStartBefore(Node node);
undefined setStartAfter(Node node);
undefined setEndBefore(Node node);
undefined setEndAfter(Node node);
undefined collapse(optional boolean toStart = false);
undefined selectNode(Node node);
undefined selectNodeContents(Node node);

const unsigned short START_TO_START = 0;
const unsigned short START_TO_END = 1;
const unsigned short END_TO_END = 2;
const unsigned short END_TO_START = 3;
short compareBoundaryPoints(unsigned short how, Range sourceRange);

[CEReactions] void deleteContents();
[CEReactions] undefined deleteContents();
[CEReactions, NewObject] DocumentFragment extractContents();
[CEReactions, NewObject] DocumentFragment cloneContents();
[CEReactions] void insertNode(Node node);
[CEReactions] void surroundContents(Node newParent);
[CEReactions] undefined insertNode(Node node);
[CEReactions] undefined surroundContents(Node newParent);

[NewObject] Range cloneRange();
void detach();
undefined detach();

boolean isPointInRange(Node node, unsigned long offset);
short comparePoint(Node node, unsigned long offset);
Expand All @@ -508,7 +508,7 @@ interface NodeIterator {
Node? nextNode();
Node? previousNode();

void detach();
undefined detach();
};

[Exposed=Window]
Expand Down Expand Up @@ -556,8 +556,8 @@ interface DOMTokenList {
readonly attribute unsigned long length;
getter DOMString? item(unsigned long index);
boolean contains(DOMString token);
[CEReactions] void add(DOMString... tokens);
[CEReactions] void remove(DOMString... tokens);
[CEReactions] undefined add(DOMString... tokens);
[CEReactions] undefined remove(DOMString... tokens);
[CEReactions] boolean toggle(DOMString token, optional boolean force);
[CEReactions] boolean replace(DOMString token, DOMString newToken);
boolean supports(DOMString token);
Expand Down
3 changes: 1 addition & 2 deletions Sources/Commands/GenerateCode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public struct GenerateCode: ParsableCommand {

guard undefinedTypes.isEmpty else {
print("Error: The following types are undefined:")
print(undefinedTypes.map { "\t- \($0.0)" }.joined(separator: "\n"))
print(undefinedTypes.map { "\t- \($0.0)" }.sorted().joined(separator: "\n"))
Self.exit(withError: ExitCode.failure)
}

Expand All @@ -85,7 +85,6 @@ public struct GenerateCode: ParsableCommand {
*/

import JavaScriptKit
import ECMAScript


"""
Expand Down
Loading