Bug 1306081 - Ship the Websense hotfix as a system add-on, targeting Firefox 47. r=MattN
MozReview-Commit-ID: Kiae8mjWmfA
--- a/browser/extensions/moz.build
+++ b/browser/extensions/moz.build
@@ -4,9 +4,10 @@
# 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/.
DIRS += [
'e10srollout',
'pdfjs',
'pocket',
'webcompat',
+ 'websensehelper',
]
copy from browser/extensions/webcompat/bootstrap.js
copy to browser/extensions/websensehelper/bootstrap.js
--- a/browser/extensions/webcompat/bootstrap.js
+++ b/browser/extensions/websensehelper/bootstrap.js
@@ -1,10 +1,61 @@
/* -*- 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/. */
-// for now we ship a stub, that can be upgraded as-needed after release
-function startup() {}
+const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
+
+const APP_UPDATE_URL_PREF = "app.update.url";
+const REPLACE_KEY = "%OS_VERSION%";
+
+Cu.import("resource://gre/modules/Services.jsm");
+Cu.import("resource://gre/modules/osfile.jsm");
+Cu.import("resource://gre/modules/TelemetryLog.jsm");
+
+function startup() {
+ if (Services.appinfo.OS != "WINNT") {
+ return;
+ }
+
+ try {
+ let windir = Services.dirsvc.get("WinD", Ci.nsILocalFile).path;
+
+ let file1 = OS.Path.join(windir, "System32\\qipcap.dll");
+ let file2 = OS.Path.join(windir, "System32\\qipcap64.dll");
+ let file3 = OS.Path.join(windir, "sysnative\\qipcap.dll");
+ let file4 = OS.Path.join(windir, "sysnative\\qipcap64.dll");
+
+ let existPromises = [
+ OS.File.exists(file1),
+ OS.File.exists(file2),
+ OS.File.exists(file3),
+ OS.File.exists(file4)
+ ];
+
+ // Update the app.update.url pref to include a special mark
+ // telling whether any of those files are present or not.
+ Promise.all(existPromises).then(results => {
+ let newValue = "(nowebsense)";
+
+ if (results.some(value => value == true)) {
+ newValue = "(websense)";
+ }
+
+ let branch = Services.prefs.getDefaultBranch("");
+ let curValue = branch.getCharPref(APP_UPDATE_URL_PREF);
+ newValue = curValue.replace(REPLACE_KEY + "/", REPLACE_KEY + newValue + "/");
+ branch.setCharPref(APP_UPDATE_URL_PREF, newValue);
+
+ }, reject => {
+ Cu.reportError("Hotfix unexpected error: " + reject);
+ TelemetryLog.log("WEBSENSE_PROMISE_ERROR", [reject]);
+ });
+ } catch (ex) {
+ Cu.reportError(ex);
+ TelemetryLog.log("WEBSENSE_DETECTION_ERROR", [ex]);
+ }
+}
+
function shutdown() {}
function install() {}
function uninstall() {}
copy from browser/extensions/webcompat/install.rdf.in
copy to browser/extensions/websensehelper/install.rdf.in
--- a/browser/extensions/webcompat/install.rdf.in
+++ b/browser/extensions/websensehelper/install.rdf.in
@@ -4,28 +4,28 @@
- 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>webcompat@mozilla.org</em:id>
+ <em:id>websensehelper@mozilla.org</em:id>
<em:version>1.0</em:version>
<em:type>2</em:type>
<em:bootstrap>true</em:bootstrap>
<!-- 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>Web Compat</em:name>
- <em:description>Urgent post-release fixes for web compatibility.</em:description>
+ <em:name>Websense Helper</em:name>
+ <em:description>Checks for the non-presence of Websense to allow updates to happen.</em:description>
</Description>
</RDF>
copy from browser/extensions/webcompat/moz.build
copy to browser/extensions/websensehelper/moz.build
--- a/browser/extensions/webcompat/moz.build
+++ b/browser/extensions/websensehelper/moz.build
@@ -2,17 +2,15 @@
# 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['webcompat@mozilla.org'] += [
+FINAL_TARGET_FILES.features['websensehelper@mozilla.org'] += [
'bootstrap.js'
]
-FINAL_TARGET_PP_FILES.features['webcompat@mozilla.org'] += [
+FINAL_TARGET_PP_FILES.features['websensehelper@mozilla.org'] += [
'install.rdf.in'
]
-
-BROWSER_CHROME_MANIFESTS += ['test/browser.ini']