firefox-client icon indicating copy to clipboard operation
firefox-client copied to clipboard

selectedTab always assume there is a tab open

Open nicola opened this issue 11 years ago • 0 comments

In FirefoxOS for example, there is no tab open, an error should be thrown by this function

  selectedTab: function(cb) {
    this.request("listTabs", function(resp) {
      var tab = resp.tabs[resp.selected];
      return new Tab(this.client, tab);
    }.bind(this), cb);
  },

or its error will be very enigmatic:

TypeError: Cannot read property 'actor' of undefined
    at EventEmitter.Tab (/Users/mozilla/Proj/mozilla/moztools/firefox-client/lib/tab.js:12:30)
    at EventEmitter.<anonymous> (/Users/mozilla/Proj/mozilla/moztools/firefox-client/lib/browser.js:66:14)
    at /Users/mozilla/Proj/mozilla/moztools/firefox-client/lib/client-methods.js:78:16
    at EventEmitter.extend.handleMessage (/Users/mozilla/Proj/mozilla/moztools/firefox-client/lib/client.js:160:7)
    at EventEmitter.extend.readMessage (/Users/mozilla/Proj/mozilla/moztools/firefox-client/lib/client.js:219:10)
    at EventEmitter.extend.onData (/Users/mozilla/Proj/mozilla/moztools/firefox-client/lib/client.js:185:16)
    at Socket.emit (events.js:95:17)
    at Socket.<anonymous> (_stream_readable.js:748:14)
    at Socket.emit (events.js:92:17)
    at emitReadable_ (_stream_readable.js:410:10)

nicola avatar Aug 29 '14 00:08 nicola