Permalink
Browse files

Bug 1179262 - Remove PlayPreview registration from PDF Viewer.

  • Loading branch information...
yurydelendik committed Jul 2, 2015
1 parent 9ad6af4 commit 0b5330781c367fcbc997947adbf2bdcdf71f61bc
@@ -85,12 +85,21 @@ Factory.prototype = {
var registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar);
registrar.registerFactory(proto.classID, proto.classDescription,
proto.contractID, this);

if (proto.classID2) {
this._classID2 = proto.classID2;
registrar.registerFactory(proto.classID2, proto.classDescription,
proto.contractID2, this);
}
},

unregister: function unregister() {
var proto = this._targetConstructor.prototype;
var registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar);
registrar.unregisterFactory(proto.classID, this);
if (this._classID2) {
registrar.unregisterFactory(this._classID2, this);
}
this._targetConstructor = null;
},

@@ -112,11 +112,20 @@ Factory.prototype = {
var registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar);
registrar.registerFactory(proto.classID, proto.classDescription,
proto.contractID, factory);

if (proto.classID2) {
this._classID2 = proto.classID2;
registrar.registerFactory(proto.classID2, proto.classDescription,
proto.contractID2, factory);
}
},

unregister: function unregister() {
var registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar);
registrar.unregisterFactory(this._classID, this._factory);
if (this._classID2) {
registrar.unregisterFactory(this._classID2, this._factory);
}
this._factory = null;
}
};
@@ -305,13 +314,6 @@ let PdfJs = {
Cu.import('resource://pdf.js/PdfStreamConverter.jsm');
this._pdfStreamConverterFactory.register(PdfStreamConverter);

this._pdfRedirectorFactory = new Factory();
Cu.import('resource://pdf.js/PdfRedirector.jsm');
this._pdfRedirectorFactory.register(PdfRedirector);

Svc.pluginHost.registerPlayPreviewMimeType(PDF_CONTENT_TYPE, true,
'data:application/x-moz-playpreview-pdfjs;,');

this._registered = true;
},

@@ -323,12 +325,6 @@ let PdfJs = {
Cu.unload('resource://pdf.js/PdfStreamConverter.jsm');
delete this._pdfStreamConverterFactory;

this._pdfRedirectorFactory.unregister();
Cu.unload('resource://pdf.js/PdfRedirector.jsm');
delete this._pdfRedirectorFactory;

Svc.pluginHost.unregisterPlayPreviewMimeType(PDF_CONTENT_TYPE);

this._registered = false;
}
};
@@ -868,6 +868,9 @@ PdfStreamConverter.prototype = {
classDescription: 'pdf.js Component',
contractID: '@mozilla.org/streamconv;1?from=application/pdf&to=*/*',

classID2: Components.ID('{PDFJSSCRIPT_STREAM_CONVERTER2_ID}'),
contractID2: '@mozilla.org/streamconv;1?from=application/pdf&to=text/html',

QueryInterface: XPCOMUtils.generateQI([
Ci.nsISupports,
Ci.nsIStreamConverter,
@@ -62,7 +62,9 @@ var ROOT_DIR = __dirname + '/', // absolute path to project's root
MOZCENTRAL_PREF_PREFIX = 'pdfjs',
FIREFOX_PREF_PREFIX = 'extensions.uriloader@pdf.js',
MOZCENTRAL_STREAM_CONVERTER_ID = 'd0c5195d-e798-49d4-b1d3-9324328b2291',
FIREFOX_STREAM_CONVERTER_ID = '6457a96b-2d68-439a-bcfa-44465fbcdbb1';
FIREFOX_STREAM_CONVERTER_ID = '6457a96b-2d68-439a-bcfa-44465fbcdbb1',
MOZCENTRAL_STREAM_CONVERTER2_ID = 'd0c5195d-e798-49d4-b1d3-9324328b2292',
FIREFOX_STREAM_CONVERTER2_ID = '6457a96b-2d68-439a-bcfa-44465fbcdbb2';

var DEFINES = {
PRODUCTION: true,
@@ -833,6 +835,8 @@ target.firefox = function() {

sed('-i', /PDFJSSCRIPT_STREAM_CONVERTER_ID/, FIREFOX_STREAM_CONVERTER_ID,
FIREFOX_BUILD_CONTENT_DIR + 'PdfStreamConverter.jsm');
sed('-i', /PDFJSSCRIPT_STREAM_CONVERTER2_ID/, FIREFOX_STREAM_CONVERTER2_ID,
FIREFOX_BUILD_CONTENT_DIR + 'PdfStreamConverter.jsm');
sed('-i', /PDFJSSCRIPT_PREF_PREFIX/, FIREFOX_PREF_PREFIX,
FIREFOX_BUILD_CONTENT_DIR + 'PdfStreamConverter.jsm');
sed('-i', /PDFJSSCRIPT_MOZ_CENTRAL/, 'false',
@@ -966,6 +970,8 @@ target.mozcentral = function() {

sed('-i', /PDFJSSCRIPT_STREAM_CONVERTER_ID/, MOZCENTRAL_STREAM_CONVERTER_ID,
MOZCENTRAL_CONTENT_DIR + 'PdfStreamConverter.jsm');
sed('-i', /PDFJSSCRIPT_STREAM_CONVERTER2_ID/, MOZCENTRAL_STREAM_CONVERTER2_ID,
MOZCENTRAL_CONTENT_DIR + 'PdfStreamConverter.jsm');
sed('-i', /PDFJSSCRIPT_PREF_PREFIX/, MOZCENTRAL_PREF_PREFIX,
MOZCENTRAL_CONTENT_DIR + 'PdfStreamConverter.jsm');
sed('-i', /PDFJSSCRIPT_MOZ_CENTRAL/, 'true',

0 comments on commit 0b53307

Please sign in to comment.