From 7e310d19493f4a708f43dd28ff18e09eb9cff967 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 2 Jun 2014 14:45:29 +0200 Subject: [PATCH 1/2] Enable some more dictionary codegen tests. --- .../script/dom/webidls/TestBinding.webidl | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/components/script/dom/webidls/TestBinding.webidl b/src/components/script/dom/webidls/TestBinding.webidl index 467abce3328..5736911e504 100644 --- a/src/components/script/dom/webidls/TestBinding.webidl +++ b/src/components/script/dom/webidls/TestBinding.webidl @@ -23,30 +23,30 @@ enum TestEnum { "", "foo", "bar" }; }; */ dictionary TestDictionaryDefaults { - // boolean booleanValue = false; - // byte byteValue = 7; - // octet octetValue = 7; + boolean booleanValue = false; + byte byteValue = 7; + octet octetValue = 7; short shortValue = 7; unsigned short unsignedShortValue = 7; long longValue = 7; unsigned long unsignedLongValue = 7; - // long long longLongValue = 7; - // unsigned long long unsignedLongLongValue = 7; + long long longLongValue = 7; + unsigned long long unsignedLongLongValue = 7; // float floatValue = 7.0; // double doubleValue = 7.0; DOMString stringValue = ""; // TestEnum enumValue = "bar"; any anyValue = null; - // boolean? nullableBooleanValue = false; - // byte? nullableByteValue = 7; - // octet? nullableOctetValue = 7; + boolean? nullableBooleanValue = false; + byte? nullableByteValue = 7; + octet? nullableOctetValue = 7; short? nullableShortValue = 7; unsigned short? nullableUnsignedShortValue = 7; long? nullableLongValue = 7; unsigned long? nullableUnsignedLongValue = 7; - // long long? nullableLongLongValue = 7; - // unsigned long long? nullableUnsignedLongLongValue = 7; + long long? nullableLongLongValue = 7; + unsigned long long? nullableUnsignedLongLongValue = 7; // float? nullableFloatValue = 7.0; // double? nullableDoubleValue = 7.0; DOMString? nullableStringValue = ""; From 6d619f484cefb9c73df8ab515a1535d4bc2428cd Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 2 Jun 2014 14:46:23 +0200 Subject: [PATCH 2/2] Support enumerations in dictionaries. --- src/components/script/dom/bindings/codegen/CodegenRust.py | 4 ++-- src/components/script/dom/webidls/TestBinding.webidl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/script/dom/bindings/codegen/CodegenRust.py b/src/components/script/dom/bindings/codegen/CodegenRust.py index 9d5578b6b58..beb0b46e8e0 100644 --- a/src/components/script/dom/bindings/codegen/CodegenRust.py +++ b/src/components/script/dom/bindings/codegen/CodegenRust.py @@ -686,7 +686,7 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None, "yet") enum = type.inner.identifier.name if invalidEnumValueFatal: - handleInvalidEnumValueCode = "return 0;" + handleInvalidEnumValueCode = exceptionCode else: handleInvalidEnumValueCode = "return 1;" @@ -696,7 +696,7 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None, " Ok(None) => { %(handleInvalidEnumValueCode)s },\n" " Ok(Some(index)) => {\n" " //XXXjdm need some range checks up in here.\n" - " cast::transmute(index)\n" + " unsafe { cast::transmute(index) }\n" " },\n" "}" % { "values" : enum + "Values::strings", "exceptionCode" : exceptionCode, diff --git a/src/components/script/dom/webidls/TestBinding.webidl b/src/components/script/dom/webidls/TestBinding.webidl index 5736911e504..578a2d3948b 100644 --- a/src/components/script/dom/webidls/TestBinding.webidl +++ b/src/components/script/dom/webidls/TestBinding.webidl @@ -35,7 +35,7 @@ dictionary TestDictionaryDefaults { // float floatValue = 7.0; // double doubleValue = 7.0; DOMString stringValue = ""; - // TestEnum enumValue = "bar"; + TestEnum enumValue = "bar"; any anyValue = null; boolean? nullableBooleanValue = false;