Bug 1246153 part 3. Use the new clean global setup for doing from-JSON creation of dictionaries. r=bholley

This commit is contained in:
Boris Zbarsky 2016-04-04 12:29:18 -04:00
Родитель 63950bd866
Коммит 80d8bedf90
1 изменённых файлов: 11 добавлений и 2 удалений

Просмотреть файл

@ -12321,8 +12321,15 @@ class CGDictionary(CGThing):
"Init", "bool",
[Argument('const nsAString&', 'aJSON')],
body=dedent("""
MOZ_ASSERT(NS_IsMainThread());
AutoSafeJSContext cx;
AutoJSAPI jsapi;
JSObject* cleanGlobal = SimpleGlobalObject::Create(SimpleGlobalObject::GlobalType::BindingDetail);
if (!cleanGlobal) {
return false;
}
if (!jsapi.Init(cleanGlobal)) {
return false;
}
JSContext* cx = jsapi.cx();
JS::Rooted<JS::Value> json(cx);
bool ok = ParseJSON(cx, aJSON, &json);
NS_ENSURE_TRUE(ok, false);
@ -13401,6 +13408,8 @@ class CGBindingRoot(CGThing):
return any(m.getExtendedAttribute("UseCounter") for m in iface.members)
bindingHeaders["mozilla/UseCounter.h"] = any(
descriptorRequiresTelemetry(d) for d in descriptors)
bindingHeaders["mozilla/dom/SimpleGlobalObject.h"] = any(
CGDictionary.dictionarySafeToJSONify(d) for d in dictionaries)
cgthings.extend(traverseMethods)
cgthings.extend(unlinkMethods)