Bug 839239 - v20130211.01 - Prepare a hotfix to disable pdf.js for users of Firefox 18 and 19 in the release channel (all platforms). r=Mossop
--- a/README
+++ b/README
@@ -18,8 +18,10 @@ v20120430.01 - Bug 741004 - A hotfix rol
communicate the de-support of Windows 2000 and XP <= SP1 in Firefox 13.
v20120817.01 - Bug 774509 - A hotfix rolled out to 16.* OS X users to
communicate the de-support of Mac OS X 10.5 in Firefox 17.
v20120910.01 - Bug 790096 - Disable staged updates on OS X and Linux for
15.0a1 - 18.0a1. The flipped pref name will be renamed in fixed builds.
v20121019.01 - Bug 803596 - Combines the previous two hotfixes and also updates
the hotfix certificate fingerprint to accept a new certificate
v20121128.01 - Bug 816197 - Notify Firefox 17 users affected by Tab Mix Plus issues.
+v20130211.01 - Bug 839239 - Disable pdf.js for Firefox 18 and 19 users in the 'release'
+ channel in all platforms.
copy from v20120910.01/bootstrap.js
copy to v20130211.01/bootstrap.js
--- a/v20120910.01/bootstrap.js
+++ b/v20130211.01/bootstrap.js
@@ -2,17 +2,23 @@
* 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/. */
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://gre/modules/AddonManager.jsm");
Cu.import("resource://gre/modules/Services.jsm");
-const APP_UPDATE_STAGE_ENABLED_PREF = "app.update.stage.enabled";
+const PDFJS_DISABLED_PREF = "pdfjs.disabled";
+const PDFJS_BEFOREHOTFIX_DISABLED_PREF = "pdfjs.beforeHotfix.disabled";
+const PREVIOUS_ACTION_PREF = "pdfjs.previousHandler.preferredAction";
+const PREVIOUS_ASK_PREF = "pdfjs.previousHandler.alwaysAskBeforeHandling";
+const DISABLED_PLUGIN_TYPES_PREF = "plugin.disable_full_page_plugin_for_types";
+const PDF_CONTENT_TYPE = "application/pdf";
+const UPDATE_CHANNEL_PREF = "app.update.channel";
function install(data, reason) {
if (!shouldHotfixApp()) {
uninstallHotfix(data);
return;
}
AddonManager.getAddonByID(data.id, function(addon) {
@@ -23,18 +29,49 @@ function install(data, reason) {
function startup(data, reason) {
if (!shouldHotfixApp()) {
uninstallHotfix(data);
return;
}
try {
- Services.prefs.setBoolPref(APP_UPDATE_STAGE_ENABLED_PREF, false);
+ let prevDisabled = Services.prefs.getBoolPref(PDFJS_DISABLED_PREF);
+
+ // Disable pdf.js and store previous user choice for when we later re-enable it.
+ Services.prefs.setBoolPref(PDFJS_DISABLED_PREF, true);
+ Services.prefs.setBoolPref(PDFJS_BEFOREHOTFIX_DISABLED_PREF, prevDisabled);
+
+ // Remove the pdf content type from the blacklist of full-page plugins for types.
+ if (Services.prefs.getPrefType(DISABLED_PLUGIN_TYPES_PREF) == Services.prefs.PREF_STRING) {
+ let disabledTypes = Services.prefs.getCharPref(DISABLED_PLUGIN_TYPES_PREF)
+ .split(",")
+ .filter(function (type) type != PDF_CONTENT_TYPE)
+ .join(",");
+ Services.prefs.setCharPref(DISABLED_PLUGIN_TYPES_PREF, disabledTypes);
+ }
+
+ // Ensure the pref changes are written to disk.
Services.prefs.savePrefFile(null);
+
+ // Restore previous pdf handler information before pdf.js was enabled.
+ let mimeSvc = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService);
+ let mimeHandler = mimeSvc.getFromTypeAndExtension(PDF_CONTENT_TYPE, "pdf");
+
+ if (Services.prefs.getPrefType(PREVIOUS_ACTION_PREF) == Services.prefs.PREF_INT) {
+ mimeHandler.preferredAction = Services.prefs.getIntPref(PREVIOUS_ACTION_PREF);
+ }
+
+ if (Services.prefs.getPrefType(PREVIOUS_ASK_PREF) == Services.prefs.PREF_BOOL) {
+ mimeHandler.alwaysAskBeforeHandling = Services.prefs.getBoolPref(PREVIOUS_ASK_PREF);
+ }
+
+ let handlerSvc = Cc['@mozilla.org/uriloader/handler-service;1']
+ .getService(Ci.nsIHandlerService);
+ handlerSvc.store(mimeHandler);
} catch (ex) {
Cu.reportError(ex);
}
// This hotfix should always be uninstalled.
uninstallHotfix(data);
}
@@ -42,43 +79,30 @@ function shutdown(data, reason) { }
function uninstall(data, reason) { }
/**
* @return boolean whether the hotfix applies to the application.
*/
function shouldHotfixApp() {
// Ensure that this is the correct version in case compatability checking is overridden.
- if (Services.vc.compare(Services.appinfo.version, "15.0a1") < 0 ||
- Services.vc.compare(Services.appinfo.version, "18.0a1") > 0) {
- return false;
- }
-
- let defaultPrefs = Services.prefs.getDefaultBranch("");
- let isESR = false;
- try {
- isESR = defaultPrefs.getCharPref("app.update.channel") == "esr";
- } catch (e) { }
-
- if (isESR) {
- return false;
- }
-
- if (Services.appinfo.OS !== "Linux" && Services.appinfo.OS !== "Darwin") {
+ if (Services.vc.compare(Services.appinfo.version, "18.0") < 0 ||
+ Services.vc.compare(Services.appinfo.version, "19.0.*") > 0 ||
+ (Services.prefs.getPrefType(UPDATE_CHANNEL_PREF) == Services.prefs.PREF_STRING &&
+ Services.prefs.getCharPref(UPDATE_CHANNEL_PREF) != "release")) {
return false;
}
try {
- if (Services.prefs.getBoolPref(APP_UPDATE_STAGE_ENABLED_PREF) === false) {
+ if (Services.prefs.getPrefType(PDFJS_BEFOREHOTFIX_DISABLED_PREF) ==
+ Services.prefs.PREF_BOOL) {
+ // This hotfix has already been used.
return false;
}
- } catch (ex) {
- // Pref does not exist so this is not an affected build.
- return false;
- }
+ } catch (ex) { }
return true;
}
function uninstallHotfix(data) {
AddonManager.getAddonByID(data.id, function(addon) {
addon.uninstall();
});
copy from v20120910.01/chrome.manifest
copy to v20130211.01/chrome.manifest
copy from v20120910.01/icon.png
copy to v20130211.01/icon.png
copy from v20120910.01/icon64.png
copy to v20130211.01/icon64.png
copy from v20120910.01/install.rdf
copy to v20130211.01/install.rdf
--- a/v20120910.01/install.rdf
+++ b/v20130211.01/install.rdf
@@ -1,29 +1,27 @@
<?xml version="1.0"?>
<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>firefox-hotfix@mozilla.org</em:id>
- <em:version>20120910.01</em:version>
+ <em:version>20130211.01</em:version>
<em:bootstrap>true</em:bootstrap>
- <em:targetPlatform>Darwin</em:targetPlatform>
- <em:targetPlatform>Linux</em:targetPlatform>
<em:strictCompatibility>true</em:strictCompatibility>
<!-- Front End MetaData -->
- <em:name>Firefox Update Hotfix</em:name>
+ <em:name>Firefox Hotfix</em:name>
<em:description>Delivers necessary support-related notifications and/or updates for Firefox without requiring a software update.</em:description>
<em:creator>Mozilla</em:creator>
<em:targetApplication>
<Description>
<!-- Firefox -->
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
- <em:minVersion>15.0a1</em:minVersion>
- <em:maxVersion>18.0a1</em:maxVersion>
+ <em:minVersion>18.0</em:minVersion>
+ <em:maxVersion>19.0.*</em:maxVersion>
</Description>
</em:targetApplication>
</Description>
</RDF>