diff --git a/content/base/public/Element.h b/content/base/public/Element.h index 5f323e245c29..2ebdcf6be54f 100644 --- a/content/base/public/Element.h +++ b/content/base/public/Element.h @@ -646,6 +646,10 @@ public: already_AddRefed GetClientRects(); already_AddRefed GetBoundingClientRect(); + void ScrollIntoView() + { + ScrollIntoView(true); + } void ScrollIntoView(bool aTop); int32_t ScrollTop() { diff --git a/content/base/public/nsIDocument.h b/content/base/public/nsIDocument.h index 798e117889fe..50c33fcb0178 100644 --- a/content/base/public/nsIDocument.h +++ b/content/base/public/nsIDocument.h @@ -2001,6 +2001,11 @@ public: mozilla::ErrorResult& rv) const; already_AddRefed ImportNode(nsINode& aNode, bool aDeep, mozilla::ErrorResult& rv) const; + already_AddRefed + ImportNode(nsINode& aNode, mozilla::ErrorResult& rv) const + { + return ImportNode(aNode, true, rv); + } nsINode* AdoptNode(nsINode& aNode, mozilla::ErrorResult& rv); already_AddRefed CreateEvent(const nsAString& aEventType, mozilla::ErrorResult& rv) const; diff --git a/content/base/public/nsINode.h b/content/base/public/nsINode.h index 2fbc246fd01d..a6da12d4613f 100644 --- a/content/base/public/nsINode.h +++ b/content/base/public/nsINode.h @@ -1533,6 +1533,10 @@ public: return ReplaceOrInsertBefore(true, &aNode, &aChild, aError); } nsINode* RemoveChild(nsINode& aChild, mozilla::ErrorResult& aError); + already_AddRefed CloneNode(mozilla::ErrorResult& aError) + { + return CloneNode(true, aError); + } already_AddRefed CloneNode(bool aDeep, mozilla::ErrorResult& aError); bool IsEqualNode(nsINode* aNode); void GetNamespaceURI(nsAString& aNamespaceURI) const diff --git a/content/base/src/nsXMLHttpRequest.h b/content/base/src/nsXMLHttpRequest.h index ef2eb8e50fa6..e66da6040af3 100644 --- a/content/base/src/nsXMLHttpRequest.h +++ b/content/base/src/nsXMLHttpRequest.h @@ -282,6 +282,13 @@ public: uint16_t ReadyState(); // request + void Open(const nsACString& aMethod, const nsAString& aUrl, ErrorResult& aRv) + { + Open(aMethod, aUrl, true, + mozilla::dom::Optional(), + mozilla::dom::Optional(), + aRv); + } void Open(const nsACString& aMethod, const nsAString& aUrl, bool aAsync, const mozilla::dom::Optional& aUser, const mozilla::dom::Optional& aPassword, diff --git a/content/base/test/test_createHTMLDocument.html b/content/base/test/test_createHTMLDocument.html index 40f585b2b060..14749a2df849 100644 --- a/content/base/test/test_createHTMLDocument.html +++ b/content/base/test/test_createHTMLDocument.html @@ -27,11 +27,15 @@ function checkDoc(title, expectedtitle, normalizedtitle) { is(doc.doctype.internalSubset, null, "internalSubset should be null!"); isElement(doc.documentElement, "html"); isElement(doc.documentElement.firstChild, "head"); - 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); + 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); + } isElement(doc.documentElement.lastChild, "body"); is(doc.documentElement.lastChild.childNodes.length, 0); ((!title || title.indexOf("\f") === -1) ? is : todo_is) @@ -41,7 +45,7 @@ function checkDoc(title, expectedtitle, normalizedtitle) { } checkDoc("", "", ""); checkDoc(null, "null", "null"); -checkDoc(undefined, "undefined", "undefined"); +checkDoc(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"); diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 26a1bfee17fb..ee8beec371f9 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -3348,9 +3348,6 @@ 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. @@ -3870,11 +3867,8 @@ class CGArgumentConverter(CGThing): "args[${index}]" ).substitute(replacer) self.replacementVariables["mutableVal"] = self.replacementVariables["val"] - if argument.treatUndefinedAs == "Missing": - haveValueCheck = "args.hasDefined(${index})" - else: - haveValueCheck = "${index} < args.length()" - haveValueCheck = string.Template(haveValueCheck).substitute(replacer) + haveValueCheck = string.Template( + "args.hasDefined(${index})").substitute(replacer) self.replacementVariables["haveValue"] = haveValueCheck self.descriptorProvider = descriptorProvider if self.argument.optional and not self.argument.defaultValue: diff --git a/dom/bindings/parser/WebIDL.py b/dom/bindings/parser/WebIDL.py index f4359b247fbb..51921078fccb 100644 --- a/dom/bindings/parser/WebIDL.py +++ b/dom/bindings/parser/WebIDL.py @@ -401,12 +401,7 @@ class IDLObjectWithIdentifier(IDLObject): if isDictionaryMember: raise WebIDLError("[TreatUndefinedAs] is not allowed for " "dictionary members", [self.location]) - if value == 'Missing': - if not isOptional: - raise WebIDLError("[TreatUndefinedAs=Missing] is only " - "allowed on optional arguments", - [self.location]) - elif value == 'Null': + if value == 'Null': if not self.type.isDOMString(): raise WebIDLError("[TreatUndefinedAs=Null] is only " "allowed on arguments or " @@ -426,8 +421,8 @@ class IDLObjectWithIdentifier(IDLObject): [self.location]) else: raise WebIDLError("[TreatUndefinedAs] must take the " - "identifiers EmptyString or Null or " - "Missing", [self.location]) + "identifiers EmptyString or Null", + [self.location]) self.treatUndefinedAs = value else: unhandledAttrs.append(attr) diff --git a/dom/bindings/test/TestBindingHeader.h b/dom/bindings/test/TestBindingHeader.h index 0f7bb01760ce..8c8ce0a0c269 100644 --- a/dom/bindings/test/TestBindingHeader.h +++ b/dom/bindings/test/TestBindingHeader.h @@ -161,9 +161,9 @@ public: void PassByte(int8_t); int8_t ReceiveByte(); void PassOptionalByte(const Optional&); - void PassOptionalUndefinedMissingByte(const Optional&); + void PassOptionalByteBeforeRequired(const Optional&, int8_t); void PassOptionalByteWithDefault(int8_t); - void PassOptionalUndefinedMissingByteWithDefault(int8_t); + void PassOptionalByteWithDefaultBeforeRequired(int8_t, int8_t); void PassNullableByte(const Nullable&); void PassOptionalNullableByte(const Optional< Nullable >&); void PassVariadicByte(const Sequence&); @@ -410,9 +410,7 @@ public: void PassString(const nsAString&); void PassNullableString(const nsAString&); void PassOptionalString(const Optional&); - void PassOptionalUndefinedMissingString(const Optional&); void PassOptionalStringWithDefaultValue(const nsAString&); - void PassOptionalUndefinedMissingStringWithDefaultValue(const nsAString&); void PassOptionalNullableString(const Optional&); void PassOptionalNullableStringWithDefaultValue(const nsAString&); void PassVariadicString(const Sequence&); diff --git a/dom/bindings/test/TestCodeGen.webidl b/dom/bindings/test/TestCodeGen.webidl index 6921744765b6..b5e945c0f81d 100644 --- a/dom/bindings/test/TestCodeGen.webidl +++ b/dom/bindings/test/TestCodeGen.webidl @@ -118,9 +118,9 @@ interface TestInterface { void passByte(byte arg); byte receiveByte(); void passOptionalByte(optional byte arg); - void passOptionalUndefinedMissingByte([TreatUndefinedAs=Missing] optional byte arg); + void passOptionalByteBeforeRequired(optional byte arg1, byte arg2); void passOptionalByteWithDefault(optional byte arg = 0); - void passOptionalUndefinedMissingByteWithDefault([TreatUndefinedAs=Missing] optional byte arg = 0); + void passOptionalByteWithDefaultBeforeRequired(optional byte arg1 = 0, byte arg2); void passNullableByte(byte? arg); void passOptionalNullableByte(optional byte? arg); void passVariadicByte(byte... arg); @@ -365,9 +365,7 @@ 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); diff --git a/dom/bindings/test/TestExampleGen.webidl b/dom/bindings/test/TestExampleGen.webidl index 09f6cfdf9f6f..109068eab104 100644 --- a/dom/bindings/test/TestExampleGen.webidl +++ b/dom/bindings/test/TestExampleGen.webidl @@ -23,9 +23,9 @@ interface TestExampleInterface { void passByte(byte arg); byte receiveByte(); void passOptionalByte(optional byte arg); - void passOptionalUndefinedMissingByte([TreatUndefinedAs=Missing] optional byte arg); + void passOptionalByteBeforeRequired(optional byte arg1, byte arg2); void passOptionalByteWithDefault(optional byte arg = 0); - void passOptionalUndefinedMissingByteWithDefault([TreatUndefinedAs=Missing] optional byte arg = 0); + void passOptionalByteWithDefaultBeforeRequired(optional byte arg1 = 0, byte arg2); void passNullableByte(byte? arg); void passOptionalNullableByte(optional byte? arg); void passVariadicByte(byte... arg); @@ -263,9 +263,7 @@ 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); diff --git a/dom/bindings/test/TestJSImplGen.webidl b/dom/bindings/test/TestJSImplGen.webidl index 17c0f5ea7fa0..a4a48e131f06 100644 --- a/dom/bindings/test/TestJSImplGen.webidl +++ b/dom/bindings/test/TestJSImplGen.webidl @@ -35,9 +35,9 @@ interface TestJSImplInterface { void passByte(byte arg); byte receiveByte(); void passOptionalByte(optional byte arg); - void passOptionalUndefinedMissingByte([TreatUndefinedAs=Missing] optional byte arg); + void passOptionalByteBeforeRequired(optional byte arg1, byte arg2); void passOptionalByteWithDefault(optional byte arg = 0); - void passOptionalUndefinedMissingByteWithDefault([TreatUndefinedAs=Missing] optional byte arg = 0); + void passOptionalByteWithDefaultBeforeRequired(optional byte arg1 = 0, byte arg2); void passNullableByte(byte? arg); void passOptionalNullableByte(optional byte? arg); void passVariadicByte(byte... arg); @@ -285,9 +285,7 @@ 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); diff --git a/dom/bindings/test/mochitest.ini b/dom/bindings/test/mochitest.ini index a93f7a1fea10..3b019305bd7d 100644 --- a/dom/bindings/test/mochitest.ini +++ b/dom/bindings/test/mochitest.ini @@ -16,6 +16,7 @@ support-files = [test_bug788369.html] [test_bug852846.html] [test_bug862092.html] +[test_cloneAndImportNode.html] [test_defineProperty.html] [test_enums.html] [test_exceptionThrowing.html] diff --git a/dom/bindings/test/test_cloneAndImportNode.html b/dom/bindings/test/test_cloneAndImportNode.html new file mode 100644 index 000000000000..d173131a7ced --- /dev/null +++ b/dom/bindings/test/test_cloneAndImportNode.html @@ -0,0 +1,42 @@ + + + + + + Test for Bug 882541 + + + + + +Mozilla Bug 882541 +

+ +
+
+ + diff --git a/dom/imptests/html/dom/nodes/test_DOMImplementation-createHTMLDocument.html b/dom/imptests/html/dom/nodes/test_DOMImplementation-createHTMLDocument.html index d80482817974..12d1bb76e85f 100644 --- a/dom/imptests/html/dom/nodes/test_DOMImplementation-createHTMLDocument.html +++ b/dom/imptests/html/dom/nodes/test_DOMImplementation-createHTMLDocument.html @@ -18,17 +18,21 @@ function checkDoc(title, expectedtitle, normalizedtitle) { assert_equals(doc.doctype.systemId, "") assert_equals(doc.documentElement.localName, "html") assert_equals(doc.documentElement.firstChild.localName, "head") - 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) + 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.lastChild.localName, "body") assert_equals(doc.documentElement.lastChild.childNodes.length, 0) }) } checkDoc("", "", "") checkDoc(null, "null", "null") -checkDoc(undefined, "undefined", "undefined") +checkDoc(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") diff --git a/dom/imptests/html/html/dom/documents/dta/test_document.title-07.html b/dom/imptests/html/html/dom/documents/dta/test_document.title-07.html index ad6e7111d27a..eea97c9ede1b 100644 --- a/dom/imptests/html/html/dom/documents/dta/test_document.title-07.html +++ b/dom/imptests/html/html/dom/documents/dta/test_document.title-07.html @@ -12,7 +12,7 @@ function checkDoc(title, expectedtitle, normalizedtitle) { } checkDoc("", "", "") checkDoc(null, "null", "null") -checkDoc(undefined, "undefined", "undefined") +checkDoc(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") diff --git a/dom/webidl/CanvasRenderingContext2D.webidl b/dom/webidl/CanvasRenderingContext2D.webidl index cf1914b06d29..de8f5155115e 100644 --- a/dom/webidl/CanvasRenderingContext2D.webidl +++ b/dom/webidl/CanvasRenderingContext2D.webidl @@ -73,7 +73,7 @@ interface CanvasRenderingContext2D { // path API (see also CanvasPathMethods) void beginPath(); - void fill([TreatUndefinedAs=Missing] optional CanvasWindingRule winding = "nonzero"); + void fill(optional CanvasWindingRule winding = "nonzero"); // NOT IMPLEMENTED void fill(Path path); void stroke(); // NOT IMPLEMENTED void stroke(Path path); @@ -83,10 +83,10 @@ interface CanvasRenderingContext2D { // NOT IMPLEMENTED boolean drawCustomFocusRing(Path path, Element element); // NOT IMPLEMENTED void scrollPathIntoView(); // NOT IMPLEMENTED void scrollPathIntoView(Path path); - void clip([TreatUndefinedAs=Missing] optional CanvasWindingRule winding = "nonzero"); + void clip(optional CanvasWindingRule winding = "nonzero"); // NOT IMPLEMENTED void clip(Path path); // NOT IMPLEMENTED void resetClip(); - boolean isPointInPath(unrestricted double x, unrestricted double y, [TreatUndefinedAs=Missing] optional CanvasWindingRule winding = "nonzero"); + boolean isPointInPath(unrestricted double x, unrestricted double y, optional CanvasWindingRule winding = "nonzero"); // NOT IMPLEMENTED boolean isPointInPath(Path path, unrestricted double x, unrestricted double y); boolean isPointInStroke(double x, double y); diff --git a/dom/webidl/Document.webidl b/dom/webidl/Document.webidl index 6f24026b98dd..1520239d0e33 100644 --- a/dom/webidl/Document.webidl +++ b/dom/webidl/Document.webidl @@ -54,7 +54,9 @@ interface Document : Node { ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data); [Throws] - Node importNode(Node node, optional boolean deep = true); + Node importNode(Node node, boolean deep); + [Throws] + Node importNode(Node node); [Throws] Node adoptNode(Node node); diff --git a/dom/webidl/Element.webidl b/dom/webidl/Element.webidl index 266b8cfd535c..1e741312ef91 100644 --- a/dom/webidl/Element.webidl +++ b/dom/webidl/Element.webidl @@ -141,7 +141,8 @@ partial interface Element { DOMRect getBoundingClientRect(); // scrolling - void scrollIntoView(optional boolean top = true); + void scrollIntoView(); + void scrollIntoView(boolean top); // None of the CSSOM attributes are [Pure], because they flush attribute long scrollTop; // scroll on setting attribute long scrollLeft; // scroll on setting diff --git a/dom/webidl/Node.webidl b/dom/webidl/Node.webidl index cddd9a47a65d..d89d18c7ddd3 100644 --- a/dom/webidl/Node.webidl +++ b/dom/webidl/Node.webidl @@ -68,7 +68,9 @@ interface Node : EventTarget { void normalize(); [Throws] - Node cloneNode(optional boolean deep = true); + Node cloneNode(); + [Throws] + Node cloneNode(boolean deep); boolean isEqualNode(Node? node); const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01; diff --git a/dom/webidl/Promise.webidl b/dom/webidl/Promise.webidl index 9d9d1a19aeec..8cea8a33aff0 100644 --- a/dom/webidl/Promise.webidl +++ b/dom/webidl/Promise.webidl @@ -28,9 +28,9 @@ interface Promise { static Promise reject(any value); [NewObject] - Promise then([TreatUndefinedAs=Missing] optional AnyCallback fulfillCallback, - [TreatUndefinedAs=Missing] optional AnyCallback rejectCallback); + Promise then(optional AnyCallback fulfillCallback, + optional AnyCallback rejectCallback); [NewObject] - Promise catch([TreatUndefinedAs=Missing] optional AnyCallback rejectCallback); + Promise catch(optional AnyCallback rejectCallback); }; diff --git a/dom/webidl/XMLHttpRequest.webidl b/dom/webidl/XMLHttpRequest.webidl index 16dee05baa9d..ba20b72ca0f7 100644 --- a/dom/webidl/XMLHttpRequest.webidl +++ b/dom/webidl/XMLHttpRequest.webidl @@ -71,7 +71,9 @@ interface XMLHttpRequest : XMLHttpRequestEventTarget { // request [Throws] - void open(ByteString method, DOMString url, optional boolean async = true, + void open(ByteString method, DOMString url); + [Throws] + void open(ByteString method, DOMString url, boolean async, optional DOMString? user, optional DOMString? password); [Throws] void setRequestHeader(ByteString header, ByteString value); diff --git a/dom/workers/XMLHttpRequest.h b/dom/workers/XMLHttpRequest.h index 29ba0536ccc4..85616f8361a7 100644 --- a/dom/workers/XMLHttpRequest.h +++ b/dom/workers/XMLHttpRequest.h @@ -121,6 +121,11 @@ public: return mStateData.mReadyState; } + void Open(const nsACString& aMethod, const nsAString& aUrl, ErrorResult& aRv) + { + Open(aMethod, aUrl, true, Optional(), + Optional(), aRv); + } void Open(const nsACString& aMethod, const nsAString& aUrl, bool aAsync, const Optional& aUser, const Optional& aPassword, diff --git a/js/xpconnect/tests/unit/test_allowedDomainsXHR.js b/js/xpconnect/tests/unit/test_allowedDomainsXHR.js index 7d257c5a9ad9..387a34c1e9cf 100644 --- a/js/xpconnect/tests/unit/test_allowedDomainsXHR.js +++ b/js/xpconnect/tests/unit/test_allowedDomainsXHR.js @@ -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); - checkResults(res); + do_check_true(checkResults(res)); // negative test sync XHR sending (to ensure that the xhr do not have chrome caps, see bug 779821) try {