Closed Bug 1216398 Opened 9 years ago Closed 9 years ago

[Presentation WebAPI] provide device ID to TCPPresentationServer while device discoverable is turned off

Categories

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

defect

Tracking

()

RESOLVED FIXED
mozilla44
Tracking Status
firefox44 --- fixed

People

(Reporter: schien, Assigned: schien)

References

Details

(Whiteboard: [ft:conndevices])

Attachments

(1 file, 2 obsolete files)

TCPPresentationServer needs a ID for initiating session request, however in current code base we only set ID after service is registered. In this case, we cannot make a pure controller (enable discovery but disable discoverable).

We'll need to init TCPPresentationServer before service registeration.
TCPPresentationServer.id is only used for controller scenario and TCPPresentationServer.startService is only used for receiver scenario.

MDNSDeviceProvider might correct the Id after service registration but it doesn't affect any receiver side functionality.
Attachment #8676099 - Flags: feedback?(xeonchen)
Attachment #8676099 - Flags: feedback?(juhsu)
Comment on attachment 8676099 [details] [diff] [review]
bug1216398-support-non-discoverable-device.patch

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

lgtm, thank you!

::: dom/presentation/provider/MulticastDNSDeviceProvider.cpp
@@ +185,5 @@
>    mDiscveryTimeoutMs = Preferences::GetUint(PREF_PRESENTATION_DISCOVERY_TIMEOUT_MS);
>    mDiscoverable = Preferences::GetBool(PREF_PRESENTATION_DISCOVERABLE);
>    mServiceName = Preferences::GetCString(PREF_PRESENTATION_DEVICE_NAME);
>  
> +  mPresentationServer->SetId(mServiceName);

the return value should be checked?
Attachment #8676099 - Flags: feedback?(xeonchen) → feedback+
Status: NEW → ASSIGNED
Comment on attachment 8676099 [details] [diff] [review]
bug1216398-support-non-discoverable-device.patch

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

::: dom/presentation/provider/MulticastDNSDeviceProvider.cpp
@@ +185,5 @@
>    mDiscveryTimeoutMs = Preferences::GetUint(PREF_PRESENTATION_DISCOVERY_TIMEOUT_MS);
>    mDiscoverable = Preferences::GetBool(PREF_PRESENTATION_DISCOVERABLE);
>    mServiceName = Preferences::GetCString(PREF_PRESENTATION_DEVICE_NAME);
>  
> +  mPresentationServer->SetId(mServiceName);

|SetId| will no fail after this modification, I'll use |unused| to capture the return value.
Address previous review comment and use device name as default service name on Fennec.
Attachment #8676099 - Attachment is obsolete: true
Attachment #8676099 - Flags: feedback?(juhsu)
Attachment #8676687 - Flags: review?(xeonchen)
Attachment #8676687 - Flags: review?(juhsu)
Attachment #8676687 - Flags: review?(xeonchen) → review+
Comment on attachment 8676687 [details] [diff] [review]
bug1216398-support-non-discoverable-device.patch

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

::: dom/presentation/interfaces/nsITCPPresentationServer.idl
@@ +87,5 @@
>    readonly attribute uint16_t port;
>  
>    /**
> +   * The id of the TCP presentation server. The TCP presentation server won't
> +   * work until the |id| is set.

This comment seems not able to elaborate the intention of this patch. Should |id| always be set before use? 

|responseSession| doesn't check the existence of |id| anymore. Does it mean TCPPresentationServer is able to without id as a presenter?

Whatever it is, make it clear on the comment.

::: dom/presentation/provider/TCPPresentationServer.js
@@ +65,5 @@
>      } catch (e) {
>        // NS_ERROR_SOCKET_ADDRESS_IN_USE
>        DEBUG && log("TCPPresentationServer - init server socket fail: " + e);
>        throw Cr.NS_ERROR_FAILURE;
>      }

idl should mention this throw

@@ +128,5 @@
>                                   aUrl);
>    },
>  
>    responseSession: function(aDeviceInfo, aSocketTransport) {
> +    if (!this._isServiceInit()) {

I guess we never reach here. Modify the log message to specify it.
Attachment #8676687 - Flags: review?(juhsu) → review+
Comment on attachment 8676687 [details] [diff] [review]
bug1216398-support-non-discoverable-device.patch

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

::: dom/presentation/interfaces/nsITCPPresentationServer.idl
@@ +87,5 @@
>    readonly attribute uint16_t port;
>  
>    /**
> +   * The id of the TCP presentation server. The TCP presentation server won't
> +   * work until the |id| is set.

Yeah, |id| is only required for controller action, i.e. requestSession. I'll rephrase the comment.

::: dom/presentation/provider/TCPPresentationServer.js
@@ +65,5 @@
>      } catch (e) {
>        // NS_ERROR_SOCKET_ADDRESS_IN_USE
>        DEBUG && log("TCPPresentationServer - init server socket fail: " + e);
>        throw Cr.NS_ERROR_FAILURE;
>      }

Oh my bad, I shouldn't remove the |throw| section in IDL.
update according to review comments, carry r+.
Attachment #8676687 - Attachment is obsolete: true
Attachment #8676750 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/d340e3a25b9c
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
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: