mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Treat undefined arguments in JS as missing
This commit is contained in:
parent
d6708a2fea
commit
db92a8b030
15 changed files with 8 additions and 62 deletions
|
@ -1142,7 +1142,6 @@ class CGArgumentConverter(CGThing):
|
||||||
"argc": argc,
|
"argc": argc,
|
||||||
"args": args
|
"args": args
|
||||||
}
|
}
|
||||||
condition = string.Template("${index} < ${argc}").substitute(replacer)
|
|
||||||
|
|
||||||
replacementVariables = {
|
replacementVariables = {
|
||||||
"val": string.Template("${args}.get(${index})").substitute(replacer),
|
"val": string.Template("${args}.get(${index})").substitute(replacer),
|
||||||
|
@ -1164,17 +1163,18 @@ class CGArgumentConverter(CGThing):
|
||||||
|
|
||||||
if not argument.variadic:
|
if not argument.variadic:
|
||||||
if argument.optional:
|
if argument.optional:
|
||||||
|
condition = "{args}.get({index}).is_undefined()".format(**replacer)
|
||||||
if argument.defaultValue:
|
if argument.defaultValue:
|
||||||
assert default
|
assert default
|
||||||
template = CGIfElseWrapper(condition,
|
template = CGIfElseWrapper(condition,
|
||||||
CGGeneric(template),
|
CGGeneric(default),
|
||||||
CGGeneric(default)).define()
|
CGGeneric(template)).define()
|
||||||
else:
|
else:
|
||||||
assert not default
|
assert not default
|
||||||
declType = CGWrapper(declType, pre="Option<", post=">")
|
declType = CGWrapper(declType, pre="Option<", post=">")
|
||||||
template = CGIfElseWrapper(condition,
|
template = CGIfElseWrapper(condition,
|
||||||
CGGeneric("Some(%s)" % template),
|
CGGeneric("None"),
|
||||||
CGGeneric("None")).define()
|
CGGeneric("Some(%s)" % template)).define()
|
||||||
else:
|
else:
|
||||||
assert not default
|
assert not default
|
||||||
|
|
||||||
|
|
2
components/servo/Cargo.lock
generated
2
components/servo/Cargo.lock
generated
|
@ -878,7 +878,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "js"
|
name = "js"
|
||||||
version = "0.1.1"
|
version = "0.1.1"
|
||||||
source = "git+https://github.com/servo/rust-mozjs#6bfe259e0adc51ceabeb95d3af87d9041d16a767"
|
source = "git+https://github.com/servo/rust-mozjs#07523d8b3dd12276eb94a266e83c0b1d77aa4160"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heapsize 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"heapsize 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
2
ports/cef/Cargo.lock
generated
2
ports/cef/Cargo.lock
generated
|
@ -838,7 +838,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "js"
|
name = "js"
|
||||||
version = "0.1.1"
|
version = "0.1.1"
|
||||||
source = "git+https://github.com/servo/rust-mozjs#6bfe259e0adc51ceabeb95d3af87d9041d16a767"
|
source = "git+https://github.com/servo/rust-mozjs#07523d8b3dd12276eb94a266e83c0b1d77aa4160"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heapsize 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"heapsize 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
2
ports/gonk/Cargo.lock
generated
2
ports/gonk/Cargo.lock
generated
|
@ -814,7 +814,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "js"
|
name = "js"
|
||||||
version = "0.1.1"
|
version = "0.1.1"
|
||||||
source = "git+https://github.com/servo/rust-mozjs#6bfe259e0adc51ceabeb95d3af87d9041d16a767"
|
source = "git+https://github.com/servo/rust-mozjs#07523d8b3dd12276eb94a266e83c0b1d77aa4160"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heapsize 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"heapsize 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
|
@ -24,9 +24,6 @@
|
||||||
[testConstructorDictionary5]
|
[testConstructorDictionary5]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[testConstructor2undefined]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[testConstructorDictionary2irregular]
|
[testConstructorDictionary2irregular]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
[DOMRect-001.htm]
|
|
||||||
type: testharness
|
|
||||||
[testConstructorUndefined1]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[testConstructorIllegal1]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[testConstructorIllegal2]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[testReadOnlyConstructorUndefined1]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
[Comment-constructor.html]
|
[Comment-constructor.html]
|
||||||
type: testharness
|
type: testharness
|
||||||
[new Comment(): undefined]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[new Comment() should get the correct ownerDocument across globals]
|
[new Comment() should get the correct ownerDocument across globals]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,6 @@
|
||||||
[createHTMLDocument(): URL parsing]
|
[createHTMLDocument(): URL parsing]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[createHTMLDocument test 2: undefined,undefined,""]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[createHTMLDocument(): characterSet aliases]
|
[createHTMLDocument(): characterSet aliases]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
[Text-constructor.html]
|
[Text-constructor.html]
|
||||||
type: testharness
|
type: testharness
|
||||||
[new Text(): undefined]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[new Text() should get the correct ownerDocument across globals]
|
[new Text() should get the correct ownerDocument across globals]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
[NodeIterator.html]
|
|
||||||
type: testharness
|
|
||||||
[createNodeIterator() with undefined as arguments]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
[TreeWalker-basic.html]
|
|
||||||
type: testharness
|
|
||||||
[Construct a TreeWalker by document.createTreeWalker(root, undefined, undefined).]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
[api-basics.html]
|
[api-basics.html]
|
||||||
type: testharness
|
type: testharness
|
||||||
[Default inputs]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Encode/decode round trip: utf-8]
|
[Encode/decode round trip: utf-8]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
[document.title-07.html]
|
|
||||||
type: testharness
|
|
||||||
[createHTMLDocument test 2: undefined,undefined,""]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
[Close-undefined.htm]
|
|
||||||
type: testharness
|
|
||||||
[W3C WebSocket API - Close WebSocket - Code is undefined]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
[Secure-Close-undefined.htm]
|
|
||||||
type: testharness
|
|
||||||
[W3C WebSocket API - Close Secure WebSocket - Code is undefined]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue