getify/LABjs

LABjs fails to execute all loaded scripts on IE 9 and IE 10

joshdance opened this issue · 8 comments

We used the debug version and found that all of the scripts were loaded correctly, but only the first was executed. Upon refresh, when the scripts were loaded from the cache, they all loaded one after another and then all ran perfectly. It was only when coming to the page for the first time, with a cleared cache would the first script run and then none of the others.

LABjs is noted to work with IE 6+, does anyone have insight into this issue? I provided logs if needed.

My guess is you have a execution race condition with a silent error that stops the chain. Can you post your $LAB chain exactly as you use it in the page?

I will, left the office for the night. I will post first thing tomorrow
morning. Thank you!

On Mon, Nov 17, 2014 at 10:22 PM, Kyle Simpson notifications@github.com
wrote:

My guess is you have a execution race condition with a silent error that
stops the chain. Can you post your $LAB chain exactly as you use it in
the page?


Reply to this email directly or view it on GitHub
#101 (comment).

-J


Joshua Dance | Problem Solver | 425-301-9137 | [image: Twitter]
http://www.twitter.com/joshdance [image: YouTube]
http://www.youtube.com/joshuajaydan
joshdance.me/
helpcapeverde.org/

<script type="text/javascript">
    var lab_load_interval = setInterval(function() {
        if (typeof $LAB != "undefined") {
            clearInterval(lab_load_interval);
            $LAB.setGlobalDefaults({AlwaysPreserveOrder: true});
            $LAB
            .script("{$url.js_nexus}/functions.js")
            .script("{$url.js_lib}/jquery.min.js")
            .script("{$url.js_lib}/persist.js")
            .script("{$url.js_lib}/swfobject.js")
            .script("{$url.js_lib}/jquery-ui-1.8.9.custom.min.js")
            .script("{$url.js_lib}/jsonp.js")
            .script("{$url.js_lib}/jquery.json.js")
            .script("{$url.js_lib}/jcookie.js")
            .script("{$url.js_lib}/jstorage.min.js")
            .script("{$url.js_lib}/jquery.postmessage.js")
            .script("{$url.js_lib}/jquery.timePicker.min.js")
            .script("{$url.js_nexus}/BarbitratorBase.js")
            .script("{$url.js_nexus}/BarbitratorClient.js")
            .script("{$url.js_nexus}/DSConference.js")
            .script("{$url.js_nexus}/DSDataStore.js")
            .script("{$url.js_nexus}/{$ds_addon}.js")
            .script("{$url.js_nexus}/c2c/DSClickToCall.js")
            .script("{$url.js}/{$c2c_addon}.js")
            .script("{$url.js_nexus}/CommsClient.js")
            .script("{$url.js_nexus}/DialerStateManager.js")
            .script("{$url.js_nexus}/InboundService.js")
            .script("{$url.js_nexus}/c2c/{$new_com_addon}.js")
            .script("{$url.js_nexus}/c2c/c2c.js")
            .script("{$url.js_nexus}/DSConference.jQuery.js")
            .wait(function() {
                pd.popup_opening_position = ("{$show_toolbox}" == "right" || "{$show_toolbox}" == "righttoggle") ? 'left' : 'right';
            });
        }
    }, 50);
</script>

We found that sometimes LAB would not load first, so we added the interval to keep checking, once it is available, it enters the LAB chain.

The elements in curly braces {$url.js_nexus} get replaced in a build script with relative URLs.

Another wrinkle in the issue is we are operating in Salesforce. Using a relative URL would point the resource to /js/file.js which resolves to salesforce.com/js/file.js which Salesforce then redirects to visual.force.com/js/file.js. It appears that on a redirect IE 9 and 10 load the resource enough to cache it, but not enough to execute it. Thanks!

How is the LABjs script file being included in the page?

<script type="text/javascript" src="cdn.example.url.com/LAB.js"></script>

I don't understand how a <script src=".."></script> tag can't be guaranteed to have loaded and run before the rest of your code. The whole setInterval(..) thing is wholly inappropriate to use here. It speaks to a deeper issue that you would ever need to try something like that. We need to dig deeper on this, I don't suspect that it has anything to do with LABjs itself.

Can you post here, or email me privately (same name but on gmail) a full HTML dump (from view-source) of your page, so I can see what actually the browser is trying to run, and in what order? Alternatively, a URL to the page would be useful.

I agree with your findings. After looking at it more we have found some serious issues. I am working on fixing problems in legacy code. And unfortunately company owned so I can't post it :(

But we do have serious issues. We have resolved them and LABjs is working well for us, outside of our legacy problems. I will close this issue, and you have been so much help. 👍 Thank you for the time.

Glad to hear you've worked through some of those issues. Let me know if I can help elsewhere. :)