Function.bind can't be called on prototype function inside constructor

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P2
    • 8
    • Affects Version/s: 8
    • Component/s: core-libs
    • None
    • b93
    • Verified

      A function defined in an Object prototype is called bind on it in the Object constructor. This is creating a TypeError: Cannot read property "bind" from undefined.
      What is strange is that, if no bind method is called, the method is not undefined and can be called. As soon as bind is called (although being called as the last instruction), method is undefined.

      Testcase:
      function MyObject() { // If the call to bind is removed, then the function is properly printed. print("function " + this._process); this._process = this._process.bind(this); }
      MyObject.prototype._process = function() { print("Message "); }
      var s = new MyObject();

            Assignee:
            Sundararajan Athijegannathan
            Reporter:
            Marcus Lagergren
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: