Add support for "newtab" notification type
Background
For https://gitlab.com/eyeo/adblockplus/abpui/adblockplusui/issues/728 we need to open a link in a new tab using the notification system in order to have a staged rollout and to be able to disable the notification remotely. In https://gitlab.com/eyeo/adblockplus/adblockpluscore/issues/162 we're adding the "newtab" notification type which we can use to determine whether a notification should trigger opening a new tab.
What to change
- Open first link from "links" property of "newtab" notification in a new, focused tab once when the user creates a new tab.
- Don't mark "newtab" notification as shown immediately. Instead, only do so after creating the new tab.
Hints for testers
- Newtab notifications may contain more than one link. Only the first of those in the list should be shown in a new tab. The others should be ignored and not lead to any further tabs being opened.
- If users don't open a new tab between the download of notifications.json and them closing the browser (or unloading the extension), the notification should be triggered (i.e. open the new tab) the first time the user opens a new tab after starting the browser (or loading the extension) again.
- If users don't open a new tab between the first and the second download of notifications.json that contain a newtab notification, only the first new tab that is being opened should trigger the notification and only a single tab should be opened.
- Newtab notifications that have already been triggered (i.e. that have created a new tab) should not open another tab the next time the user opens another new tab. This also applies if the user restarts the browser/extension between opening a tab and opening another one.
- No errors should be shown in JavaScript console during extension intialization.
Edited by Thomas Greiner