-
Notifications
You must be signed in to change notification settings - Fork 223
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
Generate Firefox Desktop front-end bindings with WebIDL #255
Merged
Merged
Changes from 17 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
6fc2f8a
Initial work on Gecko bindings.
linabutler 71eb8a0
Implement remaining C++ type conversions.
linabutler 7de9d33
Nightly check-in. Getting closer to a working demo!
linabutler 9a37750
More comments and TODOs.
linabutler 33a4805
Remove `cargo_metadata` and make other versions match m-c's.
linabutler f7ce674
Add more templates for Gecko.
linabutler 1cf040d
Stubs for remaining bindings; Rondpoint compiles on Desktop now!
linabutler d518345
Fix sequence serializer; implement record serializer.
linabutler 5d21dfb
🔥🗑
linabutler 3c2d813
Add remaining Desktop pieces.
linabutler 1c4ed47
It works!
linabutler d717469
More dependency shenanigans.
linabutler ba37996
`must_use` annotations; `CheckedInt` for `Size`.
linabutler e9bdbd3
Clean up FFI macros, remove implicit `[Throws]` for methods.
linabutler 9d21a53
Better docs about what we generate.
linabutler 855f440
Refactor WebIDL argument and return type generation.
linabutler e309d46
More docs for the new WebIDL types module.
linabutler ab872d1
Merge branch 'main' into gecko
linabutler ed8c01f
Clean up and address remaining review feedback.
linabutler ef73a60
Merge branch 'main' into gecko
linabutler 8ed57bf
Restore `Cargo.toml`.
linabutler 0912308
Replace remaining `MOZ_MUST_USE` with `[[nodiscard]]`.
linabutler c9ecca7
Comment cleanups, undefine primitive macro, use signed everywhere.
linabutler f6c7113
Fixes #301 cargo tests by updating and reenabling cargo_metadata (#301)
dmose c04dd99
Merge pull request #302 from dmose/cargo-test-gekco-fail
linabutler cafcb95
Finish the fix for #301
dmose b66630c
Merge pull request #303 from dmose/cargo-test-fix-part-2
linabutler d0d4e74
Pass a `Context` struct to Gecko JS filters.
linabutler 8d141fd
Move the Rondpoint tests into `gecko_js`.
linabutler d283aa0
Fix remaining review comments.
linabutler 2ca3547
Fix remaining `RustError` declaration.
linabutler 3461092
Pass the context to all remaining filters.
linabutler b90b465
Port remaining Rondpoint tests.
linabutler 80def1f
Fix serialization of nullable strings.
linabutler File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
add_task(async function test_rondpoint() { | ||
linabutler marked this conversation as resolved.
Show resolved
Hide resolved
|
||
deepEqual( | ||
Rondpoint.copieDictionnaire({ | ||
un: "deux", | ||
deux: false, | ||
petitNombre: 0, | ||
grosNombre: 123456789, | ||
}), | ||
{ | ||
un: "deux", | ||
deux: false, | ||
petitNombre: 0, | ||
grosNombre: 123456789, | ||
} | ||
); | ||
equal(Rondpoint.copieEnumeration("deux"), "deux"); | ||
deepEqual(Rondpoint.copieEnumerations(["un", "deux"]), ["un", "deux"]); | ||
deepEqual( | ||
Rondpoint.copieCarte({ | ||
1: "un", | ||
2: "deux", | ||
}), | ||
{ | ||
1: "un", | ||
2: "deux", | ||
} | ||
); | ||
ok(Rondpoint.switcheroo(false)); | ||
}); | ||
|
||
add_task(async function test_retourneur() { | ||
let rt = new Retourneur(); | ||
|
||
// Booleans. | ||
[true, false].forEach(v => strictEqual(rt.identiqueBoolean(v), v)); | ||
|
||
// Bytes. | ||
[-128, 127].forEach(v => equal(rt.identiqueI8(v), v)); | ||
[0x00, 0xff].forEach(v => equal(rt.identiqueU8(v), v)); | ||
|
||
// Shorts. | ||
[-Math.pow(2, 15), Math.pow(2, 15) - 1].forEach(v => | ||
equal(rt.identiqueI16(v), v) | ||
); | ||
[0, 0xffff].forEach(v => equal(rt.identiqueU16(v), v)); | ||
|
||
// Ints. | ||
[0, 1, -1, -Math.pow(2, 31), Math.pow(2, 31) - 1].forEach(v => | ||
equal(rt.identiqueI32(v), v) | ||
); | ||
[0, Math.pow(2, 32) - 1].forEach(v => equal(rt.identiqueU32(v), v)); | ||
|
||
// Longs. | ||
[0, 1, -1, Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER].forEach(v => | ||
equal(rt.identiqueI64(v), v) | ||
); | ||
[0, 1, Number.MAX_SAFE_INTEGER].forEach(v => equal(rt.identiqueU64(v), v)); | ||
|
||
// Floats. | ||
[0, 1, 0.25].forEach(v => equal(rt.identiqueFloat(v), v)); | ||
|
||
// Doubles. | ||
[0, 1, 0.25].forEach(v => equal(rt.identiqueDouble(v), v)); | ||
|
||
// Strings. | ||
[ | ||
"", | ||
"abc", | ||
linabutler marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"été", | ||
"ښي لاس ته لوستلو لوستل", | ||
"😻emoji 👨👧👦multi-emoji, 🇨🇭a flag, a canal, panama", | ||
].forEach(v => equal(rt.identiqueString(v), v)); | ||
}); | ||
|
||
add_task(async function test_stringifier() { | ||
let st = new Stringifier(); | ||
|
||
let wellKnown = st.wellKnownString("firefox"); | ||
equal(wellKnown, "uniffi 💚 firefox!"); | ||
|
||
let table = { | ||
toStringBoolean: [ | ||
[true, "true"], | ||
[false, "false"], | ||
], | ||
toStringI8: [ | ||
[-128, "-128"], | ||
[127, "127"], | ||
], | ||
toStringU8: [ | ||
[0x00, "0"], | ||
[0xff, "255"], | ||
], | ||
toStringI16: [ | ||
[-Math.pow(2, 15), "-32768"], | ||
[Math.pow(2, 15) - 1, "32767"], | ||
], | ||
toStringU16: [ | ||
[0, "0"], | ||
[0xffff, "65535"], | ||
], | ||
toStringI32: [ | ||
[0, "0"], | ||
[1, "1"], | ||
[-1, "-1"], | ||
[-Math.pow(2, 31), "-2147483648"], | ||
[Math.pow(2, 31) - 1, "2147483647"], | ||
], | ||
toStringU32: [ | ||
[0, "0"], | ||
[Math.pow(2, 32) - 1, "4294967295"], | ||
], | ||
toStringI64: [ | ||
[0, "0"], | ||
[1, "1"], | ||
[-1, "-1"], | ||
[Number.MIN_SAFE_INTEGER, "-9007199254740991"], | ||
[Number.MAX_SAFE_INTEGER, "9007199254740991"], | ||
], | ||
toStringU64: [ | ||
[0, "0"], | ||
[1, "1"], | ||
[Number.MAX_SAFE_INTEGER, "9007199254740991"], | ||
], | ||
toStringFloat: [ | ||
[0, "0"], | ||
[1, "1"], | ||
[0.25, "0.25"], | ||
], | ||
toStringDouble: [ | ||
[0, "0"], | ||
[1, "1"], | ||
[0.25, "0.25"], | ||
], | ||
}; | ||
for (let method in table) { | ||
for (let [v, expected] of table[method]) { | ||
strictEqual(st[method](v), expected); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[test_rondpoint.js] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't believe this is real 🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is
add_task
? I can see it used in this file, but I can't see it anywhere else.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I imagine the idea is to run these tests using
mach xpcshell-test
somehow - no idea what process lina has in mind for having mach find them thoughThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, this file is an xpcshell test!
Haha, my workflow so far has been “symlink
rondpoint
into m-c and add it tomoz.build
with all the other stuff”, but that’s not going to fly for anything more than a demo. Still, if you want to take it for a spin locally, there are only 11 easy steps! 😆