Bug 858101 - Followup fix for the lack of Cu.isXrayWrapper on esr17/b2g18. r=me, a=bustage
authorBobby Holley <bobbyholley@gmail.com>
Wed, 05 Jun 2013 13:50:07 -0400
changeset 110184 00914aec47d14e3e5b01569760ff2a10cb540f59
parent 110183 e2eecb449eeb5997e808616b53c014366448eac9
child 110185 19c948221485321e588161c9bac12b7e7f91ddf9
push id236
push userryanvm@gmail.com
push dateWed, 05 Jun 2013 17:50:06 +0000
reviewersme, bustage
bugs858101
milestone17.0.6
Bug 858101 - Followup fix for the lack of Cu.isXrayWrapper on esr17/b2g18. r=me, a=bustage
dom/tests/browser/browser_ConsoleAPITests.js
--- a/dom/tests/browser/browser_ConsoleAPITests.js
+++ b/dom/tests/browser/browser_ConsoleAPITests.js
@@ -1,16 +1,19 @@
 /* vim:set ts=2 sw=2 sts=2 et: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 const TEST_URI = "http://example.com/browser/dom/tests/browser/test-console-api.html";
 
 var gWindow, gLevel, gArgs, gTestDriver;
+function isXrayWrapper(x) {
+  return x && typeof x == 'object' && XPCNativeWrapper.unwrap(x) != x;
+}
 
 function test() {
   waitForExplicitFinish();
 
   var tab = gBrowser.addTab(TEST_URI);
   gBrowser.selectedTab = tab;
   var browser = gBrowser.selectedBrowser;
 
@@ -47,17 +50,17 @@ function testConsoleData(aMessageObject)
   }
   else {
     gArgs.forEach(function (a, i) {
       // Waive Xray so that we don't get messed up by Xray ToString.
       //
       // It'd be nice to just use XPCNativeWrapper.unwrap here, but there are
       // a number of dumb reasons we can't. See bug 868675.
       var arg = aMessageObject.arguments[i];
-      if (Components.utils.isXrayWrapper(arg))
+      if (isXrayWrapper(arg))
         arg = arg.wrappedJSObject;
       is(arg, a, "correct arg " + i);
     });
   }
 
   gTestDriver.next();
 }