deftjs / DeftJS

Extensions for Large-Scale Sencha Touch and Ext JS Applications
http://deftjs.org/
MIT License
285 stars 56 forks source link

DeftJS v0.9 - Promises not working in Internet Explorer 10 #113

Closed ghost closed 11 years ago

ghost commented 11 years ago

It appears Promises don't work in Internet Explorer for DeftJS .9. All other browsers seem OK.

Can be tested through the browsers console by creating a quick service and using it in a promise. Specific example below.

Version Information: DeftJS .9 (Included as a sencha package) ExtJS 4.2.1.883 Sencha CMD 4.0.0.126

Per Brian Kotek this appears to be failing in the test suites: https://groups.google.com/forum/#!topic/deftjs/mTEMNRDIqaY

Tested with following code run from in IE browsers console:

var service = { loadAsync: function () { var deferred = Ext.create('Deft.Deferred'); setTimeout(function () { return deferred.resolve("Resolved"); }, 2000); return deferred.promise; } };

service.loadAsync() .then({ success: function () { alert("HERE"); } });

johnyanarella commented 11 years ago

The test suite is passing for me in IE9 (except for two memoize() tests - turns out those are bugs in the tests themselves related to execution scope - checking for window vs undefined). Brian reproduced the failures with IE10. I'm working on getting a VM up and running here to check that one out.

I suspect this has something to do with our support for setImmediate() being broken. We try to use it when available, but apparently our implementation is wrong. All the other browsers you mention fall back to setInterval() to schedule future calls.

Thanks for reporting this issue. We'll get right on that. (Glad you pointed this out before we tagged and shipped v0.9!)

brian428 commented 11 years ago

John, I think I found it, but posting here so you can check it. I believe the check for setImmediate at the end of Function.coffee that sets the nextTick() method needs fn and scope args. Should be:

if setImmediate? 
    @nextTick = ( fn, scope ) ->
        if fn? && scope?
            fn = Ext.Function.bind( fn, scope )
        setImmediate( fn )
        return

With that in, tests pass in IE 10 (and still pass in Chrome as well).

johnyanarella commented 11 years ago

You are correct. The missing function parameters were indeed the issue. Thanks Brian!

johnyanarella commented 11 years ago

Dave,

I've just pushed v0.9.1 to the Deft JS package repo, which includes this fix.

Please let me know if you have any issues upgrading.

Thanks again for reporting this issue.

-John

johnyanarella commented 11 years ago

In theory, you should be able to pull down the update via:

sencha app refresh

or

sencha app refresh -packages

Depending on the version of Sencha Cmd, you may have to manually remove the expanded package (<YourApp>/packages/deft) -- i.e. if you see an errror message that "a folder by that name already exists".

You can double-check the version by looking at the <YourApp>/packages/deft/package.json file.

ghost commented 11 years ago

I actually had to remove and re-add the repo first. Then sencha app refresh produced the error you warned about manually removing the expanded package. Before removing/adding the repo no upgrade of the package was attempted, no error occurred. Might just be my environment, I am on one of the beta 4.0 versions of CMD.

The updated package has fixed the issues we were experiencing in our apps.

Thanks for the speedy response and resolution.