Open web-based first-run page instead of local one
Background / User story
In order to push for more user engagement through donations, we are investigating the option of opening a web-based version of our first-run page instead of the one that's currently bundled with the extension. However, such a setup is not suitable for certain features our current first-run page provides so we should only use that version for some users while keeping the local one around.
What to change
- Design: N/A
- Research: N/A
- Spec: https://gitlab.com/eyeo/specs/spec/-/merge_requests/349
- Legal: https://jira.eyeo.com/browse/ABPUI-40
-
Development:
- Open web-based first-run page (URL pending) instead of integrated one, unless it's meant to be shown to notify users about data corruption (incl. settings having been reset).
- If the web-based first-run page fails to load, update its browser tab to show the local first-run page instead.
- Failing to load could be:
- Document request returns error code (i.e. HTTP status codes outside the range of
200-399
) - Document request takes too long
- Document request was redirected away from adblockplus.org
- Document request succeeds but parts of the page fail to load before "load" event
- Page indicates to extension via an event that it failed to load before "load" event
- Document request returns error code (i.e. HTTP status codes outside the range of
- If necessary, provide web-based first-run page with a way to open the settings page of the extension, without exposing such capabilities to the web.
Hints for testers
This change breaks the automated tests in adblockpluschrome. We're working on fixing them in eyeo/adblockplus/adblockpluschrome#265 (closed).
The web-based first-run page is not yet online under welcome.adblockplus.org but you can use adblockplus.org for testing by adjusting the domain in the remote_first_run_page_url
preference accordingly.
Local first-run page should open and an error message should be shown in the extension's JavaScript console when encountering any network problems, such as:
- Slow network
- IP error (e.g. offline)
- TCP error (e.g. server timeout)
- DNS error (e.g. domain doesn't exist)
- HTTPS error (e.g. invalid certificate)
- HTTP error (e.g. not found)
- Error due to third-party software:
- Top-level frame request blocked (e.g. by modifying Adblock Plus to not ignore "main_frame"-type requests)
Note that it looks like neither Chrome nor Firefox allow extensions to block the top-level frame request. - Top-level frame request blocked by replacing it (e.g. using uBlock Origin)
- Top-level frame request blocked (e.g. by modifying Adblock Plus to not ignore "main_frame"-type requests)
This applies to any requests in a redirect chain.
The local first-run page should also be shown in the following cases:
- Browser fails to open web-based first-run page (e.g. invalid URL).
- Browser fails to replace web-based with local first-run page (e.g. browser bug causing
browser.tabs.update()
to fail). - Browser ignores replacing web-based with local first-run page (e.g. browser bug causing
browser.tabs.update()
to fail silently).
Note: We retry it a couple of times. But in case it fails each time, we leave the failing tab open and open the local first-run page in a new tab.
Hints for translators
N/A
Integration notes
Requires eyeo/adblockplus/adblockpluschrome#256 (closed).
- Add
remote_first_run_page_url
preference with the valuehttps://welcome.adblockplus.org/%LANG%/installed
. - Include adblockplusui/lib/init.js in background page. It is expected to run immediately after adblockpluschrome/lib/subscriptionInit.js.
- In adblockpluschrome/lib/subscriptionInit.js:
- Remove logic that notifies users after the extension initializes.
- Expose
setNotifyUserCallback()
and call given callback instead of the previous logic.
- Requires eyeo/adblockplus/adblockpluschrome#265 (closed).
- Requires https://jira.eyeo.com/browse/HD-1595
- We need to set up the final URL;
- The page exists but needs to be configured under the subdomain.