Skip to content

[JS Driver] Support IE 10 #162

Closed
Closed

Description

@neumino

So we don't know why Internet Explorer 10 doesn't support the JavaScript Driver.
IE 10 supports DataView and Uint8Array so it should work...

Tagging in backlog.

Activity

  1. danielmewes commented on Jan 17, 2014

    @danielmewes
    Member

    Wonder if it works with IE 11. Will try that out some time.

  2. mikemintz commented on Jul 8, 2015

    @mikemintz
    Contributor

    I'm pretty sure it doesn't work with IE10 because IE10 doesn't support __proto__, which is used in TermBase's constructor.

    self.__proto__ = @.__proto__

    Removing that line gives me the same error in chrome that I get in IE10, so I'm fairly sure it's a culprit.

    I'm trying to work out how to get the same behavior without __proto__, but I'm not sure what that constructor is doing exactly.

  3. neumino commented on Jul 9, 2015

    @neumino
    MemberAuthor

    In the constructor, the driver creates a function that maps to bracket, switches its internal prototype (__proto__) to Termbase. This is what let you do things like

    r.expr({foo: "bar"})("foo")
    // instead of
    r.expr({foo: "bar"}).bracket("foo")
    

    You could have TermBase be an empty constructor and everything will work fine. You'll have to use .bracket(...) instead of (...) though.
    If you really want to remove __proto__ without changing the same behavior, you can use ES6 proxy, but I think it's supported on Chrome and Firefox only :) It's also heavy-ish to do as you have to define the getter for all methods every time

  4. danielmewes commented on Jul 9, 2015

    @danielmewes
    Member

    @mikemintz Is IE 10 support important for you?

  5. mikemintz commented on Jul 9, 2015

    @mikemintz
    Contributor

    @danielmewes Yes, it's important for my use case with rethinkdb-websocket-client, which wraps the official driver for use in the browser. But it sounds like the javascript API would have to change in order to support that, which is pretty unfortunate.

    Unless there's another way to allow function calls on objects with prototypes, it's probably best not to change it. Ideally it would check if __proto__ is supported in the current environment, and if not, fail gracefully in a way that only disables the bracket shorthand.

    @neumino I've tried changing TermBase to have an empty constructor (and a variety of other implementations) and I still get errors, e.g. orderBy is not a function. I don't have any bracket operations in my query. So I think there is more to do in order to get everything else working without __proto__.

  6. marshall007 commented on Jul 9, 2015

    @marshall007
    Contributor

    This should be possible, but may require significant refactoring. jQuery, for example, implements this same sort of API and they do so without modifying __proto__. Take a look at the code here.

    Their implementation is arguably cleaner than how things are currently being done in ast.coffee, but like I said this would require a decent amount of work not a quick-fix.

  7. neumino commented on Jul 10, 2015

    @neumino
    MemberAuthor

    @mikemintz -- Did you replace the TermBase constructor with function() { return this }?
    It works fine for me.

    @marshall007 -- jQuery API is a less fexible. $ is a function but not what it returns

    $("div")("foo") // not defined and doesn't work
    r.expr("div")("foo") // does work
    
  8. mikemintz commented on Jul 10, 2015

    @mikemintz
    Contributor

    @neumino My bad, that actually does work for me. Turns out there I was doing r.row('createdAt') which was using the bracket shorthand.

    I still have other issues with IE10, but let me spend some time getting to the root cause of them.

  9. mikemintz commented on Jul 10, 2015

    @mikemintz
    Contributor

    The other IE10 issues were my own unrelated issues.

    After taking @neumino's suggestion to replace the TermBase constructor, and adding explicit .bracket(...) calls to my queries, the driver works in IE10.

    Would it be acceptable to modify the TermBase constructor, to something like this (sorry, not familiar with coffeescript so hopefully my syntax is right)?

    constructor: ->
        if ({})['__proto__']
            self = (ar (field) -> self.bracket(field))
            self.__proto__ = @.__proto__
            return self
        else
            return this
  10. danielmewes commented on Jul 14, 2015

    @danielmewes
    Member

    @deontologician How does that change to TermBase look to you?

  11. deontologician commented on Jul 14, 2015

    @deontologician
    Contributor

    That seems reasonable

  12. 20 remaining items

  13. modified the milestones: , 2.2.6 on Mar 17, 2016
  14. mikemintz commented on Mar 30, 2016

    @mikemintz
    Contributor

    Now that this is merged and 2.2.6 is released, could you publish a new RethinkDB JavaScript driver release on npm?

  15. danielmewes commented on Mar 30, 2016

    @danielmewes
    Member

    @mikemintz The latest JavaScript driver 2.2.3 includes the change. Have you tried it?

  16. mikemintz commented on Mar 31, 2016

    @mikemintz
    Contributor

    @danielmewes you're right, I am able to get it to work with 2.2.3 in IE10. Thanks!

  17. added a commit that references this issue on Aug 7, 2026
    f7dc076
  18. added a commit that references this issue on Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions