Bug 1089186 - Error: NS_ERROR_XPC_CANT_MODIFY_PROP_ON_WN: Cannot modify properties of a WrappedNative Source file: chrome://communicator/content/history/treeView.js r=Neil
authorPhilip Chee <philip.chee@gmail.com>
Thu, 13 Nov 2014 02:16:12 +0800
changeset 31120 d891cfe1516a46e5532add5255b993a50adf2ffb
parent 31119 7f4bf0e3bfa79f9e8a2c017ea424dd1195b451d1
child 31121 fb2e2de7d112de2c930024deaf2084eb2fc7962b
push id1
push userclokep@gmail.com
push dateMon, 07 May 2018 22:45:56 +0000
treeherdercomm-esr60@57eacde5ef40 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersNeil
bugs1089186
Bug 1089186 - Error: NS_ERROR_XPC_CANT_MODIFY_PROP_ON_WN: Cannot modify properties of a WrappedNative Source file: chrome://communicator/content/history/treeView.js r=Neil a=IanN for comm-release CLOSED TREE
suite/common/history/tree.xml
suite/common/history/treeView.js
--- a/suite/common/history/tree.xml
+++ b/suite/common/history/tree.xml
@@ -18,17 +18,17 @@
       ]]></constructor>
 
       <destructor><![CDATA[
         // Break the treeviewer->result->treeviewer cycle.
         // Note: unsetting the result's viewer also unsets
         // the viewer's reference to our treeBoxObject.
         var result = this.getResult();
         if (result)
-          result.removeObserver(this.view);
+          result.root.containerOpen = false;
         this.view = null;
       ]]></destructor>
 
       <property name="controller"
                 readonly="true"
                 onget="return this._controller;"/>
 
       <!-- overriding -->
@@ -94,16 +94,20 @@
       <method name="load">
         <parameter name="queries"/>
         <parameter name="options"/>
         <body><![CDATA[
           var result = PlacesUtils.history.executeQueries(queries, queries.length,
                                                           options);
 
           var treeView = new PlacesTreeView();
+
+          // Observer removal is done within the view itself. When the tree
+          // goes away, treeboxobject calls view.setTree(null), which then
+          // calls removeObserver.
           result.addObserver(treeView, false);
           this.view = treeView;
           if (!this._controller) {
             this._controller = new PlacesController(this);
             this.controllers.appendController(this._controller);
           }
         ]]></body>
       </method>
--- a/suite/common/history/treeView.js
+++ b/suite/common/history/treeView.js
@@ -1010,18 +1010,20 @@ PlacesTreeView.prototype = {
 
     var hasOldTree = this._tree != null;
     this._tree = aTree;
 
     if (this._result) {
       if (hasOldTree) {
         // detach from result when we are detaching from the tree.
         // This breaks the reference cycle between us and the result.
-        if (!aTree)
-          this._result.viewer = null;
+        if (!aTree) {
+          this._result.removeObserver(this);
+          this._rootNode.containerOpen = false;
+        }
       }
       if (aTree)
         this._finishInit();
     }
   },
 
   toggleOpenState: function PTV_toggleOpenState(aRow) {
     if (!this._result)