зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset f911e3de6e53 (bug 1603461) for eslint in test_attributes_on_types.html on a CLOSED TREE
This commit is contained in:
Родитель
224c3f6348
Коммит
5f3c83c29f
|
@ -4733,8 +4733,8 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
|
|||
# And we can't both be an object and be null or undefined
|
||||
assert not isDefinitelyObject or not isNullOrUndefined
|
||||
|
||||
isClamp = type.hasClamp()
|
||||
isEnforceRange = type.hasEnforceRange()
|
||||
isClamp = type.clamp
|
||||
isEnforceRange = type.enforceRange
|
||||
|
||||
# If exceptionCode is not set, we'll just rethrow the exception we got.
|
||||
# Note that we can't just set failureCode to exceptionCode, because setting
|
||||
|
|
|
@ -2104,14 +2104,14 @@ class IDLType(IDLObject):
|
|||
IDLObject.__init__(self, location)
|
||||
self.name = name
|
||||
self.builtin = False
|
||||
self.clamp = False
|
||||
self.treatNullAsEmpty = False
|
||||
self._clamp = False
|
||||
self._enforceRange = False
|
||||
self.enforceRange = False
|
||||
self._extendedAttrDict = {}
|
||||
|
||||
def __eq__(self, other):
|
||||
return (other and self.builtin == other.builtin and self.name == other.name and
|
||||
self._clamp == other.hasClamp() and self._enforceRange == other.hasEnforceRange() and
|
||||
self.clamp == other.clamp and self.enforceRange == other.enforceRange and
|
||||
self.treatNullAsEmpty == other.treatNullAsEmpty)
|
||||
|
||||
def __ne__(self, other):
|
||||
|
@ -2230,12 +2230,6 @@ class IDLType(IDLObject):
|
|||
def isJSONType(self):
|
||||
return False
|
||||
|
||||
def hasClamp(self):
|
||||
return self._clamp
|
||||
|
||||
def hasEnforceRange(self):
|
||||
return self._enforceRange
|
||||
|
||||
def tag(self):
|
||||
assert False # Override me!
|
||||
|
||||
|
@ -2343,7 +2337,10 @@ class IDLNullableType(IDLParametrizedType):
|
|||
assert not innerType.isVoid()
|
||||
assert not innerType == BuiltinTypes[IDLBuiltinType.Types.any]
|
||||
|
||||
IDLParametrizedType.__init__(self, location, None, innerType)
|
||||
name = innerType.name
|
||||
if innerType.isComplete():
|
||||
name += "OrNull"
|
||||
IDLParametrizedType.__init__(self, location, name, innerType)
|
||||
|
||||
def __eq__(self, other):
|
||||
return isinstance(other, IDLNullableType) and self.inner == other.inner
|
||||
|
@ -2440,23 +2437,11 @@ class IDLNullableType(IDLParametrizedType):
|
|||
def isJSONType(self):
|
||||
return self.inner.isJSONType()
|
||||
|
||||
def hasClamp(self):
|
||||
return self.inner.hasClamp()
|
||||
|
||||
def hasEnforceRange(self):
|
||||
return self.inner.hasEnforceRange()
|
||||
|
||||
def isComplete(self):
|
||||
return self.name is not None
|
||||
|
||||
def tag(self):
|
||||
return self.inner.tag()
|
||||
|
||||
def complete(self, scope):
|
||||
if not self.inner.isComplete():
|
||||
self.inner = self.inner.complete(scope)
|
||||
assert self.inner.isComplete()
|
||||
|
||||
self.inner = self.inner.complete(scope)
|
||||
if self.inner.nullable():
|
||||
raise WebIDLError("The inner type of a nullable type must not be "
|
||||
"a nullable type",
|
||||
|
@ -2466,10 +2451,6 @@ class IDLNullableType(IDLParametrizedType):
|
|||
raise WebIDLError("The inner type of a nullable type must not "
|
||||
"be a union type that itself has a nullable "
|
||||
"type as a member type", [self.location])
|
||||
if self.inner.isDOMString():
|
||||
if self.inner.treatNullAsEmpty:
|
||||
raise WebIDLError("[TreatNullAs] not allowed on a nullable DOMString",
|
||||
[self.location, self.inner.location])
|
||||
|
||||
self.name = self.inner.name + "OrNull"
|
||||
return self
|
||||
|
@ -2483,13 +2464,6 @@ class IDLNullableType(IDLParametrizedType):
|
|||
return False
|
||||
return self.inner.isDistinguishableFrom(other)
|
||||
|
||||
def withExtendedAttributes(self, attrs):
|
||||
# See https://github.com/heycam/webidl/issues/827#issuecomment-565131350
|
||||
# Allowing extended attributes to apply to a nullable type is an intermediate solution.
|
||||
# A potential longer term solution is to introduce a null type and get rid of nullables.
|
||||
# For example, we could do `([Clamp] long or null) foo` in the future.
|
||||
return IDLNullableType(self.location, self.inner.withExtendedAttributes(attrs))
|
||||
|
||||
|
||||
class IDLSequenceType(IDLParametrizedType):
|
||||
def __init__(self, location, parameterType):
|
||||
|
@ -3190,11 +3164,11 @@ class IDLBuiltinType(IDLType):
|
|||
self._withTreatNullAs = None
|
||||
if self.isInteger():
|
||||
if clamp:
|
||||
self._clamp = True
|
||||
self.clamp = True
|
||||
self.name = "Clamped" + self.name
|
||||
self._extendedAttrDict["Clamp"] = True
|
||||
elif enforceRange:
|
||||
self._enforceRange = True
|
||||
self.enforceRange = True
|
||||
self.name = "RangeEnforced" + self.name
|
||||
self._extendedAttrDict["EnforceRange"] = True
|
||||
elif clamp or enforceRange:
|
||||
|
@ -3374,7 +3348,7 @@ class IDLBuiltinType(IDLType):
|
|||
if not attribute.noArguments():
|
||||
raise WebIDLError("[Clamp] must take no arguments",
|
||||
[attribute.location])
|
||||
if ret.hasEnforceRange() or self._enforceRange:
|
||||
if ret.enforceRange or self.enforceRange:
|
||||
raise WebIDLError("[EnforceRange] and [Clamp] are mutually exclusive",
|
||||
[self.location, attribute.location])
|
||||
ret = self.clamped([self.location, attribute.location])
|
||||
|
@ -3382,7 +3356,7 @@ class IDLBuiltinType(IDLType):
|
|||
if not attribute.noArguments():
|
||||
raise WebIDLError("[EnforceRange] must take no arguments",
|
||||
[attribute.location])
|
||||
if ret.hasClamp() or self._clamp:
|
||||
if ret.clamp or self.clamp:
|
||||
raise WebIDLError("[EnforceRange] and [Clamp] are mutually exclusive",
|
||||
[self.location, attribute.location])
|
||||
ret = self.rangeEnforced([self.location, attribute.location])
|
||||
|
@ -4320,7 +4294,7 @@ class IDLAttribute(IDLInterfaceMember):
|
|||
assert not isinstance(t.name, IDLUnresolvedIdentifier)
|
||||
self.type = t
|
||||
|
||||
if self.readonly and (self.type.hasClamp() or self.type.hasEnforceRange() or self.type.treatNullAsEmpty):
|
||||
if self.readonly and (self.type.clamp or self.type.enforceRange or self.type.treatNullAsEmpty):
|
||||
raise WebIDLError("A readonly attribute cannot be [Clamp] or [EnforceRange]",
|
||||
[self.location])
|
||||
if self.type.isDictionary() and not self.getExtendedAttribute("Cached"):
|
||||
|
|
|
@ -25,12 +25,6 @@ def WebIDLTest(parser, harness):
|
|||
void method2(optional [EnforceRange] long foo, optional [Clamp] long bar,
|
||||
optional [TreatNullAs=EmptyString] DOMString baz);
|
||||
};
|
||||
interface C {
|
||||
attribute [EnforceRange] long? foo;
|
||||
attribute [Clamp] long? bar;
|
||||
void method([EnforceRange] long? foo, [Clamp] long? bar);
|
||||
void method2(optional [EnforceRange] long? foo, optional [Clamp] long? bar);
|
||||
};
|
||||
interface Setlike {
|
||||
setlike<[Clamp] long>;
|
||||
};
|
||||
|
@ -47,42 +41,27 @@ def WebIDLTest(parser, harness):
|
|||
|
||||
harness.ok(not threw, "Should not have thrown on parsing normal")
|
||||
if not threw:
|
||||
harness.check(results[0].innerType.hasEnforceRange(), True, "Foo is [EnforceRange]")
|
||||
harness.check(results[1].innerType.hasClamp(), True, "Bar is [Clamp]")
|
||||
harness.check(results[0].innerType.enforceRange, True, "Foo is [EnforceRange]")
|
||||
harness.check(results[1].innerType.clamp, True, "Bar is [Clamp]")
|
||||
harness.check(results[2].innerType.treatNullAsEmpty, True, "Baz is [TreatNullAs=EmptyString]")
|
||||
A = results[3]
|
||||
harness.check(A.members[0].type.hasEnforceRange(), True, "A.a is [EnforceRange]")
|
||||
harness.check(A.members[1].type.hasClamp(), True, "A.b is [Clamp]")
|
||||
harness.check(A.members[2].type.hasEnforceRange(), True, "A.c is [EnforceRange]")
|
||||
harness.check(A.members[3].type.hasEnforceRange(), True, "A.d is [EnforceRange]")
|
||||
harness.check(A.members[0].type.enforceRange, True, "A.a is [EnforceRange]")
|
||||
harness.check(A.members[1].type.clamp, True, "A.b is [Clamp]")
|
||||
harness.check(A.members[2].type.enforceRange, True, "A.c is [EnforceRange]")
|
||||
harness.check(A.members[3].type.enforceRange, True, "A.d is [EnforceRange]")
|
||||
B = results[4]
|
||||
harness.check(B.members[0].type.hasEnforceRange(), True, "B.typedefFoo is [EnforceRange]")
|
||||
harness.check(B.members[1].type.hasEnforceRange(), True, "B.foo is [EnforceRange]")
|
||||
harness.check(B.members[2].type.hasClamp(), True, "B.bar is [Clamp]")
|
||||
harness.check(B.members[0].type.enforceRange, True, "B.typedefFoo is [EnforceRange]")
|
||||
harness.check(B.members[1].type.enforceRange, True, "B.foo is [EnforceRange]")
|
||||
harness.check(B.members[2].type.clamp, True, "B.bar is [Clamp]")
|
||||
harness.check(B.members[3].type.treatNullAsEmpty, True, "B.baz is [TreatNullAs=EmptyString]")
|
||||
method = B.members[4].signatures()[0][1]
|
||||
harness.check(method[0].type.hasEnforceRange(), True, "foo argument of method is [EnforceRange]")
|
||||
harness.check(method[1].type.hasClamp(), True, "bar argument of method is [Clamp]")
|
||||
harness.check(method[0].type.enforceRange, True, "foo argument of method is [EnforceRange]")
|
||||
harness.check(method[1].type.clamp, True, "bar argument of method is [Clamp]")
|
||||
harness.check(method[2].type.treatNullAsEmpty, True, "baz argument of method is [TreatNullAs=EmptyString]")
|
||||
method2 = B.members[5].signatures()[0][1]
|
||||
harness.check(method[0].type.hasEnforceRange(), True, "foo argument of method2 is [EnforceRange]")
|
||||
harness.check(method[1].type.hasClamp(), True, "bar argument of method2 is [Clamp]")
|
||||
harness.check(method[0].type.enforceRange, True, "foo argument of method2 is [EnforceRange]")
|
||||
harness.check(method[1].type.clamp, True, "bar argument of method2 is [Clamp]")
|
||||
harness.check(method[2].type.treatNullAsEmpty, True, "baz argument of method2 is [TreatNullAs=EmptyString]")
|
||||
C = results[5]
|
||||
harness.ok(C.members[0].type.nullable(), "C.foo is nullable")
|
||||
harness.ok(C.members[0].type.hasEnforceRange(), "C.foo has [EnforceRange]")
|
||||
harness.ok(C.members[1].type.nullable(), "C.bar is nullable")
|
||||
harness.ok(C.members[1].type.hasClamp(), "C.bar has [Clamp]")
|
||||
method = C.members[2].signatures()[0][1]
|
||||
harness.ok(method[0].type.nullable(), "foo argument of method is nullable")
|
||||
harness.ok(method[0].type.hasEnforceRange(), "foo argument of method has [EnforceRange]")
|
||||
harness.ok(method[1].type.nullable(), "bar argument of method is nullable")
|
||||
harness.ok(method[1].type.hasClamp(), "bar argument of method has [Clamp]")
|
||||
method2 = C.members[3].signatures()[0][1]
|
||||
harness.ok(method2[0].type.nullable(), "foo argument of method2 is nullable")
|
||||
harness.ok(method2[0].type.hasEnforceRange(), "foo argument of method2 has [EnforceRange]")
|
||||
harness.ok(method2[1].type.nullable(), "bar argument of method2 is nullable")
|
||||
harness.ok(method2[1].type.hasClamp(), "bar argument of method2 has [Clamp]")
|
||||
|
||||
ATTRIBUTES = [("[Clamp]", "long"), ("[EnforceRange]", "long"), ("[TreatNullAs=EmptyString]", "DOMString")]
|
||||
TEMPLATES = [
|
||||
|
@ -240,18 +219,6 @@ def WebIDLTest(parser, harness):
|
|||
|
||||
harness.ok(threw, "Should not allow [TreatNullAs] on JSString")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
typedef [TreatNullAs=EmptyString] DOMString? Foo;
|
||||
""")
|
||||
parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should not allow [TreatNullAs] on nullable DOMString")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
|
@ -265,7 +232,7 @@ def WebIDLTest(parser, harness):
|
|||
except:
|
||||
threw = True
|
||||
harness.ok(not threw, "Should allow type attributes on unresolved types")
|
||||
harness.check(results[0].members[0].signatures()[0][1][0].type.hasClamp(), True,
|
||||
harness.check(results[0].members[0].signatures()[0][1][0].type.clamp, True,
|
||||
"Unresolved types with type attributes should correctly resolve with attributes")
|
||||
|
||||
parser = parser.reset()
|
||||
|
@ -281,5 +248,5 @@ def WebIDLTest(parser, harness):
|
|||
except:
|
||||
threw = True
|
||||
harness.ok(not threw, "Should allow type attributes on typedefs")
|
||||
harness.check(results[0].members[0].signatures()[0][1][0].type.hasClamp(), True,
|
||||
harness.check(results[0].members[0].signatures()[0][1][0].type.clamp, True,
|
||||
"Unresolved types that resolve to typedefs with attributes should correctly resolve with attributes")
|
||||
|
|
|
@ -56,9 +56,9 @@ def WebIDLTest(parser, harness):
|
|||
results = parser.finish()
|
||||
# Pull out the first argument out of the arglist of the first (and
|
||||
# only) signature.
|
||||
harness.ok(results[0].members[0].signatures()[0][1][0].type.hasClamp(),
|
||||
harness.ok(results[0].members[0].signatures()[0][1][0].type.clamp,
|
||||
"Should be clamped")
|
||||
harness.ok(not results[0].members[1].signatures()[0][1][0].type.hasClamp(),
|
||||
harness.ok(not results[0].members[1].signatures()[0][1][0].type.clamp,
|
||||
"Should not be clamped")
|
||||
|
||||
parser = parser.reset()
|
||||
|
@ -86,9 +86,9 @@ def WebIDLTest(parser, harness):
|
|||
results = parser.finish()
|
||||
# Pull out the first argument out of the arglist of the first (and
|
||||
# only) signature.
|
||||
harness.ok(results[0].members[0].signatures()[0][1][0].type.hasEnforceRange(),
|
||||
harness.ok(results[0].members[0].signatures()[0][1][0].type.enforceRange,
|
||||
"Should be enforceRange")
|
||||
harness.ok(not results[0].members[1].signatures()[0][1][0].type.hasEnforceRange(),
|
||||
harness.ok(not results[0].members[1].signatures()[0][1][0].type.enforceRange,
|
||||
"Should not be enforceRange")
|
||||
|
||||
parser = parser.reset()
|
||||
|
|
|
@ -1050,15 +1050,9 @@ class TestInterface : public nsISupports, public nsWrapperCache {
|
|||
// Test EnforceRange/Clamp
|
||||
void DontEnforceRangeOrClamp(int8_t);
|
||||
void DoEnforceRange(int8_t);
|
||||
void DoEnforceRangeNullable(const Nullable<int8_t>&);
|
||||
void DoClamp(int8_t);
|
||||
void DoClampNullable(const Nullable<int8_t>&);
|
||||
void SetEnforcedByte(int8_t);
|
||||
int8_t EnforcedByte();
|
||||
void SetEnforcedNullableByte(const Nullable<int8_t>&);
|
||||
Nullable<int8_t> GetEnforcedNullableByte() const;
|
||||
void SetClampedNullableByte(const Nullable<int8_t>&);
|
||||
Nullable<int8_t> GetClampedNullableByte() const;
|
||||
void SetClampedByte(int8_t);
|
||||
int8_t ClampedByte();
|
||||
|
||||
|
|
|
@ -820,13 +820,9 @@ interface TestInterface {
|
|||
// EnforceRange/Clamp tests
|
||||
void dontEnforceRangeOrClamp(byte arg);
|
||||
void doEnforceRange([EnforceRange] byte arg);
|
||||
void doEnforceRangeNullable([EnforceRange] byte? arg);
|
||||
void doClamp([Clamp] byte arg);
|
||||
void doClampNullable([Clamp] byte? arg);
|
||||
attribute [EnforceRange] byte enforcedByte;
|
||||
attribute [EnforceRange] byte? enforcedNullableByte;
|
||||
attribute [Clamp] byte clampedByte;
|
||||
attribute [Clamp] byte? clampedNullableByte;
|
||||
|
||||
// Typedefs
|
||||
const myLong myLongConstant = 5;
|
||||
|
|
|
@ -623,13 +623,9 @@ interface TestExampleInterface {
|
|||
// EnforceRange/Clamp tests
|
||||
void dontEnforceRangeOrClamp(byte arg);
|
||||
void doEnforceRange([EnforceRange] byte arg);
|
||||
void doEnforceRangeNullable([EnforceRange] byte? arg);
|
||||
void doClamp([Clamp] byte arg);
|
||||
void doClampNullable([Clamp] byte? arg);
|
||||
attribute [EnforceRange] byte enforcedByte;
|
||||
attribute [EnforceRange] byte? enforcedByteNullable;
|
||||
attribute [Clamp] byte clampedByte;
|
||||
attribute [Clamp] byte? clampedByteNullable;
|
||||
|
||||
// Typedefs
|
||||
const myLong myLongConstant = 5;
|
||||
|
|
|
@ -171,22 +171,6 @@ int32_t TestFunctions::One() const { return 1; }
|
|||
|
||||
int32_t TestFunctions::Two() const { return 2; }
|
||||
|
||||
void TestFunctions::SetClampedNullableOctet(const Nullable<uint8_t>& aOctet) {
|
||||
mClampedNullableOctet = aOctet;
|
||||
}
|
||||
|
||||
Nullable<uint8_t> TestFunctions::GetClampedNullableOctet() const {
|
||||
return mClampedNullableOctet;
|
||||
}
|
||||
|
||||
void TestFunctions::SetEnforcedNullableOctet(const Nullable<uint8_t>& aOctet) {
|
||||
mEnforcedNullableOctet = aOctet;
|
||||
}
|
||||
|
||||
Nullable<uint8_t> TestFunctions::GetEnforcedNullableOctet() const {
|
||||
return mEnforcedNullableOctet;
|
||||
}
|
||||
|
||||
bool TestFunctions::ObjectFromAboutBlank(JSContext* aCx, JSObject* aObj) {
|
||||
// We purposefully don't use WindowOrNull here, because we want to
|
||||
// demonstrate the incorrect behavior we get, not just fail some asserts.
|
||||
|
|
|
@ -58,11 +58,6 @@ class TestFunctions : public NonRefcountedDOMObject {
|
|||
int32_t One() const;
|
||||
int32_t Two() const;
|
||||
|
||||
void SetClampedNullableOctet(const Nullable<uint8_t>& aOctet);
|
||||
Nullable<uint8_t> GetClampedNullableOctet() const;
|
||||
void SetEnforcedNullableOctet(const Nullable<uint8_t>& aOctet);
|
||||
Nullable<uint8_t> GetEnforcedNullableOctet() const;
|
||||
|
||||
static bool ObjectFromAboutBlank(JSContext* aCx, JSObject* aObj);
|
||||
|
||||
WrapperCachedNonISupportsTestInterface* WrapperCachedNonISupportsObject();
|
||||
|
@ -74,9 +69,6 @@ class TestFunctions : public NonRefcountedDOMObject {
|
|||
nsString mStringData;
|
||||
RefPtr<WrapperCachedNonISupportsTestInterface>
|
||||
mWrapperCachedNonISupportsTestInterface;
|
||||
|
||||
Nullable<uint8_t> mClampedNullableOctet;
|
||||
Nullable<uint8_t> mEnforcedNullableOctet;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -637,13 +637,9 @@ interface TestJSImplInterface {
|
|||
// EnforceRange/Clamp tests
|
||||
void dontEnforceRangeOrClamp(byte arg);
|
||||
void doEnforceRange([EnforceRange] byte arg);
|
||||
void doEnforceRangeNullable([EnforceRange] byte? arg);
|
||||
void doClamp([Clamp] byte arg);
|
||||
void doClampNullable([Clamp] byte? arg);
|
||||
attribute [EnforceRange] byte enforcedByte;
|
||||
attribute [EnforceRange] byte? enforcedByteNullable;
|
||||
attribute [Clamp] byte clampedByte;
|
||||
attribute [Clamp] byte? clampedByteNullable;
|
||||
|
||||
// Typedefs
|
||||
const myLong myLongConstant = 5;
|
||||
|
|
|
@ -84,5 +84,3 @@ skip-if = debug == false
|
|||
[test_jsimplemented_subclassing.html]
|
||||
[test_toJSON.html]
|
||||
skip-if = debug == false
|
||||
[test_attributes_on_types.html]
|
||||
skip-if = debug == false
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1295322
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for WebIDL attributes on types</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1295322">Mozilla Bug 1295322</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
<script type="application/javascript">
|
||||
add_task(async function push_permission() {
|
||||
await SpecialPowers.pushPrefEnv({set: [["dom.expose_test_interfaces", true]]});
|
||||
});
|
||||
|
||||
add_task(function testClampedNullableOctet() {
|
||||
let test = new TestFunctions();
|
||||
test.clampedNullableOctet = null;
|
||||
is(test.clampedNullableOctet, null, "clampedNullableOctet should be null");
|
||||
test.clampedNullableOctet = -1;
|
||||
is(test.clampedNullableOctet, 0, "clampedNullableOctet should be clamped to 0");
|
||||
test.clampedNullableOctet = 256;
|
||||
is(test.clampedNullableOctet, 255, "clampedNullableOctet should be clamped 255");
|
||||
test.clampedNullableOctet = 200;
|
||||
is(test.clampedNullableOctet, 200, "clampedNullableOctet should be 200");
|
||||
test.clampedNullableOctet = null;
|
||||
is(test.clampedNullableOctet, null, "clampedNullableOctet should be null");
|
||||
});
|
||||
|
||||
add_task(function testEnforcedNullableOctet() {
|
||||
let test = new TestFunctions();
|
||||
test.enforcedNullableOctet = null;
|
||||
is(test.enforcedNullableOctet, null, "enforcedNullableOctet should be null");
|
||||
try {
|
||||
test.enforcedNullableOctet = -1;
|
||||
ok(false, "Setting -1 to enforcedNullableOctet should throw exception");
|
||||
} catch(e) {}
|
||||
is(test.enforcedNullableOctet, null, "enforcedNullableOctet should still be null");
|
||||
try {
|
||||
test.enforcedNullableOctet = 256;
|
||||
ok(false, "Setting 256 to enforcedNullableOctet should throw exception");
|
||||
} catch(e) {}
|
||||
is(test.enforcedNullableOctet, null, "enforcedNullableOctet should still be null");
|
||||
test.enforcedNullableOctet = 200;
|
||||
is(test.enforcedNullableOctet, 200, "enforcedNullableOctet should be 200");
|
||||
test.enforcedNullableOctet = null;
|
||||
is(test.enforcedNullableOctet, null, "enforcedNullableOctet should be null");
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -98,7 +98,4 @@ interface TestFunctions {
|
|||
// bindings. This is needed to test wrapper preservation for weak map keys.
|
||||
// See bug 1351501.
|
||||
readonly attribute WrapperCachedNonISupportsTestInterface wrapperCachedNonISupportsObject;
|
||||
|
||||
attribute [Clamp] octet? clampedNullableOctet;
|
||||
attribute [EnforceRange] octet? enforcedNullableOctet;
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче