From ec45e06e9997831797460f5d67804cb62279e143 Mon Sep 17 00:00:00 2001 From: Peter Van der Beken Date: Tue, 27 Mar 2012 16:31:36 -0700 Subject: [PATCH] Fix for bug 739898 (Stop using enablePrivilege in test_bug480509.html). r=bz. --- .../tests/mochitest/bugs/test_bug480509.html | 3 +-- .../tests/SimpleTest/specialpowersAPI.js | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/security/manager/ssl/tests/mochitest/bugs/test_bug480509.html b/security/manager/ssl/tests/mochitest/bugs/test_bug480509.html index 4d0e0ec2a1c..9537de19655 100644 --- a/security/manager/ssl/tests/mochitest/bugs/test_bug480509.html +++ b/security/manager/ssl/tests/mochitest/bugs/test_bug480509.html @@ -66,8 +66,7 @@ function onWindowLoad() try { req.open("GET", "https://www.bank1.com/", false); - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - req.channel.notificationCallbacks = certListener; + SpecialPowers.setPrivilegedProps(req, "channel.notificationCallbacks", certListener); req.send(null); } catch(ex) diff --git a/testing/mochitest/tests/SimpleTest/specialpowersAPI.js b/testing/mochitest/tests/SimpleTest/specialpowersAPI.js index 192d49adfc0..47f11148ec2 100644 --- a/testing/mochitest/tests/SimpleTest/specialpowersAPI.js +++ b/testing/mochitest/tests/SimpleTest/specialpowersAPI.js @@ -940,6 +940,23 @@ SpecialPowersAPI.prototype = { } return obj; }, + setPrivilegedProps: function(obj, props, val) { + var parts = props.split('.'); + + if (parts.length == 0) { + return; + } + + for (var i = 0; i < parts.length - 1; i++) { + var p = parts[i]; + if (obj[p]) { + obj = obj[p]; + } else { + return; + } + } + obj[parts[i]] = val; + }, get focusManager() { if (this._fm != null)