test
[Evergreen.git] / Open-ILS / xul / staff_client / chrome / content / evergreen / main / window.js
1 dump('entering main/window.js\n');
2
3 if (typeof main == 'undefined') main = {};
4 main.window = function () {
5         JSAN.use('util.error'); this.error = new util.error(); this.win = window;
6         return this;
7 };
8
9 main.window.prototype = {
10         
11         // list of open window references, used for debugging in shell
12         'win_list' : [],        
13
14         // list of Top Level menu interface window references
15         'appshell_list' : [],   
16
17         // list of documents for debugging.  BROKEN
18         'doc_list' : [],        
19
20         // Windows need unique names.  This number helps.
21         'window_name_increment' : 0, 
22
23         // This number gets put into the title bar for Top Level menu interface windows
24         'appshell_name_increment' : 0,
25
26         // From: Bryan White on netscape.public.mozilla.xpfe, Oct 13, 2004
27         // Message-ID: <ckjh7a$18q1@ripley.netscape.com>
28         // Modified by Jason for Evergreen
29         'SafeWindowOpen' : function (url,title,features) {
30                 var w;
31
32                 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
33                 alert('pause');
34                 const CI = Components.interfaces;
35                 const PB = Components.classes["@mozilla.org/preferences-service;1"].getService(CI.nsIPrefBranch);
36
37                 var blocked = false;
38                 try {
39                         // pref 'dom.disable_open_during_load' is the main popup blocker preference
40                         blocked = PB.getBoolPref("dom.disable_open_during_load");
41                         if(blocked) PB.setBoolPref("dom.disable_open_during_load",false);
42
43                         w = this.win.open(url,title,features);
44                 } catch(E) {
45                         this.error.sdump('D_ERROR','window.SafeWindowOpen: ' + E + '\n');
46                         throw(E);
47                 }
48                 if(blocked) PB.setBoolPref("dom.disable_open_during_load",true);
49
50                 return w;
51         },
52
53         'open' : function(url,title,features) {
54                 this.error.sdump('D_WIN',
55                         'opening ' + url + ', ' + title + ', ' + features + ' from ' + this.win + '\n');
56                 var w = this.SafeWindowOpen(url,title,features);
57                 /*
58                 setTimeout( 
59                         function() { 
60                                 try { w.title = title; } catch(E) { dump('**'+E+'\n'); }
61                                 try { w.document.title = title; } catch(E) { dump('**'+E+'\n'); }
62                         }, 0 
63                 );
64                 */
65                 return w;
66         }
67 }
68
69 dump('exiting main/window.js\n');