Closed Bug 1360409 Opened 7 years ago Closed 7 years ago

WebIDL bindgen doesn't support [SecureContext] on enums or dictionaries

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: cpearce, Unassigned)

References

(Blocks 1 open bug)

Details

The EME spec requires its MediaKeySessionType enum to have the [SecureContext] attribute:

https://w3c.github.io/encrypted-media/#idl-def-mediakeysessiontype

But if I add that, I get an (opaque) error:

 0:12.40 Elapsed: 0.35s; From ../../dist/idl: Kept 0 existing; Added/updated 1101; Removed 0 files and 0 directories.
 0:13.99 Traceback (most recent call last):
 0:13.99   File "c:\mozilla-build\python\Lib\runpy.py", line 162, in _run_module_as_main
 0:13.99     "__main__", fname, loader, pkg_name)
 0:13.99   File "c:\mozilla-build\python\Lib\runpy.py", line 72, in _run_code
 0:13.99     exec code in run_globals
 0:13.99   File "c:\Users\chris\src\central\python\mozbuild\mozbuild\action\webidl.py", line 19, in <module>
 0:13.99     sys.exit(main(sys.argv[1:]))
 0:13.99   File "c:\Users\chris\src\central\python\mozbuild\mozbuild\action\webidl.py", line 15, in main
 0:13.99     manager.generate_build_files()
 0:13.99   File "c:\Users\chris\src\central\dom\bindings\mozwebidlcodegen\__init__.py", line 248, in generate_build_files
 0:13.99     self._parse_webidl()
 0:13.99   File "c:\Users\chris\src\central\dom\bindings\mozwebidlcodegen\__init__.py", line 333, in _parse_webidl
 0:13.99     parser.parse(data, path)
 0:13.99   File "c:\Users\chris\src\central\dom\bindings\parser\WebIDL.py", line 6851, in parse
 0:13.99     self._productions.extend(self.parser.parse(lexer=self.lexer, tracking=True))
 0:13.99   File "c:\Users\chris\src\central\other-licenses\ply\ply\yacc.py", line 263, in parse
 0:13.99     return self.parseopt(input,lexer,debug,tracking,tokenfunc)
 0:13.99   File "c:\Users\chris\src\central\other-licenses\ply\ply\yacc.py", line 710, in parseopt
 0:13.99     p.callable(pslice)
 0:13.99   File "c:\Users\chris\src\central\dom\bindings\parser\WebIDL.py", line 5354, in p_Definitions
 0:13.99     p[2].addExtendedAttributes(p[1])
 0:13.99   File "c:\Users\chris\src\central\dom\bindings\parser\WebIDL.py", line 1969, in addExtendedAttributes
 0:13.99     assert len(attrs) == 0
 0:13.99 AssertionError
 0:13.99 Makefile:55: recipe for target 'codegen.pp' failed
 0:13.99 mozmake.EXE[5]: *** [codegen.pp] Error 1
 0:14.00 c:/Users/chris/src/central/config/recurse.mk:100: recipe for target 'dom/bindings/export' failed
 0:14.00 mozmake.EXE[4]: *** [dom/bindings/export] Error 2
 0:14.00 mozmake.EXE[4]: *** Waiting for unfinished jobs....
 0:33.51 c:/Users/chris/src/central/config/recurse.mk:32: recipe for target 'export' failed
 0:33.51 mozmake.EXE[3]: *** [export] Error 2
 0:33.51 c:/Users/chris/src/central/config/rules.mk:519: recipe for target 'default' failed
 0:33.51 mozmake.EXE[2]: *** [default] Error 2
 0:33.51 c:/Users/chris/src/central/client.mk:419: recipe for target 'realbuild' failed
 0:33.51 mozmake.EXE[1]: *** [realbuild] Error 2
 0:33.52 client.mk:170: recipe for target 'build' failed
 0:33.52 mozmake.EXE: *** [build] Error 2
 0:33.55 273 compiler warnings present.
2

EME also requires [SecureContext] on dictionaries, and that's not working either.

[SecureContext] is working as expected for interface definitions.
Flags: needinfo?(bzbarsky)
> The EME spec requires its MediaKeySessionType enum to have the [SecureContext] attribute:

What does that even mean?  enum names are not web-exposed, so what does [SecureContext] mean here?

> But if I add that, I get an (opaque) error:

Yeah, maybe a better error there would be "extended attributes are not allowed here" or something...  Filed bug 1360557.

> EME also requires [SecureContext] on dictionaries, and that's not working either.

What would _that_ mean?  Again, dictionaries are not web-exposed.

In any case, from <https://heycam.github.io/webidl/#SecureContext>:

  If the [SecureContext] extended attribute appears on an interface, partial interface,
  namespace, partial namespace, interface member, or namespace member, it indicates
  that the construct is exposed only within a secure context.

Note that neither enums nor dictionaries are in the list of things [SecureContext] is allowed to appear on, with good reason: it doesn't mean anything there.

Please file issues on the EME spec to not have bogus cargo-culted IDL, and maybe even make use of the IDL checkers that are available to make sure their IDL is valid...
Status: NEW → RESOLVED
Closed: 7 years ago
Flags: needinfo?(bzbarsky)
Resolution: --- → INVALID
Or put another way, enums and dictionaries are not "exposed" in any meaningful way, so it's nonsense to restrict their (already nonexistend) exposure to only secure contexts.
You need to log in before you can comment on or make changes to this bug.