Closed Bug 1363661 Opened 7 years ago Closed 7 years ago

problem webExtensions API on notifications.onClicked.addListener

Categories

(WebExtensions :: Frontend, defect)

55 Branch
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: hellosct1, Unassigned, NeedInfo)

Details

Attachments

(9 files)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0
Build ID: 20170508100218

Steps to reproduce:

I have developed a WebExtension

Its purpose is to open a new window in relation to the choices of navigation icons

The result of the webExtension
- Windows
   Firefox Nightly 55: ok
   Chrome: ok
   Opera: ok
   Chronium: ok

- Linux (Debian / Ubuntu / linux Mint)
   Firefox Nightly 55: KO
  Chrome: ok
  Openra: ok
  Chronium: ok

I used the function :  https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/notifications/onClicked


Actual results:

The steps of use on windows and linux, are:

- Select the "action" button (image linux-1-browser.png and windows-1-browser.png)
- A notification window is displayed (image linux-2-notification.png and windows-2-notification.png)
- Click on the text
   => Under Windows 10 and Firefox Nightly 55, I have a new tab with the loading of the website (windows-4-resultat.png)
   => Under linux (Debian / ubuntu / linuxMint) and Firefox Nightly 55, the tab does not create

When looking at the debugger, there is no information (image Windows-3-debug.png and linux3-debug.png)

The problem is with the function notifications.onClicked.addListener
Which is in the fichiher popup.js line 35


Expected results:

The script must create a new page and load a new site from an action on the same principle as the favorites

It works on Windows Nightly but not on linux Nitghly


The original API : https://github.com/hellosct1/demo-WebExt-manifest
Component: Untriaged → WebExtensions: Frontend
Product: Firefox → Toolkit
The problem here most likely is, that the popup gets closed before you can click the notification on Linux, while you can click it immediately on Windows. As soon as the popup is closed, the click listener is removed, since the popup's document is unloaded. I don't think that's actually a bug and working as expected, unless maybe the popup should close before clicking a notification on Windows.

You'd want your onClicked listener to be in the background page. Note that you don't need to attach the listener every time you display a notification, since you only use the id, which you get in the onClicked listener.

P.S.: You seem to always want to use browser.*, https://github.com/mozilla/webextension-polyfill might be interesting for you for using promises cross-browser.
Flags: needinfo?(kmaglione+bmo)
based on comment 9, it sounds like there is a way to make this work better.  does that meet your needs?
Status: NEW → RESOLVED
Closed: 7 years ago
Flags: needinfo?(kmaglione+bmo) → needinfo?(hellosct1)
Resolution: --- → FIXED
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: