Closed
Bug 1215426
Opened 9 years ago
Closed 9 years ago
[Presentation WebAPI] Grant access to browser receiving pages
Categories
(Firefox OS Graveyard :: General, defect)
Tracking
(firefox44 fixed)
RESOLVED
FIXED
FxOS-S10 (30Oct)
Tracking | Status | |
---|---|---|
firefox44 | --- | fixed |
People
(Reporter: selin, Assigned: selin)
References
Details
(Whiteboard: [ft:conndevices])
Attachments
(1 file, 3 obsolete files)
15.18 KB,
patch
|
selin
:
review+
|
Details | Diff | Splinter Review |
When the receiving context opens a page, especially for the one with an http/https URL, we need to grant "presentation" permission to that page, so that it's able to access |navigator.presentation|. (When opening an app page with app protocol, the receiver app may already declare "presentation" permission in its app manifest. So the opening page will automatically have the permission to use Presentation API.)
Assignee | ||
Updated•9 years ago
|
Whiteboard: [ft:conndevices]
Assignee | ||
Updated•9 years ago
|
Summary: [Presentation WebAPI] Add |presentation| permission to the receiving page → [Presentation WebAPI] Add |presentation| permission to browser receiving pages
Assignee | ||
Comment 1•9 years ago
|
||
Grant "presentation" permission to the OOP process if it's for browser receiving pages.
Comment 2•9 years ago
|
||
Hmm, why can't we change
partial interface Navigator {
[Throws, Pref="dom.presentation.enabled", CheckAnyPermissions="presentation", SameObject]
readonly attribute Presentation? presentation;
};
so that it would use Func, which then the relevant function checks pref, permission or if we're receiver?
Playing with codebase principal and what not looks hackish
Comment 3•9 years ago
|
||
Comment on attachment 8676091 [details] [diff] [review]
Patch, v1
...but if you think this approach should be taken, please explain and as review again.
Attachment #8676091 -
Flags: review?(bugs) → review-
Assignee | ||
Updated•9 years ago
|
Summary: [Presentation WebAPI] Add |presentation| permission to browser receiving pages → [Presentation WebAPI] Grant access to browser receiving pages
Assignee | ||
Comment 4•9 years ago
|
||
Using |Func| for access control.
Attachment #8676091 -
Attachment is obsolete: true
Attachment #8676658 -
Flags: review?(bugs)
Comment 5•9 years ago
|
||
Comment on attachment 8676658 [details] [diff] [review]
Patch, v2
>+
>+ nsAutoString sessionId;
>+ nsresult rv = presentationService->GetExistentSessionIdAtLaunch(win->WindowID(),
>+ sessionId);
>+ if (NS_WARN_IF(NS_FAILED(rv))) {
>+ return false;
>+ }
>+
I wonder how this all should work in iframes. Do we want to allow also same origin iframes to access the presentation?
If yes, something like the following, instead of testing win, could be done in a followup patch (+ some tests)
nsCOMPtr<nsIDOMWindow> top = win->GetTop();
nsCOMPtr<nsIScriptObjectPrincipal> sop = do_QueryInterface(win);
nsCOMPtr<nsIScriptObjectPrincipal> topSop = do_QueryInterface(top);
if (!sop || !topSop) {
return false;
}
nsIPrincipal* principal = sop->GetPrincipal();
nsIPrincipal* topPrincipal = topSop->GetPrincipal();
if (!principal || !topPrincipal || !principal->Subsumes(topPrincipal)) {
return false;
}
nsCOMPtr<nsPIDOMWindow> piTop = do_QueryInterface(top);
if (!piTop || !(piTop = piTop->GetCurrentInnerWindow())) {
return false;
}
nsAutoString sessionId;
presentationService->GetExistentSessionIdAtLaunch(piTop->WindowID(), sessionId);
return !sessionId.IsEmpty();
Attachment #8676658 -
Flags: review?(bugs) → review+
Assignee | ||
Comment 6•9 years ago
|
||
Updating based on r+ comments.
Attachment #8676658 -
Attachment is obsolete: true
Attachment #8677307 -
Flags: review+
Assignee | ||
Comment 7•9 years ago
|
||
The latest try-run. FYI.
https://treeherder.mozilla.org/#/jobs?repo=try&revision=ebb1cae6efbe
Keywords: checkin-needed
Assignee | ||
Comment 8•9 years ago
|
||
Attachment #8677307 -
Attachment is obsolete: true
Attachment #8677316 -
Flags: review+
Keywords: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox44:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → FxOS-S10 (30Oct)
You need to log in
before you can comment on or make changes to this bug.
Description
•