details:   https://code.openbravo.com/erp/devel/pi/rev/9c529a8c8b8d
changeset: 31975:9c529a8c8b8d
user:      Carlos Aristu <carlos.aristu <at> openbravo.com>
date:      Fri Apr 21 14:28:27 2017 +0200
summary:   fixes issue 35769: Firefox browser freezed sometimes after showing 
some pop-ups

After the changes introduced in project [1], there was a race condition 
reproducible in Firefox (not in Chrome).

The heartbeat/registration pop-ups are now displayed before the moment they 
were shown. Together with this, when generating the content of the pop-up, the 
standard document.write() is used since the very beginning, and according to 
the documentation[2] it is recommended to call document.close() to tell the 
browser to finish loading the page.

The document.close() was not being used and this seems to be the root cause of 
the race condition: by adding this function Firefox is not getting blocked and 
the instabilities in CI are gone.

[1] 
http://wiki.openbravo.com/wiki/Projects:Login_Process_Perfomance_Improvements
[2] https://developer.mozilla.org/en-US/docs/Web/API/Document/write

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/classic/ob-classic-compatibility.js
 |  1 +
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-layout.js
                   |  4 +++-
 
modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-myopenbravo.js
                                 |  2 --
 3 files changed, 4 insertions(+), 3 deletions(-)

diffs (37 lines):

diff -r bcf679ab26bb -r 9c529a8c8b8d 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/classic/ob-classic-compatibility.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/classic/ob-classic-compatibility.js
      Fri Apr 21 13:55:46 2017 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/classic/ob-classic-compatibility.js
      Fri Apr 21 14:28:27 2017 +0200
@@ -437,6 +437,7 @@
       postOpen: function (cPopup, postParams) {
         if (!cPopup.isFramesetDraw) {
           
cPopup.getIframeHtmlObj().contentWindow.document.write(cPopup.htmlCode);
+          cPopup.getIframeHtmlObj().contentWindow.document.close();
           cPopup.isFramesetDraw = true;
         }
         if (!cPopup.getIframeHtmlObj().contentWindow.frames[0].document.body) {
diff -r bcf679ab26bb -r 9c529a8c8b8d 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-layout.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-layout.js
        Fri Apr 21 13:55:46 2017 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-layout.js
        Fri Apr 21 14:28:27 2017 +0200
@@ -199,6 +199,8 @@
   OB.TestRegistry.register('org.openbravo.client.application.mainview.tabset', 
OB.MainView.TabSet);
   OB.TestRegistry.register('org.openbravo.client.application.layout', 
OB.Layout);
 
+  OB.NavBar.createMembers(OB.Application.navigationBarComponents);
 
-  OB.NavBar.createMembers(OB.Application.navigationBarComponents);
+  // show the heartbeat or registration popups (if it applies)
+  OB.Application.showHeartBeatOrRegistration();
 };
\ No newline at end of file
diff -r bcf679ab26bb -r 9c529a8c8b8d 
modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-myopenbravo.js
--- 
a/modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-myopenbravo.js
      Fri Apr 21 13:55:46 2017 +0200
+++ 
b/modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-myopenbravo.js
      Fri Apr 21 14:28:27 2017 +0200
@@ -434,8 +434,6 @@
 
     OB.MyOB = this;
 
-    // show the heartbeat or registration popups (if it applies)
-    //OB.Application.showHeartBeatOrRegistration();
     // tell each column their index number
     // is used when dragging/dropping 
     if (this.portalLayout) {

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to