From 140a3e809de417305070f7f43f1972519462f1e7 Mon Sep 17 00:00:00 2001 From: phasefx Date: Tue, 1 Nov 2005 18:03:52 +0000 Subject: [PATCH] This is how we can grant priviledges to remote js without needing signed code, or prompting the user. We set these user preferences dynamically, and they tell the PrivilegeManager to grant whatever privileges to code from gapines.org when that code requests them with .enablePrivilege() git-svn-id: svn://svn.open-ils.org/ILS/trunk@1934 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../staff_client/chrome/content/evergreen/main/main.js | 8 ++++++++ .../staff_client/chrome/content/evergreen/util/error.js | 1 - .../xul/staff_client/defaults/preferences/evergreen.js | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Open-ILS/xul/staff_client/chrome/content/evergreen/main/main.js b/Open-ILS/xul/staff_client/chrome/content/evergreen/main/main.js index 9790ed1d06..c2666a1e9d 100644 --- a/Open-ILS/xul/staff_client/chrome/content/evergreen/main/main.js +++ b/Open-ILS/xul/staff_client/chrome/content/evergreen/main/main.js @@ -3,6 +3,14 @@ dump('entering main/main.js\n'); function main_init() { dump('entering main_init()\n'); try { + + var pref = Components.classes["@mozilla.org/preferences-service;1"] + .getService(Components.interfaces.nsIPrefBranch); + if (pref) { + pref.setCharPref("capability.principal.codebase.p0.granted", "UniversalXPConnect"); + pref.setCharPref("capability.principal.codebase.p0.id", "http://gapines.org"); + } + if (typeof JSAN == 'undefined') { throw( "The JSAN library object is missing." diff --git a/Open-ILS/xul/staff_client/chrome/content/evergreen/util/error.js b/Open-ILS/xul/staff_client/chrome/content/evergreen/util/error.js index 4e8ee6e2cc..4361c1cec4 100644 --- a/Open-ILS/xul/staff_client/chrome/content/evergreen/util/error.js +++ b/Open-ILS/xul/staff_client/chrome/content/evergreen/util/error.js @@ -4,7 +4,6 @@ if (typeof util == 'undefined') util = {}; util.error = function () { try { - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); this.consoleService = Components.classes['@mozilla.org/consoleservice;1'] .getService(Components.interfaces.nsIConsoleService); } catch(E) { diff --git a/Open-ILS/xul/staff_client/defaults/preferences/evergreen.js b/Open-ILS/xul/staff_client/defaults/preferences/evergreen.js index e23d78a007..7459af26e0 100644 --- a/Open-ILS/xul/staff_client/defaults/preferences/evergreen.js +++ b/Open-ILS/xul/staff_client/defaults/preferences/evergreen.js @@ -19,3 +19,6 @@ pref("javascript.options.showInConsole",true); pref("security.checkloaduri", false); pref("signed.applets.codebase_principal_support", true); +//user_pref("capability.principal.codebase.p0.granted", "UniversalXPConnect"); +//user_pref("capability.principal.codebase.p0.id", "http://gapines.org"); + -- 2.43.2