vakata / jstree

jquery tree plugin
http://jstree.com
MIT License
5.15k stars 1.38k forks source link

Subtrees not refreshed in Firefox 38.0.5 #1144

Closed kwent closed 9 years ago

kwent commented 9 years ago

Hi,

My subtrees are not refreshed and stuck on the loading state when i clicked on one parent folder on Firefox. I checked my log messages and i don't have any API errors. My API is responding with the right data. Not issues on Chrome. (More information about browsers versions below).

screen shot 2015-06-04 at 3 09 36 am

I noticed this message when running cfx run:

JavaScript error: resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/loader/sandbox.js -> resource://jid1-om7ejgwa1u8ag-at-jetpack/quiptree/data/jstree.js, line 1476: Error: Not allowed to define cross-origin object as property on [Object] or [Array] XrayWrapper

Regards,

vakata commented 9 years ago

Sorry, but I use Firefox myself and I have not noticed a problem - do you see the issue when viewing the demos on jstree.com? If you provide a demo I will reopen the issue and help you.

Best regards, Ivan

kwent commented 9 years ago

Hi Ivan,

Well. It's cause i use jstree in a firefox extension. So they added protection to query data from another domain. But i added my api domain to the whitelist of package.json. All API Requests are going through and my data are returned. But the tree is only refreshed with the first request. When trying to see subtrees, it's fetching data but not refreshing tree (infinite loader).

This error below might be why ...

JavaScript error: resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/loader/sandbox.js -> resource://jid1-om7ejgwa1u8ag-at-jetpack/quiptree/data/jstree.js, line 1476: Error: Not allowed to define cross-origin object as property on [Object] or [Array] XrayWrapper

Line 1476 in my jstree.js is dom.children = []

_append_json_data : function (dom, data, cb, force_processing) {
  if(this.element === null) { return; }
  dom = this.get_node(dom);
  dom.children = []; # This line
  dom.children_d = [];
  // *%$@!!!
  if(data.d) {
    data = data.d;
    if(typeof data === "string") {
      data = JSON.parse(data);
    }
  }

Maybe : http://stackoverflow.com/questions/10992517/how-to-get-content-from-this-xraywrapper ?

It might be not a Jstree bug but any help would be appreciate...

Best Regards,

vakata commented 9 years ago

I do not think this is a jstree problem, but still - could you please post your config? My guess is that you are not returning an array of plain objects.

Best regards, Ivan

kwent commented 9 years ago

@vakata I gave you the access to my repository.

gulp build && gulp firefox:xpi cd tmp/firefox && cfx run

Go to quip.com, create an account and play with the tree.

vakata commented 9 years ago

After a quick look I noticed a couple of things: 1) replace this cb.call(folder, tree), with cb(tree) - no need to set the context to a non existing object 2) tree actually is a promise object, not the data itself - fix that in the core.data function, you should call cb with an array, not a promise object.

This should be enough to get you going, sorry, I do not have time to debug further. Let me know if you run into any issues with jstree.

Best regards, Ivan