mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 861064. Root WebIDL dictionary Init. r=smaug,terrence
This commit is contained in:
parent
f7e751861b
commit
c72e933878
@ -189,14 +189,14 @@ nsDOMMultipartFile::InitBlob(JSContext* aCx,
|
|||||||
if (aArgc > 1) {
|
if (aArgc > 1) {
|
||||||
if (NS_IsMainThread()) {
|
if (NS_IsMainThread()) {
|
||||||
BlobPropertyBag d;
|
BlobPropertyBag d;
|
||||||
if (!d.Init(aCx, nullptr, aArgv[1])) {
|
if (!d.Init(aCx, JS::NullPtr(), aArgv[1])) {
|
||||||
return NS_ERROR_TYPE_ERR;
|
return NS_ERROR_TYPE_ERR;
|
||||||
}
|
}
|
||||||
mContentType = d.mType;
|
mContentType = d.mType;
|
||||||
nativeEOL = d.mEndings == EndingTypesValues::Native;
|
nativeEOL = d.mEndings == EndingTypesValues::Native;
|
||||||
} else {
|
} else {
|
||||||
BlobPropertyBagWorkers d;
|
BlobPropertyBagWorkers d;
|
||||||
if (!d.Init(aCx, nullptr, aArgv[1])) {
|
if (!d.Init(aCx, JS::NullPtr(), aArgv[1])) {
|
||||||
return NS_ERROR_TYPE_ERR;
|
return NS_ERROR_TYPE_ERR;
|
||||||
}
|
}
|
||||||
mContentType = d.mType;
|
mContentType = d.mType;
|
||||||
@ -283,7 +283,7 @@ nsDOMMultipartFile::InitFile(JSContext* aCx,
|
|||||||
|
|
||||||
if (aArgc > 1) {
|
if (aArgc > 1) {
|
||||||
FilePropertyBag d;
|
FilePropertyBag d;
|
||||||
if (!d.Init(aCx, nullptr, aArgv[1])) {
|
if (!d.Init(aCx, JS::NullPtr(), aArgv[1])) {
|
||||||
return NS_ERROR_TYPE_ERR;
|
return NS_ERROR_TYPE_ERR;
|
||||||
}
|
}
|
||||||
mName = d.mName;
|
mName = d.mName;
|
||||||
|
@ -5004,7 +5004,7 @@ nsDocument::Register(const nsAString& aName, const JS::Value& aOptions,
|
|||||||
JSAutoCompartment ac(aCx, GetWrapper());
|
JSAutoCompartment ac(aCx, GetWrapper());
|
||||||
NS_ENSURE_TRUE(JS_WrapValue(aCx, const_cast<JS::Value*>(&aOptions)),
|
NS_ENSURE_TRUE(JS_WrapValue(aCx, const_cast<JS::Value*>(&aOptions)),
|
||||||
NS_ERROR_UNEXPECTED);
|
NS_ERROR_UNEXPECTED);
|
||||||
NS_ENSURE_TRUE(options.Init(aCx, nullptr, aOptions),
|
NS_ENSURE_TRUE(options.Init(aCx, JS::NullPtr(), aOptions),
|
||||||
NS_ERROR_UNEXPECTED);
|
NS_ERROR_UNEXPECTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ public:
|
|||||||
{
|
{
|
||||||
// Pretend like someone passed null, so we can pick up the default values
|
// Pretend like someone passed null, so we can pick up the default values
|
||||||
mozilla::dom::MozXMLHttpRequestParameters params;
|
mozilla::dom::MozXMLHttpRequestParameters params;
|
||||||
if (!params.Init(aCx, nullptr, JS::NullValue())) {
|
if (!params.Init(aCx, JS::NullPtr(), JS::NullValue())) {
|
||||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -1019,7 +1019,7 @@ class CGClassConstructor(CGAbstractStaticMethod):
|
|||||||
|
|
||||||
def generate_code(self):
|
def generate_code(self):
|
||||||
preamble = """
|
preamble = """
|
||||||
JSObject* obj = JSVAL_TO_OBJECT(JS_CALLEE(cx, vp));
|
JS::Rooted<JSObject*> obj(cx, JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)));
|
||||||
"""
|
"""
|
||||||
name = self._ctor.identifier.name
|
name = self._ctor.identifier.name
|
||||||
nativeName = MakeNativeName(self.descriptor.binaryNames.get(name, name))
|
nativeName = MakeNativeName(self.descriptor.binaryNames.get(name, name))
|
||||||
@ -2423,8 +2423,8 @@ if (!arr.SetCapacity(length)) {
|
|||||||
%s
|
%s
|
||||||
}
|
}
|
||||||
for (uint32_t i = 0; i < length; ++i) {
|
for (uint32_t i = 0; i < length; ++i) {
|
||||||
jsval temp;
|
JS::Rooted<JS::Value> temp(cx);
|
||||||
if (!JS_GetElement(cx, seq, i, &temp)) {
|
if (!JS_GetElement(cx, seq, i, temp.address())) {
|
||||||
%s
|
%s
|
||||||
}
|
}
|
||||||
%s& slot = *arr.AppendElement();
|
%s& slot = *arr.AppendElement();
|
||||||
@ -2441,7 +2441,7 @@ for (uint32_t i = 0; i < length; ++i) {
|
|||||||
string.Template(elementTemplate).substitute(
|
string.Template(elementTemplate).substitute(
|
||||||
{
|
{
|
||||||
"val" : "temp",
|
"val" : "temp",
|
||||||
"valPtr": "&temp",
|
"valPtr": "temp.address()",
|
||||||
"declName" : "slot",
|
"declName" : "slot",
|
||||||
# We only need holderName here to handle isExternal()
|
# We only need holderName here to handle isExternal()
|
||||||
# interfaces, which use an internal holder for the
|
# interfaces, which use an internal holder for the
|
||||||
@ -6816,7 +6816,7 @@ class CGDictionary(CGThing):
|
|||||||
return (string.Template(
|
return (string.Template(
|
||||||
"struct ${selfName} ${inheritance}{\n"
|
"struct ${selfName} ${inheritance}{\n"
|
||||||
" ${selfName}() {}\n"
|
" ${selfName}() {}\n"
|
||||||
" bool Init(JSContext* cx, JSObject* scopeObj, const JS::Value& val);\n"
|
" bool Init(JSContext* cx, JS::Handle<JSObject*> scopeObj, const JS::Value& val);\n"
|
||||||
" bool ToObject(JSContext* cx, JSObject* parentObject, JS::Value *vp);\n"
|
" bool ToObject(JSContext* cx, JSObject* parentObject, JS::Value *vp);\n"
|
||||||
"\n" +
|
"\n" +
|
||||||
(" bool Init(const nsAString& aJSON)\n"
|
(" bool Init(const nsAString& aJSON)\n"
|
||||||
@ -6826,7 +6826,7 @@ class CGDictionary(CGThing):
|
|||||||
" Maybe< JS::Rooted<JS::Value> > json;\n"
|
" Maybe< JS::Rooted<JS::Value> > json;\n"
|
||||||
" JSContext* cx = ParseJSON(aJSON, ar, ac, json);\n"
|
" JSContext* cx = ParseJSON(aJSON, ar, ac, json);\n"
|
||||||
" NS_ENSURE_TRUE(cx, false);\n"
|
" NS_ENSURE_TRUE(cx, false);\n"
|
||||||
" return Init(cx, nullptr, json.ref());\n"
|
" return Init(cx, JS::NullPtr(), json.ref());\n"
|
||||||
" }\n" if not self.workers else "") +
|
" }\n" if not self.workers else "") +
|
||||||
"\n" +
|
"\n" +
|
||||||
"\n".join(memberDecls) + "\n"
|
"\n".join(memberDecls) + "\n"
|
||||||
@ -6843,7 +6843,7 @@ class CGDictionary(CGThing):
|
|||||||
"struct ${selfName}Initializer : public ${selfName} {\n"
|
"struct ${selfName}Initializer : public ${selfName} {\n"
|
||||||
" ${selfName}Initializer() {\n"
|
" ${selfName}Initializer() {\n"
|
||||||
" // Safe to pass a null context if we pass a null value\n"
|
" // Safe to pass a null context if we pass a null value\n"
|
||||||
" Init(nullptr, nullptr, JS::NullValue());\n"
|
" Init(nullptr, JS::NullPtr(), JS::NullValue());\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"};").substitute( { "selfName": self.makeClassName(d),
|
"};").substitute( { "selfName": self.makeClassName(d),
|
||||||
"inheritance": inheritance }))
|
"inheritance": inheritance }))
|
||||||
@ -6900,7 +6900,7 @@ class CGDictionary(CGThing):
|
|||||||
"}\n"
|
"}\n"
|
||||||
"\n" if self.needToInitIds else "") +
|
"\n" if self.needToInitIds else "") +
|
||||||
"bool\n"
|
"bool\n"
|
||||||
"${selfName}::Init(JSContext* cx, JSObject* scopeObj, const JS::Value& val)\n"
|
"${selfName}::Init(JSContext* cx, JS::Handle<JSObject*> scopeObj, const JS::Value& val)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" // Passing a null JSContext is OK only if we're initing from null,\n"
|
" // Passing a null JSContext is OK only if we're initing from null,\n"
|
||||||
" // Since in that case we will not have to do any property gets\n"
|
" // Since in that case we will not have to do any property gets\n"
|
||||||
@ -6911,7 +6911,7 @@ class CGDictionary(CGThing):
|
|||||||
" }\n" if self.needToInitIds else "") +
|
" }\n" if self.needToInitIds else "") +
|
||||||
"${initParent}" +
|
"${initParent}" +
|
||||||
(" JSBool found;\n"
|
(" JSBool found;\n"
|
||||||
" JS::Value temp;\n"
|
" JS::Rooted<JS::Value> temp(cx);\n"
|
||||||
" bool isNull = val.isNullOrUndefined();\n" if len(memberInits) > 0 else "") +
|
" bool isNull = val.isNullOrUndefined();\n" if len(memberInits) > 0 else "") +
|
||||||
" if (!IsConvertibleToDictionary(cx, val)) {\n"
|
" if (!IsConvertibleToDictionary(cx, val)) {\n"
|
||||||
" return ThrowErrorMessage(cx, MSG_NOT_DICTIONARY);\n"
|
" return ThrowErrorMessage(cx, MSG_NOT_DICTIONARY);\n"
|
||||||
@ -6973,7 +6973,7 @@ class CGDictionary(CGThing):
|
|||||||
(member, (templateBody, declType,
|
(member, (templateBody, declType,
|
||||||
holderType, dealWithOptional)) = memberInfo
|
holderType, dealWithOptional)) = memberInfo
|
||||||
replacements = { "val": "temp",
|
replacements = { "val": "temp",
|
||||||
"valPtr": "&temp",
|
"valPtr": "temp.address()",
|
||||||
"declName": self.makeMemberName(member.identifier.name),
|
"declName": self.makeMemberName(member.identifier.name),
|
||||||
# We need a holder name for external interfaces, but
|
# We need a holder name for external interfaces, but
|
||||||
# it's scoped down to the conversion so we can just use
|
# it's scoped down to the conversion so we can just use
|
||||||
@ -6992,13 +6992,13 @@ class CGDictionary(CGThing):
|
|||||||
propName = member.identifier.name
|
propName = member.identifier.name
|
||||||
propCheck = ('JS_HasProperty(cx, &val.toObject(), "%s", &found)' %
|
propCheck = ('JS_HasProperty(cx, &val.toObject(), "%s", &found)' %
|
||||||
propName)
|
propName)
|
||||||
propGet = ('JS_GetProperty(cx, &val.toObject(), "%s", &temp)' %
|
propGet = ('JS_GetProperty(cx, &val.toObject(), "%s", temp.address())' %
|
||||||
propName)
|
propName)
|
||||||
else:
|
else:
|
||||||
propId = self.makeIdName(member.identifier.name);
|
propId = self.makeIdName(member.identifier.name);
|
||||||
propCheck = ("JS_HasPropertyById(cx, &val.toObject(), %s, &found)" %
|
propCheck = ("JS_HasPropertyById(cx, &val.toObject(), %s, &found)" %
|
||||||
propId)
|
propId)
|
||||||
propGet = ("JS_GetPropertyById(cx, &val.toObject(), %s, &temp)" %
|
propGet = ("JS_GetPropertyById(cx, &val.toObject(), %s, temp.address())" %
|
||||||
propId)
|
propId)
|
||||||
|
|
||||||
conversionReplacements = {
|
conversionReplacements = {
|
||||||
|
@ -83,7 +83,7 @@ public:
|
|||||||
{
|
{
|
||||||
// Pretend like someone passed null, so we can pick up the default values
|
// Pretend like someone passed null, so we can pick up the default values
|
||||||
MozXMLHttpRequestParametersWorkers params;
|
MozXMLHttpRequestParametersWorkers params;
|
||||||
if (!params.Init(aGlobal.GetContext(), nullptr, JS::NullValue())) {
|
if (!params.Init(aGlobal.GetContext(), JS::NullPtr(), JS::NullValue())) {
|
||||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -401,7 +401,7 @@ PeerConnectionImpl::ConvertRTCConfiguration(const JS::Value& aSrc,
|
|||||||
}
|
}
|
||||||
JSAutoCompartment ac(aCx, &aSrc.toObject());
|
JSAutoCompartment ac(aCx, &aSrc.toObject());
|
||||||
RTCConfiguration config;
|
RTCConfiguration config;
|
||||||
if (!(config.Init(aCx, nullptr, aSrc) && config.mIceServers.WasPassed())) {
|
if (!(config.Init(aCx, JS::NullPtr(), aSrc) && config.mIceServers.WasPassed())) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
for (uint32_t i = 0; i < config.mIceServers.Value().Length(); i++) {
|
for (uint32_t i = 0; i < config.mIceServers.Value().Length(); i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user