Problem with info.selectionText of contextMenus.onShown

I am working on a web extension, involving right click context menu.
I need to read the selectionText of the “info” in browser.contextMenus.onShown.addListener, as well as in browser.contextMenus.onClicked.addListener. There is no problem with onClicked event. But sometimes info.selectionText returns “undefined” in onShown event, while there is selected text on the page. I can not find any pattern of when it occurs, but one thing is for sure. Even when info.selectionText in onShown returns “undefined” on page A, then I click on the contextmenu, which opens a new tab with the selected text as parameter with no problem. Once that is done, then I return to the page A, there will be no problem with info.selectionText in onShown. And it will always work on page A afterwards. This is repeatable.
Firefox Quantum 62.0 (64-bit) on Ubuntu 14.04.