aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2019-06-28 20:44:41 -0400
committerGitHub <noreply@github.com>2019-06-28 20:44:41 -0400
commit84786add227f2c0a675f4bcca708ac8a70011f6c (patch)
tree00546c477a7167a1aee9c4c4ac88e3cf4159cbdc
parent177b2a6fa9094ce725d50636abe76e8bd557c7dd (diff)
parent3c7ceff46d38d78971ca2d011d7c86a1835d787e (diff)
downloadservo-84786add227f2c0a675f4bcca708ac8a70011f6c.tar.gz
servo-84786add227f2c0a675f4bcca708ac8a70011f6c.zip
Auto merge of #23653 - Manishearth:nested, r=jdm
Improve support for nested dictionaries Fixes https://github.com/servo/servo/issues/23640 Some IDLs need `= null`, that's something that needs to be updated upstream too. After talking with @bzbarsky I realized that it was our IDLs which were incorrect, causing Options to appear where we don't want them to. In the media code we _do_ want Options. `= null` is the correct fix for that (and should be upstreamed). r? @jdm <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23653) <!-- Reviewable:end -->
-rw-r--r--components/script/dom/bindings/codegen/parser/WebIDL.py3
-rw-r--r--components/script/dom/bindings/codegen/parser/undo-dictionary-optional.patch12
-rwxr-xr-xcomponents/script/dom/bindings/codegen/parser/update.sh1
-rw-r--r--components/script/dom/mediadevices.rs10
-rw-r--r--components/script/dom/webidls/DOMQuad.webidl8
-rw-r--r--components/script/dom/webidls/TestBinding.webidl2
6 files changed, 12 insertions, 24 deletions
diff --git a/components/script/dom/bindings/codegen/parser/WebIDL.py b/components/script/dom/bindings/codegen/parser/WebIDL.py
index 31692bd1a2e..df88cf120dd 100644
--- a/components/script/dom/bindings/codegen/parser/WebIDL.py
+++ b/components/script/dom/bindings/codegen/parser/WebIDL.py
@@ -4611,7 +4611,8 @@ class IDLArgument(IDLObjectWithIdentifier):
if ((self.type.isDictionary() or
self.type.isUnion() and self.type.unroll().hasDictionaryType()) and
- self.optional and not self.defaultValue and not self.variadic):
+ self.optional and not self.defaultValue and not self.variadic and
+ not self.dictionaryMember):
# Default optional non-variadic dictionary arguments to null,
# for simplicity, so the codegen doesn't have to special-case this.
self.defaultValue = IDLNullValue(self.location)
diff --git a/components/script/dom/bindings/codegen/parser/undo-dictionary-optional.patch b/components/script/dom/bindings/codegen/parser/undo-dictionary-optional.patch
deleted file mode 100644
index b414a536415..00000000000
--- a/components/script/dom/bindings/codegen/parser/undo-dictionary-optional.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- WebIDL.py
-+++ WebIDL.py
-@@ -4570,8 +4570,7 @@ class IDLArgument(IDLObjectWithIdentifier):
-
- if ((self.type.isDictionary() or
- self.type.isUnion() and self.type.unroll().hasDictionaryType()) and
-- self.optional and not self.defaultValue and not self.variadic and
-- not self.dictionaryMember):
-+ self.optional and not self.defaultValue and not self.variadic):
- # Default optional non-variadic dictionary arguments to null,
- # for simplicity, so the codegen doesn't have to special-case this.
- self.defaultValue = IDLNullValue(self.location)
diff --git a/components/script/dom/bindings/codegen/parser/update.sh b/components/script/dom/bindings/codegen/parser/update.sh
index 0386b0294fe..213aba6df89 100755
--- a/components/script/dom/bindings/codegen/parser/update.sh
+++ b/components/script/dom/bindings/codegen/parser/update.sh
@@ -5,7 +5,6 @@ patch < pref-main-thread.patch
patch < callback-location.patch
patch < union-typedef.patch
patch < inline.patch
-patch < undo-dictionary-optional.patch
wget https://hg.mozilla.org/mozilla-central/archive/tip.tar.gz/dom/bindings/parser/tests/ -O tests.tar.gz
rm -r tests
diff --git a/components/script/dom/mediadevices.rs b/components/script/dom/mediadevices.rs
index 0276a3d0c61..6cdc5eb7e04 100644
--- a/components/script/dom/mediadevices.rs
+++ b/components/script/dom/mediadevices.rs
@@ -78,11 +78,11 @@ fn convert_constraints(js: &BooleanOrMediaTrackConstraints) -> Option<MediaTrack
BooleanOrMediaTrackConstraints::Boolean(true) => Some(Default::default()),
BooleanOrMediaTrackConstraints::MediaTrackConstraints(ref c) => {
Some(MediaTrackConstraintSet {
- height: convert_culong(&c.parent.height),
- width: convert_culong(&c.parent.width),
- aspect: convert_cdouble(&c.parent.aspectRatio),
- frame_rate: convert_cdouble(&c.parent.frameRate),
- sample_rate: convert_culong(&c.parent.sampleRate),
+ height: c.parent.height.as_ref().and_then(convert_culong),
+ width: c.parent.width.as_ref().and_then(convert_culong),
+ aspect: c.parent.aspectRatio.as_ref().and_then(convert_cdouble),
+ frame_rate: c.parent.frameRate.as_ref().and_then(convert_cdouble),
+ sample_rate: c.parent.sampleRate.as_ref().and_then(convert_culong),
})
},
}
diff --git a/components/script/dom/webidls/DOMQuad.webidl b/components/script/dom/webidls/DOMQuad.webidl
index d68cfddd7a8..397118a88aa 100644
--- a/components/script/dom/webidls/DOMQuad.webidl
+++ b/components/script/dom/webidls/DOMQuad.webidl
@@ -25,8 +25,8 @@ interface DOMQuad {
};
dictionary DOMQuadInit {
- DOMPointInit p1;
- DOMPointInit p2;
- DOMPointInit p3;
- DOMPointInit p4;
+ DOMPointInit p1 = null;
+ DOMPointInit p2 = null;
+ DOMPointInit p3 = null;
+ DOMPointInit p4 = null;
};
diff --git a/components/script/dom/webidls/TestBinding.webidl b/components/script/dom/webidls/TestBinding.webidl
index de22f3171ca..cc942fd06b8 100644
--- a/components/script/dom/webidls/TestBinding.webidl
+++ b/components/script/dom/webidls/TestBinding.webidl
@@ -32,7 +32,7 @@ dictionary TestDictionary {
Blob interfaceValue;
any anyValue;
object objectValue;
- TestDictionaryDefaults dict;
+ TestDictionaryDefaults dict = null;
sequence<TestDictionaryDefaults> seqDict;
// Testing codegen to import Element correctly, ensure no other code references Element directly
sequence<Element> elementSequence;