Opened 4 years ago

Closed 4 years ago

#2071 closed defect (fixed)

Can't send messages from popup to background page

Reported by: sebastian Assignee: sebastian
Priority: P4 Milestone: Adblock-Plus-1.8.12-for-Chrome-Opera-Safari
Module: Platform Keywords:
Cc: Blocked By:
Blocking: #2067 Platform: Unknown
Ready: yes Confidential: no
Tester: Verified working:
Review URL(s):

http://codereview.adblockplus.org/5703008528629760

Description (last modified by sebastian)

How to reproduce

Call ext.backgroundPage.sendMessage() from popup.html. Currently this issue is only visible on the API-level. However, it's becoming user visible with #2067 and when we finally make the popup rely on messaging.

Observed behaviour

On Chrome, the message listener in the background page gets undefined. That is because we call chrome.runtime.sendMessage() with the chrome namespace from the background page.

On Safari, we get a TypeError, because only content scripts can send messages to the background page there. In order to work around that limitation, we would have to call the message listeners directly.

Expected behaviour

Calling ext.backgroundPage.sendMessage() from the popup should work as it does when called from content scripts. The message should be received by the message listeners registered in the background page.

Hint for testers

See #2067. If it's not merged yet, there shouldn't be any user visible effect. But make sure that the icon popup is still behaving correctly on Chrome and Safari.

Change History (3)

comment:1 Changed 4 years ago by sebastian

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:2 Changed 4 years ago by sebastian

  • Description modified (diff)

comment:3 Changed 4 years ago by sebastian

  • Milestone set to Adblock-Plus-for-Chrome-Opera-Safari-next
  • Resolution set to fixed
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.