1 dump('entering util/window.js\n');
3 if (typeof util == 'undefined') util = {};
4 util.window = function () {
5 JSAN.use('util.error'); this.error = new util.error(); this.win = window;
9 util.window.prototype = {
11 // list of open window references, used for debugging in shell
14 // list of Top Level menu interface window references
17 // list of documents for debugging. BROKEN
20 // This number gets put into the title bar for Top Level menu interface windows
21 'appshell_name_increment' : function() {
22 JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
23 if (typeof data.appshell_name_increment == 'undefined') {
24 data.appshell_name_increment = 1;
26 data.appshell_name_increment++;
28 data.stash('appshell_name_increment');
29 return data.appshell_name_increment;
32 // From: Bryan White on netscape.public.mozilla.xpfe, Oct 13, 2004
33 // Message-ID: <ckjh7a$18q1@ripley.netscape.com>
34 // Modified by Jason for Evergreen
35 'SafeWindowOpenDialog' : function (url,title,features) {
38 const CI = Components.interfaces;
39 const PB = Components.classes["@mozilla.org/preferences-service;1"].getService(CI.nsIPrefBranch);
43 // pref 'dom.disable_open_during_load' is the main popup blocker preference
44 blocked = PB.getBoolPref("dom.disable_open_during_load");
45 if(blocked) PB.setBoolPref("dom.disable_open_during_load",false);
46 w = this.win.openDialog.apply(this.win,arguments);
48 this.error.sdump('D_ERROR','window.SafeWindowOpenDialog: ' + E + '\n');
51 if(blocked) PB.setBoolPref("dom.disable_open_during_load",true);
56 // This has basically become a compatibility wrapper for openDialog.
57 'open' : function(url,title,features,my_xulG) {
59 if (!features) features = 'chrome,dialog=no';
60 if (!features.match(/dialog/)) features = 'dialog=no,' + features; // window.open doesn't do dialog by default
61 if (!features.match(/chrome/)) features = 'chrome=no,' + features; // And window.open doesn't assume chrome by default
62 var outArgs = Array.prototype.slice.call(arguments);
64 outArgs[2] = features;
65 return this.openDialog.apply(this, outArgs); // Pass to openDialog
68 'openDialog' : function(url,title,features,my_xulG) {
70 if (!title) title = '_blank';
71 if (!features) features = 'chrome'; // Note that this is a default for openDialog anyway
72 var outArgs = Array.prototype.slice.call(arguments);
74 outArgs[2] = features;
75 this.error.sdump('D_WIN', 'opening ' + url + ', ' + title + ', ' + features + ' from ' + this.win + '\n');
77 var w = this.SafeWindowOpenDialog.apply(this, outArgs);
78 if (features.match(/modal/) && my_xulG) {
82 if (get_contentWindow(w)) {
83 get_contentWindow(w).xulG = my_xulG;
92 try { w.title = title; } catch(E) { dump('**'+E+'\n'); }
93 try { w.document.title = title; } catch(E) { dump('**'+E+'\n'); }
101 dump('exiting util/window.js\n');