Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-3195

Improve ArrayBuffer brand check in ensureBuffer

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • bson-4.4.0
    • Affects Version/s: None
    • Component/s: BSON
    • Not Needed

      instanceof is notoriously unreliable in JS, because it can
      be fooled by prototype manipulation and breaks down entirely
      for cross-realm brand checks.

      Using Object.prototype.toString is generally a better choice
      for this.

      This also adds SharedArrayBuffer as an alternative, as both
      should be treated the same under most circumstances.

            Assignee:
            Unassigned Unassigned
            Reporter:
            neal.beeken@mongodb.com Neal Beeken
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: