Fully qualify type names in IPDL more reliably
Categories
(Core :: IPC, enhancement)
Tracking
()
People
(Reporter: nika, Assigned: nika)
References
Details
Attachments
(2 files)
Right now we have some using
statements in IPDL code which do not correctly specify the full namespace of the type being imported. For example, ServiceWorkerState
here (https://searchfox.org/mozilla-central/rev/f1dc2743777711c821d43f9911ee7c4447d60c8e/dom/serviceworkers/ServiceWorkerOpArgs.ipdlh#11,23), should be qualified as mozilla::dom::ServiceWorkerState
, but happens to build because it is only used in that namespace. We should make fully qualified names in IPDL be generated with a leading ::
so that we are more confident that the types are correctly namespaced when using
statements are written.
Comment 1•1 year ago
|
||
A few use using class mozilla::Foo
or what not, which might make it tricky.
Assignee | ||
Comment 2•1 year ago
|
||
These types were used in IPDL but were not fully qualified.
Updated•1 year ago
|
Assignee | ||
Comment 3•1 year ago
|
||
This is done by changing the formatting of QualifiedIds in the compiler
to include a leading ::
, anchoring the path in the global namespace.
This means that the generated code will fail to recognize imports by
relative paths, as they will not be found in the correct namespace.
This required no longer using QualifiedId in TypeSpec, as that type is
generally used for local types in IPDL, which are never qualified in a
namespace (only using
statements actually support being qualified). As
part of this, I also removed the unnecessary wrapper TypeSpec from using
statements, which was never used.
Finally, this also required changing how we handle builtin imports for
the C primitive types, as these types (such as int
, bool
, or
double
) are special keywords, and can't be named in the global
namespace. They are now given a new builtin type name for C builtins,
and defined separately from other using statements.
This change also means that typedefs will now appear in generated code
for types in the global namespace, but this is required to double-check
that the type is actually in the global namespace.
Depends on D168877
Updated•1 year ago
|
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/85dbc47c6fb0 Part 1: Fix some IPDL statements to use fully qualified names, r=necko-reviewers,valentin
Comment 5•1 year ago
|
||
bugherder |
Pushed by nlayzell@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2208cd8db3ca Part 2: Require all IPDL using statements to be fully qualified, r=ipc-reviewers,mccr8
Comment 7•1 year ago
|
||
bugherder |
Assignee | ||
Comment 8•1 year ago
|
||
This was actually fixed when I landed the second part.
Description
•