Closed
Bug 945788
Opened 12 years ago
Closed 12 years ago
Can't declare a cached sequence of dictionaries in JS-implemented WebIDL
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla28
People
(Reporter: reuben, Assigned: bzbarsky)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
|
13.55 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
|
7.40 KB,
text/plain
|
Details |
Trying to declare a cached attribute that is a sequence of dictionaries yields the following error:
0:04.92 Traceback (most recent call last):
0:04.92 File "/Users/Reuben/Development/b2g-inbound/config/pythonpath.py", line 56, in <module>
0:04.92 main(sys.argv[1:])
0:04.92 File "/Users/Reuben/Development/b2g-inbound/config/pythonpath.py", line 48, in main
0:04.92 execfile(script, frozenglobals)
0:04.92 File "/Users/Reuben/Development/b2g-inbound/dom/bindings/BindingGen.py", line 98, in <module>
0:04.92 main()
0:04.92 File "/Users/Reuben/Development/b2g-inbound/dom/bindings/BindingGen.py", line 95, in main
0:04.92 generatedEventsWebIDLFiles);
0:04.92 File "/Users/Reuben/Development/b2g-inbound/dom/bindings/BindingGen.py", line 22, in generate_binding_files
0:04.92 root = CGBindingRoot(config, outputprefix, webidlfile)
0:04.92 File "/Users/Reuben/Development/b2g-inbound/dom/bindings/Codegen.py", line 9500, in __init__
0:04.92 cgthings.append(CGCallbackInterface(x))
0:04.92 File "/Users/Reuben/Development/b2g-inbound/dom/bindings/Codegen.py", line 10610, in __init__
0:04.92 getters = [CallbackGetter(a, descriptor) for a in attrs]
0:04.92 File "/Users/Reuben/Development/b2g-inbound/dom/bindings/Codegen.py", line 10974, in __init__
0:04.93 rethrowContentException=descriptor.interface.isJSImplemented())
0:04.93 File "/Users/Reuben/Development/b2g-inbound/dom/bindings/Codegen.py", line 10676, in __init__
0:04.93 jsObjectsArePtr=True)
0:04.93 File "/Users/Reuben/Development/b2g-inbound/dom/bindings/Codegen.py", line 9578, in __init__
0:04.93 self.getArgs(signature[0], signature[1]),
0:04.93 File "/Users/Reuben/Development/b2g-inbound/dom/bindings/Codegen.py", line 10822, in getArgs
0:04.93 args = CGNativeMember.getArgs(self, returnType, argList)
0:04.93 File "/Users/Reuben/Development/b2g-inbound/dom/bindings/Codegen.py", line 9717, in getArgs
0:04.93 elementDecl = self.getReturnType(returnType.inner, True)
0:04.93 File "/Users/Reuben/Development/b2g-inbound/dom/bindings/Codegen.py", line 9589, in getReturnType
0:04.93 return self.getRetvalInfo(type, isMember)[0]
0:04.93 File "/Users/Reuben/Development/b2g-inbound/dom/bindings/Codegen.py", line 9703, in getRetvalInfo
0:04.94 type)
0:04.94 TypeError: Don't know how to declare return value for ContactFieldInit (Wrapper)
| Assignee | ||
Comment 1•12 years ago
|
||
This is example/jsimpl codegen fail. Will fix.
Assignee: nobody → bzbarsky
Summary: Can't declare a cached sequence of dictionaries → Can't declare a cached sequence of dictionaries in JS-implemented WebIDL
| Assignee | ||
Comment 2•12 years ago
|
||
In fact, this is bug 863949, I guess, but let's just do it here.
| Assignee | ||
Updated•12 years ago
|
Blocks: ParisBindings
| Assignee | ||
Comment 3•12 years ago
|
||
Attachment #8341825 -
Flags: review?(bugs)
| Assignee | ||
Comment 4•12 years ago
|
||
This shows the code generated for these two pieces of JS-implemented WebIDL:
[Cached, Pure]
readonly attribute sequence<Dict> readonlySequenceOfDictionaries;
Dict receiveDictionary();
The static methods are the same as for normal bindings, I believe. This patch's shenanigans affect the TestJSImplInterfaceJSImpl member methods.
| Assignee | ||
Comment 5•12 years ago
|
||
Comment 7•12 years ago
|
||
Comment on attachment 8341825 [details] [diff] [review]
Add support for dictionary return values to example codegen and js-implemented codegen.
>+++ b/dom/bindings/parser/WebIDL.py
>@@ -2027,17 +2027,17 @@ class IDLWrapperType(IDLType):
> def isSerializable(self):
> if self.isInterface():
> if self.inner.isExternal():
> return False
> return any(m.isMethod() and m.isJsonifier() for m in self.inner.members)
> elif self.isEnum():
> return True
> elif self.isDictionary():
>- return all(m.isSerializable() for m in self.inner.members)
>+ return all(m.type.isSerializable() for m in self.inner.members)
I don't see how this is related to the bug.
Do we have tests for jsonification?
| Assignee | ||
Comment 8•12 years ago
|
||
> I don't see how this is related to the bug.
Without it, this patch fails codegen; see below. ;)
> Do we have tests for jsonification?
Yes. TestInterface has a stringifier. But dictionary-typed attributes are not allowed in WebIDL, so this incorrect code was actually never reached. When I added the "readonly attribute sequence<Dict>" member in the tests in this patch, we started calling this code to determine whether that attribute is of a serializable type, and then the fact that "m" there is an IDLArgument, which doesn't have an isSerializable method manifested itself in a lovely exception.
Updated•12 years ago
|
Attachment #8341825 -
Flags: review?(bugs) → review+
| Assignee | ||
Comment 9•12 years ago
|
||
Flags: in-testsuite+
Target Milestone: --- → mozilla28
Comment 10•12 years ago
|
||
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Updated•7 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•