This is what I have so far. It compiles, but doesn't work. Looks like `nsCookiePermissionMailnews::CanAccess[URI]()` is never invoked. Frankly, I can't see a call site in M-C other than in AntiTrackingCommon.cpp, but I didn't look very carefully.
I'm not sure whether the
```
#if defined(MOZ_THUNDERBIRD) || defined(MOZ_SUITE)
mozilla::StaticRefPtr<nsCookiePermissionMailnews> gSingleton;
#else
mozilla::StaticRefPtr<nsCookiePermission> gSingleton;
#endif
```
is needed. I could imagine that only storing a pointer to the M-C class might lose the "Mailnews-ness" in case we compile it for TB.
```
%{C++
#if defined(MOZ_THUNDERBIRD) || defined(MOZ_SUITE)
/**
* This protocol handler forbids accessing cookies e.g. for mail related
* protocols. We use the higest flag possible to avoid reshuffling
* if more flags need to be added.
*/
#define URI_FORBIDS_COOKIE_ACCESS (1<<31)
#endif
%}
```
is very unfortunate, but `#ifdef` only appears to work within `%{C++ %}` blocks. The IDL processor is producing an enum like so:
```
enum {
URI_STD = 0U,
...
URI_DISALLOW_IN_PRIVATE_CONTEXT = 4194304U
};
```
but I don't know how to extend this. Unless we just add `URI_FORBIDS_COOKIE_ACCESS` without `#ifdef`.
Of course the `#define` only works in C++ code, so the JS bits `Ci.nsIProtocolHandler.URI_FORBIDS_COOKIE_ACCESS` in the third patch don't actually work.
Bug 1543219 Comment 31 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
This is what I have so far. It compiles, but doesn't work. Looks like `nsCookiePermissionMailnews::CanAccess[URI]()` is never invoked. Frankly, I can't see a call site in M-C other than in AntiTrackingCommon.cpp, but I didn't look very carefully.
I'm not sure whether the
```
#if defined(MOZ_THUNDERBIRD) || defined(MOZ_SUITE)
mozilla::StaticRefPtr<nsCookiePermissionMailnews> gSingleton;
#else
mozilla::StaticRefPtr<nsCookiePermission> gSingleton;
#endif
```
is needed. I could imagine that only storing a pointer to the M-C class might lose the "Mailnews-ness" in case we compile it for TB.
```
%{C++
#if defined(MOZ_THUNDERBIRD) || defined(MOZ_SUITE)
/**
* This protocol handler forbids accessing cookies e.g. for mail related
* protocols. We use the higest flag possible to avoid reshuffling
* if more flags need to be added.
*/
#define URI_FORBIDS_COOKIE_ACCESS (1<<31)
#endif
%}
```
is very unfortunate, but `#ifdef` only appears to work within `%{C++ %}` blocks. The IDL processor is producing an enum like so:
```
enum {
URI_STD = 0U,
...
URI_DISALLOW_IN_PRIVATE_CONTEXT = 4194304U
};
```
but I don't know how to extend this. Unless we just add `URI_FORBIDS_COOKIE_ACCESS` without `#ifdef`.
Of course the `#define` only works in C++ code, so the JS bits `Ci.nsIProtocolHandler.URI_FORBIDS_COOKIE_ACCESS` in the 1543219-reinstate-URI_FORBIDS_COOKIE_ACCESS-flags patch don't actually work.