mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-30 05:35:31 +00:00
Merge latest green fx-team changeset and mozilla-central
This commit is contained in:
commit
a24271dad8
@ -282,13 +282,6 @@ public:
|
||||
uint16_t ReadyState();
|
||||
|
||||
// request
|
||||
void Open(const nsACString& aMethod, const nsAString& aUrl, ErrorResult& aRv)
|
||||
{
|
||||
Open(aMethod, aUrl, true,
|
||||
mozilla::dom::Optional<nsAString>(),
|
||||
mozilla::dom::Optional<nsAString>(),
|
||||
aRv);
|
||||
}
|
||||
void Open(const nsACString& aMethod, const nsAString& aUrl, bool aAsync,
|
||||
const mozilla::dom::Optional<nsAString>& aUser,
|
||||
const mozilla::dom::Optional<nsAString>& aPassword,
|
||||
|
@ -27,15 +27,11 @@ function checkDoc(title, expectedtitle, normalizedtitle) {
|
||||
is(doc.doctype.internalSubset, null, "internalSubset should be null!");
|
||||
isElement(doc.documentElement, "html");
|
||||
isElement(doc.documentElement.firstChild, "head");
|
||||
if (title !== undefined) {
|
||||
is(doc.documentElement.firstChild.childNodes.length, 1);
|
||||
isElement(doc.documentElement.firstChild.firstChild, "title");
|
||||
// Doesn't always work out in WebKit.
|
||||
ok(doc.documentElement.firstChild.firstChild.firstChild, "Need a text node.");
|
||||
is(doc.documentElement.firstChild.firstChild.firstChild.data, expectedtitle);
|
||||
} else {
|
||||
is(doc.documentElement.firstChild.childNodes.length, 0);
|
||||
}
|
||||
is(doc.documentElement.firstChild.childNodes.length, 1);
|
||||
isElement(doc.documentElement.firstChild.firstChild, "title");
|
||||
// Doesn't always work out in WebKit.
|
||||
ok(doc.documentElement.firstChild.firstChild.firstChild, "Need a text node.");
|
||||
is(doc.documentElement.firstChild.firstChild.firstChild.data, expectedtitle);
|
||||
isElement(doc.documentElement.lastChild, "body");
|
||||
is(doc.documentElement.lastChild.childNodes.length, 0);
|
||||
((!title || title.indexOf("\f") === -1) ? is : todo_is)
|
||||
@ -45,7 +41,7 @@ function checkDoc(title, expectedtitle, normalizedtitle) {
|
||||
}
|
||||
checkDoc("", "", "");
|
||||
checkDoc(null, "null", "null");
|
||||
checkDoc(undefined, "", "");
|
||||
checkDoc(undefined, "undefined", "undefined");
|
||||
checkDoc("foo bar baz", "foo bar baz", "foo bar baz");
|
||||
checkDoc("foo\t\tbar baz", "foo\t\tbar baz", "foo bar baz");
|
||||
checkDoc("foo\n\nbar baz", "foo\n\nbar baz", "foo bar baz");
|
||||
|
@ -998,34 +998,8 @@ nsXBLPrototypeBinding::Read(nsIObjectInputStream* aStream,
|
||||
previousHandler = handler;
|
||||
} while (1);
|
||||
|
||||
if (mBinding) {
|
||||
while (true) {
|
||||
XBLBindingSerializeDetails type;
|
||||
rv = aStream->Read8(&type);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (type != XBLBinding_Serialize_Attribute) {
|
||||
break;
|
||||
}
|
||||
|
||||
int32_t attrNamespace;
|
||||
rv = ReadNamespace(aStream, attrNamespace);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoString attrName, attrValue;
|
||||
rv = aStream->ReadString(attrName);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = aStream->ReadString(attrValue);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIAtom> atomName = do_GetAtom(attrName);
|
||||
mBinding->SetAttr(attrNamespace, atomName, attrValue, false);
|
||||
}
|
||||
}
|
||||
|
||||
// Finally, read in the resources.
|
||||
while (true) {
|
||||
do {
|
||||
XBLBindingSerializeDetails type;
|
||||
rv = aStream->Read8(&type);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -1042,7 +1016,7 @@ nsXBLPrototypeBinding::Read(nsIObjectInputStream* aStream,
|
||||
|
||||
AddResource(type == XBLBinding_Serialize_Stylesheet ? nsGkAtoms::stylesheet :
|
||||
nsGkAtoms::image, src);
|
||||
}
|
||||
} while (1);
|
||||
|
||||
if (isFirstBinding) {
|
||||
aDocInfo->SetFirstPrototypeBinding(this);
|
||||
@ -1152,30 +1126,6 @@ nsXBLPrototypeBinding::Write(nsIObjectOutputStream* aStream)
|
||||
aStream->Write8(XBLBinding_Serialize_NoMoreItems);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (mBinding) {
|
||||
uint32_t attributes = mBinding->GetAttrCount();
|
||||
nsAutoString attrValue;
|
||||
for (uint32_t i = 0; i < attributes; ++i) {
|
||||
const nsAttrName* attr = mBinding->GetAttrNameAt(i);
|
||||
nsDependentAtomString attrName = attr->Atom();
|
||||
mBinding->GetAttr(attr->NamespaceID(), attr->Atom(), attrValue);
|
||||
rv = aStream->Write8(XBLBinding_Serialize_Attribute);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = WriteNamespace(aStream, attr->NamespaceID());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = aStream->WriteWStringZ(attrName.get());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = aStream->WriteWStringZ(attrValue.get());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
}
|
||||
|
||||
aStream->Write8(XBLBinding_Serialize_NoMoreItems);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Write out the resources
|
||||
if (mResources) {
|
||||
rv = mResources->Write(aStream);
|
||||
|
@ -15,7 +15,7 @@ typedef uint8_t XBLBindingSerializeDetails;
|
||||
|
||||
// A version number to ensure we don't load cached data in a different
|
||||
// file format.
|
||||
#define XBLBinding_Serialize_Version 0x00000003
|
||||
#define XBLBinding_Serialize_Version 0x00000002
|
||||
|
||||
// Set for the first binding in a document
|
||||
#define XBLBinding_Serialize_IsFirstBinding 1
|
||||
@ -45,7 +45,6 @@ typedef uint8_t XBLBindingSerializeDetails;
|
||||
#define XBLBinding_Serialize_Handler 8
|
||||
#define XBLBinding_Serialize_Image 9
|
||||
#define XBLBinding_Serialize_Stylesheet 10
|
||||
#define XBLBinding_Serialize_Attribute 0xA
|
||||
#define XBLBinding_Serialize_Mask 0x0F
|
||||
#define XBLBinding_Serialize_ReadOnly 0x80
|
||||
|
||||
|
@ -2703,7 +2703,8 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
|
||||
# A helper function for wrapping up the template body for
|
||||
# possibly-nullable objecty stuff
|
||||
def wrapObjectTemplate(templateBody, type, codeToSetNull, failureCode=None):
|
||||
if isNullOrUndefined and type.nullable():
|
||||
if isNullOrUndefined:
|
||||
assert type.nullable()
|
||||
# Just ignore templateBody and set ourselves to null.
|
||||
# Note that we don't have to worry about default values
|
||||
# here either, since we already examined this value.
|
||||
@ -3320,6 +3321,9 @@ for (uint32_t i = 0; i < length; ++i) {
|
||||
"Default": "eStringify",
|
||||
"EmptyString": "eEmpty",
|
||||
"Null": "eNull",
|
||||
# For Missing it doesn't matter what we use here, since we'll never
|
||||
# call ConvertJSValueToString on undefined in that case.
|
||||
"Missing": "eStringify"
|
||||
}
|
||||
if type.nullable():
|
||||
# For nullable strings null becomes a null string.
|
||||
@ -3839,8 +3843,11 @@ class CGArgumentConverter(CGThing):
|
||||
"args[${index}]"
|
||||
).substitute(replacer)
|
||||
self.replacementVariables["mutableVal"] = self.replacementVariables["val"]
|
||||
haveValueCheck = string.Template(
|
||||
"args.hasDefined(${index})").substitute(replacer)
|
||||
if argument.treatUndefinedAs == "Missing":
|
||||
haveValueCheck = "args.hasDefined(${index})"
|
||||
else:
|
||||
haveValueCheck = "${index} < args.length()"
|
||||
haveValueCheck = string.Template(haveValueCheck).substitute(replacer)
|
||||
self.replacementVariables["haveValue"] = haveValueCheck
|
||||
self.descriptorProvider = descriptorProvider
|
||||
if self.argument.optional and not self.argument.defaultValue:
|
||||
@ -4981,6 +4988,15 @@ class CGMethodCall(CGThing):
|
||||
CGWrapper(CGIndenter(CGGeneric(code)), pre="\n", post="\n"))
|
||||
return
|
||||
|
||||
# We don't handle [TreatUndefinedAs=Missing] arguments in overload
|
||||
# resolution yet.
|
||||
for (_, sigArgs) in signatures:
|
||||
for arg in sigArgs:
|
||||
if arg.treatUndefinedAs == "Missing":
|
||||
raise TypeError("No support for [TreatUndefinedAs=Missing] "
|
||||
"handling in overload resolution yet: %s" %
|
||||
arg.location)
|
||||
|
||||
# Need to find the right overload
|
||||
maxArgCount = method.maxArgCount
|
||||
allowedArgCounts = method.allowedArgCounts
|
||||
@ -5070,30 +5086,22 @@ class CGMethodCall(CGThing):
|
||||
else:
|
||||
failureCode = None
|
||||
type = distinguishingType(signature)
|
||||
# The argument at index distinguishingIndex can't possibly be
|
||||
# unset here, because we've already checked that argc is large
|
||||
# enough that we can examine this argument. But note that we
|
||||
# still want to claim that optional arguments are optional, in
|
||||
# case undefined was passed in.
|
||||
argIsOptional = (distinguishingArgument(signature).optional and
|
||||
not distinguishingArgument(signature).defaultValue)
|
||||
# The argument at index distinguishingIndex can't possibly
|
||||
# be unset here, because we've already checked that argc is
|
||||
# large enough that we can examine this argument.
|
||||
testCode = instantiateJSToNativeConversion(
|
||||
getJSToNativeConversionInfo(type, descriptor,
|
||||
failureCode=failureCode,
|
||||
isDefinitelyObject=isDefinitelyObject,
|
||||
isNullOrUndefined=isNullOrUndefined,
|
||||
isOptional=argIsOptional,
|
||||
sourceDescription=(argDesc % (distinguishingIndex + 1))),
|
||||
{
|
||||
"declName" : "arg%d" % distinguishingIndex,
|
||||
"holderName" : ("arg%d" % distinguishingIndex) + "_holder",
|
||||
"val" : distinguishingArg,
|
||||
"mutableVal" : distinguishingArg,
|
||||
"obj" : "obj",
|
||||
"haveValue": "args.hasDefined(%d)" % distinguishingIndex
|
||||
},
|
||||
checkForValue=argIsOptional
|
||||
)
|
||||
"obj" : "obj"
|
||||
})
|
||||
caseBody.append(CGIndenter(testCode, indent));
|
||||
# If we got this far, we know we unwrapped to the right
|
||||
# C++ type, so just do the call. Start conversion with
|
||||
@ -5103,76 +5111,24 @@ class CGMethodCall(CGThing):
|
||||
getPerSignatureCall(signature, distinguishingIndex + 1),
|
||||
indent))
|
||||
|
||||
def hasConditionalConversion(type):
|
||||
"""
|
||||
Return whether the argument conversion for this type will be
|
||||
conditional on the type of incoming JS value. For example, for
|
||||
interface types the conversion is conditional on the incoming
|
||||
value being isObject().
|
||||
|
||||
For the types for which this returns false, we do not have to
|
||||
output extra isUndefined() or isNullOrUndefined() cases, because
|
||||
null/undefined values will just fall through into our
|
||||
unconditional conversion.
|
||||
"""
|
||||
if type.isString() or type.isEnum():
|
||||
return False
|
||||
if type.isBoolean():
|
||||
distinguishingTypes = (distinguishingType(s) for s in
|
||||
possibleSignatures)
|
||||
return any(t.isString() or t.isEnum() or t.isNumeric()
|
||||
for t in distinguishingTypes)
|
||||
if type.isNumeric():
|
||||
distinguishingTypes = (distinguishingType(s) for s in
|
||||
possibleSignatures)
|
||||
return any(t.isString() or t.isEnum()
|
||||
for t in distinguishingTypes)
|
||||
return True
|
||||
|
||||
def needsNullOrUndefinedCase(type):
|
||||
"""
|
||||
Return true if the type needs a special isNullOrUndefined() case
|
||||
"""
|
||||
return ((type.nullable() and
|
||||
hasConditionalConversion(type)) or
|
||||
type.isDictionary())
|
||||
|
||||
# First check for undefined and optional distinguishing arguments
|
||||
# and output a special branch for that case. Note that we don't
|
||||
# use distinguishingArgument here because we actualy want to
|
||||
# exclude variadic arguments. Also note that we skip this check if
|
||||
# we plan to output a isNullOrUndefined() special case for this
|
||||
# argument anyway, since that will subsume our isUndefined() check.
|
||||
# This is safe, because there can be at most one nullable
|
||||
# distinguishing argument, so if we're it we'll definitely get
|
||||
# picked up by the nullable handling. Also, we can skip this check
|
||||
# if the argument has an unconditional conversion later on.
|
||||
undefSigs = [s for s in possibleSignatures if
|
||||
distinguishingIndex < len(s[1]) and
|
||||
s[1][distinguishingIndex].optional and
|
||||
hasConditionalConversion(s[1][distinguishingIndex].type) and
|
||||
not needsNullOrUndefinedCase(s[1][distinguishingIndex].type)]
|
||||
# Can't have multiple signatures with an optional argument at the
|
||||
# same index.
|
||||
assert len(undefSigs) < 2
|
||||
if len(undefSigs) > 0:
|
||||
caseBody.append(CGGeneric("if (%s.isUndefined()) {" %
|
||||
distinguishingArg))
|
||||
tryCall(undefSigs[0], 2, isNullOrUndefined=True)
|
||||
caseBody.append(CGGeneric("}"))
|
||||
|
||||
# Next, check for null or undefined. That means looking for
|
||||
# First check for null or undefined. That means looking for
|
||||
# nullable arguments at the distinguishing index and outputting a
|
||||
# separate branch for them. But if the nullable argument has an
|
||||
# unconditional conversion, we don't need to do that. The reason
|
||||
# separate branch for them. But if the nullable argument is a
|
||||
# primitive, string, or enum, we don't need to do that. The reason
|
||||
# for that is that at most one argument at the distinguishing index
|
||||
# is nullable (since two nullable arguments are not
|
||||
# distinguishable), and null/undefined values will always fall
|
||||
# through to the unconditional conversion we have, if any, since
|
||||
# they will fail whatever the conditions on the input value are for
|
||||
# our other conversions.
|
||||
# distinguishable), and all the argument types other than
|
||||
# primitive/string/enum end up inside isObject() checks. So if our
|
||||
# nullable is a primitive/string/enum it's safe to not output the
|
||||
# extra branch: we'll fall through to conversion for those types,
|
||||
# which correctly handles null as needed, because isObject() will be
|
||||
# false for null and undefined.
|
||||
nullOrUndefSigs = [s for s in possibleSignatures
|
||||
if needsNullOrUndefinedCase(distinguishingType(s))]
|
||||
if ((distinguishingType(s).nullable() and not
|
||||
distinguishingType(s).isString() and not
|
||||
distinguishingType(s).isEnum() and not
|
||||
distinguishingType(s).isPrimitive()) or
|
||||
distinguishingType(s).isDictionary())]
|
||||
# Can't have multiple nullable types here
|
||||
assert len(nullOrUndefSigs) < 2
|
||||
if len(nullOrUndefSigs) > 0:
|
||||
|
@ -81,6 +81,11 @@ public:
|
||||
return !Equals(aOtherNullable);
|
||||
}
|
||||
|
||||
operator bool() const
|
||||
{
|
||||
return !mIsNull;
|
||||
}
|
||||
|
||||
// Make it possible to use a const Nullable of an array type with other
|
||||
// array types.
|
||||
template<typename U>
|
||||
|
@ -401,7 +401,12 @@ class IDLObjectWithIdentifier(IDLObject):
|
||||
if isDictionaryMember:
|
||||
raise WebIDLError("[TreatUndefinedAs] is not allowed for "
|
||||
"dictionary members", [self.location])
|
||||
if value == 'Null':
|
||||
if value == 'Missing':
|
||||
if not isOptional:
|
||||
raise WebIDLError("[TreatUndefinedAs=Missing] is only "
|
||||
"allowed on optional arguments",
|
||||
[self.location])
|
||||
elif value == 'Null':
|
||||
if not self.type.isDOMString():
|
||||
raise WebIDLError("[TreatUndefinedAs=Null] is only "
|
||||
"allowed on arguments or "
|
||||
@ -421,8 +426,8 @@ class IDLObjectWithIdentifier(IDLObject):
|
||||
[self.location])
|
||||
else:
|
||||
raise WebIDLError("[TreatUndefinedAs] must take the "
|
||||
"identifiers EmptyString or Null",
|
||||
[self.location])
|
||||
"identifiers EmptyString or Null or "
|
||||
"Missing", [self.location])
|
||||
self.treatUndefinedAs = value
|
||||
else:
|
||||
unhandledAttrs.append(attr)
|
||||
@ -3138,12 +3143,15 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
||||
|
||||
def finish(self, scope):
|
||||
for overload in self._overloads:
|
||||
inOptionalArguments = False
|
||||
variadicArgument = None
|
||||
|
||||
arguments = overload.arguments
|
||||
for (idx, argument) in enumerate(arguments):
|
||||
if not argument.isComplete():
|
||||
argument.complete(scope)
|
||||
if argument.isComplete():
|
||||
continue
|
||||
|
||||
argument.complete(scope)
|
||||
assert argument.type.isComplete()
|
||||
|
||||
if (argument.type.isDictionary() or
|
||||
@ -3153,7 +3161,7 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
||||
# end of the list or followed by optional arguments must be
|
||||
# optional.
|
||||
if (not argument.optional and
|
||||
all(arg.optional for arg in arguments[idx+1:])):
|
||||
(idx == len(arguments) - 1 or arguments[idx+1].optional)):
|
||||
raise WebIDLError("Dictionary argument or union "
|
||||
"argument containing a dictionary "
|
||||
"not followed by a required argument "
|
||||
@ -3171,6 +3179,13 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
||||
if variadicArgument:
|
||||
raise WebIDLError("Variadic argument is not last argument",
|
||||
[variadicArgument.location])
|
||||
# Once we see an optional argument, there can't be any non-optional
|
||||
# arguments.
|
||||
if inOptionalArguments and not argument.optional:
|
||||
raise WebIDLError("Non-optional argument after optional "
|
||||
"arguments",
|
||||
[argument.location])
|
||||
inOptionalArguments = argument.optional
|
||||
if argument.variadic:
|
||||
variadicArgument = argument
|
||||
|
||||
@ -3215,7 +3230,7 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
||||
return [overload for overload in self._overloads if
|
||||
len(overload.arguments) == argc or
|
||||
(len(overload.arguments) > argc and
|
||||
all(arg.optional for arg in overload.arguments[argc:])) or
|
||||
overload.arguments[argc].optional) or
|
||||
(len(overload.arguments) < argc and
|
||||
len(overload.arguments) > 0 and
|
||||
overload.arguments[-1].variadic)]
|
||||
@ -4045,6 +4060,21 @@ class Parser(Tokenizer):
|
||||
raise WebIDLError("stringifier must have DOMString return type",
|
||||
[self.getLocation(p, 2)])
|
||||
|
||||
inOptionalArguments = False
|
||||
variadicArgument = False
|
||||
for argument in arguments:
|
||||
# Only the last argument can be variadic
|
||||
if variadicArgument:
|
||||
raise WebIDLError("Only the last argument can be variadic",
|
||||
[variadicArgument.location])
|
||||
# Once we see an optional argument, there can't be any non-optional
|
||||
# arguments.
|
||||
if inOptionalArguments and not argument.optional:
|
||||
raise WebIDLError("Cannot have a non-optional argument following an optional argument",
|
||||
[argument.location])
|
||||
inOptionalArguments = argument.optional
|
||||
variadicArgument = argument if argument.variadic else None
|
||||
|
||||
# identifier might be None. This is only permitted for special methods.
|
||||
if not identifier:
|
||||
if not getter and not setter and not creator and \
|
||||
|
@ -171,23 +171,6 @@ def WebIDLTest(parser, harness):
|
||||
|
||||
harness.ok(threw, "Dictionary arg followed by optional arg must be optional")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
dictionary A {
|
||||
};
|
||||
interface X {
|
||||
void doFoo(A arg1, optional long arg2, long arg3);
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(not threw,
|
||||
"Dictionary arg followed by non-optional arg doesn't have to be optional")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
|
@ -11,9 +11,9 @@ def WebIDLTest(parser, harness):
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(not threw,
|
||||
"Should not have thrown on non-optional argument following "
|
||||
"optional argument.")
|
||||
harness.ok(threw,
|
||||
"Should have thrown on non-optional argument following optional "
|
||||
"argument.")
|
||||
|
||||
parser = parser.reset()
|
||||
parser.parse("""
|
||||
|
@ -11,8 +11,6 @@ def WebIDLTest(parser, harness):
|
||||
void withVariadics(long... numbers);
|
||||
void withVariadics(TestOverloads iface);
|
||||
void withVariadics(long num, TestOverloads iface);
|
||||
void optionalTest();
|
||||
void optionalTest(optional long num1, long num2);
|
||||
};
|
||||
""")
|
||||
|
||||
@ -25,7 +23,7 @@ def WebIDLTest(parser, harness):
|
||||
"Should be an IDLInterface")
|
||||
harness.check(iface.identifier.QName(), "::TestOverloads", "Interface has the right QName")
|
||||
harness.check(iface.identifier.name, "TestOverloads", "Interface has the right name")
|
||||
harness.check(len(iface.members), 4, "Expect %s members" % 4)
|
||||
harness.check(len(iface.members), 3, "Expect %s members" % 3)
|
||||
|
||||
member = iface.members[0]
|
||||
harness.check(member.identifier.QName(), "::TestOverloads::basic", "Method has the right QName")
|
||||
@ -50,11 +48,3 @@ def WebIDLTest(parser, harness):
|
||||
harness.check(argument.identifier.QName(), "::TestOverloads::basic::arg1", "Argument has the right QName")
|
||||
harness.check(argument.identifier.name, "arg1", "Argument has the right name")
|
||||
harness.check(str(argument.type), "Long", "Argument has the right type")
|
||||
|
||||
member = iface.members[3]
|
||||
harness.check(len(member.overloadsForArgCount(0)), 1,
|
||||
"Only one overload for no args")
|
||||
harness.check(len(member.overloadsForArgCount(1)), 0,
|
||||
"No overloads for one arg")
|
||||
harness.check(len(member.overloadsForArgCount(2)), 1,
|
||||
"Only one overload for two args")
|
||||
|
@ -1,62 +1,51 @@
|
||||
def WebIDLTest(parser, harness):
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
results = parser.parse("""
|
||||
interface VariadicConstraints1 {
|
||||
void foo(byte... arg1, byte arg2);
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw,
|
||||
"Should have thrown on variadic argument followed by required "
|
||||
"argument.")
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
results = parser.parse("""
|
||||
interface VariadicConstraints2 {
|
||||
void foo(byte... arg1, optional byte arg2);
|
||||
};
|
||||
""")
|
||||
results = parser.finish();
|
||||
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw,
|
||||
"Should have thrown on variadic argument followed by optional "
|
||||
"argument.")
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
results = parser.parse("""
|
||||
interface VariadicConstraints3 {
|
||||
void foo(optional byte... arg1);
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw,
|
||||
"Should have thrown on variadic argument explicitly flagged as "
|
||||
"optional.")
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
results = parser.parse("""
|
||||
interface VariadicConstraints4 {
|
||||
void foo(byte... arg1 = 0);
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
|
||||
except:
|
||||
threw = True
|
||||
|
||||
|
@ -161,9 +161,9 @@ public:
|
||||
void PassByte(int8_t);
|
||||
int8_t ReceiveByte();
|
||||
void PassOptionalByte(const Optional<int8_t>&);
|
||||
void PassOptionalByteBeforeRequired(const Optional<int8_t>&, int8_t);
|
||||
void PassOptionalUndefinedMissingByte(const Optional<int8_t>&);
|
||||
void PassOptionalByteWithDefault(int8_t);
|
||||
void PassOptionalByteWithDefaultBeforeRequired(int8_t, int8_t);
|
||||
void PassOptionalUndefinedMissingByteWithDefault(int8_t);
|
||||
void PassNullableByte(const Nullable<int8_t>&);
|
||||
void PassOptionalNullableByte(const Optional< Nullable<int8_t> >&);
|
||||
void PassVariadicByte(const Sequence<int8_t>&);
|
||||
@ -410,7 +410,9 @@ public:
|
||||
void PassString(const nsAString&);
|
||||
void PassNullableString(const nsAString&);
|
||||
void PassOptionalString(const Optional<nsAString>&);
|
||||
void PassOptionalUndefinedMissingString(const Optional<nsAString>&);
|
||||
void PassOptionalStringWithDefaultValue(const nsAString&);
|
||||
void PassOptionalUndefinedMissingStringWithDefaultValue(const nsAString&);
|
||||
void PassOptionalNullableString(const Optional<nsAString>&);
|
||||
void PassOptionalNullableStringWithDefaultValue(const nsAString&);
|
||||
void PassVariadicString(const Sequence<nsString>&);
|
||||
@ -629,22 +631,6 @@ public:
|
||||
void Overload7(const nsCString&);
|
||||
void Overload8(int32_t);
|
||||
void Overload8(TestInterface&);
|
||||
void Overload9(const Nullable<int32_t>&);
|
||||
void Overload9(const nsAString&);
|
||||
void Overload10(const Nullable<int32_t>&);
|
||||
void Overload10(JSContext*, JS::Handle<JSObject*>);
|
||||
void Overload11(int32_t);
|
||||
void Overload11(const nsAString&);
|
||||
void Overload12(int32_t);
|
||||
void Overload12(const Nullable<bool>&);
|
||||
void Overload13(const Nullable<int32_t>&);
|
||||
void Overload13(bool);
|
||||
void Overload14(const Optional<int32_t>&);
|
||||
void Overload14(TestInterface&);
|
||||
void Overload15(int32_t);
|
||||
void Overload15(const Optional<NonNull<TestInterface> >&);
|
||||
void Overload16(int32_t);
|
||||
void Overload16(const Optional<TestInterface*>&);
|
||||
|
||||
// Variadic handling
|
||||
void PassVariadicThirdArg(const nsAString&, int32_t,
|
||||
|
@ -118,9 +118,9 @@ interface TestInterface {
|
||||
void passByte(byte arg);
|
||||
byte receiveByte();
|
||||
void passOptionalByte(optional byte arg);
|
||||
void passOptionalByteBeforeRequired(optional byte arg1, byte arg2);
|
||||
void passOptionalUndefinedMissingByte([TreatUndefinedAs=Missing] optional byte arg);
|
||||
void passOptionalByteWithDefault(optional byte arg = 0);
|
||||
void passOptionalByteWithDefaultBeforeRequired(optional byte arg1 = 0, byte arg2);
|
||||
void passOptionalUndefinedMissingByteWithDefault([TreatUndefinedAs=Missing] optional byte arg = 0);
|
||||
void passNullableByte(byte? arg);
|
||||
void passOptionalNullableByte(optional byte? arg);
|
||||
void passVariadicByte(byte... arg);
|
||||
@ -365,7 +365,9 @@ interface TestInterface {
|
||||
void passString(DOMString arg);
|
||||
void passNullableString(DOMString? arg);
|
||||
void passOptionalString(optional DOMString arg);
|
||||
void passOptionalUndefinedMissingString([TreatUndefinedAs=Missing] optional DOMString arg);
|
||||
void passOptionalStringWithDefaultValue(optional DOMString arg = "abc");
|
||||
void passOptionalUndefinedMissingStringWithDefaultValue([TreatUndefinedAs=Missing] optional DOMString arg = "abc");
|
||||
void passOptionalNullableString(optional DOMString? arg);
|
||||
void passOptionalNullableStringWithDefaultValue(optional DOMString? arg = null);
|
||||
void passVariadicString(DOMString... arg);
|
||||
@ -579,22 +581,6 @@ interface TestInterface {
|
||||
void overload7(ByteString arg);
|
||||
void overload8(long arg);
|
||||
void overload8(TestInterface arg);
|
||||
void overload9(long? arg);
|
||||
void overload9(DOMString arg);
|
||||
void overload10(long? arg);
|
||||
void overload10(object arg);
|
||||
void overload11(long arg);
|
||||
void overload11(DOMString? arg);
|
||||
void overload12(long arg);
|
||||
void overload12(boolean? arg);
|
||||
void overload13(long? arg);
|
||||
void overload13(boolean arg);
|
||||
void overload14(optional long arg);
|
||||
void overload14(TestInterface arg);
|
||||
void overload15(long arg);
|
||||
void overload15(optional TestInterface arg);
|
||||
void overload16(long arg);
|
||||
void overload16(optional TestInterface? arg);
|
||||
|
||||
// Variadic handling
|
||||
void passVariadicThirdArg(DOMString arg1, long arg2, TestInterface... arg3);
|
||||
|
@ -23,9 +23,9 @@ interface TestExampleInterface {
|
||||
void passByte(byte arg);
|
||||
byte receiveByte();
|
||||
void passOptionalByte(optional byte arg);
|
||||
void passOptionalByteBeforeRequired(optional byte arg1, byte arg2);
|
||||
void passOptionalUndefinedMissingByte([TreatUndefinedAs=Missing] optional byte arg);
|
||||
void passOptionalByteWithDefault(optional byte arg = 0);
|
||||
void passOptionalByteWithDefaultBeforeRequired(optional byte arg1 = 0, byte arg2);
|
||||
void passOptionalUndefinedMissingByteWithDefault([TreatUndefinedAs=Missing] optional byte arg = 0);
|
||||
void passNullableByte(byte? arg);
|
||||
void passOptionalNullableByte(optional byte? arg);
|
||||
void passVariadicByte(byte... arg);
|
||||
@ -263,7 +263,9 @@ interface TestExampleInterface {
|
||||
void passString(DOMString arg);
|
||||
void passNullableString(DOMString? arg);
|
||||
void passOptionalString(optional DOMString arg);
|
||||
void passOptionalUndefinedMissingString([TreatUndefinedAs=Missing] optional DOMString arg);
|
||||
void passOptionalStringWithDefaultValue(optional DOMString arg = "abc");
|
||||
void passOptionalUndefinedMissingStringWithDefaultValue([TreatUndefinedAs=Missing] optional DOMString arg = "abc");
|
||||
void passOptionalNullableString(optional DOMString? arg);
|
||||
void passOptionalNullableStringWithDefaultValue(optional DOMString? arg = null);
|
||||
void passVariadicString(DOMString... arg);
|
||||
@ -476,22 +478,6 @@ interface TestExampleInterface {
|
||||
void overload7(ByteString arg);
|
||||
void overload8(long arg);
|
||||
void overload8(TestInterface arg);
|
||||
void overload9(long? arg);
|
||||
void overload9(DOMString arg);
|
||||
void overload10(long? arg);
|
||||
void overload10(object arg);
|
||||
void overload11(long arg);
|
||||
void overload11(DOMString? arg);
|
||||
void overload12(long arg);
|
||||
void overload12(boolean? arg);
|
||||
void overload13(long? arg);
|
||||
void overload13(boolean arg);
|
||||
void overload14(optional long arg);
|
||||
void overload14(TestInterface arg);
|
||||
void overload15(long arg);
|
||||
void overload15(optional TestInterface arg);
|
||||
void overload16(long arg);
|
||||
void overload16(optional TestInterface? arg);
|
||||
|
||||
// Variadic handling
|
||||
void passVariadicThirdArg(DOMString arg1, long arg2, TestInterface... arg3);
|
||||
|
@ -35,9 +35,9 @@ interface TestJSImplInterface {
|
||||
void passByte(byte arg);
|
||||
byte receiveByte();
|
||||
void passOptionalByte(optional byte arg);
|
||||
void passOptionalByteBeforeRequired(optional byte arg1, byte arg2);
|
||||
void passOptionalUndefinedMissingByte([TreatUndefinedAs=Missing] optional byte arg);
|
||||
void passOptionalByteWithDefault(optional byte arg = 0);
|
||||
void passOptionalByteWithDefaultBeforeRequired(optional byte arg1 = 0, byte arg2);
|
||||
void passOptionalUndefinedMissingByteWithDefault([TreatUndefinedAs=Missing] optional byte arg = 0);
|
||||
void passNullableByte(byte? arg);
|
||||
void passOptionalNullableByte(optional byte? arg);
|
||||
void passVariadicByte(byte... arg);
|
||||
@ -285,7 +285,9 @@ interface TestJSImplInterface {
|
||||
void passString(DOMString arg);
|
||||
void passNullableString(DOMString? arg);
|
||||
void passOptionalString(optional DOMString arg);
|
||||
void passOptionalUndefinedMissingString([TreatUndefinedAs=Missing] optional DOMString arg);
|
||||
void passOptionalStringWithDefaultValue(optional DOMString arg = "abc");
|
||||
void passOptionalUndefinedMissingStringWithDefaultValue([TreatUndefinedAs=Missing] optional DOMString arg = "abc");
|
||||
void passOptionalNullableString(optional DOMString? arg);
|
||||
void passOptionalNullableStringWithDefaultValue(optional DOMString? arg = null);
|
||||
void passVariadicString(DOMString... arg);
|
||||
@ -504,22 +506,6 @@ interface TestJSImplInterface {
|
||||
void overload7(ByteString arg);
|
||||
void overload8(long arg);
|
||||
void overload8(TestJSImplInterface arg);
|
||||
void overload9(long? arg);
|
||||
void overload9(DOMString arg);
|
||||
void overload10(long? arg);
|
||||
void overload10(object arg);
|
||||
void overload11(long arg);
|
||||
void overload11(DOMString? arg);
|
||||
void overload12(long arg);
|
||||
void overload12(boolean? arg);
|
||||
void overload13(long? arg);
|
||||
void overload13(boolean arg);
|
||||
void overload14(optional long arg);
|
||||
void overload14(TestInterface arg);
|
||||
void overload15(long arg);
|
||||
void overload15(optional TestInterface arg);
|
||||
void overload16(long arg);
|
||||
void overload16(optional TestInterface? arg);
|
||||
|
||||
// Variadic handling
|
||||
void passVariadicThirdArg(DOMString arg1, long arg2, TestJSImplInterface... arg3);
|
||||
|
@ -18,21 +18,17 @@ function checkDoc(title, expectedtitle, normalizedtitle) {
|
||||
assert_equals(doc.doctype.systemId, "")
|
||||
assert_equals(doc.documentElement.localName, "html")
|
||||
assert_equals(doc.documentElement.firstChild.localName, "head")
|
||||
if (title !== undefined) {
|
||||
assert_equals(doc.documentElement.firstChild.childNodes.length, 1)
|
||||
assert_equals(doc.documentElement.firstChild.firstChild.localName, "title")
|
||||
assert_equals(doc.documentElement.firstChild.firstChild.firstChild.data,
|
||||
expectedtitle)
|
||||
} else {
|
||||
assert_equals(doc.documentElement.firstChild.childNodes.length, 0)
|
||||
}
|
||||
assert_equals(doc.documentElement.firstChild.childNodes.length, 1)
|
||||
assert_equals(doc.documentElement.firstChild.firstChild.localName, "title")
|
||||
assert_equals(doc.documentElement.firstChild.firstChild.firstChild.data,
|
||||
expectedtitle)
|
||||
assert_equals(doc.documentElement.lastChild.localName, "body")
|
||||
assert_equals(doc.documentElement.lastChild.childNodes.length, 0)
|
||||
})
|
||||
}
|
||||
checkDoc("", "", "")
|
||||
checkDoc(null, "null", "null")
|
||||
checkDoc(undefined, "", "")
|
||||
checkDoc(undefined, "undefined", "undefined")
|
||||
checkDoc("foo bar baz", "foo bar baz", "foo bar baz")
|
||||
checkDoc("foo\t\tbar baz", "foo\t\tbar baz", "foo bar baz")
|
||||
checkDoc("foo\n\nbar baz", "foo\n\nbar baz", "foo bar baz")
|
||||
|
@ -12,7 +12,7 @@ function checkDoc(title, expectedtitle, normalizedtitle) {
|
||||
}
|
||||
checkDoc("", "", "")
|
||||
checkDoc(null, "null", "null")
|
||||
checkDoc(undefined, "", "")
|
||||
checkDoc(undefined, "undefined", "undefined")
|
||||
checkDoc("foo bar baz", "foo bar baz", "foo bar baz")
|
||||
checkDoc("foo\t\tbar baz", "foo\t\tbar baz", "foo bar baz")
|
||||
checkDoc("foo\n\nbar baz", "foo\n\nbar baz", "foo bar baz")
|
||||
|
@ -2802,7 +2802,7 @@ QuotaManager::FindSynchronizedOp(const nsACString& aPattern,
|
||||
for (uint32_t index = 0; index < mSynchronizedOps.Length(); index++) {
|
||||
const nsAutoPtr<SynchronizedOp>& currentOp = mSynchronizedOps[index];
|
||||
if (PatternMatchesOrigin(aPattern, currentOp->mOriginOrPattern) &&
|
||||
(currentOp->mPersistenceType.IsNull() ||
|
||||
(!currentOp->mPersistenceType ||
|
||||
currentOp->mPersistenceType == aPersistenceType) &&
|
||||
(!currentOp->mId || currentOp->mId == aId)) {
|
||||
return currentOp;
|
||||
@ -3067,7 +3067,7 @@ QuotaManager::CollectOriginsForEviction(uint64_t aMinSizeToBeFreed,
|
||||
uint32_t index;
|
||||
for (index = 0; index < mSynchronizedOps.Length(); index++) {
|
||||
nsAutoPtr<SynchronizedOp>& op = mSynchronizedOps[index];
|
||||
if (op->mPersistenceType.IsNull() ||
|
||||
if (!op->mPersistenceType ||
|
||||
op->mPersistenceType.Value() == PERSISTENCE_TYPE_TEMPORARY) {
|
||||
if (op->mOriginOrPattern.IsPattern() &&
|
||||
!originCollection.ContainsPattern(op->mOriginOrPattern)) {
|
||||
@ -3078,7 +3078,7 @@ QuotaManager::CollectOriginsForEviction(uint64_t aMinSizeToBeFreed,
|
||||
|
||||
for (index = 0; index < mSynchronizedOps.Length(); index++) {
|
||||
nsAutoPtr<SynchronizedOp>& op = mSynchronizedOps[index];
|
||||
if (op->mPersistenceType.IsNull() ||
|
||||
if (!op->mPersistenceType ||
|
||||
op->mPersistenceType.Value() == PERSISTENCE_TYPE_TEMPORARY) {
|
||||
if (op->mOriginOrPattern.IsOrigin() &&
|
||||
!originCollection.ContainsOrigin(op->mOriginOrPattern)) {
|
||||
|
@ -74,7 +74,7 @@ interface CanvasRenderingContext2D {
|
||||
|
||||
// path API (see also CanvasPathMethods)
|
||||
void beginPath();
|
||||
void fill(optional CanvasWindingRule winding = "nonzero");
|
||||
void fill([TreatUndefinedAs=Missing] optional CanvasWindingRule winding = "nonzero");
|
||||
// NOT IMPLEMENTED void fill(Path path);
|
||||
void stroke();
|
||||
// NOT IMPLEMENTED void stroke(Path path);
|
||||
@ -84,10 +84,10 @@ interface CanvasRenderingContext2D {
|
||||
// NOT IMPLEMENTED boolean drawCustomFocusRing(Path path, Element element);
|
||||
// NOT IMPLEMENTED void scrollPathIntoView();
|
||||
// NOT IMPLEMENTED void scrollPathIntoView(Path path);
|
||||
void clip(optional CanvasWindingRule winding = "nonzero");
|
||||
void clip([TreatUndefinedAs=Missing] optional CanvasWindingRule winding = "nonzero");
|
||||
// NOT IMPLEMENTED void clip(Path path);
|
||||
// NOT IMPLEMENTED void resetClip();
|
||||
boolean isPointInPath(unrestricted double x, unrestricted double y, optional CanvasWindingRule winding = "nonzero");
|
||||
boolean isPointInPath(unrestricted double x, unrestricted double y, [TreatUndefinedAs=Missing] optional CanvasWindingRule winding = "nonzero");
|
||||
// NOT IMPLEMENTED boolean isPointInPath(Path path, unrestricted double x, unrestricted double y);
|
||||
boolean isPointInStroke(double x, double y);
|
||||
|
||||
|
@ -28,9 +28,9 @@ interface Promise {
|
||||
static Promise reject(any value);
|
||||
|
||||
[Creator]
|
||||
Promise then(optional AnyCallback fulfillCallback,
|
||||
optional AnyCallback rejectCallback);
|
||||
Promise then([TreatUndefinedAs=Missing] optional AnyCallback fulfillCallback,
|
||||
[TreatUndefinedAs=Missing] optional AnyCallback rejectCallback);
|
||||
|
||||
[Creator]
|
||||
Promise catch(optional AnyCallback rejectCallback);
|
||||
Promise catch([TreatUndefinedAs=Missing] optional AnyCallback rejectCallback);
|
||||
};
|
||||
|
@ -71,9 +71,7 @@ interface XMLHttpRequest : XMLHttpRequestEventTarget {
|
||||
|
||||
// request
|
||||
[Throws]
|
||||
void open(ByteString method, DOMString url);
|
||||
[Throws]
|
||||
void open(ByteString method, DOMString url, boolean async,
|
||||
void open(ByteString method, DOMString url, optional boolean async = true,
|
||||
optional DOMString? user, optional DOMString? password);
|
||||
[Throws]
|
||||
void setRequestHeader(ByteString header, ByteString value);
|
||||
|
@ -121,11 +121,6 @@ public:
|
||||
return mStateData.mReadyState;
|
||||
}
|
||||
|
||||
void Open(const nsACString& aMethod, const nsAString& aUrl, ErrorResult& aRv)
|
||||
{
|
||||
Open(aMethod, aUrl, true, Optional<nsAString>(),
|
||||
Optional<nsAString>(), aRv);
|
||||
}
|
||||
void
|
||||
Open(const nsACString& aMethod, const nsAString& aUrl, bool aAsync,
|
||||
const Optional<nsAString>& aUser, const Optional<nsAString>& aPassword,
|
||||
|
@ -52,7 +52,7 @@ function run_test()
|
||||
// Test sync XHR sending
|
||||
cu.evalInSandbox('var createXHR = ' + createXHR.toString(), sb);
|
||||
var res = cu.evalInSandbox('var sync = createXHR("4444/simple"); sync.send(null); sync', sb);
|
||||
do_check_true(checkResults(res));
|
||||
checkResults(res);
|
||||
|
||||
// negative test sync XHR sending (to ensure that the xhr do not have chrome caps, see bug 779821)
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user