Coder Social home page Coder Social logo

Android 4.0 issue about native-promise-only HOT 17 CLOSED

getify avatar getify commented on August 10, 2024
Android 4.0 issue

from native-promise-only.

Comments (17)

smikes avatar smikes commented on August 10, 2024

Thanks for the bug report.

from native-promise-only.

smikes avatar smikes commented on August 10, 2024

Could you try out the candidate fix in 306216f and let me know if it works? I don't have an appropriate device to test with.

from native-promise-only.

ironsidevsquincy avatar ironsidevsquincy commented on August 10, 2024

Will do. Clocking off time here in England, I'll try tomorrow morning

from native-promise-only.

smikes avatar smikes commented on August 10, 2024

OK, thanks!

On Wed, Nov 5, 2014 at 10:55 AM, Darren Hurley [email protected]
wrote:

Will do. Clocking off time here in England, I'll try tomorrow morning


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

from native-promise-only.

ironsidevsquincy avatar ironsidevsquincy commented on August 10, 2024

Hmmm, doesn't quite work. Looks like it only fails specifically when setting the prototype on a function, i.e.

var func  = function () {},
    proto = {};
builtInProp(func, 'prototype', proto, false);

alert(func.prototype === proto);

alerts false, as expected. If func = {}, alerts true

from native-promise-only.

smikes avatar smikes commented on August 10, 2024

Thanks - will fix it

On Thu, Nov 6, 2014 at 4:15 AM, Darren Hurley [email protected]
wrote:

Hmmm, doesn't quite work. Looks like it only fails specifically when setting the prototype on a function, i.e.

var func  = function () {},
    proto = {};
builtInProp(func, 'prototype', proto, false);
alert(func.prototype === proto);

alerts false, as expected. If func = {}, alerts true

Reply to this email directly or view it on GitHub:
#38 (comment)

from native-promise-only.

smikes avatar smikes commented on August 10, 2024

I made x be a function () {} -- when you have a chance, let me know if the new fix works.

Thanks!

from native-promise-only.

smikes avatar smikes commented on August 10, 2024

Unfortunately my test was incorrect - it should check for

var y = function() {} , x = {};

Object.defineProperty(y, "prototype", { value: x });
if (y.prototype === x) throw;

Can you please verify, again, with the new corrected code?

from native-promise-only.

getify avatar getify commented on August 10, 2024

(FYI: I updated my suggested gist with this correction, too: https://gist.github.com/getify/906aadd914a675ea4a57)

from native-promise-only.

deleteme avatar deleteme commented on August 10, 2024

@smikes Confirming that 67d8223 fixes it. It look me a little longer to test this because a build step is required. For what it's worth, npm build doesn't work, but node build does.

from native-promise-only.

smikes avatar smikes commented on August 10, 2024

Thanks.

Yes, npm build would run node-gyp if there was a bindings.gyp, while npm run-script build is necessary to run the 'build' script defined in package.json

from native-promise-only.

mgol avatar mgol commented on August 10, 2024

jQuery is now using NPO to test compliance of its Deferreds against the Promises/A+ tests and this issue is causing jQuery.when tests to fail. See http://swarm.jquery.org/result/99082

What else is needed to get #38 merged?

from native-promise-only.

getify avatar getify commented on August 10, 2024

Sorry that this got hung up for so long on #41. We were discussing possible file reorg and tests and such, and I think we missed the forest for the trees. So I've just landed a fix only for the Android thing (hopefully!).

from native-promise-only.

mgol avatar mgol commented on August 10, 2024

@getify Thanks! It turns out jQuery test errors are caused by another issue, see #43.

from native-promise-only.

getify avatar getify commented on August 10, 2024

Actually, I didn't fix this issue correctly after all. :(

from native-promise-only.

getify avatar getify commented on August 10, 2024

Man, this android4 browser behavior is insane. If you use Object.defineProperty, it actually does change the descriptor, but not the underlying function value. Then, even better, subsequently if you try to set it with normal = assignment, THAT assignment silently fails. = assignment only works if you haven't previously done the Object.defineProperty.

from native-promise-only.

getify avatar getify commented on August 10, 2024

For posterity sake, the observation I made was that the builtInProp(..) usage before was actually setting the same sort of descriptor (writable:true, enumerable:false, configurable:false) as is already true of function prototypes (per spec)... so the normal = assignment is shorter, accomplishes the exact same outcome, and most importantly doesn't trigger this android4 stupidity.

Ironic/unfortunate that the OP suggested exactly this, and it took me all this time and wrapping around the issue to come to the same conclusion. :/

from native-promise-only.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.