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 - Navigator doesn't display nothing for smoothie.js
Summary: Navigator doesn't display nothing for smoothie.js
Status: NEW
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.2
Hardware: PC Linux
: P3 normal (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-23 13:00 UTC by Petr Pisl
Modified: 2017-04-17 05:36 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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;

}();