Window.open fixes
authorThomas Berezansky <tsbere@mvlc.org>
Sat, 28 Jul 2012 19:17:40 +0000 (15:17 -0400)
committerDan Scott <dscott@laurentian.ca>
Mon, 30 Jul 2012 14:54:49 +0000 (10:54 -0400)
Add a window.open compatible "browser" file for unsecured calls.

Add "chrome" to most window.open calls to bypass the wrapper.

Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Signed-off-by: Dan Scott <dscott@laurentian.ca>
15 files changed:
Open-ILS/web/js/dojo/openils/Util.js
Open-ILS/web/js/ui/default/acq/common/li_table.js
Open-ILS/web/js/ui/default/acq/financial/claim_voucher.js
Open-ILS/web/js/ui/default/booking/populator.js
Open-ILS/web/js/ui/default/cat/authority/list.js
Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js
Open-ILS/web/js/ui/default/vandelay/vandelay.js
Open-ILS/web/opac/common/js/utils.js
Open-ILS/web/opac/skin/default/js/rdetail.js
Open-ILS/web/reports/oils_rpt_utils.js
Open-ILS/xul/staff_client/chrome/content/cat/opac.js
Open-ILS/xul/staff_client/chrome/content/util/print.js
Open-ILS/xul/staff_client/chrome/content/util/untrusted_window.xul [new file with mode: 0644]
Open-ILS/xul/staff_client/defaults/preferences/standalone_xul_app.js
Open-ILS/xul/staff_client/server/cat/marcedit.js

index 5745fad..804d13c 100644 (file)
@@ -474,7 +474,7 @@ if(!dojo._hasResource["openils.Util"]) {
      */
     openils.Util.printHtmlString = function(html, callback) {
 
-        var win = window.open('', 'Print Window', 'resizable,width=800,height=600,scrollbars=1'); 
+        var win = window.open('', 'Print Window', 'resizable,width=800,height=600,scrollbars=1,chrome'); 
 
         // force the new window to the background
         win.blur(); 
index f9abb71..aba6da9 100644 (file)
@@ -2662,9 +2662,9 @@ function AcqLiTable() {
             to true in about:config */
 
         if(openils.XUL.isXUL()) {
-            win = window.open('/xul/' + openils.XUL.buildId() + '/server/cat/marcedit.xul');
+            win = window.open('/xul/' + openils.XUL.buildId() + '/server/cat/marcedit.xul','','chrome');
         } else {
-            win = window.open('/xul/server/cat/marcedit.xul'); 
+            win = window.open('/xul/server/cat/marcedit.xul','','chrome'); 
         }
         var self = this;
         win.xulG = {
@@ -2852,7 +2852,7 @@ function AcqLiTable() {
 
         win = window.open(
             oilsBasePath + '/acq/lineitem/findbib?query=' + escape(query),
-            '', 'resizable,scrollbars=1');
+            '', 'resizable,scrollbars=1,chrome');
 
         win.window.recordFound = function(bibId) { 
             win.close();
index c6191f8..70ed2f0 100644 (file)
@@ -1,6 +1,6 @@
 function openClaimVoucherWindow() {
     var win = window.open(
-        "", "", "resizable,width=800,height=600,scrollbars=1"
+        "", "", "resizable,width=800,height=600,scrollbars=1,chrome"
     );
     /* XXX i18n - also, the reason this isn't loaded from a server-side page
      * has to do with problems of knowing when the page has loaded, so we
index 1eeb7cb..c6927e6 100644 (file)
@@ -333,7 +333,7 @@ function display_transit_slip(e) {
     /* XXX i18n and/or template */
     try {
         var win = window.open(
-            "","","resizeable,width=600,height=400,scrollbars=1"
+            "","","resizeable,width=600,height=400,scrollbars=1,chrome"
         );
         win.document.body.innerHTML =
             "<h1>Transit Slip</h1>\n" +
index 99fba63..3f1c666 100644 (file)
@@ -281,7 +281,7 @@ function loadMarcEditor(pcrud, rec) {
        To run in Firefox directly, must set signed.applets.codebase_principal_support
        to true in about:config
      */
-    win = window.open('/xul/server/cat/marcedit.xul'); // XXX version?
+    win = window.open('/xul/server/cat/marcedit.xul','','chrome'); // XXX version?
 
     win.xulG = {
         "record": {"marc": rec.marc(), "rtype": "are"},
index 886c8c3..0b47be3 100644 (file)
@@ -1279,7 +1279,7 @@ SelfCheckManager.prototype.printSessionReceipt = function(callback) {
 
 SelfCheckManager.prototype.printData = function(data, numItems, callback) {
 
-    var win = window.open('', '', 'resizable,width=700,height=500,scrollbars=1'); 
+    var win = window.open('', '', 'resizable,width=700,height=500,scrollbars=1,chrome'); 
     win.document.body.innerHTML = data;
     win.print();
 
index e8b8f5a..8e5f314 100644 (file)
@@ -1520,7 +1520,7 @@ function vlOpenMarcEditWindow(rec, postReloadHTMLHandler) {
         To run in Firefox directly, must set signed.applets.codebase_principal_support
         to true in about:config
     */
-    win = window.open('/xul/server/cat/marcedit.xul'); // XXX version?
+    win = window.open('/xul/server/cat/marcedit.xul','','chrome'); // XXX version?
 
     var type;
     if (currentType == 'bib') {
index 444d9cf..3d1366e 100644 (file)
@@ -564,7 +564,7 @@ function openWindow( data ) {
                        'chrome,resizable,width=700,height=500'); 
 
        } else {
-               win = window.open('','', 'resizable,width=700,height=500,scrollbars=1'); 
+               win = window.open('','', 'resizable,width=700,height=500,scrollbars=1,chrome'); 
                win.document.body.innerHTML = data;
        }
 }
index 2a228f5..3446574 100644 (file)
@@ -337,7 +337,7 @@ function OpenMarcEditWindow(pcrud, rec) {
           To run in Firefox directly, must set signed.applets.codebase_principal_support
           to true in about:config
         */
-       win = window.open('/xul/server/cat/marcedit.xul'); // XXX version?
+       win = window.open('/xul/server/cat/marcedit.xul','','chrome'); // XXX version?
        dojo.require('openils.PermaCrud');
 
        win.xulG = {
index 2ab687e..676d4c7 100644 (file)
@@ -129,7 +129,7 @@ function oilsRptDebug() {
 
        /*
        if(!oilsRptDebugWindow)
-               oilsRptDebugWindow = window.open('','Debug','resizable,width=700,height=500,scrollbars=1'); 
+               oilsRptDebugWindow = window.open('','Debug','resizable,width=700,height=500,scrollbars=1,chrome'); 
        oilsRptDebugWindow.document.body.innerHTML = oilsRpt.toHTMLString();
        */
 }
index 9f58b81..9151ab1 100644 (file)
@@ -736,7 +736,7 @@ function open_mfhd_editor(sre_id) {
 }
 
 function open_marc_editor(rec, label) {
-    win = window.open( xulG.url_prefix('XUL_MARC_EDIT') );
+    win = window.open( xulG.url_prefix('XUL_MARC_EDIT'), '', 'chrome' );
 
     win.xulG = {
         record : {marc : rec.marc()},
index c3ff12b..c84833a 100644 (file)
@@ -510,9 +510,9 @@ util.print.prototype = {
                             }
                         } else {
                             if (params.content_type == 'text/plain') {
-                                w = window.open('data:text/plain,'+escape(params.msg));
+                                w = window.open('data:text/plain,'+escape(params.msg),'','chrome');
                             } else {
-                                w = window.open('data:text/html,'+escape(params.msg));
+                                w = window.open('data:text/html,'+escape(params.msg),'','chrome');
                             }
                             setTimeout(
                                 function() {
@@ -535,9 +535,9 @@ util.print.prototype = {
                             obj._NSPrint_webBrowserPrint(w,silent,params);
                         } else {
                             if (params.content_type == 'text/plain') {
-                                w = window.open('data:text/plain,'+escape(params.msg));
+                                w = window.open('data:text/plain,'+escape(params.msg),'','chrome');
                             } else {
-                                w = window.open('data:text/html,'+escape(params.msg));
+                                w = window.open('data:text/html,'+escape(params.msg),'','chrome');
                             }
                             setTimeout(
                                 function() {
diff --git a/Open-ILS/xul/staff_client/chrome/content/util/untrusted_window.xul b/Open-ILS/xul/staff_client/chrome/content/util/untrusted_window.xul
new file mode 100644 (file)
index 0000000..a68e666
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<!-- Application: Evergreen Staff Client -->
+<!-- Screen: Window.Open compatible simple browser wrapper for untrusted pages -->
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- STYLESHEETS -->
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+
+<window id="util_window_open_browser_win" 
+    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+    <browser id="browser_browser" flex="1" autoscroll="false" type="content-primary" oils_force_external="true" />
+
+</window>
+
index 2b2fe74..65d995a 100644 (file)
@@ -9,8 +9,8 @@ pref("javascript.options.jit.content", true);
 pref("general.useragent.locale", "en-US");
 
 // We need something like this to get window.open to work in some places (where it complains about
-// navigator.xul not being registered.  But is about:blank the best value to use here?
-pref("browser.chromeURL","about:blank");
+// navigator.xul not being registered). The untrusted_window file provided the minimum required elements.
+pref("browser.chromeURL","chrome://open_ils_staff_client/content/util/untrusted_window.xul");
 
 // This one just makes things speedier.  We use a lot of XMLHttpRequest
 pref("network.http.max-persistent-connections-per-server",8);
index 620923a..71e6f22 100644 (file)
@@ -2048,7 +2048,7 @@ function loadMarcEditor(pcrud, marcxml, target, sf) {
        To run in Firefox directly, must set signed.applets.codebase_principal_support
        to true in about:config
      */
-    win = window.open('/xul/server/cat/marcedit.xul'); // XXX version?
+    win = window.open('/xul/server/cat/marcedit.xul', '_blank', 'chrome'); // XXX version?
 
     // Match marc2are.pl last_xact_id format, roughly
     var now = new Date;