Closed Bug 1153063 Opened 9 years ago Closed 9 years ago

trun on logging for debug in test_tcp_control_channel.js

Categories

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

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla40
Tracking Status
firefox40 --- fixed

People

(Reporter: CuveeHsu, Assigned: CuveeHsu)

References

Details

Attachments

(1 file, 3 obsolete files)

      No description provided.
Per bug 1152522 comment 3, trun on logging for debug in test_tcp_control_channel.js
Attached patch turn-on-log (obsolete) — Splinter Review
turn on log in mochitest and test_tcp_control_channel.js
Attachment #8590726 - Flags: review?(fabrice)
Attached patch turn-on-log (obsolete) — Splinter Review
add one more log
Attachment #8590726 - Attachment is obsolete: true
Attachment #8590726 - Flags: review?(fabrice)
Attachment #8590731 - Flags: review?(fabrice)
Comment on attachment 8590731 [details] [diff] [review]
turn-on-log

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

::: dom/presentation/provider/TCPPresentationServer.js
@@ +13,2 @@
>  function log(aMsg) {
>    dump("-*- TCPPresentationServer.js: " + aMsg + "\n");

that should be DEBUG && dump(...); so that it applies to all calls to log() no?

@@ +57,5 @@
>      let serverSocketPort = (aPort !== 0) ? aPort : -1;
>  
>      this._serverSocket = Cc["@mozilla.org/network/server-socket;1"]
>                           .createInstance(Ci.nsIServerSocket);
> + 

nit: trailing whitespace

@@ +59,5 @@
>      this._serverSocket = Cc["@mozilla.org/network/server-socket;1"]
>                           .createInstance(Ci.nsIServerSocket);
> + 
> +    if(!this._serverSocket) {
> +      DEBUG && log("TCPPresentationServer - create server socket fail.");

and then you would not need the DEBUG here

::: modules/libpref/init/all.js
@@ +4534,5 @@
>  pref("dom.beforeAfterKeyboardEvent.enabled", false);
>  
>  // Presentation API
>  pref("dom.presentation.enabled", false);
> +pref("dom.presentation.tcpServer.debug", false);

We usually name prefs with snake_case, note camelCase. So that I would rather like `dom.presentation.tcp_server.debug`
Attachment #8590731 - Flags: review?(fabrice) → review-
(In reply to Fabrice Desré [:fabrice] from comment #5)
> Comment on attachment 8590731 [details] [diff] [review]
> turn-on-log
> 
> Review of attachment 8590731 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: dom/presentation/provider/TCPPresentationServer.js
> @@ +13,2 @@
> >  function log(aMsg) {
> >    dump("-*- TCPPresentationServer.js: " + aMsg + "\n");
> 
> that should be DEBUG && dump(...); so that it applies to all calls to log()
> no?
> 
> @@ +59,5 @@
> >      this._serverSocket = Cc["@mozilla.org/network/server-socket;1"]
> >                           .createInstance(Ci.nsIServerSocket);
> > + 
> > +    if(!this._serverSocket) {
> > +      DEBUG && log("TCPPresentationServer - create server socket fail.");
> 
> and then you would not need the DEBUG here
> 

If we change the position of |DEBUG|, |log| will evaluate its parameter and be time-consuming since lots of |JSON.stringify| like here:
https://dxr.mozilla.org/mozilla-central/source/dom/presentation/provider/TCPPresentationServer.js#182

Is that OK?
Flags: needinfo?(fabrice)
Right, you just added a missing one. Let's only change the pref name then!
Flags: needinfo?(fabrice)
Attached patch turn-on-log (obsolete) — Splinter Review
Modify by review comments
https://treeherder.mozilla.org/#/jobs?repo=try&revision=3e59178340f2
Attachment #8590731 - Attachment is obsolete: true
Attachment #8592606 - Flags: review?(fabrice)
Comment on attachment 8592606 [details] [diff] [review]
turn-on-log

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

::: dom/presentation/provider/TCPPresentationServer.js
@@ +58,5 @@
>  
>      this._serverSocket = Cc["@mozilla.org/network/server-socket;1"]
>                           .createInstance(Ci.nsIServerSocket);
> +
> +    if(!this._serverSocket) {

nit: if (...)
Attachment #8592606 - Flags: review?(fabrice) → review+
Attached patch turn-on-logSplinter Review
Modify nit, carry r+

Thanks Fabrice!
Attachment #8592606 - Attachment is obsolete: true
Attachment #8592608 - Flags: review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/05e29a28737a
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
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: