ICEmobile
  1. ICEmobile
  2. MOBI-764

jQuery 1.6.1 version in JSP demos is interfering with ICEpush

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.3 Beta
    • Fix Version/s: EE 1.3
    • Component/s: Applications
    • Labels:
      None
    • Environment:
      ICEmobile spring

      Description

      When the icemobilespring demo is loaded

      http://labs.icesoft.com/icemobilespring

      the initial page does not make use of notifications, so the blocking connection is not started. When the Cloud Push demo is chosen, ice.push.register is invoked


      ice.push.register(['2hh14981m:zcl'], function(){
      ice.push.get('/icemobilespring/notificationsregion', function(parameter) {
       parameter('group', 'notifications');} , function(statusCode, responseText) {
      var container = document.getElementById('2hh14981m:zcl');
      if( container ) container.innerHTML = responseText;if( container ) ice.push.searchAndEvaluateScripts(container);});});

      but the implementation of register does not appear to guarantee that the listen.icepush requests will run.

      It is often necessary to clear the cache and restart the demo from the beginning to observe push updates not being delivered.

        Activity

        Hide
        Mircea Toma added a comment -

        When running icemobilespring demo the blocking connection is started reliably when the "Cloud Push" page is accessed.

        Show
        Mircea Toma added a comment - When running icemobilespring demo the blocking connection is started reliably when the "Cloud Push" page is accessed.
        Hide
        Mircea Toma added a comment -

        Also, double checking the blocking connection behaviour with a slightly modified icepush-basic application confirms that the connection is started right away after ice.push.register function is invoked.

        Show
        Mircea Toma added a comment - Also, double checking the blocking connection behaviour with a slightly modified icepush-basic application confirms that the connection is started right away after ice.push.register function is invoked.
        Hide
        Ted Goddard added a comment -

        Can be easily reproduced as follows:

        Show
        Ted Goddard added a comment - Can be easily reproduced as follows:
        Hide
        Ted Goddard added a comment -

        Ajax Push appears to work when the Cloud Push demo is accessed first. The following procedure shows the problem in Chrome on the Mac.

        (1) Load

        http://localhost:8080/icemobilespring

        Click on Buttons

        Click on Cloud Push

        • test

        repeat above (1), perhaps with a delay so that the listen interval is exceeded.

        Show
        Ted Goddard added a comment - Ajax Push appears to work when the Cloud Push demo is accessed first. The following procedure shows the problem in Chrome on the Mac. (1) Load http://localhost:8080/icemobilespring Click on Buttons Click on Cloud Push test repeat above (1), perhaps with a delay so that the listen interval is exceeded.
        Hide
        Mircea Toma added a comment -

        Shouldn't we fix the error that shows up in console before blaming ICEpush?

        Uncaught TypeError: Object #<Text> has no method 'getBoundingClientRect'
        WombatUtils.getElementRect
        M
        U
        Y
        n
        d.callbackWrapper
        jQuery.fn.extend.append jquery.js:389
        jQuery.fn.extend.domManip jquery.js:400
        jQuery.fn.extend.append jquery.js:389
        jQuery.fn.extend.html jquery.js:393
        jQuery.fn.extend.load.jQuery.ajax.complete jquery.js:472
        jQuery.extend._Deferred.deferred.resolveWith jquery.js:67
        done jquery.js:497
        jQuery.ajaxTransport.send.callback
        
        Show
        Mircea Toma added a comment - Shouldn't we fix the error that shows up in console before blaming ICEpush? Uncaught TypeError: Object #<Text> has no method 'getBoundingClientRect' WombatUtils.getElementRect M U Y n d.callbackWrapper jQuery.fn.extend.append jquery.js:389 jQuery.fn.extend.domManip jquery.js:400 jQuery.fn.extend.append jquery.js:389 jQuery.fn.extend.html jquery.js:393 jQuery.fn.extend.load.jQuery.ajax.complete jquery.js:472 jQuery.extend._Deferred.deferred.resolveWith jquery.js:67 done jquery.js:497 jQuery.ajaxTransport.send.callback
        Hide
        Mircea Toma added a comment -

        Looks like the error is triggered even without jQuery. I will investigate further.

        Show
        Mircea Toma added a comment - Looks like the error is triggered even without jQuery. I will investigate further.
        Hide
        Mircea Toma added a comment -

        The error shown above was triggered by a Chrome extension. Most probably the extension has localStorage registered callbacks the fail to run properly.

        Show
        Mircea Toma added a comment - The error shown above was triggered by a Chrome extension. Most probably the extension has localStorage registered callbacks the fail to run properly.
        Hide
        Mircea Toma added a comment -

        Managed to reproduce this issue reliably when running icemobilespring demo locally.

        Show
        Mircea Toma added a comment - Managed to reproduce this issue reliably when running icemobilespring demo locally.
        Hide
        Mircea Toma added a comment - - edited

        While debugging the ICEpush code I could observe that the monitor that ICepush starts (using setInterval) to check if pushIds are registered is not running anymore after the "Cloud Push" link is clicked.

        After some Google search I learned about issue http://bugs.jquery.com/ticket/9678. When "Cloud Push" link is clicked this registered callback actually runs:

        MvcUtil.addClickLinkHandler = function(link, updateRegion){
            $(link).click( function(e) {
                if( window.history && window.history.pushState ){
                    $('#menu').find('a').each( function(){
                        this.className = '';
                    });
                    $(updateRegion).load(link.href, function(){ 
                        ice.mobi.sizePagePanelsToViewPort();
                        $('html, body').animate({ scrollTop:0 }, 400);
                    });
                    history.pushState({ src: link.href }, null, link.href);
                    e.preventDefault();
                }
              });
        }
        

        When line

        $('html, body').animate({ scrollTop:0 }, 400);

        is removed the blocking connection starts every time.

        Show
        Mircea Toma added a comment - - edited While debugging the ICEpush code I could observe that the monitor that ICepush starts (using setInterval) to check if pushIds are registered is not running anymore after the "Cloud Push" link is clicked. After some Google search I learned about issue http://bugs.jquery.com/ticket/9678 . When "Cloud Push" link is clicked this registered callback actually runs: MvcUtil.addClickLinkHandler = function (link, updateRegion){ $(link).click( function (e) { if ( window.history && window.history.pushState ){ $('#menu').find('a').each( function (){ this .className = ''; }); $(updateRegion).load(link.href, function (){ ice.mobi.sizePagePanelsToViewPort(); $('html, body').animate({ scrollTop:0 }, 400); }); history.pushState({ src: link.href }, null , link.href); e.preventDefault(); } }); } When line $('html, body').animate({ scrollTop:0 }, 400); is removed the blocking connection starts every time.
        Hide
        Mircea Toma added a comment -

        It seems that the animation code stops pseudo-threads started with setInterval, even if they are not started by the animation code.

        I was able to confirm that by using jQuery 1.7.1 (included in the demo) this issue goes away.

        Show
        Mircea Toma added a comment - It seems that the animation code stops pseudo-threads started with setInterval, even if they are not started by the animation code. I was able to confirm that by using jQuery 1.7.1 (included in the demo) this issue goes away.
        Hide
        Mircea Toma added a comment -

        So, in order to fix this issue we either make the sample use jQuery 1.7.1 (higher that 1.6.3 anyway) or remove the animation triggered by the 'click' callback.

        Show
        Mircea Toma added a comment - So, in order to fix this issue we either make the sample use jQuery 1.7.1 (higher that 1.6.3 anyway) or remove the animation triggered by the 'click' callback.
        Hide
        Ted Goddard added a comment -

        Should ICEpush use a setTimeout "loop" rather than setInterval to guard against this? For instance, other user-level code could potentially cause the same problem. (It's not clear to me how jQuery disrupts the ICEpush setInterval callback – is there only one per window?)

        Show
        Ted Goddard added a comment - Should ICEpush use a setTimeout "loop" rather than setInterval to guard against this? For instance, other user-level code could potentially cause the same problem. (It's not clear to me how jQuery disrupts the ICEpush setInterval callback – is there only one per window?)
        Hide
        Mircea Toma added a comment -

        There's one setInterval setup per browser in this case. But if access the site in one window that window will own the blocking connection as well (with its setInterval started).

        Are you sure that switching to setTimeout would not cause other libraries to cause us problems? Both setTimeout and setInterval are equally fundamental in Javascript.

        Show
        Mircea Toma added a comment - There's one setInterval setup per browser in this case. But if access the site in one window that window will own the blocking connection as well (with its setInterval started). Are you sure that switching to setTimeout would not cause other libraries to cause us problems? Both setTimeout and setInterval are equally fundamental in Javascript.
        Hide
        Ted Goddard added a comment -

        I'm not sure – I don't see how it's possible for jQuery to interfere with our existing setInterval.

        Show
        Ted Goddard added a comment - I'm not sure – I don't see how it's possible for jQuery to interfere with our existing setInterval.
        Hide
        Ted Goddard added a comment -

        Philip, please upgrade the jQuery version in the demo for EE.

        Show
        Ted Goddard added a comment - Philip, please upgrade the jQuery version in the demo for EE.
        Hide
        Ted Goddard added a comment -

        As Mircea mentioned, switching to setTimeout is unlikely to help – the bug is that jQuery is killing the timer based on the guessable process ID (such as id = 1).

        Show
        Ted Goddard added a comment - As Mircea mentioned, switching to setTimeout is unlikely to help – the bug is that jQuery is killing the timer based on the guessable process ID (such as id = 1).
        Hide
        Ted Goddard added a comment -

        IE 8 compatibility is still desired, so jQuery 2 is too recent an upgrade.

        Show
        Ted Goddard added a comment - IE 8 compatibility is still desired, so jQuery 2 is too recent an upgrade.
        Hide
        Philip Breau added a comment -

        Upgraded jquery version to 1.9.1

        Revision: 36224
        Author: philip.breau
        Date: June-13-13 3:54:50 PM
        Message:
        MOBI-764 Ensure push connection is active when pushIDs are registered


        Modified : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/WEB-INF/views/inc/head.jsp
        Modified : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/WEB-INF/views/template-small-android.jsp
        Modified : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/camera.html
        Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery/jquery-1.9.1.min.js
        Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery.mobile-1.3.1
        Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery.mobile-1.3.1/images
        Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery.mobile-1.3.1/images/ajax-loader.gif
        Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery.mobile-1.3.1/images/icons-18-black.png
        Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery.mobile-1.3.1/images/icons-18-white.png
        Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery.mobile-1.3.1/images/icons-36-black.png
        Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery.mobile-1.3.1/images/icons-36-white.png
        Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery.mobile-1.3.1/jquery.mobile-1.3.1.css
        Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery.mobile-1.3.1/jquery.mobile-1.3.1.js
        Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery.mobile-1.3.1/jquery.mobile-1.3.1.min.css
        Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery.mobile-1.3.1/jquery.mobile-1.3.1.min.js
        Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery.mobile-1.3.1/jquery.mobile-1.3.1.min.map
        Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery.mobile-1.3.1/jquery.mobile.structure-1.3.1.css
        Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery.mobile-1.3.1/jquery.mobile.structure-1.3.1.min.css
        Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery.mobile-1.3.1/jquery.mobile.theme-1.3.1.css
        Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery.mobile-1.3.1/jquery.mobile.theme-1.3.1.min.css
        Modified : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/microphone.html

        Show
        Philip Breau added a comment - Upgraded jquery version to 1.9.1 Revision: 36224 Author: philip.breau Date: June-13-13 3:54:50 PM Message: MOBI-764 Ensure push connection is active when pushIDs are registered Modified : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/WEB-INF/views/inc/head.jsp Modified : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/WEB-INF/views/template-small-android.jsp Modified : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/camera.html Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery/jquery-1.9.1.min.js Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery.mobile-1.3.1 Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery.mobile-1.3.1/images Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery.mobile-1.3.1/images/ajax-loader.gif Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery.mobile-1.3.1/images/icons-18-black.png Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery.mobile-1.3.1/images/icons-18-white.png Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery.mobile-1.3.1/images/icons-36-black.png Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery.mobile-1.3.1/images/icons-36-white.png Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery.mobile-1.3.1/jquery.mobile-1.3.1.css Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery.mobile-1.3.1/jquery.mobile-1.3.1.js Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery.mobile-1.3.1/jquery.mobile-1.3.1.min.css Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery.mobile-1.3.1/jquery.mobile-1.3.1.min.js Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery.mobile-1.3.1/jquery.mobile-1.3.1.min.map Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery.mobile-1.3.1/jquery.mobile.structure-1.3.1.css Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery.mobile-1.3.1/jquery.mobile.structure-1.3.1.min.css Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery.mobile-1.3.1/jquery.mobile.theme-1.3.1.css Added : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/jquery.mobile-1.3.1/jquery.mobile.theme-1.3.1.min.css Modified : /icemobile/trunk/icemobile/samples/jsp/icemobilespring/src/main/webapp/resources/microphone.html
        Hide
        Philip Breau added a comment -

        Revision: 36225
        Author: philip.breau
        Date: June-13-13 4:10:04 PM
        Message:
        MOBI-764 Ensure push connection is active when pushIDs are registered

        • upgrade jq to 1.9.1 to avoid killing the setInterval process

          Modified : /icemobile/trunk/icemobile/samples/jsp/mvc-mediacast/src/main/webapp/WEB-INF/jsp/head.jsp
          Added : /icemobile/trunk/icemobile/samples/jsp/mvc-mediacast/src/main/webapp/resources/javascript/jquery-1.9.1.min.js

        Show
        Philip Breau added a comment - Revision: 36225 Author: philip.breau Date: June-13-13 4:10:04 PM Message: MOBI-764 Ensure push connection is active when pushIDs are registered upgrade jq to 1.9.1 to avoid killing the setInterval process Modified : /icemobile/trunk/icemobile/samples/jsp/mvc-mediacast/src/main/webapp/WEB-INF/jsp/head.jsp Added : /icemobile/trunk/icemobile/samples/jsp/mvc-mediacast/src/main/webapp/resources/javascript/jquery-1.9.1.min.js
        Hide
        Philip Breau added a comment -

        Can no longer reproduce in mvc-mediacast or icemobilespring demos

        Show
        Philip Breau added a comment - Can no longer reproduce in mvc-mediacast or icemobilespring demos

          People

          • Assignee:
            Philip Breau
            Reporter:
            Ted Goddard
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: