Bug 792036 - Expose |Components| to content in the indexedDB test harness. r=bent
authorBobby Holley <bobbyholley@gmail.com>
Mon, 24 Sep 2012 14:46:27 +0200
changeset 108014 dc84f6a237d7c8ebf17e4ac528602c3da07afcd4
parent 108013 1460d44ec8def5ee7d1d4ebb9534dcce652a0966
child 108015 d3f7731dd39ce2bf65f9fe0043a1bed84114c975
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewersbent
bugs792036
milestone18.0a1
Bug 792036 - Expose |Components| to content in the indexedDB test harness. r=bent
dom/indexedDB/test/helpers.js
--- a/dom/indexedDB/test/helpers.js
+++ b/dom/indexedDB/test/helpers.js
@@ -1,15 +1,22 @@
 /**
  * Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 var testGenerator = testSteps();
 
+// The test js is shared between xpcshell (which has no SpecialPowers object)
+// and content mochitests (where the |Components| object is accessible only as
+// SpecialPowers.Components). Expose Components if necessary here to make things
+// work everywhere.
+if (typeof Components === 'undefined')
+  Components = SpecialPowers.Components;
+
 function executeSoon(aFun)
 {
   let comp = SpecialPowers.wrap(Components);
 
   let thread = comp.classes["@mozilla.org/thread-manager;1"]
                    .getService(comp.interfaces.nsIThreadManager)
                    .mainThread;