Bug 1407911 - [template] use system addon to set/reset stylo blocklist.
This is a template for creating a one-off-system-add-ons for stylo blocklist
update. For people who would like to update the stylo blocklist, please refer
to following steps:
1. fix the TODO section and set/reset the blocked domain(s) in bootstrap.js
2. build it to get a post-processed install.rdf
3. zip the bootstrap.js and install.rdf files into an .xpi (make package?)
4. get the add-on signed
5. QA it and announce it to gofaster@ and release-drivers@ (is this step necessary in our case?)
6. deploy it by requesting approval-mozilla-release?
References:
https://wiki.mozilla.org/Firefox/Go_Faster/System_Add-ons/Process
https://github.com/mozilla/one-off-system-add-ons
MozReview-Commit-ID: 24UMmcRw7zT
new file mode 100644
--- /dev/null
+++ b/browser/extensions/styloblocklist/bootstrap.js
@@ -0,0 +1,31 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/* exported install, uninstall, startup, shutdown */
+/* eslint no-implicit-globals: "off" */
+
+const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
+
+const {Preferences} = Cu.import("resource://gre/modules/Preferences.jsm", {});
+const {Services} = Cu.import("resource://gre/modules/Services.jsm");
+
+const PREF_STYLO_BLOCKLIST_ENABLED = "layout.css.stylo-blocklist.enabled";
+const PREF_STYLO_BLOCKLIST_DOMAINS = "layout.css.stylo-blocklist.blocked_domains";
+// TODO: Put a comma-separated string here to set/reset the stylo blocklist.
+// e.g., "example1.com,example2.com,example3.com"
+const BLOCKED_DOMAINS = "";
+
+function install() {
+ Preferences.set(PREF_STYLO_BLOCKLIST_ENABLED, true);
+ Preferences.set(PREF_STYLO_BLOCKLIST_DOMAINS, BLOCKED_DOMAINS);
+ // Flush the preferences to disk
+ Services.prefs.savePrefFile(null);
+}
+
+function uninstall() {}
+
+function startup() {}
+
+function shutdown(data, reason) {}
new file mode 100644
--- /dev/null
+++ b/browser/extensions/styloblocklist/install.rdf.in
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+#filter substitution
+
+<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:em="http://www.mozilla.org/2004/em-rdf#">
+
+ <Description about="urn:mozilla:install-manifest">
+ <em:id>styloblocklist@mozilla.org</em:id>
+ <em:version>1.0</em:version>
+ <em:type>2</em:type>
+ <em:bootstrap>true</em:bootstrap>
+ <em:multiprocessCompatible>true</em:multiprocessCompatible>
+
+ <!-- Target Application this theme can install into,
+ with minimum and maximum supported versions. -->
+ <em:targetApplication>
+ <Description>
+ <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
+ <em:minVersion>@MOZ_APP_VERSION@</em:minVersion>
+ <em:maxVersion>@MOZ_APP_MAXVERSION@</em:maxVersion>
+ </Description>
+ </em:targetApplication>
+
+ <!-- Front End MetaData -->
+ <em:name>Update Stylo Blocklist</em:name>
+ <em:description>Updates stylo blocklist for users.</em:description>
+ </Description>
+</RDF>
new file mode 100644
--- /dev/null
+++ b/browser/extensions/styloblocklist/moz.build
@@ -0,0 +1,16 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DEFINES['MOZ_APP_VERSION'] = CONFIG['MOZ_APP_VERSION']
+DEFINES['MOZ_APP_MAXVERSION'] = CONFIG['MOZ_APP_MAXVERSION']
+
+FINAL_TARGET_FILES.features['asyncrendering@mozilla.org'] += [
+ 'bootstrap.js'
+]
+
+FINAL_TARGET_PP_FILES.features['asyncrendering@mozilla.org'] += [
+ 'install.rdf.in'
+]