Closed
Bug 1234128
Opened 9 years ago
Closed 8 years ago
[Presentation WebAPI] navigator.presentation.receiver is null in 1-UA use case.
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
People
(Reporter: kuoe0.tw, Assigned: schien)
References
Details
(Whiteboard: [ETA 5/26])
Attachments
(7 files, 13 obsolete files)
14.37 KB,
patch
|
schien
:
review+
jocheng
:
approval-mozilla-b2g48+
|
Details | Diff | Splinter Review |
38.70 KB,
patch
|
schien
:
review+
jocheng
:
approval-mozilla-b2g48+
|
Details | Diff | Splinter Review |
11.15 KB,
patch
|
schien
:
review+
jocheng
:
approval-mozilla-b2g48+
|
Details | Diff | Splinter Review |
14.48 KB,
patch
|
Details | Diff | Splinter Review | |
11.15 KB,
patch
|
Details | Diff | Splinter Review | |
38.70 KB,
patch
|
Details | Diff | Splinter Review | |
48 bytes,
text/x-github-pull-request
|
Details | Review |
I found navigator.presentation.receiver is null when using Presentation API in 1-UA use case. The reason is PresentationIPCService::GetExistentSessionIdAtLaunch called before PresentationIPCService::NotifyReceiverReady. So PresentationIPCService::GetExistentSessionIdAtLaunch got an empty session id and does not create PresentationReceiver. A workaround is using navigator.presentation with 1 sec delay.
Reporter | ||
Comment 1•9 years ago
|
||
I noticed that it need longer time to call PresentationIPCService::NotifyReceiverReady. We need to go thru the following steps before calling PresentationIPCService::NotifyReceiverReady: 1. App launched 2. Notify shell_remote.js 3. Notify observer (PresentationRequestUIGlue.js) 4. Call PresentationIPCService::NotifyReceiverReady And navigator.presentation.receiver is usually used when app launched.
Reporter | ||
Updated•9 years ago
|
Summary: navigator.presentation.receiver is null in 1-UA use case. → [Presentation WebAPI] navigator.presentation.receiver is null in 1-UA use case.
Reporter | ||
Updated•9 years ago
|
Blocks: 1-UA_Presentation_API
Comment 2•8 years ago
|
||
In bug 1245031, the same timing issue is confirmed to happen to 2-UA scenarios under some edge cases. And it's intermittently reproducible in mochitest run on the local desktop (Linux x64). As a short-term workaround, we disable the affected test and wait for the fix to this bug to enable it again.
Comment 3•8 years ago
|
||
Hi Tommy, Could you please confirm this patch? I encountered this bug at bug 1217713, comment 14.(Simulate of Presentation API) I added the observer in order to detect status of receiver for testing. The patch of those testing is this attachment. I thought that |PresentationPresentingInfo#NotifyResponderready| is called when receiver is ready, even if frame is OOP or in-process. So I think that we can observe those function as whether receiver is ready.
Attachment #8731565 -
Flags: review?(schien)
Attachment #8731565 -
Flags: review?(kuoe0)
Assignee | ||
Comment 4•8 years ago
|
||
Comment on attachment 8731565 [details] [diff] [review] Add observer to Presentation in order to detect prepare of receiver. Review of attachment 8731565 [details] [diff] [review]: ----------------------------------------------------------------- Presentation and PresentationSessionInfo object can be in different process, which cannot be communicated over observer.
Attachment #8731565 -
Flags: review?(schien) → review-
Comment 5•8 years ago
|
||
Many thanks schine. (In reply to Shih-Chiang Chien [:schien] (UTC+8) (use ni? plz) from comment #4) > Comment on attachment 8731565 [details] [diff] [review] > Add observer to Presentation in order to detect prepare of receiver. > > Review of attachment 8731565 [details] [diff] [review]: > ----------------------------------------------------------------- > > Presentation and PresentationSessionInfo object can be in different process, > which cannot be communicated over observer. I think that |PresentationPresentingInfo#NotifyResponderReady| called from content process. In OOP case(Gonk/Desktop), notify to content process from parent process via IPC[1]. So We can detect receiver ready status in content process. In process frame case(Mulet), notify to same process as function call[2]. I guess that we can notify receiver status to content process using current presentation implementation. I am sorry if my interpretation is mistaken. [1] https://dxr.mozilla.org/mozilla-central/source/dom/presentation/PresentationSessionInfo.cpp#963 [2] https://dxr.mozilla.org/mozilla-central/source/dom/presentation/PresentationSessionInfo.cpp#975
Flags: needinfo?(schien)
Assignee | ||
Comment 6•8 years ago
|
||
PresentationSessionInfo object always lives in chrome process and Presentation object lives in the same process as the receiver web page (content process for e10s and chrome process for Mulet). For e10s environment the notification is just like what you described, and for non-e10s environment the notification is done at the same function at [1]. The entire flow is like below: PresentationSessionInfo::ResolvedCallback [=> IPC to content process for e10s] => PresentationResponderLoadingCallback::Init [=> wait for document loading callback if necessary] => PresentationResponderLoadingCallback::NotifyReceiverReady => nsIPresentationService::NotifyReceiverReady => mResponderSessionIds.Put(windowId, sessionId) [=> IPC to chrome process for e10s] => PresentationSessionInfo::NotifyResponderReady As for content page, navigator.presentation object is created at the first use and we decide whether this page is for controller and receiver. The check we use is via nsIPresentationService::GetExistingSessionIdAtLaunch and it checks by mResponderSessionIds.Get(windowId). So you can see there is a timing issue if the first use of navigator.presentation comes earlier than mResponderSessionIds.Put(). That's why I think your patch doesn't matched with the current code and might not solve the bug. The real solution I can imaging is either to improve the controller/receiver check, or do synchronous check while creating PresentationReceiver object. [1] https://dxr.mozilla.org/mozilla-central/source/dom/presentation/PresentationSessionInfo.cpp#974
Flags: needinfo?(schien)
Comment 7•8 years ago
|
||
(FWIW, I think it would be great if someone draw some picture of the object hierarchy in Presentation API. And also some state diagram. Perhaps separate versions for non-OOP and OOP. )
Assignee | ||
Comment 8•8 years ago
|
||
(In reply to Olli Pettay [:smaug] from comment #7) > (FWIW, I think it would be great if someone draw some picture of the object > hierarchy in Presentation API. And also some state diagram. Perhaps separate > versions for non-OOP and OOP. ) I put the sequence diagram on https://wiki.mozilla.org/WebAPI/PresentationAPI:CoreService#handle_presentation_request . I'll take first stab on this bug.
Assignee: nobody → schien
Assignee | ||
Updated•8 years ago
|
blocking-b2g: --- → 2.6?
Assignee | ||
Comment 9•8 years ago
|
||
The solution I have in mind is to pass a flag while creating the browser element for presented content, i.e. we'll need to introduce additional 'mozPresentation' attributes in browser element. Therefore, this information will be ready at the very beginning of document loading procedure.
Assignee | ||
Comment 10•8 years ago
|
||
WIP for marking presented content with "mozPresentation" attribute. TODOs - support non-remote iframe - check same-origin policy for iframe inside the presented content
Attachment #8731565 -
Attachment is obsolete: true
Attachment #8731565 -
Flags: review?(kuoe0)
Assignee | ||
Updated•8 years ago
|
Whiteboard: [ETA 5/26]
Assignee | ||
Comment 11•8 years ago
|
||
Introduce 'mozpresentation' attribute for browser element for identifying the scope of presented content.
Attachment #8746352 -
Attachment is obsolete: true
Attachment #8749148 -
Flags: review?(khuey)
Assignee | ||
Comment 12•8 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=646705d35577
Assignee | ||
Comment 13•8 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=c2f3dc12f9f6
Assignee | ||
Comment 14•8 years ago
|
||
add "mozpresentation=<requested URL>" in browser element.
Attachment #8749148 -
Attachment is obsolete: true
Attachment #8749148 -
Flags: review?(khuey)
Attachment #8750169 -
Flags: review?(bugs)
Assignee | ||
Comment 15•8 years ago
|
||
use the presentation URL stored in nsDocShell to identify the window for presented content.
Attachment #8750170 -
Flags: review?(bugs)
Assignee | ||
Comment 16•8 years ago
|
||
update test cases to use mozbrowser and mozpresentation.
Attachment #8750171 -
Flags: review?(bugs)
Comment 17•8 years ago
|
||
Reviews are coming. Sorry about delay. Trying to get to this and other presentation API patches tomorrow.
Comment 18•8 years ago
|
||
Comment on attachment 8750169 [details] [diff] [review] part 1, introduce mozpresentation Could we not store presentation url in so many places. in non-OOP case one can access is from the xul:browser and in IPC case from TabChild. So is there any reason to have setPresentationURL, when GetPresentationURL can get the information from elsewhere. And if there is... readonly attribute DOMString presentationURL; void setPresentationURL(in DOMString presentationURL); is effectively the same as attribute DOMString presentationURL; If we want to keep nsDocShell::SetPresentationURL, it should want if it is used on non-toplevel root same-type-docshell. ...but let me read other patches.
Comment 19•8 years ago
|
||
Comment on attachment 8750169 [details] [diff] [review] part 1, introduce mozpresentation Yeah, so after looking at the other patch, I think we don't need any changes to docshell. Just some helper method which takes a docshell as param and then tries to access TabChild from it and the presentation url from it, or in non-OOP case there seems to be the helper GetTopFrameElement. I just prefer to not add presentation API specific stuff to docshell if possible, since docshell is complicated enough
Attachment #8750169 -
Flags: review?(bugs) → review-
Comment 20•8 years ago
|
||
Comment on attachment 8750170 [details] [diff] [review] part 2, use presentation URL to identify prsented content So docshell->GetPresentationURL calls would need to use some helper method, but otherwise look ok.
Attachment #8750170 -
Flags: review?(bugs) → review+
Comment 21•8 years ago
|
||
Comment on attachment 8750171 [details] [diff] [review] part 3, test cases I'm pretty sure you don't want alert() anywhere. Wouldn't console.log() or dump() work better than alert. mostly rs+
Attachment #8750171 -
Flags: review?(bugs) → review+
Assignee | ||
Comment 22•8 years ago
|
||
(In reply to Olli Pettay [:smaug] from comment #21) > Comment on attachment 8750171 [details] [diff] [review] > part 3, test cases > > I'm pretty sure you don't want alert() anywhere. > Wouldn't console.log() or dump() work better than alert. > > mostly rs+ |alert| is used as a content-to-chrome IPC mechanism (via mozBrowser API) in these test cases.
Comment 23•8 years ago
|
||
I see. ok, thanks.
Assignee | ||
Comment 24•8 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=40e7ae0ac71e
Assignee | ||
Comment 25•8 years ago
|
||
add helper function in nsContentUtils and remove docshell modifications.
Attachment #8750169 -
Attachment is obsolete: true
Attachment #8753170 -
Flags: review?(bugs)
Assignee | ||
Comment 26•8 years ago
|
||
use the helper function in nsContentUtils, carry r+.
Attachment #8750170 -
Attachment is obsolete: true
Attachment #8753171 -
Flags: review+
Assignee | ||
Comment 27•8 years ago
|
||
rebase to m-c, carry r+.
Attachment #8750171 -
Attachment is obsolete: true
Attachment #8753172 -
Flags: review+
Comment 28•8 years ago
|
||
Comment on attachment 8753170 [details] [diff] [review] part 1, introduce mozpresentation, v2 >+nsContentUtils::GetPresentationURL(nsIDocShell* aDocShell, nsAString& aPresentationUrl) >+{ >+ MOZ_ASSERT(aDocShell); >+ >+ if (XRE_IsContentProcess()) { >+ TabChild* tabChild = TabChild::GetFrom(aDocShell); >+ aPresentationUrl = tabChild->PresentationURL(); >+ return; >+ } >+ >+ nsCOMPtr<nsILoadContext> loadContext(do_QueryInterface(aDocShell)); >+ nsCOMPtr<nsIDOMElement> topFrameElement; >+ loadContext->GetTopFrameElement(getter_AddRefs(topFrameElement)); Just want to make sure... if <iframe mozbrowser> used in an application, this will return the iframe, and not the container iframe of the document which has that <iframe mozbrowser>. Is that expected? Other option is to effectively inline GetTopFrameElement call, but use GetTop and not GetScriptableTop. It is not clear to me which approach should be taken. I guess the current setup is fine. If some application using mozbrowser wants to expose presentation, it could first check whether it has presentation itself and if so, expose the attribute in the mozbrowser. >+ nsAutoString presentationURLStr; >+ if (mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::mozpresentation)) { >+ mOwnerContent->GetAttr(kNameSpaceID_None, >+ nsGkAtoms::mozpresentation, >+ presentationURLStr); >+ } You don't need the HasAttr check.
Attachment #8753170 -
Flags: review?(bugs) → review+
Assignee | ||
Comment 29•8 years ago
|
||
(In reply to Olli Pettay [:smaug] from comment #28) > Comment on attachment 8753170 [details] [diff] [review] > part 1, introduce mozpresentation, v2 > > >+nsContentUtils::GetPresentationURL(nsIDocShell* aDocShell, nsAString& aPresentationUrl) > >+{ > >+ MOZ_ASSERT(aDocShell); > >+ > >+ if (XRE_IsContentProcess()) { > >+ TabChild* tabChild = TabChild::GetFrom(aDocShell); > >+ aPresentationUrl = tabChild->PresentationURL(); > >+ return; > >+ } > >+ > >+ nsCOMPtr<nsILoadContext> loadContext(do_QueryInterface(aDocShell)); > >+ nsCOMPtr<nsIDOMElement> topFrameElement; > >+ loadContext->GetTopFrameElement(getter_AddRefs(topFrameElement)); > > Just want to make sure... if <iframe mozbrowser> used in an application, > this will return the iframe, and not the container iframe of > the document which has that <iframe mozbrowser>. Is that expected? > Other option is to effectively inline GetTopFrameElement call, but use > GetTop and not GetScriptableTop. > It is not clear to me which approach should be taken. I guess the current > setup is fine. If some application using mozbrowser wants to expose > presentation, > it could first check whether it has presentation itself and if so, expose > the attribute in the mozbrowser. Yes return the element of iframe is what I want. The <iframe mozbrowser> in side a presented content should not inherit the accessibility of presentation API. That's why I use |GetSameTypeRootTreeItem| in previous version. This reminds me that the behavior for OOP browser element doesn't have the same behavior because I always check the TabChild but not the inner most <iframe mozbrowser>. If this scenario is something we should take into consider, this is the logic I'll apply: if (oop) { if (docshell.rootTreeItem == docshell.sameTypeRootTreeItem) { return tabchild.presentatioURL(); } } return docshell.topFrameElement.attribute["mozpresentation"]; Any comments? > > >+ nsAutoString presentationURLStr; > >+ if (mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::mozpresentation)) { > >+ mOwnerContent->GetAttr(kNameSpaceID_None, > >+ nsGkAtoms::mozpresentation, > >+ presentationURLStr); > >+ } > You don't need the HasAttr check. Will fix.
Flags: needinfo?(bugs)
Assignee | ||
Comment 30•8 years ago
|
||
update according to comment #29.
Comment 31•8 years ago
|
||
(In reply to Shih-Chiang Chien [:schien] (UTC+8) (use ni? plz) from comment #29) > if (oop) { > if (docshell.rootTreeItem == docshell.sameTypeRootTreeItem) { > return tabchild.presentatioURL(); > } > } > > return docshell.topFrameElement.attribute["mozpresentation"]; That looks ok.
Flags: needinfo?(bugs)
Assignee | ||
Updated•8 years ago
|
Attachment #8753170 -
Attachment is obsolete: true
Assignee | ||
Comment 32•8 years ago
|
||
need a final check for nsContentUtils::GetPresentationURL.
Attachment #8753680 -
Attachment is obsolete: true
Attachment #8753799 -
Flags: review?(bugs)
Assignee | ||
Updated•8 years ago
|
Attachment #8753172 -
Attachment description: update-test-cases.patch → part 3, update-test-cases.patch
Assignee | ||
Comment 33•8 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=cd630bb55697
Comment 34•8 years ago
|
||
Comment on attachment 8753799 [details] [diff] [review] part 1, introduce mozpresentation, v3 >+ if (XRE_IsContentProcess()) { >+ nsCOMPtr<nsIDocShellTreeItem> sameTypeRoot; >+ aDocShell->GetSameTypeRootTreeItem(getter_AddRefs(sameTypeRoot)); >+ nsCOMPtr<nsIDocShellTreeItem> root; >+ aDocShell->GetRootTreeItem(getter_AddRefs(root)); >+ if (sameTypeRoot.get() == root.get()) { >+ // presentation URL is stored in TabChild for the top most >+ // <iframe mozbrowser> in content process. >+ TabChild* tabChild = TabChild::GetFrom(aDocShell); >+ aPresentationUrl = tabChild->PresentationURL(); Actually, I wouldn't mind adding a null check for tabChild. Just return early if there is no tabChild.
Attachment #8753799 -
Flags: review?(bugs) → review+
Assignee | ||
Comment 35•8 years ago
|
||
update according to review comments, rebase to m-c, carry r+
Attachment #8753799 -
Attachment is obsolete: true
Attachment #8754181 -
Flags: review+
Assignee | ||
Comment 36•8 years ago
|
||
rebase to m-c, carry r+
Attachment #8753171 -
Attachment is obsolete: true
Attachment #8754182 -
Flags: review+
Assignee | ||
Comment 37•8 years ago
|
||
rebase to m-c, carry r+
Attachment #8753172 -
Attachment is obsolete: true
Attachment #8754183 -
Flags: review+
Assignee | ||
Updated•8 years ago
|
Keywords: checkin-needed
Comment 38•8 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/7cf300dda85a https://hg.mozilla.org/integration/mozilla-inbound/rev/8a0848fb59ac https://hg.mozilla.org/integration/mozilla-inbound/rev/11db59507360
Keywords: checkin-needed
Comment 39•8 years ago
|
||
Backed out for Android crashtest failures. https://hg.mozilla.org/integration/mozilla-inbound/rev/e42d3d42dafa https://treeherder.mozilla.org/logviewer.html#?job_id=28239976&repo=mozilla-inbound#L2443
Assignee | ||
Comment 40•8 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=4bc8b548bb2f
Assignee | ||
Comment 41•8 years ago
|
||
fix android crashtest issue
Attachment #8754182 -
Attachment is obsolete: true
Attachment #8754618 -
Flags: review+
Assignee | ||
Updated•8 years ago
|
Keywords: checkin-needed
Comment 42•8 years ago
|
||
I've asked Gary to land your patches, since some of my works are depended on this bug. However, there are conflicts when applying to inbound. Could you rebase your patch again, please?
Flags: needinfo?(schien)
Assignee | ||
Comment 43•8 years ago
|
||
Flags: needinfo?(schien)
Assignee | ||
Comment 44•8 years ago
|
||
Assignee | ||
Comment 45•8 years ago
|
||
Assignee | ||
Comment 46•8 years ago
|
||
I've update the patch for inbound, please help merge. Thanks
Flags: needinfo?(xeonchen)
Comment 47•8 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/660dc7b00368 https://hg.mozilla.org/integration/mozilla-inbound/rev/cd4b56d6e53c https://hg.mozilla.org/integration/mozilla-inbound/rev/46845866285d
Keywords: checkin-needed
Updated•8 years ago
|
Flags: needinfo?(xeonchen)
Comment 48•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/660dc7b00368 https://hg.mozilla.org/mozilla-central/rev/cd4b56d6e53c https://hg.mozilla.org/mozilla-central/rev/46845866285d
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox49:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
Assignee | ||
Comment 49•8 years ago
|
||
Comment on attachment 8754181 [details] [diff] [review] part 1, introduce mozpresentation 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: presentation connection might fail 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 #8754181 -
Flags: approval-mozilla-b2g48?
Assignee | ||
Comment 50•8 years ago
|
||
Comment on attachment 8754183 [details] [diff] [review] part 3, update-test-cases.patch 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: presentation connection might fail 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 #8754183 -
Flags: approval-mozilla-b2g48?
Assignee | ||
Comment 51•8 years ago
|
||
Comment on attachment 8754618 [details] [diff] [review] part 2, use presentation URL to identify presented content 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: presentation connection might fail 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 #8754618 -
Flags: approval-mozilla-b2g48?
Comment 52•8 years ago
|
||
Comment on attachment 8754181 [details] [diff] [review] part 1, introduce mozpresentation Approve for TV 2.6
Attachment #8754181 -
Flags: approval-mozilla-b2g48? → approval-mozilla-b2g48+
Comment 53•8 years ago
|
||
Comment on attachment 8754183 [details] [diff] [review] part 3, update-test-cases.patch Approve for TV 2.6
Attachment #8754183 -
Flags: approval-mozilla-b2g48? → approval-mozilla-b2g48+
Comment 54•8 years ago
|
||
Comment on attachment 8754618 [details] [diff] [review] part 2, use presentation URL to identify presented content Approve for TV 2.6
Attachment #8754618 -
Flags: approval-mozilla-b2g48? → approval-mozilla-b2g48+
Assignee | ||
Comment 55•8 years ago
|
||
Flags: needinfo?(xeonchen)
Comment 56•8 years ago
|
||
https://github.com/mozilla-b2g/gecko-b2g/commit/6b1d94f1edc5abc4f92953d685097a7333130364
status-b2g-v2.6:
--- → fixed
Flags: needinfo?(xeonchen)
Comment 57•8 years ago
|
||
https://github.com/mozilla-b2g/gecko-b2g/commit/3020a9629ea22bf70e8e3509b57d0cb7daf5a540
Assignee | ||
Comment 58•8 years ago
|
||
Attachment #8758191 -
Attachment is obsolete: true
Flags: needinfo?(xeonchen)
Updated•8 years ago
|
Flags: needinfo?(xeonchen)
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•