mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 949682 part 1. Add a [Frozen] annotation on WebIDL attributes that have sequence types. r=peterv
This commit is contained in:
parent
b4c8b829b5
commit
45faf1e000
@ -5134,11 +5134,25 @@ if (!${obj}) {
|
||||
preserveWrapper = "PreserveWrapper(self);\n"
|
||||
else:
|
||||
preserveWrapper = ""
|
||||
if self.idlNode.getExtendedAttribute("Frozen"):
|
||||
assert self.idlNode.type.isSequence()
|
||||
freezeValue = CGGeneric(
|
||||
"if (!JS_FreezeObject(cx, &args.rval().toObject())) {\n"
|
||||
" return false;\n"
|
||||
"}")
|
||||
if self.idlNode.type.nullable():
|
||||
freezeValue = CGIfWrapper(freezeValue,
|
||||
"args.rval().isObject()")
|
||||
freezeValue = freezeValue.define() + "\n"
|
||||
else:
|
||||
freezeValue = ""
|
||||
|
||||
successCode = (
|
||||
"%s"
|
||||
"js::SetReservedSlot(reflector, %s, args.rval());\n"
|
||||
"%s"
|
||||
"break;" %
|
||||
(memberReservedSlot(self.idlNode), preserveWrapper))
|
||||
(freezeValue, memberReservedSlot(self.idlNode), preserveWrapper))
|
||||
else:
|
||||
successCode = None
|
||||
|
||||
|
@ -2795,6 +2795,10 @@ class IDLAttribute(IDLInterfaceMember):
|
||||
raise WebIDLError("[LenientThis] is not allowed in combination "
|
||||
"with [%s]" % identifier,
|
||||
[attr.location, self.location])
|
||||
elif identifier == "Frozen":
|
||||
if not self.type.isSequence():
|
||||
raise WebIDLError("[Frozen] is only allowed on sequence-valued "
|
||||
"attributes", [attr.location, self.location])
|
||||
elif (identifier == "Pref" or
|
||||
identifier == "SetterThrows" or
|
||||
identifier == "Pure" or
|
||||
|
@ -346,6 +346,8 @@ public:
|
||||
void GetReadonlySequence(nsTArray<int32_t>&);
|
||||
void GetReadonlySequenceOfDictionaries(JSContext*, nsTArray<Dict>&);
|
||||
void GetReadonlyNullableSequenceOfDictionaries(JSContext*, Nullable<nsTArray<Dict> >&);
|
||||
void GetReadonlyFrozenSequence(JSContext*, nsTArray<Dict>&);
|
||||
void GetReadonlyFrozenNullableSequence(JSContext*, Nullable<nsTArray<Dict>>&);
|
||||
void ReceiveSequence(nsTArray<int32_t>&);
|
||||
void ReceiveNullableSequence(Nullable< nsTArray<int32_t> >&);
|
||||
void ReceiveSequenceOfNullableInts(nsTArray< Nullable<int32_t> >&);
|
||||
|
@ -305,6 +305,10 @@ interface TestInterface {
|
||||
readonly attribute sequence<Dict> readonlySequenceOfDictionaries;
|
||||
[Cached, Pure]
|
||||
readonly attribute sequence<Dict>? readonlyNullableSequenceOfDictionaries;
|
||||
[Cached, Pure, Frozen]
|
||||
readonly attribute sequence<Dict> readonlyFrozenSequence;
|
||||
[Cached, Pure, Frozen]
|
||||
readonly attribute sequence<Dict>? readonlyFrozenNullableSequence;
|
||||
sequence<long> receiveSequence();
|
||||
sequence<long>? receiveNullableSequence();
|
||||
sequence<long?> receiveSequenceOfNullableInts();
|
||||
|
@ -201,6 +201,10 @@ interface TestExampleInterface {
|
||||
readonly attribute sequence<Dict> readonlySequenceOfDictionaries;
|
||||
[Cached, Pure]
|
||||
readonly attribute sequence<Dict>? readonlyNullableSequenceOfDictionaries;
|
||||
[Cached, Pure, Frozen]
|
||||
readonly attribute sequence<long> readonlyFrozenSequence;
|
||||
[Cached, Pure, Frozen]
|
||||
readonly attribute sequence<long>? readonlyFrozenNullableSequence;
|
||||
sequence<long> receiveSequence();
|
||||
sequence<long>? receiveNullableSequence();
|
||||
sequence<long?> receiveSequenceOfNullableInts();
|
||||
|
@ -222,6 +222,10 @@ interface TestJSImplInterface {
|
||||
readonly attribute sequence<Dict> readonlySequenceOfDictionaries;
|
||||
[Cached, Pure]
|
||||
readonly attribute sequence<Dict>? readonlyNullableSequenceOfDictionaries;
|
||||
[Cached, Pure, Frozen]
|
||||
readonly attribute sequence<long> readonlyFrozenSequence;
|
||||
[Cached, Pure, Frozen]
|
||||
readonly attribute sequence<long>? readonlyFrozenNullableSequence;
|
||||
sequence<long> receiveSequence();
|
||||
sequence<long>? receiveNullableSequence();
|
||||
sequence<long?> receiveSequenceOfNullableInts();
|
||||
|
Loading…
Reference in New Issue
Block a user