Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0008911Openbravo ERPB. User interfacepublic2009-05-05 13:532009-08-05 11:44
roklenardic 
iperdomo 
normalminoralways
closedfixed 
20Ubuntu 9.04
2.50 
pi 
Core
No
0008911: menu in Openbravo app called from a link does not work
If there is a link or a button to the login screen of the Openbravo ERP such as:
* <a href="http://ec2-67-202-1-77.compute-1.amazonaws.com" [^] target="_blank">
* <input type='button' onClick="window.open('http://ec2-67-202-1-77.compute-1.amazonaws.com','vm' [^])" name="ov" value="Open My Virtual Machine">

once you login, the menu items simply do not work. if you access the same instance by copy-pasting the url into another browser (or even a new tab of the same browser) it works.

The problem is in utils.js (of PI)

line 297 and 307

      if(top.opener != null) { // is a pop-up window

This is triggering in the main window because it has a top.opener (external link).

If Firebug is enabled, the error that is attached as a snapshot appears.


See also this cross-domain restriction:

Q: I can not access the properties of the new secondary window. I always
get an error in the javascript console saying "Error: uncaught
exception: Permission denied to get property <property_name or
method_name>. Why is that?

A: It is because of the cross-domain script security restriction (also
referred as the "Same Origin Policy"). A script loaded in a window (or
frame) from a distinct origin (domain name) cannot get nor set
properties of another window (or frame) or the properties of any of its
HTML objects coming from another distinct origin (domain name).
Therefore, before executing a script targeting a secondary window, the
browser in the main window will verify that the secondary window has
the same domain name.

https://developer.mozilla.org/En/DOM:window.open [^]
David Baz suggested:

if(top.opener != null && frames.name.indexOf('appFrame')==-1 && frames.name.indexOf('frameMenu')==-1) { // is a pop-up window

in every places of utils.js where

if(top.opener != null) or if(top.opener) appears
250MP1
related to defect 00109552.50MP12 closed roklenardic Callouts stop working in the app when called from a button 
related to defect 0019038 closed alostale App opened with window.open or link from another domain makes popups not to work 
png ec2MenuClicksNotWorking.png (37,163) 2009-05-05 13:53
https://issues.openbravo.com/file_download.php?file_id=1263&type=bug
png
Issue History
2009-05-05 13:53roklenardicNew Issue
2009-05-05 13:53roklenardicAssigned To => iperdomo
2009-05-05 13:53roklenardicFile Added: ec2MenuClicksNotWorking.png
2009-05-05 13:53roklenardicRegression testing => No
2009-05-05 22:39iperdomoStatusnew => scheduled
2009-05-05 22:39iperdomofix_in_branch => pi
2009-05-05 22:41hgbotCheckin
2009-05-05 22:41hgbotNote Added: 0016076
2009-05-05 22:41hgbotStatusscheduled => resolved
2009-05-05 22:41hgbotResolutionopen => fixed
2009-05-05 22:41hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/68932ea3c43d79291211a32a0e9940cac1413c84 [^]
2009-05-05 22:41iperdomoTag Attached: 250MP1
2009-06-17 08:39sureshbabuStatusresolved => closed
2009-06-17 08:39sureshbabuNote Added: 0017374
2009-06-17 08:39sureshbabuFixed in Version => pi
2009-06-18 00:00anonymoussf_bug_id0 => 2807992
2009-06-19 09:10roklenardicNote Added: 0017452
2009-08-04 10:10roklenardicNote Added: 0018813
2009-08-05 11:44roklenardicNote Added: 0018836
2009-10-19 07:09rafarodaRelationship addedrelated to 0010955
2011-11-10 20:59roklenardicRelationship addedrelated to 0019038

Notes
(0016076)
hgbot   
2009-05-05 22:41   
Repository: erp/devel/pi
Changeset: 68932ea3c43d79291211a32a0e9940cac1413c84
Author: Iván Perdomo <ivan.perdomo <at> openbravo.com>
Date: Tue May 05 22:41:20 2009 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/68932ea3c43d79291211a32a0e9940cac1413c84 [^]

Fixes issue 8911: Verify the the top.opener reference is a application frame

---
M web/js/utils.js
---
(0017374)
sureshbabu   
2009-06-17 08:39   
Tested working fine
(0017452)
roklenardic   
2009-06-19 09:10   
This still does not work in 2.50MP1.
(0018813)
roklenardic   
2009-08-04 10:10   
This still does not work in 2.50MP2!
(0018836)
roklenardic   
2009-08-05 11:44   
My mistake, the patch wasn't applied correctly. I'm sorry.