mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-08 00:38:39 +09:00
Bug 1413815 - Convert 'observedAttributes' to a sequence<DOMString>
Tag UXP Issue #1344
This commit is contained in:
parent
f64c7135b4
commit
a9b3ebace0
1 changed files with 13 additions and 5 deletions
|
|
@ -699,7 +699,6 @@ CustomElementRegistry::Define(const nsAString& aName,
|
|||
* observedAttributesIterable to a sequence<DOMString>. Rethrow
|
||||
* any exceptions from the conversion.
|
||||
*/
|
||||
// TODO: Bug 1293921 - Implement connected/disconnected/adopted/attributeChanged lifecycle callbacks for custom elements
|
||||
if (callbacksHolder->mAttributeChangedCallback.WasPassed()) {
|
||||
// Enter constructor's compartment.
|
||||
JSAutoCompartment ac(cx, constructor);
|
||||
|
|
@ -712,12 +711,22 @@ CustomElementRegistry::Define(const nsAString& aName,
|
|||
}
|
||||
|
||||
if (!observedAttributesIterable.isUndefined()) {
|
||||
if (!observedAttributesIterable.isObject()) {
|
||||
aRv.ThrowTypeError<MSG_NOT_SEQUENCE>(NS_LITERAL_STRING("observedAttributes"));
|
||||
return;
|
||||
}
|
||||
|
||||
JS::ForOfIterator iter(cx);
|
||||
if (!iter.init(observedAttributesIterable)) {
|
||||
if (!iter.init(observedAttributesIterable, JS::ForOfIterator::AllowNonIterable)) {
|
||||
aRv.StealExceptionFromJSContext(cx);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!iter.valueIsIterable()) {
|
||||
aRv.ThrowTypeError<MSG_NOT_SEQUENCE>(NS_LITERAL_STRING("observedAttributes"));
|
||||
return;
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> attribute(cx);
|
||||
while (true) {
|
||||
bool done;
|
||||
|
|
@ -729,9 +738,8 @@ CustomElementRegistry::Define(const nsAString& aName,
|
|||
break;
|
||||
}
|
||||
|
||||
JSString *attrJSStr = attribute.toString();
|
||||
nsAutoJSString attrStr;
|
||||
if (!attrStr.init(cx, attrJSStr)) {
|
||||
nsAutoString attrStr;
|
||||
if (!ConvertJSValueToString(cx, attribute, eStringify, eStringify, attrStr)) {
|
||||
aRv.StealExceptionFromJSContext(cx);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue