Closed
Bug 1023520
Opened 10 years ago
Closed 10 years ago
WebIDL Globals cannot have method returning a Promise
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla33
People
(Reporter: nsm, Assigned: nsm)
References
Details
Attachments
(1 file)
(deleted),
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
For fetch spec (http://fetch.spec.whatwg.org/#fetch-method), fetch() method is on WorkerGlobalScope. The globals Dedicated & SharedWorkerGlobalScope inherit from it.
WebIDL codegen traceback:
0:16.01 Traceback (most recent call last):
0:16.01 File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
0:16.01 "__main__", fname, loader, pkg_name)
0:16.01 File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
0:16.01 exec code in run_globals
0:16.01 File "/home/nikhil/mozilla-central-fetch/python/mozbuild/mozbuild/action/webidl.py", line 17, in <module>
0:16.01 sys.exit(main(sys.argv[1:]))
0:16.01 File "/home/nikhil/mozilla-central-fetch/python/mozbuild/mozbuild/action/webidl.py", line 13, in main
0:16.01 manager.generate_build_files()
0:16.01 File "/home/nikhil/mozilla-central-fetch/dom/bindings/mozwebidlcodegen/__init__.py", line 263, in generate_build_files
0:16.01 written, deps = self._generate_build_files_for_webidl(filename)
0:16.01 File "/home/nikhil/mozilla-central-fetch/dom/bindings/mozwebidlcodegen/__init__.py", line 464, in _generate_build_files_for_webidl
0:16.01 root = CGBindingRoot(self._config, binding_stem, filename)
0:16.01 File "/home/nikhil/mozilla-central-fetch/dom/bindings/Codegen.py", line 11341, in __init__
0:16.01 cgthings.extend([CGDescriptor(x) for x in descriptors])
0:16.01 File "/home/nikhil/mozilla-central-fetch/dom/bindings/Codegen.py", line 10277, in __init__
0:16.01 cgThings.append(CGGeneric(define=str(properties)))
0:16.01 File "/home/nikhil/mozilla-central-fetch/dom/bindings/Codegen.py", line 2309, in __str__
0:16.01 define += str(getattr(self, array))
0:16.01 File "/home/nikhil/mozilla-central-fetch/dom/bindings/Codegen.py", line 1858, in __str__
0:16.01 self.usedForXrays())
0:16.01 File "/home/nikhil/mozilla-central-fetch/dom/bindings/Codegen.py", line 2168, in generateArray
0:16.01 condition, specData, doIdArrays)
0:16.01 File "/home/nikhil/mozilla-central-fetch/dom/bindings/Codegen.py", line 1946, in generatePrefableArray
0:16.01 specs.append(specTemplate % getDataTuple(member))
0:16.01 File "/home/nikhil/mozilla-central-fetch/dom/bindings/Codegen.py", line 2148, in specData
0:16.01 accessor)
0:16.01 TypeError: fetch returns a Promise but needs special generic ops?
Comment 1•10 years ago
|
||
Yeah, we just need to add the support for this; I didn't add it initially when landing the Promise stuff because we had no consumers at the time.
Do you want to try doing it, or should I do it?
Flags: needinfo?(nsm.nikhil)
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → nsm.nikhil
Flags: needinfo?(nsm.nikhil)
Assignee | ||
Comment 2•10 years ago
|
||
Do I need to preserve the callee the way GenericPromiseReturningBindingMethod does?
In that case, where do I put the code to preserve the callee in Codegen.py?
Attachment #8438036 -
Flags: review?(bzbarsky)
Comment 3•10 years ago
|
||
Comment on attachment 8438036 [details] [diff] [review]
Add support for Promise returning methods on globals.
> Do I need to preserve the callee the way GenericPromiseReturningBindingMethod
> does?
Yes, because CallArgs stores callee and rval in the same place. So once someone does rval() you can't even do args.callee() without asserting...
> In that case, where do I put the code to preserve the callee in Codegen.py?
Putting it at the top of your new generate_code output and also at the top of the unwrapFailureCode block should work fine, I expect.
>+ args.rval());\n"""%
Space before '%', please.
r=me with the nits fixed and the callee/rval thing addressed.
Attachment #8438036 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 4•10 years ago
|
||
Assignee | ||
Comment 5•10 years ago
|
||
As discussed on IRC, we agreed to use the callArgs to save the callee right at the beginning of the function to avoid any "should work fine, I expect" moments!
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•