Closed Bug 1268810 Opened 9 years ago Closed 8 years ago

[Presentation WebAPI] set sandboxed auxiliary navigation browsing context flag on receiving browsing context

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
FxOS-S1 (26Jun)
blocking-b2g 2.6+
Tracking Status
b2g-v2.6 --- fixed
firefox50 --- fixed

People

(Reporter: schien, Assigned: kershaw)

References

()

Details

(Whiteboard: [ft:conndevices]btpp-backlog [ETA 6/30])

Attachments

(3 files, 4 obsolete files)

We need to set sandboxed auxiliary navigation browsing context flag to prevent presented content opening popup window.
Whiteboard: btpp-backlog
blocking-b2g: 2.6? → 2.6+
Whiteboard: btpp-backlog → btpp-backlog [ETA 6/30]
Whiteboard: btpp-backlog [ETA 6/30] → [ft:conndevices]btpp-backlog [ETA 6/30]
Target Milestone: --- → FxOS-S1 (26Jun)
First version.
Assignee: nobody → kechang
Attachment #8763028 - Flags: feedback?(schien)
Attached patch Part2: Test case (obsolete) β€” β€” Splinter Review
Attachment #8763029 - Flags: feedback?(schien)
Comment on attachment 8763028 [details] [diff] [review]
Part1: Add SANDBOXED_AUXILIARY_NAVIGATION flag to  receiver page

Review of attachment 8763028 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/base/nsFrameLoader.cpp
@@ +2137,5 @@
> +  HTMLIFrameElement* iframe = HTMLIFrameElement::FromContent(mOwnerContent);
> +  if (iframe) {
> +    sandboxFlags = iframe->GetSandboxFlags();
> +  }
> +  ApplySandboxFlags(sandboxFlags);

Why we need to move this code? Please add comment for it if there is legitimate reason.

@@ +3014,5 @@
> +    nsAutoString presentationURL;
> +    nsContentUtils::GetPresentationURL(mDocShell, presentationURL);
> +    if (!presentationURL.IsEmpty()) {
> +      sandboxFlags |= SANDBOXED_AUXILIARY_NAVIGATION;
> +    }

Please add a comment for it, or leave a reference to spec here.

::: dom/ipc/TabChild.cpp
@@ +894,5 @@
>    nsDocShell::Cast(docShell)->SetOriginAttributes(OriginAttributesRef());
> +
> +  if (!PresentationURL().IsEmpty()) {
> +    docShell->SetSandboxFlags(SANDBOXED_AUXILIARY_NAVIGATION);
> +  }

comment here, too.
Attachment #8763028 - Flags: feedback?(schien) → feedback+
Comment on attachment 8763029 [details] [diff] [review]
Part2: Test case

Review of attachment 8763029 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/presentation/tests/mochitest/mochitest.ini
@@ +50,5 @@
>  skip-if = (e10s || toolkit == 'gonk' || toolkit == 'android') # Bug 1129785
> +[test_presentation_receiver_auxiliary_navigation_inproc.html]
> +skip-if = (e10s || toolkit == 'gonk' || toolkit == 'android') # Bug 1129785
> +[test_presentation_receiver_auxiliary_navigation_oop.html]
> +skip-if = (e10s || toolkit == 'gonk' || toolkit == 'android') # Bug 1129785

we can probably run this test on Android as well. please try it.
Attachment #8763029 - Flags: feedback?(schien) → feedback+
(In reply to Shih-Chiang Chien [:schien] (UTC+8) (use ni? plz) from comment #3)
> Comment on attachment 8763028 [details] [diff] [review]
> Part1: Add SANDBOXED_AUXILIARY_NAVIGATION flag to  receiver page
> 
> Review of attachment 8763028 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: dom/base/nsFrameLoader.cpp
> @@ +2137,5 @@
> > +  HTMLIFrameElement* iframe = HTMLIFrameElement::FromContent(mOwnerContent);
> > +  if (iframe) {
> > +    sandboxFlags = iframe->GetSandboxFlags();
> > +  }
> > +  ApplySandboxFlags(sandboxFlags);
> 
> Why we need to move this code? Please add comment for it if there is
> legitimate reason.
> 

We have to do mDocShell->SetFrameType first for setting the mozbrowser boundary, or we will get a wrong top frame element in nsContentUtils::GetPresentationURL.

> @@ +3014,5 @@
> > +    nsAutoString presentationURL;
> > +    nsContentUtils::GetPresentationURL(mDocShell, presentationURL);
> > +    if (!presentationURL.IsEmpty()) {
> > +      sandboxFlags |= SANDBOXED_AUXILIARY_NAVIGATION;
> > +    }
> 
> Please add a comment for it, or leave a reference to spec here.
> 

Will do.

> ::: dom/ipc/TabChild.cpp
> @@ +894,5 @@
> >    nsDocShell::Cast(docShell)->SetOriginAttributes(OriginAttributesRef());
> > +
> > +  if (!PresentationURL().IsEmpty()) {
> > +    docShell->SetSandboxFlags(SANDBOXED_AUXILIARY_NAVIGATION);
> > +  }
> 
> comment here, too.

Will do. Thanks.
Add some comments.
Attachment #8763028 - Attachment is obsolete: true
Attachment #8763202 - Flags: review?(bugs)
(In reply to Shih-Chiang Chien [:schien] (UTC+8) (use ni? plz) from comment #4)
> Comment on attachment 8763029 [details] [diff] [review]
> Part2: Test case
> 
> Review of attachment 8763029 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: dom/presentation/tests/mochitest/mochitest.ini
> @@ +50,5 @@
> >  skip-if = (e10s || toolkit == 'gonk' || toolkit == 'android') # Bug 1129785
> > +[test_presentation_receiver_auxiliary_navigation_inproc.html]
> > +skip-if = (e10s || toolkit == 'gonk' || toolkit == 'android') # Bug 1129785
> > +[test_presentation_receiver_auxiliary_navigation_oop.html]
> > +skip-if = (e10s || toolkit == 'gonk' || toolkit == 'android') # Bug 1129785
> 
> we can probably run this test on Android as well. please try it.

Let's see if this can pass on Android.
https://treeherder.mozilla.org/#/jobs?repo=try&revision=ae7106e72500
Attachment #8763202 - Flags: review?(bugs) → review+
Attached patch Part2: Test case -v2 (obsolete) β€” β€” Splinter Review
Enable tests on Android.
Attachment #8763029 - Attachment is obsolete: true
Attachment #8763752 - Flags: review?(bugs)
Comment on attachment 8763752 [details] [diff] [review]
Part2: Test case -v2

Not about this bug, but presentation code in general. I wonder if we should add a new module for it and have couple of peers for reviewing and such?
Attachment #8763752 - Flags: review?(bugs) → review+
Attachment #8763202 - Attachment is obsolete: true
Attachment #8764100 - Flags: review+
Attached patch Part2: Test case, r=smaug β€” β€” Splinter Review
Attachment #8763752 - Attachment is obsolete: true
Attachment #8764101 - Flags: review+
Keywords: checkin-needed
(In reply to Olli Pettay [:smaug] (high review load, please consider other reviewers) from comment #9)
> Comment on attachment 8763752 [details] [diff] [review]
> Part2: Test case -v2
> 
> Not about this bug, but presentation code in general. I wonder if we should
> add a new module for it and have couple of peers for reviewing and such?

Sounds a good idea.

I think S.C. should be the peer or perhaps the owner. :)
Flags: needinfo?(schien)
Pushed by cbook@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/29e67b27dae3
Set SANDBOXED_AUXILIARY_NAVIGATION flag to receiver page, r=smaug
https://hg.mozilla.org/integration/mozilla-inbound/rev/79918d9ceb0b
Test case, r=smaug
Keywords: checkin-needed
(In reply to Kershaw Chang [:kershaw] from comment #12)
> (In reply to Olli Pettay [:smaug] (high review load, please consider other
> reviewers) from comment #9)
> > Comment on attachment 8763752 [details] [diff] [review]
> > Part2: Test case -v2
> > 
> > Not about this bug, but presentation code in general. I wonder if we should
> > add a new module for it and have couple of peers for reviewing and such?
> 
> Sounds a good idea.
> 
> I think S.C. should be the peer or perhaps the owner. :)

I'm ok with it since I've been doing drive-by review for a while.
Flags: needinfo?(schien)
https://hg.mozilla.org/mozilla-central/rev/29e67b27dae3
https://hg.mozilla.org/mozilla-central/rev/79918d9ceb0b
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
NOTE: Please see https://wiki.mozilla.org/Release_Management/B2G_Landing to better understand the B2G approval process and landings.

[Approval Request Comment]
Bug caused by (feature/regressing bug #): Presentation API
User impact if declined: Receiver page can do window.open().
Testing completed: with automation test
Risk to taking this patch (and alternatives if risky): low
String or UUID changes made by this patch: N/A
Attachment #8765806 - Flags: approval-mozilla-b2g48?
Attachment #8764101 - Flags: approval-mozilla-b2g48?
Josh,

Please help to approve. Thanks.
Flags: needinfo?(jocheng)
Comment on attachment 8765806 [details] [diff] [review]
[b2g_48_v2_6] Part1: Add SANDBOXED_AUXILIARY_NAVIGATION flag to receiver page, r=smaug

Approve for TV 2.6
Flags: needinfo?(jocheng)
Attachment #8765806 - Flags: approval-mozilla-b2g48? → approval-mozilla-b2g48+
Comment on attachment 8764101 [details] [diff] [review]
Part2: Test case, r=smaug

Approve for TV 2.6
Attachment #8764101 - Flags: approval-mozilla-b2g48? → approval-mozilla-b2g48+
Gary, please help to merge the pull request.

Thanks.

https://github.com/mozilla-b2g/gecko-b2g/pull/29
Flags: needinfo?(xeonchen)
https://github.com/mozilla-b2g/gecko-b2g/commit/e81fd19f9e908939f9476b95b85d09e155b4aaea
Flags: needinfo?(xeonchen)
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: