Blocklisting/Testing
Contents
Add-ons
Testing Staged Add-ons Blocklist
Prerequisites
To test the full functionality of blocklist v3 against the staging server, you need to set up a Firefox profile with the following preferences:
-
extensions.blocklist.useMLBF.stashes
= true -
extensions.blocklist.useMLBF
= true -
services.settings.server
= https://settings.stage.mozaws.net/v1 -
xpinstall.signatures.dev-root
= true -
extensions.webapi.testing
= true (new pref to be created to be able to interact with the install button on stage)
Note 1: During testing, the behavior should be identical regardless of whether stashes=true or stashes=false. This preference enables an optimization to save bandwidth.
Note 2: The preferences referenced in entries 1 and 2 should be enabled by default in the latest version of Firefox and will not require manually setting them.
Creating a block entry
Blocks in v3 are managed via the admin tool on AMO, and are automatically on a schedule used to create a new bloomfilter.
To set up a block entry, follow these steps:
- Identify an add-on on AMO stage https://addons.allizom.org/ that should be blocked and download the .XPI
Note: The add-on needs to be a webextension and approved (signed). Or upload an add-on and download the .XPI once approved and signed. - Install the add-on in Firefox.
Note: You will need to enable the preference to install add-ons from AMO stage (xpinstall.signatures.dev-root = true, see Prerequisite #4). Make sure that the add-on appears installed in addons manager (about:addons) - Retrieve the add-on’s guid
Note: If the guid is not specified in the manifest.json of the .XPI you can retrieve it from about:debugging#/runtime/this-firefox. - Login at https://addons-internal.stage.mozaws.net/en-US/admin/models/.
Note: You will need to connect via Mozilla’s VPN. You will also need to be added to an admin user group on AMO if not already a member. You’ll aslo need the ‘Blocklist:Create’ permission. - Make sure the waffle switch
blocklist_mlbf_submit
is enabled in https://addons-internal.stage.mozaws.net/en-US/admin/models/waffle/switch/ - Create a new add-on block record for the add-on guid from Step 1 via https://addons-internal.stage.mozaws.net/en-US/admin/models/blocklist/block/add/
Note: If you chose to block multiple guids at a time, the version range can be manually entered (i.e. there is no predefined select field with versions available to choose from). Make sure that at least one version of the guids you work with is covered by your chosen that range, otherwise the you ,might not find the add-on in the new generated blocklist. - If you are blocking an add-on that has a large number of active daily users (over 100k, which is unlikely for AMO stage), or an add-on that has 0 users (which is guaranteed if you created a new add-on in Step 1) then a sign-off is required from a different AMO/FxA user (who will also need to login via the VPN and be in an admin user group on AMO).
- Take note of the contents of https://kinto.stage.mozaws.net/v1/buckets/blocklists/collections/addons-bloomfilters/records
Important Note: The new blocklist starts being generated on AMO every 6 hours (06:35 UTC), so it should be available between 06:45 – 07:00 UTC (and every 6 hours thereafter) - Check the contents of https://kinto.stage.mozaws.net/v1/buckets/blocklists/collections/addons-bloomfilters/records have changed since Step 8
Note: How to verify the new stash: the stash will contain two sections -blocked: []
andunblocked: []
; There will be one entry for each combination or"guid:version string”
covered by the block range set up in AMO admin. If a block is deleted, all the add-on versions should be located in thestash - unblocked
section. Also, keep in mind that if you edit an existing block by expanding the blocked version range (i.e. you include additional add-on versions in the blocked range), you should see the new covered versions in thestash - blocked
. Similarly, if you exclude some previous blocked versions from the block range, the excluded versions should be visible instash - unblocked
.
Connecting to the stage server and triggering a new blocklist
You need to force an update of the blocklist in Firefox and verify that the add-on added in the previous step are indeed blocked. And similarly, marking an add-on as unblocked in the AMO admin tools, forcing an update and verifying that the add-on is unblocked again.
To point Firefox to the stage server, follow these steps:
- set
services.settings.server
= https://settings.stage.mozaws.net/v1 (Prerequisites #3) - on Beta and Release, start Firefox via the command line as follows:
▪ [Windows]: Open cmd and run:
1.set XPCSHELL_TEST_PROFILE_DIR=1
2.firefox.exe --no-remote -p
▪ [Linux and macOS]: Open the terminal and run:
1.export XPCSHELL_TEST_PROFILE_DIR=1
2.firefox --no-remote -p
Note: In both cases `-p` opens the profile manager. You can also use --profile to specify an explicit location of the profile directory. (“firefox”/”firefox.exe” must be replaced with the actual path to the Firefox binary if needed).
Optional: to verify that the switch to the staging server has been successful, open the DevTools console and run
ChromeUtils.import("resource://services-settings/Utils.jsm").Utils.SERVER_URL
=> this should return https://settings.stage.mozaws.net/v1 - Go to about:addons, open the DevTools console and force an update of the blocklist by running:
ChromeUtils.import('resource://gre/modules/Blocklist.jsm').Blocklist.ExtensionBlocklist._client.sync()
The installed add-on should now reflect the blocked status. If the status is not automatically updated, refresh the page.
Logging States
Enable logging to help debug via the browser console:
- open a new tab and type about:config into the URL
- change the
extensions.logging.enabled
preference fromfalse
totrue
- open the browser console using the steps from Forcing a Blocklist Ping and force a ping
You'll receive similar output via the browser console:
Blocklist state for firefox-devedition@mozilla.org@personas.mozilla.org changed from 0 to 0 Blocklist state for Shockwave Flash changed from 0 to 4
The definitions of each state can be found in the following source file
Plugins
Flash (Downloading/Uninstalling)
Graphics
Testing Graphics Blocklist entries
(Note: this only applies to Windows.)
- If the blocklist entry is on staging, see above for testing a staged blocklist first.
- Ensure you're currently hardware accelerated by opening about:support and looking at the Graphics section. Check that you have:
- Direct2D true (if on Windows 7 or Vista with the platform update)
- Hardware accelerated windows 1/1 Direct3D 9 (or 10)
- Force a blocklist ping, as above.
- Wait 5 seconds.
- Restart your browser.
- Open about:support and look at the Graphics section again. Ensure that:
- Direct2D is false
- Hardware accelerated windows 0/1
Quickly Checking Features
In addition to the above section, features can also be checked for disabled/enabled status by the following:
Feature | Enabled | Disabled |
---|---|---|
Direct2D (Windows) | about:support will show "Direct2D Enabled: true" | about:support will show "Direct2D Enabled: false" |
Direct3D 9 Layers (Windows) | about:support will show "GPU Accelerated Windows: 2/2 Direct3D 9" *if it says Direct3D 10, this is not possible to test on this setup | about:support will show "GPU Accelerated Windows: 0/2" and will not list the rendering API |
Direct3D 10 Layers (Windows) | about:support will show "GPU Accelerated Windows: 2/2 Direct3D 10" *if it says Direct3D 9, this is not possible to test on this setup | about:support will show "GPU Accelerated Windows: 0/2" and will not list the rendering API |
Direct3D 10.1 Layers (Windows) | about:support will show "GPU Accelerated Windows: 2/2 Direct3D 10" *if it says Direct3D 9, this is not possible to test on this setup | about:support will show "GPU Accelerated Windows: 0/2" and will not list the rendering API |
OpenGL Layers (Android, Linux, Mac) | about:support will show "GPU Accelerated Windows: 1/1 OpenGL" | about:support will show "GPU Accelerated Windows: 0/1" and will not list the rendering API |
WebGL, OpenGL Variant (Android, Linux, Mac, sometimes Windows) | about:support will show "WebGL Renderer: <your renderer>" and it will not contain anything about being blocked for a driver version or similar messages *NOTE: if it contains the word "ANGLE" on windows, it is NOT using OpenGL, even if after that it says "OpenGL ES 2.0" or some such | about:support will show "WebGL Renderer: <some error>" which contains some information about why the renderer is blocked |
WebGL, ANGLE Variant (Windows) | about:support will show "WebGL Renderer: ANGLE( <your render> )" and will not contain anything about being blocked for a driver version or similar messages. *NOTE: DO NOT assume that if it says "OpenGL ES 2.0" or some such that it is using OpenGL; the only important thing is that it says "ANGLE" | about:support will show "WebGL Renderer: <some error>" which contains some information about why the renderer is blocked |
WebGL MSAA | Go to https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/sdk/demos/mozilla/spore/index.html and compare the model to this reference; if it looks like the left image, MSAA is enabled. | Go to https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/sdk/demos/mozilla/spore/index.html and compare the model to this reference; if it looks like the right image, MSAA is disabled. *NOTE: this is not a scientific test. MSAA may be disabled but you cannot be certain that it's blocked. the card could simply not support it. the best way to be sure is to download a utility that checks your GPU's available extensions and if antialiasing is not in that list, it is simply not supported |
- NOTE: Direct3D 10 and Direct3D 10.1 are impossible to distinguish visually.
Spoofing Hardware Details for Blocklist Testing
Sometimes you don't have hardware or software available to test a given blocklist entry. On Windows, you can spoof your hardware and software details to the graphics blacklist using environment variables.
Environment Variable | Sample Value(s) | rMeaning | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
MOZ_GFX_SPOOF_DRIVER_VERSION | 8.17.18.2563 | The version of the driver you want to spoof. | ||||||||||
MOZ_GFX_SPOOF_VENDOR_ID | 0x1002 | The PCI vendor ID of the card you want to spoof. | ||||||||||
MOZ_GFX_SPOOF_DEVICE_ID | 0x3245 | The PCI device ID of the card you want to spoof. | ||||||||||
MOZ_GFX_SPOOF_WINDOWS_VERSION |
|
The numeric ID of the Windows version you want to spoof. |