SwitchPrevious/Next tab work incorrectly on Safari

SwitchPreviousTab/SwitchNextTab work incorrectly on Safari

Step to reproduce:

  1. open 3-4 tabs
  2. call switchPreviousTab(2)

Actual Observe: It works incorrectly

NOTE: It’s only happen on Safari.

As I found that SwitchPreviousTab/SwitchNextTab call getWindowHandles. The getWindowHandles api on Safari return an array tabs that is not consistent with the tab display on browser.

e.g.:

Tab on Browser: tab1, tab2, tab3, tab4

getWindowHandles return: [tab1, tab4, tab2, tab3]