Do not always try to retain the catalog tree state

With this commit we make sure we have a previous tree state before calling the retainTreeState function. We really should be more cautious and abort pending requests here. But we need to check that JSONP requests can effectively be aborted before (ref #485).
Merge pull request #478 from geoadmin/fix_catalogtree2

JavaScript error in catalog tree component