From c9624f0f7abcdcc30ad439dc8b582d6ecbd1860f Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Tue, 17 Jul 2012 17:48:11 +0100 Subject: [PATCH] Backout 9deb8edb5070 (bug 773519), ea5a243a60f1 & 0cad1e553bea (bug 768537) for compilation failures --- content/base/src/nsXMLHttpRequest.h | 7 +- dom/bindings/BindingUtils.h | 91 +---------- dom/bindings/Codegen.py | 72 ++++----- dom/bindings/parser/WebIDL.py | 145 ++++++------------ dom/bindings/parser/tests/test_dictionary.py | 75 --------- .../parser/tests/test_distinguishability.py | 2 +- dom/bindings/test/TestBindingHeader.h | 5 +- dom/bindings/test/TestCodeGen.webidl | 9 +- dom/webidl/XMLHttpRequest.webidl | 2 +- dom/workers/XMLHttpRequest.cpp | 2 +- dom/workers/XMLHttpRequest.h | 2 +- 11 files changed, 100 insertions(+), 312 deletions(-) diff --git a/content/base/src/nsXMLHttpRequest.h b/content/base/src/nsXMLHttpRequest.h index b16a4b68abe0..c0d87dbc1917 100644 --- a/content/base/src/nsXMLHttpRequest.h +++ b/content/base/src/nsXMLHttpRequest.h @@ -181,7 +181,7 @@ public: static already_AddRefed Constructor(JSContext* aCx, nsISupports* aGlobal, - const mozilla::dom::MozXMLHttpRequestParameters& aParams, + const mozilla::dom::Nullable& aParams, ErrorResult& aRv) { nsCOMPtr window = do_QueryInterface(aGlobal); @@ -193,7 +193,10 @@ public: nsRefPtr req = new nsXMLHttpRequest(); req->Construct(principal->GetPrincipal(), window); - req->InitParameters(aParams.mozAnon, aParams.mozSystem); + if (!aParams.IsNull()) { + const mozilla::dom::MozXMLHttpRequestParameters& params = aParams.Value(); + req->InitParameters(params.mozAnon, params.mozSystem); + } return req.forget(); } diff --git a/dom/bindings/BindingUtils.h b/dom/bindings/BindingUtils.h index 59514e56c3d0..92c5cf5c1429 100644 --- a/dom/bindings/BindingUtils.h +++ b/dom/bindings/BindingUtils.h @@ -682,15 +682,6 @@ public: #endif } - template - void operator=(U* t) { - ptr = t->ToAStringPtr(); - MOZ_ASSERT(ptr); -#ifdef DEBUG - inited = true; -#endif - } - T** Slot() { #ifdef DEBUG inited = true; @@ -745,72 +736,6 @@ protected: #endif }; -// A struct that has the same layout as an nsDependentString but much -// faster constructor and destructor behavior -struct FakeDependentString { - FakeDependentString() : - mFlags(nsDependentString::F_TERMINATED) - { - } - - void SetData(const nsDependentString::char_type* aData, - nsDependentString::size_type aLength) { - MOZ_ASSERT(mFlags == nsDependentString::F_TERMINATED); - mData = aData; - mLength = aLength; - } - - void Truncate() { - mData = nsnull; - mLength = 0; - } - - void SetNull() { - Truncate(); - mFlags |= nsDependentString::F_VOIDED; - } - - const nsAString* ToAStringPtr() const { - return reinterpret_cast(this); - } - - nsAString* ToAStringPtr() { - return reinterpret_cast(this); - } - - operator const nsAString& () const { - return *reinterpret_cast(this); - } - -private: - const nsDependentString::char_type* mData; - nsDependentString::size_type mLength; - PRUint32 mFlags; - - // A class to use for our static asserts to ensure our object layout - // matches that of nsDependentString. - class DepedentStringAsserter : public nsDependentString { - public: - static const size_t dataOffset = offsetof(nsDependentString, mData); - static const size_t lengthOffset = offsetof(nsDependentString, mLength); - static const size_t flagsOffset = offsetof(nsDependentString, mFlags); - }; - - static void StaticAsserts() { - MOZ_STATIC_ASSERT(sizeof(FakeDependentString) == sizeof(nsDependentString), - "Must have right object size"); - MOZ_STATIC_ASSERT(offsetof(FakeDependentString, mData) == - DepedentStringAsserter::dataOffset, - "Offset of mData should match"); - MOZ_STATIC_ASSERT(offsetof(FakeDependentString, mLength) == - DepedentStringAsserter::lengthOffset, - "Offset of mLength should match"); - MOZ_STATIC_ASSERT(offsetof(FakeDependentString, mFlags) == - DepedentStringAsserter::flagsOffset, - "Offset of mFlags should match"); - } -}; - enum StringificationBehavior { eStringify, eEmpty, @@ -821,7 +746,7 @@ static inline bool ConvertJSValueToString(JSContext* cx, const JS::Value& v, JS::Value* pval, StringificationBehavior nullBehavior, StringificationBehavior undefinedBehavior, - FakeDependentString& result) + nsDependentString& result) { JSString *s; if (v.isString()) { @@ -842,11 +767,7 @@ ConvertJSValueToString(JSContext* cx, const JS::Value& v, JS::Value* pval, if (behavior != eStringify || !pval) { // Here behavior == eStringify implies !pval, so both eNull and // eStringify should end up with void strings. - if (behavior == eEmpty) { - result.Truncate(); - } else { - result.SetNull(); - } + result.SetIsVoid(behavior != eEmpty); return true; } @@ -863,7 +784,7 @@ ConvertJSValueToString(JSContext* cx, const JS::Value& v, JS::Value* pval, return false; } - result.SetData(chars, len); + result.Rebind(chars, len); return true; } @@ -918,12 +839,6 @@ public: mPassed = true; } - void operator=(const FakeDependentString* str) { - MOZ_ASSERT(str); - mStr = str->ToAStringPtr(); - mPassed = true; - } - const nsAString& Value() const { MOZ_ASSERT(WasPassed()); return *mStr; diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 15dce27d8316..b7ccbf47b85c 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -1977,7 +1977,7 @@ for (uint32_t i = 0; i < length; ++i) { declType = CGGeneric("nsString") return ( "{\n" - " FakeDependentString str;\n" + " nsDependentString str;\n" " if (!ConvertJSValueToString(cx, ${val}, ${valPtr}, %s, %s, str)) {\n" " return false;\n" " }\n" @@ -1997,7 +1997,7 @@ for (uint32_t i = 0; i < length; ++i) { "}\n" "const_cast<%s&>(${declName}) = &${holderName};" % (nullBehavior, undefinedBehavior, declType), - CGGeneric("const " + declType), CGGeneric("FakeDependentString"), + CGGeneric("const " + declType), CGGeneric("nsDependentString"), # No need to deal with Optional here; we have handled it already False) @@ -2058,30 +2058,35 @@ for (uint32_t i = 0; i < length; ++i) { if type.isDictionary(): if failureCode is not None: raise TypeError("Can't handle dictionaries when failureCode is not None") - # There are no nullable dictionaries - assert not type.nullable() - # All optional dictionaries always have default values, so we - # should be able to assume not isOptional here. - assert not isOptional - typeName = CGDictionary.makeDictionaryName(type.inner, - descriptorProvider.workers) - actualTypeName = typeName - selfRef = "${declName}" + if type.nullable(): + typeName = CGDictionary.makeDictionaryName(type.inner.inner, + descriptorProvider.workers) + actualTypeName = "Nullable<%s>" % typeName + selfRef = "const_cast<%s&>(${declName}).SetValue()" % actualTypeName + else: + typeName = CGDictionary.makeDictionaryName(type.inner, + descriptorProvider.workers) + actualTypeName = typeName + selfRef = "${declName}" declType = CGGeneric(actualTypeName) - # If we're a member of something else, the const + # If we're optional or a member of something else, the const # will come from the Optional or our container. - if not isMember: + if not isOptional and not isMember: declType = CGWrapper(declType, pre="const ") selfRef = "const_cast<%s&>(%s)" % (typeName, selfRef) - template = ("if (!%s.Init(cx, ${val})) {\n" - " return false;\n" - "}" % selfRef) + template = wrapObjectTemplate("if (!%s.Init(cx, &${val}.toObject())) {\n" + " return false;\n" + "}" % selfRef, + isDefinitelyObject, type, + ("const_cast<%s&>(${declName}).SetNull()" % + actualTypeName), + descriptorProvider.workers, None) - return (template, declType, None, False) + return (template, declType, None, isOptional) if not type.isPrimitive(): raise TypeError("Need conversion for argument type '%s'" % type) @@ -2828,13 +2833,6 @@ class CGMethodCall(CGThing): distinguishingIndex = method.distinguishingIndexForArgCount(argCount) - # We can't handle unions at the distinguishing index. - for (returnType, args) in possibleSignatures: - if args[distinguishingIndex].type.isUnion(): - raise TypeError("No support for unions as distinguishing " - "arguments yet: %s", - args[distinguishingIndex].location) - # Convert all our arguments up to the distinguishing index. # Doesn't matter which of the possible signatures we use, since # they all have the same types up to that point; just use @@ -2865,8 +2863,7 @@ class CGMethodCall(CGThing): # First check for null or undefined pickFirstSignature("%s.isNullOrUndefined()" % distinguishingArg, - lambda s: (s[1][distinguishingIndex].type.nullable() or - s[1][distinguishingIndex].type.isDictionary())) + lambda s: s[1][distinguishingIndex].type.nullable()) # Now check for distinguishingArg being an object that implements a # non-callback interface. That includes typed arrays and @@ -3285,8 +3282,6 @@ def getUnionAccessorSignatureType(type, descriptorProvider): def getUnionTypeTemplateVars(type, descriptorProvider): # For dictionaries and sequences we need to pass None as the failureCode # for getJSToNativeConversionTemplate. - # Also, for dictionaries we would need to handle conversion of - # null/undefined to the dictionary correctly. if type.isDictionary() or type.isSequence(): raise TypeError("Can't handle dictionaries or sequences in unions") @@ -4111,7 +4106,7 @@ class CGDictionary(CGThing): return (string.Template( "struct ${selfName} ${inheritance}{\n" " ${selfName}() {}\n" - " bool Init(JSContext* cx, const JS::Value& val);\n" + " bool Init(JSContext* cx, JSObject* obj);\n" "\n" + "\n".join(memberDecls) + "\n" "private:\n" @@ -4131,7 +4126,7 @@ class CGDictionary(CGThing): d = self.dictionary if d.parent: initParent = ("// Per spec, we init the parent's members first\n" - "if (!%s::Init(cx, val)) {\n" + "if (!%s::Init(cx, obj)) {\n" " return false;\n" "}\n" % self.makeClassName(d.parent)) else: @@ -4165,7 +4160,7 @@ class CGDictionary(CGThing): "}\n" "\n" "bool\n" - "${selfName}::Init(JSContext* cx, const JS::Value& val)\n" + "${selfName}::Init(JSContext* cx, JSObject* obj)\n" "{\n" " if (!initedIds && !InitIds(cx)) {\n" " return false;\n" @@ -4173,10 +4168,6 @@ class CGDictionary(CGThing): "${initParent}" " JSBool found;\n" " JS::Value temp;\n" - " bool isNull = val.isNullOrUndefined();\n" - " if (!isNull && !val.isObject()) {\n" - " return Throw<${isMainThread}>(cx, NS_ERROR_XPC_BAD_CONVERT_JS);\n" - " }\n" "\n" "${initMembers}\n" " return true;\n" @@ -4184,8 +4175,7 @@ class CGDictionary(CGThing): "selfName": self.makeClassName(d), "initParent": CGIndenter(CGGeneric(initParent)).define(), "initMembers": "\n\n".join(memberInits), - "idInit": CGIndenter(idinit).define(), - "isMainThread": toStringBool(not self.workers) + "idInit": CGIndenter(idinit).define() }) @staticmethod @@ -4232,15 +4222,13 @@ class CGDictionary(CGThing): "prop": "(this->%s)" % member.identifier.name, "convert": string.Template(templateBody).substitute(replacements) } - conversion = ("if (isNull) {\n" - " found = false;\n" - "} else if (!JS_HasPropertyById(cx, &val.toObject(), ${propId}, &found)) {\n" + conversion = ("if (!JS_HasPropertyById(cx, obj, ${propId}, &found)) {\n" " return false;\n" "}\n") if member.defaultValue: conversion += ( "if (found) {\n" - " if (!JS_GetPropertyById(cx, &val.toObject(), ${propId}, &temp)) {\n" + " if (!JS_GetPropertyById(cx, obj, ${propId}, &temp)) {\n" " return false;\n" " }\n" "} else {\n" @@ -4253,7 +4241,7 @@ class CGDictionary(CGThing): conversion += ( "if (found) {\n" " ${prop}.Construct();\n" - " if (!JS_GetPropertyById(cx, &val.toObject(), ${propId}, &temp)) {\n" + " if (!JS_GetPropertyById(cx, obj, ${propId}, &temp)) {\n" " return false;\n" " }\n" "${convert}\n" diff --git a/dom/bindings/parser/WebIDL.py b/dom/bindings/parser/WebIDL.py index 9cecc168cf13..2ca973b794d5 100644 --- a/dom/bindings/parser/WebIDL.py +++ b/dom/bindings/parser/WebIDL.py @@ -707,9 +707,11 @@ class IDLDictionary(IDLObjectWithScope): for member in self.members: member.resolve(self) - if not member.isComplete(): - member.complete(scope) - assert member.type.isComplete() + if not member.type.isComplete(): + type = member.type.complete(scope) + assert not isinstance(type, IDLUnresolvedType) + assert not isinstance(type.name, IDLUnresolvedIdentifier) + member.type = type # Members of a dictionary are sorted in lexicographic order self.members.sort(cmp=cmp, key=lambda x: x.identifier.name) @@ -1017,23 +1019,10 @@ class IDLNullableType(IDLType): def complete(self, scope): self.inner = self.inner.complete(scope) - if self.inner.isUnion(): - if self.inner.hasNullableType: - 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]) - # Check for dictionaries in the union - for memberType in self.inner.flatMemberTypes: - if memberType.isDictionary(): - raise WebIDLError("The inner type of a nullable type must " - "not be a union type containing a " - "dictionary type", - [self.location, memberType.location]) - - if self.inner.isDictionary(): + if self.inner.isUnion() and self.inner.hasNullableType: raise WebIDLError("The inner type of a nullable type must not be a " - "dictionary type", [self.location]) - + "union type that itself has a nullable type as a " + "member type", [self.location]) self.name = self.inner.name return self @@ -1041,8 +1030,7 @@ class IDLNullableType(IDLType): return self.inner.unroll() def isDistinguishableFrom(self, other): - if (other.nullable() or (other.isUnion() and other.hasNullableType) or - other.isDictionary()): + if other.nullable() or (other.isUnion() and other.hasNullableType): # Can't tell which type null should become return False return self.inner.isDistinguishableFrom(other) @@ -1417,9 +1405,8 @@ class IDLWrapperType(IDLType): if other.isPrimitive() or other.isString() or other.isEnum() or other.isDate(): return True if self.isDictionary(): - return (not other.nullable() and - (other.isNonCallbackInterface() or other.isSequence() or - other.isArray())) + return (other.isNonCallbackInterface() or other.isSequence() or + other.isArray()) assert self.isInterface() # XXXbz need to check that the interfaces can't be implemented @@ -1739,9 +1726,7 @@ class IDLNullValue(IDLObject): self.value = None def coerceToType(self, type, location): - if (not isinstance(type, IDLNullableType) and - not (type.isUnion() and type.hasNullableType) and - not type.isDictionary()): + if not isinstance(type, IDLNullableType) and not (type.isUnion() and type.hasNullableType): raise WebIDLError("Cannot coerce null value to type %s." % type, [location]) @@ -1877,11 +1862,14 @@ class IDLArgument(IDLObjectWithIdentifier): assert isinstance(type, IDLType) self.type = type + if defaultValue: + defaultValue = defaultValue.coerceToType(type, location) + assert defaultValue + self.optional = optional self.defaultValue = defaultValue self.variadic = variadic self.dictionaryMember = dictionaryMember - self._isComplete = False assert not variadic or optional @@ -1898,33 +1886,6 @@ class IDLArgument(IDLObjectWithIdentifier): # But actually, we can't handle this at all, so far. assert len(attrs) == 0 - def isComplete(self): - return self._isComplete - - def complete(self, scope): - if self._isComplete: - return - - self._isComplete = True - - if not self.type.isComplete(): - type = self.type.complete(scope) - assert not isinstance(type, IDLUnresolvedType) - assert not isinstance(type.name, IDLUnresolvedIdentifier) - self.type = type - - if self.type.isDictionary() and self.optional and not self.defaultValue: - # Default optional dictionaries to null, for simplicity, - # so the codegen doesn't have to special-case this. - self.defaultValue = IDLNullValue(self.location) - - # Now do the coercing thing; this needs to happen after the - # above creation of a default value. - if self.defaultValue: - self.defaultValue = self.defaultValue.coerceToType(self.type, - self.location) - assert self.defaultValue - class IDLCallbackType(IDLType, IDLObjectWithScope): def __init__(self, location, parentScope, identifier, returnType, arguments): assert isinstance(returnType, IDLType) @@ -2077,6 +2038,34 @@ class IDLMethod(IDLInterfaceMember, IDLScope): assert len(overload.arguments) == 0 assert overload.returnType == BuiltinTypes[IDLBuiltinType.Types.domstring] + inOptionalArguments = False + variadicArgument = None + sawOptionalWithNoDefault = False + + assert len(self._overloads) == 1 + arguments = self._overloads[0].arguments + + for argument in arguments: + # Only the last argument can be variadic + 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]) + # Once we see an argument with no default value, there can + # be no more default values. + if sawOptionalWithNoDefault and argument.defaultValue: + raise WebIDLError("Argument with default value after optional " + "arguments with no default values", + [argument.location]) + inOptionalArguments = argument.optional + if argument.variadic: + variadicArgument = argument + sawOptionalWithNoDefault = argument.optional and not argument.defaultValue + def isStatic(self): return self._static @@ -2159,49 +2148,15 @@ class IDLMethod(IDLInterfaceMember, IDLScope): def finish(self, scope): for overload in self._overloads: - inOptionalArguments = False - variadicArgument = None - sawOptionalWithNoDefault = False - - arguments = overload.arguments - for (idx, argument) in enumerate(arguments): - if argument.isComplete(): + for argument in overload.arguments: + if argument.type.isComplete(): continue - argument.complete(scope) - assert argument.type.isComplete() + type = argument.type.complete(scope) - if argument.type.isDictionary(): - # Dictionaries at the end of the list or followed by - # optional arguments must be optional. - if (not argument.optional and - (idx == len(arguments) - 1 or arguments[idx+1].optional)): - raise WebIDLError("Dictionary argument not followed by " - "a required argument must be " - "optional", [argument.location]) - - # Only the last argument can be variadic - 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]) - # Once we see an argument with no default value, there can - # be no more default values. - if sawOptionalWithNoDefault and argument.defaultValue: - raise WebIDLError("Argument with default value after " - "optional arguments with no default " - "values", - [argument.location]) - inOptionalArguments = argument.optional - if argument.variadic: - variadicArgument = argument - sawOptionalWithNoDefault = (argument.optional and - not argument.defaultValue) + assert not isinstance(type, IDLUnresolvedType) + assert not isinstance(type.name, IDLUnresolvedIdentifier) + argument.type = type returnType = overload.returnType if returnType.isComplete(): diff --git a/dom/bindings/parser/tests/test_dictionary.py b/dom/bindings/parser/tests/test_dictionary.py index 9ae9eb2b66f7..d1a8e950facd 100644 --- a/dom/bindings/parser/tests/test_dictionary.py +++ b/dom/bindings/parser/tests/test_dictionary.py @@ -121,78 +121,3 @@ def WebIDLTest(parser, harness): threw = True harness.ok(threw, "Should not allow [TreatUndefinedAs] on dictionary members"); - - parser = parser.reset() - threw = False - try: - parser.parse(""" - dictionary A { - }; - interface X { - void doFoo(A arg); - }; - """) - results = parser.finish() - except: - threw = True - - harness.ok(threw, "Trailing dictionary arg must be optional") - - parser = parser.reset() - threw = False - try: - parser.parse(""" - dictionary A { - }; - interface X { - void doFoo(A arg1, optional long arg2); - }; - """) - results = parser.finish() - except: - threw = True - - harness.ok(threw, "Dictionary arg followed by optional arg must be optional") - - parser = parser.reset() - parser.parse(""" - dictionary A { - }; - interface X { - void doFoo(A arg1, long arg2); - }; - """) - results = parser.finish() - harness.ok(True, "Dictionary arg followed by required arg can be required") - - parser = parser.reset() - threw = False - try: - parser.parse(""" - dictionary A { - }; - interface X { - void doFoo(optional A? arg1); - }; - """) - results = parser.finish() - except: - threw = True - - harness.ok(threw, "Dictionary arg must not be nullable") - - parser = parser.reset() - threw = False - try: - parser.parse(""" - dictionary A { - }; - interface X { - void doFoo((A or long)? arg1); - }; - """) - results = parser.finish() - except: - threw = True - - harness.ok(threw, "Dictionary arg must not be in a nullable union") diff --git a/dom/bindings/parser/tests/test_distinguishability.py b/dom/bindings/parser/tests/test_distinguishability.py index 86847800631a..6d53f5649dd4 100644 --- a/dom/bindings/parser/tests/test_distinguishability.py +++ b/dom/bindings/parser/tests/test_distinguishability.py @@ -9,7 +9,7 @@ def WebIDLTest(parser, harness): }; interface Bar { // Bit of a pain to get things that have dictionary types - void passDict(optional Dict arg); + void passDict(Dict arg); void passFoo(Foo arg); void passNullableUnion((object? or DOMString) arg); void passNullable(Foo? arg); diff --git a/dom/bindings/test/TestBindingHeader.h b/dom/bindings/test/TestBindingHeader.h index e7b1919a5c61..cd86abedb6fe 100644 --- a/dom/bindings/test/TestBindingHeader.h +++ b/dom/bindings/test/TestBindingHeader.h @@ -346,10 +346,11 @@ public: // Dictionary tests void PassDictionary(const Dict&, ErrorResult&); + void PassOptionalDictionary(const Optional&, ErrorResult&); + void PassNullableDictionary(const Nullable&, ErrorResult&); + void PassOptionalNullableDictionary(const Optional >&, ErrorResult&); void PassOtherDictionary(const GrandparentDict&, ErrorResult&); void PassSequenceOfDictionaries(const Sequence&, ErrorResult&); - void PassDictionaryOrLong(const Dict&, ErrorResult&); - void PassDictionaryOrLong(int32_t, ErrorResult&); // Methods and properties imported via "implements" bool GetImplementedProperty(ErrorResult&); diff --git a/dom/bindings/test/TestCodeGen.webidl b/dom/bindings/test/TestCodeGen.webidl index 025ea83cb622..b9b0f0142bb1 100644 --- a/dom/bindings/test/TestCodeGen.webidl +++ b/dom/bindings/test/TestCodeGen.webidl @@ -261,11 +261,12 @@ interface TestInterface { readonly attribute byte attributeGetterRenamedFrom; attribute byte attributeRenamedFrom; - void passDictionary(optional Dict x); - void passOtherDictionary(optional GrandparentDict x); + void passDictionary(Dict x); + void passOptionalDictionary(optional Dict x); + void passNullableDictionary(Dict? x); + void passOptionalNullableDictionary(optional Dict? x); + void passOtherDictionary(GrandparentDict x); void passSequenceOfDictionaries(sequence x); - void passDictionaryOrLong(optional Dict x); - void passDictionaryOrLong(long x); }; interface TestNonWrapperCacheInterface { diff --git a/dom/webidl/XMLHttpRequest.webidl b/dom/webidl/XMLHttpRequest.webidl index 5c435fc988d8..ca55250b1888 100644 --- a/dom/webidl/XMLHttpRequest.webidl +++ b/dom/webidl/XMLHttpRequest.webidl @@ -51,7 +51,7 @@ dictionary MozXMLHttpRequestParameters boolean mozSystem = false; }; -[Constructor(optional MozXMLHttpRequestParameters params)] +[Constructor(optional MozXMLHttpRequestParameters? params = null)] interface XMLHttpRequest : XMLHttpRequestEventTarget { // event handler [TreatNonCallableAsNull, GetterInfallible=MainThread] diff --git a/dom/workers/XMLHttpRequest.cpp b/dom/workers/XMLHttpRequest.cpp index 98c089d2f40b..032b70767d5e 100644 --- a/dom/workers/XMLHttpRequest.cpp +++ b/dom/workers/XMLHttpRequest.cpp @@ -1466,7 +1466,7 @@ XMLHttpRequest::_finalize(JSFreeOp* aFop) XMLHttpRequest* XMLHttpRequest::Constructor(JSContext* aCx, JSObject* aGlobal, - const MozXMLHttpRequestParametersWorkers& aParams, + const Nullable& aParams, ErrorResult& aRv) { WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx); diff --git a/dom/workers/XMLHttpRequest.h b/dom/workers/XMLHttpRequest.h index 2de709e9c5ca..9d27f56cbba6 100644 --- a/dom/workers/XMLHttpRequest.h +++ b/dom/workers/XMLHttpRequest.h @@ -72,7 +72,7 @@ public: static XMLHttpRequest* Constructor(JSContext* aCx, JSObject* aGlobal, - const MozXMLHttpRequestParametersWorkers& aParams, + const Nullable& aParams, ErrorResult& aRv); void Unpin();