(In reply to Mike Kaply [:mkaply] from comment #3)
Seems like we should load an error page in this case, not load about:blank.
My answer was unhelpful. In the about case, it was pretty easy to show an error message because we are just affecting the redirection.
For loading chrome URLs directly, the nsIContentPolicy was the only think we could think of.
Is it possible to redirect the channel in content policy?
I don't know what the nsIContentPolicy thing is or how it works, so I don't know if there's a better way than:
(In reply to Mike Kaply [:mkaply] from comment #4)
How wrong would it be to just do:
loadInfo.loadingContext.contentWindow.location.href = "about:neterror?e=blockedByPolicy";
FWIW, I suspect this isn't OK given this comment: https://searchfox.org/mozilla-central/source/dom/base/nsIContentPolicy.idl#436-447 .
in the content policy? We're really looking at an edge case here.
It'd be better to have us handle failures in
shouldLoad correctly. I'm pretty sure there are other edgecases already documented on bugzilla that hit this case.