From ec08cbb3fca76220fc40ac10a72f42fbb0314d6b Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Thu, 24 May 2012 13:04:57 +0200 Subject: [PATCH] Bug 553102 - Fix SpecialPowers DOMWindowUtils. r=ted --- testing/mochitest/tests/SimpleTest/specialpowersAPI.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/testing/mochitest/tests/SimpleTest/specialpowersAPI.js b/testing/mochitest/tests/SimpleTest/specialpowersAPI.js index c74e7641092..a26faa5e195 100644 --- a/testing/mochitest/tests/SimpleTest/specialpowersAPI.js +++ b/testing/mochitest/tests/SimpleTest/specialpowersAPI.js @@ -37,8 +37,12 @@ function bindDOMWindowUtils(aWindow) { // apply to call them from this privileged scope. This way we don't // have to explicitly stub out new methods that appear on // nsIDOMWindowUtils. + // + // Note that this will be a chrome object that is (possibly) exposed to + // content. Make sure to define __exposedProps__ for each property to make + // sure that it gets through the security membrane. var proto = Object.getPrototypeOf(util); - var target = {}; + var target = { __exposedProps__: {} }; function rebind(desc, prop) { if (prop in desc && typeof(desc[prop]) == "function") { var oldval = desc[prop]; @@ -57,6 +61,7 @@ function bindDOMWindowUtils(aWindow) { rebind(desc, "set"); rebind(desc, "value"); Object.defineProperty(target, i, desc); + target.__exposedProps__[i] = 'rw'; } return target; }