Closed Bug 949682 Opened 11 years ago Closed 11 years ago

Add the ability to freeze sequence attribute return values

Categories

(Core :: DOM: Core & HTML, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla29

People

(Reporter: bzbarsky, Assigned: bzbarsky)

Details

Attachments

(2 files)

Jonas tells me if we do this he might use it.  ;)

We can also use it for Gamepad.
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Whiteboard: [needs review]
Attachment #8346839 - Flags: review?(peterv) → review?(ted)
Comment on attachment 8346839 [details] [diff] [review]
part 2.  Make gamepad use frozen sequences.

Review of attachment 8346839 [details] [diff] [review]:
-----------------------------------------------------------------

This seems sensible. Is there a way to indicate that this is the desired behavior in the spec?
Attachment #8346839 - Flags: review?(ted) → review+
We're not sure how to go about speccing this yet, actually.  We're not even sure how to spec the [Cached] behavior.  https://www.w3.org/Bugs/Public/show_bug.cgi?id=23682 is open on the spec angle of this.

I should probably sit down with Cameron and talk over how to express all this stuff in WebIDL.
Comment on attachment 8346837 [details] [diff] [review]
part 1.  Add a [Frozen] annotation on WebIDL attributes that have sequence types.

Review of attachment 8346837 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/bindings/Codegen.py
@@ +5174,5 @@
> +                                              "args.rval().isObject()")
> +                freezeValue = freezeValue.define() + "\n"
> +            else:
> +                freezeValue = ""
> +                

Trailing whitespace.

::: dom/bindings/test/TestCodeGen.webidl
@@ +305,5 @@
>    readonly attribute sequence<Dict>? readonlyNullableSequenceOfDictionaries;
> +  [Cached, Pure, Frozen]
> +  readonly attribute sequence<Dict> readonlyFrozenSequence;
> +  [Cached, Pure, Frozen]
> +  readonly attribute sequence<Dict>? readonlyFrozenNullableSequence;  

Trailing whitespace.

::: dom/bindings/test/TestExampleGen.webidl
@@ +201,5 @@
>    readonly attribute sequence<Dict>? readonlyNullableSequenceOfDictionaries;
> +  [Cached, Pure, Frozen]
> +  readonly attribute sequence<long> readonlyFrozenSequence;
> +  [Cached, Pure, Frozen]
> +  readonly attribute sequence<long>? readonlyFrozenNullableSequence;  

Trailing whitespace.

::: dom/bindings/test/TestJSImplGen.webidl
@@ +222,5 @@
>    readonly attribute sequence<Dict>? readonlyNullableSequenceOfDictionaries;
> +  [Cached, Pure, Frozen]
> +  readonly attribute sequence<long> readonlyFrozenSequence;
> +  [Cached, Pure, Frozen]
> +  readonly attribute sequence<long>? readonlyFrozenNullableSequence;  

Trailing whitespace.
Attachment #8346837 - Flags: review?(peterv) → review+
With the whitespace nits fixed:

https://hg.mozilla.org/integration/mozilla-inbound/rev/40dd59af8938
https://hg.mozilla.org/integration/mozilla-inbound/rev/fba171682148
Flags: in-testsuite?
Keywords: dev-doc-needed
Whiteboard: [needs review]
Target Milestone: --- → mozilla29
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: