Closed Bug 1590166 Opened 5 years ago Closed 4 years ago

Check if WindowGlobalChild::Create should call GetCrossOriginOpenerPolicy instead of ComputeCrossOriginOpenerPolicy

Categories

(Core :: DOM: Navigation, task, P2)

task

Tracking

()

RESOLVED FIXED
mozilla74
Tracking Status
firefox74 --- fixed

People

(Reporter: valentin, Assigned: valentin)

References

Details

Attachments

(1 file)

https://phabricator.services.mozilla.com/D48715#inline-303287

Hmm, this looks like perhaps it should be updated to use the new cached GetCrossOriginOpenerPolicy getter. I'm not convinced this is doing the right thing.

Priority: -- → P3

Valentin and Boris, could you review and decide if there are changes needed per Nika's comment on the previous review?

Flags: needinfo?(valentin.gosu)
Flags: needinfo?(bzbarsky)
Priority: P3 → P2

OK, so if we're landing in WindowGlobalChild::Create we are quite far along from necko's point of view.

Is mComputedCrossOriginOpenerPolicy computed by then (assuming it will be computed at all)? It gets set by nsHttpChannel::ComputeCrossOriginOpenerPolicyMismatch, which is called in necko way before we ever get to this code. So the only way this can fail is if ComputeCrossOriginOpenerPolicyMismatch didn't compute it but HttpBaseChannel::ComputeCrossOriginOpenerPolicy would.

The reasons ComputeCrossOriginOpenerPolicyMismatch can fail to compute a policy are:

  • Pref is disabled. Sees like we wouldn't want it in the window global child code either, then.
  • This is not a toplevel document load. I'm not actually sure what we want here. Anne?
  • There's no browsing context. That's clearly not an issue in WindowGlobalChild.

So the basic question is what the behavior here should be for toplevel vs non-toplevel documents...

Flags: needinfo?(bzbarsky) → needinfo?(annevk)

Cross-Origin-Opener-Policy only applies to navigations of top-level browsing contexts. Hope that helps. (See also its processing model.)

Flags: needinfo?(annevk)

OK. And now that I look again, this particular ComputeCrossOriginOpenerPolicy call in WindowGlobalChild::Create is only done if loadInfo->GetExternalContentPolicyType() == nsIContentPolicy::TYPE_DOCUMENT. So we're only dealing with toplevel loads here to start with.

So yes, I think this call should be GetCrossOriginOpenerPolicy instead. Someone should change that and make sure that tests pass, etc.

Flags: needinfo?(cpeterson)

(In reply to Boris Zbarsky [:bzbarsky, bz on IRC] from comment #5)

OK. And now that I look again, this particular ComputeCrossOriginOpenerPolicy call in WindowGlobalChild::Create is only done if loadInfo->GetExternalContentPolicyType() == nsIContentPolicy::TYPE_DOCUMENT. So we're only dealing with toplevel loads here to start with.

So yes, I think this call should be GetCrossOriginOpenerPolicy instead. Someone should change that and make sure that tests pass, etc.

Tom or Bas, are you the right engineer to work on this bug?

I see Tom is re-enabling SAB in bug 1594748 in Nightly, but I think Neha mentioned that Bas was working on SAB.

Is the current plan to re-enable SAB in 73 Nightly and then ride the trains in Firefox 74 or 75?

Flags: needinfo?(ttung)
Flags: needinfo?(cpeterson)
Flags: needinfo?(bas)

Valentin will likely work on this as he and Junior are responsible for COOP (and parts of COEP) and Valentin is back the soonest.

Re-enabling SAB is in effect several smaller projects:

  1. Bas is working on bug 1563335 which is a requirement to have in beta quality to ship the remainder on release.
  2. We need to make some design changes as the result of specification changes. These are minorish, but probably need some time to bake.
  3. We can hopefully ship SharedArrayBuffer and atomics (without postMessage() support) sooner, I suspect in 75 as we want at least one cycle where it's enabled in beta (that'd be 74 with the current freeze as I understand it). Tracked in bug 1606624.
  4. Shipping COOP/COEP (i.e., postMessage() support) can hopefully follow soon after provided 1 and 2 are done and bugs blocking bug 1477743 are addressed.

Hope that helps clarify the plans.

Flags: needinfo?(ttung)
Flags: needinfo?(bas)
Assignee: nobody → valentin.gosu
Flags: needinfo?(valentin.gosu)
Pushed by valentin.gosu@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/513930129452
WindowGlobalChild::Create should call GetCrossOriginOpenerPolicy instead of ComputeCrossOriginOpenerPolicy r=bzbarsky
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla74
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: