Back out f410bdf30132 (bug 722428) for mochitest bustage
authorPhil Ringnalda <philringnalda@gmail.com>
Mon, 30 Jan 2012 13:18:04 -0800
changeset 86928 e7386241a1472a8ebf1957a6b52463799f0b1d0e
parent 86927 89bb79343f73f27e3f5f4d6b001d64a1d8338927
child 86929 8705f07a49ecca80089c21be7cfc7d795baec728
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs722428
milestone12.0a1
backs outf410bdf30132fa51821a089bf5db563952c8c4dc
Back out f410bdf30132 (bug 722428) for mochitest bustage
testing/mochitest/specialpowers/content/specialpowers.js
testing/mochitest/tests/SimpleTest/specialpowersAPI.js
--- a/testing/mochitest/specialpowers/content/specialpowers.js
+++ b/testing/mochitest/specialpowers/content/specialpowers.js
@@ -34,17 +34,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK *****/
 /* This code is loaded in every child process that is started by mochitest in
  * order to be used as a replacement for UniversalXPConnect
  */
 
 function SpecialPowers(window) {
-  this.window = Components.utils.getWeakReference(window);
+  this.window = window;
   this._encounteredCrashDumpFiles = [];
   this._unexpectedCrashDumpFiles = { };
   this._crashDumpDir = null;
   this.DOMWindowUtils = bindDOMWindowUtils(window);
   this._pongHandlers = [];
   this._messageListener = this._messageReceived.bind(this);
   addMessageListener("SPPingService", this._messageListener);
   this._consoleListeners = [];
--- a/testing/mochitest/tests/SimpleTest/specialpowersAPI.js
+++ b/testing/mochitest/tests/SimpleTest/specialpowersAPI.js
@@ -58,35 +58,31 @@ function SpecialPowersAPI() {
 }
 
 function bindDOMWindowUtils(aWindow) {
   if (!aWindow)
     return
 
   var util = aWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
                    .getInterface(Components.interfaces.nsIDOMWindowUtils);
-  var weakUtil = Components.utils.getWeakReference(util);
   // This bit of magic brought to you by the letters
   // B Z, and E, S and the number 5.
   //
   // Take all of the properties on the nsIDOMWindowUtils-implementing
   // object, and rebind them onto a new object with a stub that uses
   // apply to call them from this privileged scope. This way we don't
   // have to explicitly stub out new methods that appear on
   // nsIDOMWindowUtils.
   var proto = Object.getPrototypeOf(util);
   var target = {};
   function rebind(desc, prop) {
     if (prop in desc && typeof(desc[prop]) == "function") {
       var oldval = desc[prop];
       try {
-        desc[prop] = function() {
-          utils = weakUtil.get();
-          return oldval.apply(utils, arguments);
-        };
+        desc[prop] = function() { return oldval.apply(util, arguments); };
       } catch (ex) {
         dump("WARNING: Special Powers failed to rebind function: " + desc + "::" + prop + "\n");
       }
     }
   }
   for (var i in proto) {
     var desc = Object.getOwnPropertyDescriptor(proto, i);
     rebind(desc, "get");
@@ -425,17 +421,17 @@ SpecialPowersAPI.prototype = {
   wrap: wrapPrivileged,
   unwrap: unwrapPrivileged,
 
   get MockFilePicker() {
     return MockFilePicker
   },
 
   getDOMWindowUtils: function(aWindow) {
-    if (aWindow == this.window.get() && this.DOMWindowUtils != null)
+    if (aWindow == this.window && this.DOMWindowUtils != null)
       return this.DOMWindowUtils;
 
     return bindDOMWindowUtils(aWindow);
   },
 
   removeExpectedCrashDumpFiles: function(aExpectingProcessCrash) {
     var success = true;
     if (aExpectingProcessCrash) {
@@ -813,17 +809,17 @@ SpecialPowersAPI.prototype = {
   },
 
   createSystemXHR: function() {
     return Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
              .createInstance(Ci.nsIXMLHttpRequest);
   },
 
   snapshotWindow: function (win, withCaret) {
-    var el = this.window.get().document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
+    var el = this.window.document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
     el.width = win.innerWidth;
     el.height = win.innerHeight;
     var ctx = el.getContext("2d");
     var flags = 0;
 
     ctx.drawWindow(win, win.scrollX, win.scrollY,
                    win.innerWidth, win.innerHeight,
                    "rgb(255,255,255)",
@@ -1028,17 +1024,17 @@ SpecialPowersAPI.prototype = {
     if (this._cb == null) {
       this._cb = Components.classes["@mozilla.org/widget/clipboard;1"].
                             getService(Components.interfaces.nsIClipboard);
     }
     return this._cb.supportsSelectionClipboard();
   },
 
   snapshotWindow: function (win, withCaret) {
-    var el = this.window.get().document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
+    var el = this.window.document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
     el.width = win.innerWidth;
     el.height = win.innerHeight;
     var ctx = el.getContext("2d");
     var flags = 0;
 
     ctx.drawWindow(win, win.scrollX, win.scrollY,
                    win.innerWidth, win.innerHeight,
                    "rgb(255,255,255)",