It's all about the answers!

Ask a question

JavaScript Debugging Configuration


nannette Mori (501985) | asked Feb 01 '18, 10:35 a.m.
edited Feb 02 '18, 3:12 a.m. by Ralph Schoon (63.6k33646)

Question:
Is there a setting either in the local browser, in RTC, or on the server to enable debugging of javaScript code? 

Problem:
I am having trouble getting the debugger to stop on a break point or console log to print information within a getValue function. 

Below is some code that I will refer to.  This code is an example of what is running on different servers and in different projects.  Each instance is behaving the same way.   

I am running 6.0.3 server.  This happens when viewing a work item using either Firefox or Internet Explorer on Windows and also using Firefox from Linux.  Another user on the team sees the same behavior. 

Behavior Clarification:
When the script executes the browser console view shows the "Running Script..." line but not the "Hello value..." line.

I can set a breakpoint in the debugger and get the execution to pause on any line within the outer function and up to and including the line beginning with "getValue: ...".

If I set a breakpoint on any line after this line it will not break. 

When the script executes to completion, the attribute value is updated with the "Hi There" so I know the script executes to completion. 

If I set a breakpoint on the first console.log line ("Running Script...") The debugger shows two instances of the showHelloWorldValue.js script.  One labeled (eval) and the other labeled (anonymous).

Using the step debug button does not result in getting into the function.  The program pointer switches from one instance to another thus resetting the program pointer back to the opening "{" of the other instance.  Then it skips to the "}" before allowing both functions to go out of scope. 

 

Code:

dojo.provide("showHelloWorldValue");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");

(function() {
   var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
   var scriptName = "showHelloWorldValue";
   console.log("Running Script - " + scriptName);

   dojo.declare(scriptName, null, {

      getValue: function(attribute,workItem, configuration) {
         var hello = workItem.getValue("helloWorld");
         console.log("Hello Value: " + hello);
         hello = "Hi there";      
         return hello;    

      }
   });

})();

 

 


Comments
Ralph Schoon commented Apr 17 '18, 7:52 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I find the line

console.log("Running Script - " + scriptName);


Strange. Is it allowed to have logging out side of the function definition.

One answer



permanent link
Ralph Schoon (63.6k33646) | answered Feb 02 '18, 3:12 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

JavaScript code is compressed to reduce overhead or something. You need to use a special debug URL.
See the article in the library for debugging

Other stuff you should know about:

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.