This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 269906

Summary: Navigator doesn't display nothing for smoothie.js
Product: javascript Reporter: Petr Pisl <ppisl>
Component: EditorAssignee: Petr Pisl <ppisl>
Status: NEW ---    
Severity: normal CC: mbalin
Priority: P3    
Version: 8.2   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:

Description Petr Pisl 2017-02-23 13:00:33 UTC
Have a simple code:

;(function(exports) {

  var Util = {
    extend: function() {}
  };

  function TimeSeries() { }

  function SmoothieChart() { }

  SmoothieChart.defaultChartOptions = {  };
  
  exports.TimeSeries = TimeSeries;
  exports.SmoothieChart = SmoothieChart;

})(typeof exports === 'undefined' ? this : exports);


The navigator doesn't display no items. Probably it doesn't affect only navigator. But when you delete typeof exports === 'undefined' ? this : exports (the argument on the last line) navigator works correctly.
Comment 1 arusinha 2017-04-17 05:36:57 UTC
The issue is happening whenever there is a anonymous function in the JS file and also if module.exports is used .


IMHO NodeJsObjectInterceptor tries to recognized, whether the code can be a Node.js module. Node.js module in run-time is wrap up in to a function.
So all variables and function, which are declared in global space are not public, but private for the module. Node.js module exposes public variables and methods through export. So the ide, should not offer the variables and function from global space. This is a reason, why the NodeJsObjectInterceptor hides them.

But because of this wrapping of, while scanning for JsStructure it is not able to identify the underlying item under the wrap up function in case of anonymous function. 

e.g., in below JS, navigator will not display Util variable.

 var result = function() {
  var Util =10;
 exports.val = 10;
  return 20;

}();