Closed Bug 1272197 Opened 8 years ago Closed 8 years ago

[Presentation WebAPI] implement connect / disconnect / launch command

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla50
blocking-b2g 2.6+
Tracking Status
b2g-v2.6 --- fixed
firefox50 --- fixed

People

(Reporter: schien, Assigned: schien)

References

Details

(Whiteboard: [ETA 5/26] btpp-active)

Attachments

(7 files, 17 obsolete files)

(deleted), patch
schien
: review+
Details | Diff | Splinter Review
(deleted), patch
schien
: review+
Details | Diff | Splinter Review
(deleted), patch
schien
: review+
Details | Diff | Splinter Review
(deleted), patch
schien
: review+
Details | Diff | Splinter Review
(deleted), patch
schien
: review+
Details | Diff | Splinter Review
(deleted), patch
CuveeHsu
: review+
Details | Diff | Splinter Review
(deleted), text/x-github-pull-request
Details
Whiteboard: [ETA 5/26] → [ETA 5/26] btpp-active
Attached patch [WIP] broadcast-protcol-version.patch (obsolete) (deleted) — Splinter Review
change mdns service name to "_presentation-ctrl._tcp" and add "version" field in service record.
Attached patch [WIP] start-session-procedure.patch (obsolete) (deleted) — Splinter Review
move the protocol handling out of control channel.
blocking-b2g: 2.6? → 2.6+
Summary: [Presentation WebAPI] implement launch / terminate /close command → [Presentation WebAPI] implement connect / disconnect / launch / terminate command
Attached patch [WIP] broadcast-protcol-version.patch (obsolete) (deleted) — Splinter Review
Attachment #8753800 - Attachment is obsolete: true
Attached patch [WIP] start-session-procedure.patch (obsolete) (deleted) — Splinter Review
Attachment #8753801 - Attachment is obsolete: true
Attached patch [WIP] broadcast-protcol-version.patch (obsolete) (deleted) — Splinter Review
rebased to m-c
Attachment #8757047 - Attachment is obsolete: true
Attached patch [WIP] start-session-procedure.patch (obsolete) (deleted) — Splinter Review
rebased to m-c
Attachment #8757049 - Attachment is obsolete: true
Attached patch support-terminate-command.patch (obsolete) (deleted) — Splinter Review
rebase to m-c
Attachment #8757050 - Attachment is obsolete: true
Will further split the patches into review-able parts, or even bugs tomorrow.
Attached patch part 1, broadcast-protcol-version.patch (obsolete) (deleted) — Splinter Review
introduce new MDNS service type and version number concept
Attachment #8757082 - Attachment is obsolete: true
Attachment #8765863 - Flags: feedback?(juhsu)
Attached patch part 2, start-session-procedure.patch (obsolete) (deleted) — Splinter Review
implement connect and launch command
Attachment #8757083 - Attachment is obsolete: true
Attachment #8765864 - Flags: feedback?(juhsu)
Attached patch part 3, support-terminate-command.patch (obsolete) (deleted) — Splinter Review
implement terminate command
Attachment #8757084 - Attachment is obsolete: true
Attachment #8765865 - Flags: feedback?(juhsu)
Attached patch part 4, support-legacy-ctrl-protocol.patch (obsolete) (deleted) — Splinter Review
add legacy device provider for TV 2.5 backward compatibility
Attachment #8765866 - Flags: feedback?(juhsu)
Attachment #8765863 - Attachment description: broadcast-protcol-version.patch → part 1, broadcast-protcol-version.patch
Comment on attachment 8765863 [details] [diff] [review]
part 1, broadcast-protcol-version.patch

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

::: dom/presentation/provider/MulticastDNSDeviceProvider.cpp
@@ +349,5 @@
> +
> +  uint32_t localVersion;
> +  Unused << NS_WARN_IF(NS_FAILED(mPresentationService->GetVersion(&localVersion)));
> +
> +  return localVersion == remoteVersion;

Is the service compatible only if the versions are the same? Or maybe backward compatible?
Attachment #8765863 - Flags: feedback?(juhsu) → feedback+
Comment on attachment 8765864 [details] [diff] [review]
part 2, start-session-procedure.patch

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

::: dom/presentation/provider/ControllerStateMachine.jsm
@@ +15,5 @@
> +/* globals State, CommandType */
> +Cu.import("resource://gre/modules/presentation/StateMachineHelper.jsm");
> +
> +const DEBUG = true;
> +function debug (str) {

nit: debug(str) {

::: dom/presentation/provider/PresentationControlService.js
@@ +119,2 @@
>      if (!this.id) {
> +      DEBUG && log("PresentationControlService - Id has not initialized; requestSession fails"); //jshint ignore:line

Lots of noise for jshint here and there 
It's fine with the new-add code, but it distracts the review process for code with only adding ignore message.

If you'd like to land those jshint symbol, maybe we need to sort out these code to another patch.

@@ +353,5 @@
>                       .openOutputStream(Ci.nsITransport.OPEN_UNBUFFERED, 0, 0);
>  
> +  this._stateMachine =
> +    (direction === "sender") ? new ControllerStateMachine(this, presentationService.id)
> +                             : new ReceiverStateMachine(this);

Is there a circular reference?

::: dom/presentation/provider/ReceiverStateMachine.jsm
@@ +116,5 @@
> +    handlers[this.state](this, command);
> +  },
> +
> +  onChannelReady: function _onChannelReady() {
> +    this.state = State.CONNECTING;

Any precondition?

@@ +142,5 @@
> +            reason = this._closeReason;
> +            delete this._closeReason;
> +          }
> +          this._notifyClosed(reason);
> +        }

How about the else case?
Attachment #8765864 - Flags: feedback?(juhsu) → feedback+
Comment on attachment 8765866 [details] [diff] [review]
part 4, support-legacy-ctrl-protocol.patch

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

Originally I hope we can move logic to stateMachine.
However it seems not easy per offline discussion.

But it's fine. These should be removed eventually.

I'm not familiar with MDNS code, maybe we need another eye for feedback.

::: dom/presentation/provider/LegacyPresentationControlService.js
@@ +467,5 @@
> +      this._connected = false;
> +    }
> +  },
> +
> +  classID: Components.ID("{fefb8286-0bdc-488b-98bf-0c11b485c955}"),

I guess the id should be changed
Attachment #8765866 - Flags: feedback?(xeonchen)
Attachment #8765866 - Flags: feedback?(juhsu)
Attachment #8765866 - Flags: feedback+
Comment on attachment 8765865 [details] [diff] [review]
part 3, support-terminate-command.patch

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

Sorry not able to finish feedback this week. Will continue on this.

::: dom/presentation/provider/PresentationControlService.js
@@ +396,5 @@
>  
> +  terminate: function(aPresentationId) {
> +    this._stateMachine.terminate(aPresentationId);
> +  },
> +

Where is the caller? I guess it should be control by SessionInfo.
Comment on attachment 8765863 [details] [diff] [review]
part 1, broadcast-protcol-version.patch

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

::: dom/presentation/provider/MulticastDNSDeviceProvider.cpp
@@ +349,5 @@
> +
> +  uint32_t localVersion;
> +  Unused << NS_WARN_IF(NS_FAILED(mPresentationService->GetVersion(&localVersion)));
> +
> +  return localVersion == remoteVersion;

How about move this compatibility check into PresentationControlService? There might be more complex check every time we update the protocol.
Comment on attachment 8765864 [details] [diff] [review]
part 2, start-session-procedure.patch

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

::: dom/presentation/provider/ControllerStateMachine.jsm
@@ +15,5 @@
> +/* globals State, CommandType */
> +Cu.import("resource://gre/modules/presentation/StateMachineHelper.jsm");
> +
> +const DEBUG = true;
> +function debug (str) {

done.

::: dom/presentation/provider/PresentationControlService.js
@@ +119,2 @@
>      if (!this.id) {
> +      DEBUG && log("PresentationControlService - Id has not initialized; requestSession fails"); //jshint ignore:line

sure I can separate jshint code in part-0 patch.

@@ +353,5 @@
>                       .openOutputStream(Ci.nsITransport.OPEN_UNBUFFERED, 0, 0);
>  
> +  this._stateMachine =
> +    (direction === "sender") ? new ControllerStateMachine(this, presentationService.id)
> +                             : new ReceiverStateMachine(this);

circular reference in between pure JS objects is fine IIRC.

::: dom/presentation/provider/ReceiverStateMachine.jsm
@@ +116,5 @@
> +    handlers[this.state](this, command);
> +  },
> +
> +  onChannelReady: function _onChannelReady() {
> +    this.state = State.CONNECTING;

Add |if (this.state === State.INIT)| as precondition.

@@ +142,5 @@
> +            reason = this._closeReason;
> +            delete this._closeReason;
> +          }
> +          this._notifyClosed(reason);
> +        }

In closing state, it means we have triggered close from local peer. Local channel close will do nothing.
Or do you have second thoughts?
Comment on attachment 8765865 [details] [diff] [review]
part 3, support-terminate-command.patch

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

::: dom/presentation/provider/PresentationControlService.js
@@ +396,5 @@
>  
> +  terminate: function(aPresentationId) {
> +    this._stateMachine.terminate(aPresentationId);
> +  },
> +

yes by session info object, see patch on bug 1276378.
Comment on attachment 8765866 [details] [diff] [review]
part 4, support-legacy-ctrl-protocol.patch

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

::: dom/presentation/provider/LegacyPresentationControlService.js
@@ +467,5 @@
> +      this._connected = false;
> +    }
> +  },
> +
> +  classID: Components.ID("{fefb8286-0bdc-488b-98bf-0c11b485c955}"),

done.
@junior you might want to check my response between comment #19 ~ #22.
Flags: needinfo?(juhsu)
> ::: dom/presentation/provider/MulticastDNSDeviceProvider.cpp
> @@ +349,5 @@
> > +
> > +  uint32_t localVersion;
> > +  Unused << NS_WARN_IF(NS_FAILED(mPresentationService->GetVersion(&localVersion)));
> > +
> > +  return localVersion == remoteVersion;
> 
> How about move this compatibility check into PresentationControlService?
> There might be more complex check every time we update the protocol.

That's up to you. My point is to consider the precise compatible situation.

> @@ +142,5 @@
> > +            reason = this._closeReason;
> > +            delete this._closeReason;
> > +          }
> > +          this._notifyClosed(reason);
> > +        }
> 
> In closing state, it means we have triggered close from local peer. Local
> channel close will do nothing.
> Or do you have second thoughts?

Just confirm you have checked this condition.
Flags: needinfo?(juhsu)
(In reply to Junior [:junior] from comment #24)
> > ::: dom/presentation/provider/MulticastDNSDeviceProvider.cpp
> > @@ +349,5 @@
> > > +
> > > +  uint32_t localVersion;
> > > +  Unused << NS_WARN_IF(NS_FAILED(mPresentationService->GetVersion(&localVersion)));
> > > +
> > > +  return localVersion == remoteVersion;
> > 
> > How about move this compatibility check into PresentationControlService?
> > There might be more complex check every time we update the protocol.
> 
> That's up to you. My point is to consider the precise compatible situation.
Every time when updating protocol implementation, we'll need to rethink the compatibility check algorithm.
Since this is the first version of this protocol, exactly match of version number seems reasonable.
Comment on attachment 8765865 [details] [diff] [review]
part 3, support-terminate-command.patch

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

::: dom/presentation/interfaces/nsIPresentationTerminateRequest.idl
@@ +24,5 @@
> +  // The Id for representing this session.
> +  readonly attribute DOMString presentationId;
> +
> +  // The control channel for this session.
> +  readonly attribute nsIPresentationControlChannel controlChannel;

I guess the control channel is supposed to limited use.
Could we use all the APIs of controlChannel? Annotate it.

::: dom/presentation/provider/ControllerStateMachine.jsm
@@ +50,5 @@
>        case CommandType.LAUNCH_ACK:
>          stateMachine._notifyLaunch(command.presentationId);
>          break;
> +      case CommandType.TERMINATE_ACK:
> +        stateMachine._notifyTerminate(command.presentationId);

This call ends with |ControlService.onSessionTerminate| but the annotation there says "Callback while the remote host is requesting to terminate a presentation session."

Kinda semantically weird

::: dom/presentation/tests/xpcshell/test_tcp_control_channel.js
@@ +185,5 @@
> +  let yayFuncs = makeJointSuccess(['controllerControlChannelClose',
> +                                   'presenterControlChannelClose']);
> +  let controllerControlChannel;
> +
> +  tps.listener = {

tps should be renamed to pcs or something else.
Modify here or file a good first bug.

@@ +217,5 @@
> +
> +  presenterControlChannel.listener = {
> +    notifyOpened: function() {
> +      presenterControlChannel.terminate('testPresentationId', 'http://example.com');
> +      presenterControlChannel.close(CLOSE_CONTROL_CHANNEL_REASON);

The setup is kinda complicated and I can not easily tell the difference between |terminate| and |close|. Maybe we should mention something in |PresentationControlChannel.idl|:
1. the control channel is still alive after terminate
2. the relationship between |resume| and |terminate|
3. what API should be trigger after |terminate|? It seems |ControlService.onTerminateRequest|.

Should we always call a |terminate| before |close|?
Annotate clearly since it tends to confuse us when we have |terminate| and |close|.
Attachment #8765865 - Flags: feedback?(juhsu) → feedback+
Comment on attachment 8765865 [details] [diff] [review]
part 3, support-terminate-command.patch

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

::: dom/presentation/interfaces/nsIPresentationTerminateRequest.idl
@@ +24,5 @@
> +  // The Id for representing this session.
> +  readonly attribute DOMString presentationId;
> +
> +  // The control channel for this session.
> +  readonly attribute nsIPresentationControlChannel controlChannel;

done.

::: dom/presentation/provider/ControllerStateMachine.jsm
@@ +50,5 @@
>        case CommandType.LAUNCH_ACK:
>          stateMachine._notifyLaunch(command.presentationId);
>          break;
> +      case CommandType.TERMINATE_ACK:
> +        stateMachine._notifyTerminate(command.presentationId);

termination procedure doesn't really need "ack", however I tried to make the protocol looks more symmetric. I'll rethink about this part.

::: dom/presentation/tests/xpcshell/test_tcp_control_channel.js
@@ +185,5 @@
> +  let yayFuncs = makeJointSuccess(['controllerControlChannelClose',
> +                                   'presenterControlChannelClose']);
> +  let controllerControlChannel;
> +
> +  tps.listener = {

done.

@@ +217,5 @@
> +
> +  presenterControlChannel.listener = {
> +    notifyOpened: function() {
> +      presenterControlChannel.terminate('testPresentationId', 'http://example.com');
> +      presenterControlChannel.close(CLOSE_CONTROL_CHANNEL_REASON);

"terminate" means trigger/continue session termination procedure on this control channel and "close" means close control channel.

So, we'll always do "close" after "terminate".

semantically, "launch" and "terminate" will be a pair for controlling start/stop a presentation session.

"resume" and close transport channel will be a pair for controlling the lifecycle of a transport channel within a session.

do you think rename "close" to "disconnect" will make more sense? since I'm going to rename nsIPresentationControlService.requestSession to nsIPresentationControlService.connect.
> do you think rename "close" to "disconnect" will make more sense? since I'm
> going to rename nsIPresentationControlService.requestSession to
> nsIPresentationControlService.connect.

That will be lovely.
Comment on attachment 8765866 [details] [diff] [review]
part 4, support-legacy-ctrl-protocol.patch

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

Overall looks good :)
Attachment #8765866 - Flags: feedback?(xeonchen) → feedback+
I decided to move patch for terminate command to bug 1276378 so that we can have a clear view on how to implement a new session control API.
Summary: [Presentation WebAPI] implement connect / disconnect / launch / terminate command → [Presentation WebAPI] implement connect / disconnect / launch command
Attached patch part 0, jshint.patch (obsolete) (deleted) — Splinter Review
Attachment #8768637 - Flags: review?(juhsu)
Attached patch part 1, broadcast-protcol-version.patch (obsolete) (deleted) — Splinter Review
move compatibility check to PresentationControlService.js.
Attachment #8765863 - Attachment is obsolete: true
Attachment #8768638 - Flags: review?(juhsu)
Attached patch part 2, start-session-procedure.patch (obsolete) (deleted) — Splinter Review
update according to review comment, rebase to latest m-c.
Attachment #8765864 - Attachment is obsolete: true
Attachment #8768640 - Flags: review?(juhsu)
Attached patch part 3, support-legacy-ctrl-protocol.patch (obsolete) (deleted) — Splinter Review
update according to review comment, rebase to latest m-c.
Attachment #8765865 - Attachment is obsolete: true
Attachment #8765866 - Attachment is obsolete: true
Attachment #8768641 - Flags: review?(juhsu)
Attachment #8768641 - Attachment description: support-legacy-ctrl-protocol.patch → part 3, support-legacy-ctrl-protocol.patch
Attached patch part 4, fix-naming-in-testcase.patch (obsolete) (deleted) — Splinter Review
Attachment #8768645 - Flags: review?(juhsu)
Comment on attachment 8768637 [details] [diff] [review]
part 0, jshint.patch

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

::: dom/presentation/provider/PresentationControlService.js
@@ +498,4 @@
>    },
>  
>    // nsIStreamListener (Triggered by nsIInputStreamPump.asyncRead)
> +  onDataAvailable: function(aRequest, aContext, aInputStream) {

Why need this change?
Attachment #8768637 - Flags: review?(juhsu) → review+
Comment on attachment 8768637 [details] [diff] [review]
part 0, jshint.patch

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

::: dom/presentation/provider/PresentationControlService.js
@@ +498,4 @@
>    },
>  
>    // nsIStreamListener (Triggered by nsIInputStreamPump.asyncRead)
> +  onDataAvailable: function(aRequest, aContext, aInputStream) {

unused parameter (aOffset / aCount)
Comment on attachment 8768638 [details] [diff] [review]
part 1, broadcast-protcol-version.patch

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

::: dom/presentation/provider/MulticastDNSDeviceProvider.cpp
@@ +256,5 @@
>    if (NS_WARN_IF(NS_FAILED(rv = serviceInfo->SetPort(servicePort)))) {
>      return rv;
>    }
>  
> +  nsCOMPtr<nsIWritablePropertyBag2> propbag =

It's up to you, but I prefer |propBag| which is easy to recognize.

@@ +333,5 @@
> +MulticastDNSDeviceProvider::IsCompatibleServer(nsIDNSServiceInfo* aServiceInfo)
> +{
> +  MOZ_ASSERT(aServiceInfo);
> +
> +  nsCOMPtr<nsIPropertyBag2> propbag;

same here

::: dom/presentation/tests/xpcshell/test_multicast_dns_device_provider.js
@@ +23,5 @@
> +const latestVersion = 1;
> +const serviceType = "_presentation-ctrl._tcp";
> +const versionAttr = Cc["@mozilla.org/hash-property-bag;1"]
> +                      .createInstance(Ci.nsIWritablePropertyBag2);
> +versionAttr.setPropertyAsUint32("version", latestVersion);

nit: naming should be aligned like LATEST_VERSION
Attachment #8768638 - Flags: review?(juhsu) → review+
Comment on attachment 8768640 [details] [diff] [review]
part 2, start-session-procedure.patch

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

::: dom/presentation/interfaces/nsIPresentationControlChannel.idl
@@ +113,5 @@
> +  /*
> +   * Disconnect the control channel.
> +   * @param reason The reason of disconnecting channel; NS_OK represents normal.
> +   */
> +  void disconnect(in nsresult reason);

I'm thinking about changing |notifyClosed| to |notifyDisconnect|. Also |notifyOpened| to |notifyConnect|.

How do you think?

::: dom/presentation/provider/ReceiverStateMachine.jsm
@@ +7,5 @@
> +/* globals Components, dump */
> +
> +"use strict";
> +
> +this.EXPORTED_SYMBOLS = ["ReceiverStateMachine"]; //jshint ignore:line

nit: space between "//" and comment. Also in patch 0 and elsewhere
Sorry for picking up this so late.

@@ +15,5 @@
> +/* globals State, CommandType */
> +Cu.import("resource://gre/modules/presentation/StateMachineHelper.jsm");
> +
> +const DEBUG = true;
> +function debug (str) {

nit: no space between debug and (str)
and any plan to let DEBUG = false?

@@ +39,5 @@
> +        stateMachine._notifyClosed(command.reason);
> +        break;
> +      default:
> +        debug("unexpected command: " + JSON.stringify(command));
> +        // ignore

nit: the annotation is incomplete

@@ +63,5 @@
> +        stateMachine._notifyChannelDescriptor(command);
> +        break;
> +      default:
> +        debug("unexpected command: " + JSON.stringify(command));
> +        // ignore

same here and also those in controlling side

@@ +149,5 @@
> +          // do nothing and wait for remote channel closed.
> +        }
> +        break;
> +      default:
> +        DEBUG && debug("unexpected channel close: " + reason + ", " + isByRemote); //jshint ignore:line

I found that you're not always using "DEBUG && debug(...)" pattern.
Any policy?

::: dom/presentation/tests/mochitest/PresentationSessionChromeScript.js
@@ +407,5 @@
>  addMessageListener('trigger-control-channel-open', function(reason) {
>    mockedControlChannel.simulateNotifyOpened();
>  });
>  
>  addMessageListener('trigger-control-channel-close', function(reason) {

This event name should be changed.
We have lots open/close/connect/disconnect.
Any policy for the naming?
Attachment #8768640 - Flags: review?(juhsu) → review+
Attachment #8768645 - Flags: review?(juhsu) → review+
(In reply to Shih-Chiang Chien [:schien] (UTC+8) (use ni? plz) from comment #34)
> Created attachment 8768641 [details] [diff] [review]
> part 3, support-legacy-ctrl-protocol.patch
> 
> update according to review comment, rebase to latest m-c.

Is the |terminate| syntax out of this bug?
(In reply to Junior [:junior] from comment #40)
> (In reply to Shih-Chiang Chien [:schien] (UTC+8) (use ni? plz) from comment
> #34)
> > Created attachment 8768641 [details] [diff] [review]
> > part 3, support-legacy-ctrl-protocol.patch
> > 
> > update according to review comment, rebase to latest m-c.
> 
> Is the |terminate| syntax out of this bug?
Yes, all the terminate-related changes are moved to another bug.
Attachment #8768641 - Flags: review?(juhsu) → review+
Comment on attachment 8768640 [details] [diff] [review]
part 2, start-session-procedure.patch

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

::: dom/presentation/provider/ReceiverStateMachine.jsm
@@ +149,5 @@
> +          // do nothing and wait for remote channel closed.
> +        }
> +        break;
> +      default:
> +        DEBUG && debug("unexpected channel close: " + reason + ", " + isByRemote); //jshint ignore:line

DEBUG will not be applied for error message that I think shouldn't happen.
Comment on attachment 8768640 [details] [diff] [review]
part 2, start-session-procedure.patch

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

::: dom/presentation/provider/ReceiverStateMachine.jsm
@@ +39,5 @@
> +        stateMachine._notifyClosed(command.reason);
> +        break;
> +      default:
> +        debug("unexpected command: " + JSON.stringify(command));
> +        // ignore

this is not jshint annotation. it is a comment for ignoring unexpected protocol message.

@@ +63,5 @@
> +        stateMachine._notifyChannelDescriptor(command);
> +        break;
> +      default:
> +        debug("unexpected command: " + JSON.stringify(command));
> +        // ignore

not jshint annotation, either.
(In reply to Junior [:junior] from comment #39)
> ::: dom/presentation/tests/mochitest/PresentationSessionChromeScript.js
> @@ +407,5 @@
> >  addMessageListener('trigger-control-channel-open', function(reason) {
> >    mockedControlChannel.simulateNotifyOpened();
> >  });
> >  
> >  addMessageListener('trigger-control-channel-close', function(reason) {
> 
> This event name should be changed.
> We have lots open/close/connect/disconnect.
> Any policy for the naming?

Tedious for fixing all the naming in test cases so I'm not going to do it on this bug.
Comment on attachment 8768640 [details] [diff] [review]
part 2, start-session-procedure.patch

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

::: dom/presentation/interfaces/nsIPresentationControlChannel.idl
@@ +113,5 @@
> +  /*
> +   * Disconnect the control channel.
> +   * @param reason The reason of disconnecting channel; NS_OK represents normal.
> +   */
> +  void disconnect(in nsresult reason);

would be included in part-5 patch.
> ::: dom/presentation/provider/ReceiverStateMachine.jsm
> @@ +39,5 @@
> > +        stateMachine._notifyClosed(command.reason);
> > +        break;
> > +      default:
> > +        debug("unexpected command: " + JSON.stringify(command));
> > +        // ignore
> 
> this is not jshint annotation. it is a comment for ignoring unexpected
> protocol message.
> 
> @@ +63,5 @@
> > +        stateMachine._notifyChannelDescriptor(command);
> > +        break;
> > +      default:
> > +        debug("unexpected command: " + JSON.stringify(command));
> > +        // ignore
> 
> not jshint annotation, either.

I guess annotation like "ignore unexpected protocol message" would be better than only one word annotation. When I see this comment, "ignore what" comes to my mind and I need a few seconds to figure out.

> > ::: dom/presentation/tests/mochitest/PresentationSessionChromeScript.js
> > @@ +407,5 @@
> > >  addMessageListener('trigger-control-channel-open', function(reason) {
> > >    mockedControlChannel.simulateNotifyOpened();
> > >  });
> > >  
> > >  addMessageListener('trigger-control-channel-close', function(reason) {
> > 
> > This event name should be changed.
> > We have lots open/close/connect/disconnect.
> > Any policy for the naming?
> 
> Tedious for fixing all the naming in test cases so I'm not going to do it on
> this bug.

It's up to you but we need to keep in mind we have this issue which makes others have difficulty to decide the name.
(In reply to Junior [:junior] from comment #46)
> > ::: dom/presentation/provider/ReceiverStateMachine.jsm
> > @@ +39,5 @@
> > > +        stateMachine._notifyClosed(command.reason);
> > > +        break;
> > > +      default:
> > > +        debug("unexpected command: " + JSON.stringify(command));
> > > +        // ignore
> > 
> > this is not jshint annotation. it is a comment for ignoring unexpected
> > protocol message.
> > 
> > @@ +63,5 @@
> > > +        stateMachine._notifyChannelDescriptor(command);
> > > +        break;
> > > +      default:
> > > +        debug("unexpected command: " + JSON.stringify(command));
> > > +        // ignore
> > 
> > not jshint annotation, either.
> 
> I guess annotation like "ignore unexpected protocol message" would be better
> than only one word annotation. When I see this comment, "ignore what" comes
> to my mind and I need a few seconds to figure out.
yes I'll make a complete sentence in my next version.
Attached patch part 0, jshint.patch (deleted) — Splinter Review
update according to review comments and rebase to latest m-c, carry r+.
Attachment #8768637 - Attachment is obsolete: true
Attachment #8769965 - Flags: review+
update according to review comment and rebase to latest m-c, carry r+.
Attachment #8768638 - Attachment is obsolete: true
Attachment #8769967 - Flags: review+
update according to review comment and rebase to latest m-c, carry r+.
Attachment #8768640 - Attachment is obsolete: true
Attachment #8769968 - Flags: review+
update according to review comment and rebase to latest m-c, carry r+.
Attachment #8768641 - Attachment is obsolete: true
Attachment #8769971 - Flags: review+
update according to review comment and rebase to latest m-c, carry r+.
Attachment #8768645 - Attachment is obsolete: true
Attachment #8769972 - Flags: review+
rename notifyOpened/notifyClosed to notifyConnect/notifyDisconnected
Attachment #8769974 - Flags: review?(juhsu)
Attachment #8769974 - Flags: review?(juhsu) → review+
Attached file pull request for tv 2.6 (deleted) —
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: n/a
Testing completed: manual test
Risk to taking this patch (and alternatives if risky): n/a
String or UUID changes made by this patch: n/a
Attachment #8770004 - Flags: approval-mozilla-b2g48?
Pushed by cbook@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/fd6b414ffb8b
Part 0 - introduce jshint in PresentationControlService. r=junior
https://hg.mozilla.org/integration/mozilla-inbound/rev/ae8dbcd27f34
Part 1 - broadcast new service type and protocol version on mDNS. r=junior
https://hg.mozilla.org/integration/mozilla-inbound/rev/2ff7f8ad4bdd
Part 2, implement start presentation procedure. r=junior
https://hg.mozilla.org/integration/mozilla-inbound/rev/6c64cab758d8
Part 3, backward compatibility for connecting TV 2.5 devices. r=junior
https://hg.mozilla.org/integration/mozilla-inbound/rev/c460c012034e
Part 4, fix naming in test cases. r=junior
https://hg.mozilla.org/integration/mozilla-inbound/rev/b1b73e428562
Part 5, rename callback functions in nsIPresentationControlChannel.idl. r=junior
Keywords: checkin-needed
Comment on attachment 8770004 [details]
pull request for tv 2.6

Approve for TV 2.6
Attachment #8770004 - Flags: approval-mozilla-b2g48? → approval-mozilla-b2g48+
Comment on attachment 8770004 [details]
pull request for tv 2.6

ni? @xeonchen for uplift.
Flags: needinfo?(xeonchen)
Depends on: 1320348
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: