Fixed the bug which the background page context cannot be retrieved.