Closed Bug 1559181 Opened 2 years ago Closed 4 months ago

Loading chrome pages blocked by about: policies never complete

Categories

(Firefox :: Enterprise Policies, defect, P3)

defect

Tracking

()

RESOLVED FIXED
84 Branch
Tracking Status
firefox-esr78 --- wontfix
firefox82 --- wontfix
firefox83 --- wontfix
firefox84 --- fixed

People

(Reporter: mkaply, Assigned: mkaply)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

When about: pages are blocked, we block all chrome URLs loading in the main browser window (not optimal, I'm going to make it better)

Starting with when bug 1362774 landed, when you try to load these pages, instead of just loading as blank, they stay spinning forever.

These pages are blocked in content policy:

https://searchfox.org/mozilla-central/rev/227f5329f75bd8b16c6b146a7414598a420260cb/browser/components/enterprisepolicies/Policies.jsm#1417

So something seems to have changed related to that.

To recreate, add a policies.json in a distribution directory:

{
"policies": {
"BlockAboutConfig": true
}
}

Restart the browser and navigate to

chrome://global/content/config.xul

Seems like we should load an error page in this case, not load about:blank.

We're not loading about:blank, we're just rejecting the request.

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?

How wrong would it be to just do:

loadInfo.loadingContext.contentWindow.location.href = "about:neterror?e=blockedByPolicy";

in the content policy? We're really looking at an edge case here.

(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.

Priority: -- → P1
Priority: P1 → P3
Severity: normal → S3

Now that I've added support for policy errors in nsiContentPolicy, this should be straightforward to do.

Assignee: nobody → mozilla
Status: NEW → ASSIGNED
Depends on: 1655857, 1450309
Pushed by mozilla@kaply.com:
https://hg.mozilla.org/integration/autoland/rev/265970bfef8c
Switch about blocking to use new REJECT_POLICY and cleanup tests r=Gijs
Status: ASSIGNED → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 84 Branch
Blocks: 1672995
You need to log in before you can comment on or make changes to this bug.