Bug 888969 - Make our tree's sole implementation of nsIRemoteTagService.getRemoteObjectTag not depend upon the infallibility of [[GetPrototypeOf]] on the object provided to it. r=bz
authorJeff Walden <jwalden@mit.edu>
Wed, 13 Apr 2016 14:31:14 -0700
changeset 331026 fe3aba52a965e4975aa9f1f416852cd3ac923846
parent 331025 498e330e857deb78bb57d11231e0ab2ece7cf3aa
child 331027 1e6cb22a8971cb6ba21bd44afe084b9db22f5911
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs888969
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 888969 - Make our tree's sole implementation of nsIRemoteTagService.getRemoteObjectTag not depend upon the infallibility of [[GetPrototypeOf]] on the object provided to it. r=bz
toolkit/components/utils/simpleServices.js
--- a/toolkit/components/utils/simpleServices.js
+++ b/toolkit/components/utils/simpleServices.js
@@ -34,23 +34,31 @@ RemoteTagServiceService.prototype = {
 
   /**
    * CPOWs can have user data attached to them. This data originates
    * in the local process from this function, getRemoteObjectTag. It's
    * sent along with the CPOW to the remote process, where it can be
    * fetched with Components.utils.getCrossProcessWrapperTag.
    */
   getRemoteObjectTag: function(target) {
-    if (target instanceof Ci.nsIDocShellTreeItem) {
-      return "ContentDocShellTreeItem";
-    }
+    try {
+      if (target.QueryInterface) {
+        try {
+          if (target.QueryInterface(Ci.nsIDocShellTreeItem)) {
+            return "ContentDocShellTreeItem";
+          }
+        } catch (e) {}
 
-    if (target instanceof Ci.nsIDOMDocument) {
-      return "ContentDocument";
-    }
+        try {
+          if (target.QueryInterface(Ci.nsIDOMDocument)) {
+            return "ContentDocument";
+          }
+        } catch (e) {}
+      }
+    } catch (e) {}
 
     return "generic";
   }
 };
 
 function AddonPolicyService()
 {
   this.wrappedJSObject = this;