On Fri, Jan 11, 2019 at 11:30 AM Boris Zbarsky <bzbar...@mit.edu> wrote:

> On 1/10/19 6:15 PM, Kyle Machulis wrote:
> > - Removal of [noscript] methods in interfaces in favor of direct calls
> via
> > Cast() where possible.
>
> This seems generally reasonably, though I'd like to put in a bit of a
> vote for the pattern I recently used for
> nsIPrincipal::IsSystemPrincipal, which looks like this:
>
> IDL:
>
>      %{C++
>        inline bool IsSystemPrincipal() const;
>      %}
>
> C++ (in BasePrincipal.h):
>
>    inline bool nsIPrincipal::IsSystemPrincipal() const {
>      return BasePrincipal::Cast(this)->IsSystemPrincipal();
>    }
>
> which avoids having the Cast() calls scattered all over the place...
>

The idea is that we should gradually pass BasePrincipal around the codebase
rather than nsIPrincipal, which would avoid the need to invoke Cast at the
specific callsite. I have no objection to your proposed pattern in the
interim if it results in simpler code, but I think we should aim higher for
the desired end state.


>
> > - Direct getters through Cast() where possible, infallible (also where
> > possible) otherwise.
>
> Yes, please.
>
> -Boris
> _______________________________________________
> dev-platform mailing list
> dev-platform@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-platform
>
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to