Backed out changeset ccf11ae08ba2 (bug 882541)

This commit is contained in:
Ed Morley 2013-10-14 17:30:43 +01:00
parent fb825e85f3
commit 566ebb2848
15 changed files with 52 additions and 55 deletions

View File

@ -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,

View File

@ -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");

View File

@ -3320,6 +3320,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 +3842,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:

View File

@ -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)

View File

@ -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>&);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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")

View File

@ -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")

View File

@ -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);

View File

@ -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);
};

View File

@ -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);

View File

@ -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,

View File

@ -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 {