Bug 783059 - Add do_lookupGetter helper to SpecialPowers. r=bholley
authorJohn Schoenick <jschoenick@mozilla.com>
Thu, 07 Mar 2013 16:10:54 -0800
changeset 124392 c7ff3b1f040fde0050e41c851026e5a91e350fa5
parent 124391 edff7aaa5e652cf300523ebeeb37d1d04c0fcf9f
child 124393 18df15462240d878b418357cd02b82686efc5831
push id24420
push userryanvm@gmail.com
push dateTue, 12 Mar 2013 19:35:31 +0000
treeherdermozilla-central@79b8e0a0bdb7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs783059
milestone22.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 783059 - Add do_lookupGetter helper to SpecialPowers. r=bholley
testing/specialpowers/content/specialpowersAPI.js
--- a/testing/specialpowers/content/specialpowersAPI.js
+++ b/testing/specialpowers/content/specialpowersAPI.js
@@ -706,16 +706,27 @@ SpecialPowersAPI.prototype = {
   },
 
   call_Instanceof: function (obj1, obj2) {
      obj1=unwrapIfWrapped(obj1);
      obj2=unwrapIfWrapped(obj2);
      return obj1 instanceof obj2;
   },
 
+  // Returns a privileged getter from an object. GetOwnPropertyDescriptor does
+  // not work here because xray wrappers don't properly implement it.
+  //
+  // This terribleness is used by content/base/test/test_object.html because
+  // <object> and <embed> tags will spawn plugins if their prototype is touched,
+  // so we need to get and cache the getter of |hasRunningPlugin| if we want to
+  // call it without paradoxically spawning the plugin.
+  do_lookupGetter: function(obj, name) {
+    return Object.prototype.__lookupGetter__.call(obj, name);
+  },
+
   // Mimic the get*Pref API
   getBoolPref: function(aPrefName) {
     return (this._getPref(aPrefName, 'BOOL'));
   },
   getIntPref: function(aPrefName) {
     return (this._getPref(aPrefName, 'INT'));
   },
   getCharPref: function(aPrefName) {