svn commit: r1652732 - in /ofbiz/branches/release14.12: ./ framework/images/webapp/images/fieldlookup.js

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1652732 - in /ofbiz/branches/release14.12: ./ framework/images/webapp/images/fieldlookup.js

jleroux@apache.org
Author: jleroux
Date: Sun Jan 18 11:13:15 2015
New Revision: 1652732

URL: http://svn.apache.org/r1652732
Log:
"Applied fix from trunk for revision: 1652731  "
------------------------------------------------------------------------
r1652731 | jleroux | 2015-01-18 12:12:11 +0100 (dim. 18 janv. 2015) | 8 lignes

A patch from Gareth Carter for "framework/images/webapp/images/fieldlookup.js throws a javascript error in google chrome from a link to ofbiz from another site" https://issues.apache.org/jira/browse/OFBIZ-5968

When you link to your ofbiz installation from another site using _blank as the target and protocol is changing from http to https, google chrome will throw an error -
Blocked a frame with origin "https://ofbiz.company.com" from accessing a frame with origin "http://other.company.com".  The frame requesting access has a protocol of "https", the frame being accessed has a protocol of "http". Protocols must match.

This error may prevent other javascript from executing (this has caused, in our ofbiz installation, datetimepickers from working properly)

jleroux: this simply adds a try/catch block and use the parent in case of failure
------------------------------------------------------------------------


Modified:
    ofbiz/branches/release14.12/   (props changed)
    ofbiz/branches/release14.12/framework/images/webapp/images/fieldlookup.js

Propchange: ofbiz/branches/release14.12/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Jan 18 11:13:15 2015
@@ -8,4 +8,4 @@
 /ofbiz/branches/json-integration-refactoring:1634077-1635900
 /ofbiz/branches/multitenant20100310:921280-927264
 /ofbiz/branches/release13.07:1547657
-/ofbiz/trunk:1649742,1650240,1650583,1650642,1650678,1650882,1650887,1650938,1651593,1652361,1652706,1652725
+/ofbiz/trunk:1649742,1650240,1650583,1650642,1650678,1650882,1650887,1650938,1651593,1652361,1652706,1652725,1652731

Modified: ofbiz/branches/release14.12/framework/images/webapp/images/fieldlookup.js
URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/framework/images/webapp/images/fieldlookup.js?rev=1652732&r1=1652731&r2=1652732&view=diff
==============================================================================
--- ofbiz/branches/release14.12/framework/images/webapp/images/fieldlookup.js (original)
+++ ofbiz/branches/release14.12/framework/images/webapp/images/fieldlookup.js Sun Jan 18 11:13:15 2015
@@ -684,11 +684,20 @@ function lookupPaginationAjaxRequest(nav
  ******************************************************************************/
 var re_id = new RegExp('id=(\\d+)');
 var num_id = (re_id.exec(String(window.location)) ? new Number(RegExp.$1) : 0);
-var obj_caller = (window.opener && window.opener.lookups? window.opener.lookups[num_id]: null);
-if (obj_caller == null && window.opener != null) {
- obj_caller = window.opener;
-} else if (obj_caller == null && window.opener == null) {
+var obj_caller;
+try {
+ obj_caller = (window.opener && window.opener.lookups? window.opener.lookups[num_id]: null);
+ if (obj_caller == null && window.opener != null) {
+ obj_caller = window.opener;
+ } else if (obj_caller == null && window.opener == null) {
+ obj_caller = parent;
+ }
+}
+catch (err) {
  obj_caller = parent;
+ if (console) {
+ console.log(err);
+ }
 }
 
 function setSourceColor(src) {