From 5e63889c06ddeb666e0da52e6c0014c085b89ccd Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 29 Jan 2019 20:58:42 -0800 Subject: [PATCH] Bug 1524688: Part 19 - Convert PDF.j to static registration. r=bdahl --HG-- extra : rebase_source : eaf1366b7a7617b577f0495dc43b6c02ef04023b --- browser/extensions/pdfjs/components.conf | 17 +++++++++++++++++ browser/extensions/pdfjs/moz.build | 7 +++++-- browser/extensions/pdfjs/pdfjs.js | 8 +------- browser/extensions/pdfjs/pdfjs.manifest | 3 --- browser/installer/package-manifest.in | 4 ---- 5 files changed, 23 insertions(+), 16 deletions(-) create mode 100644 browser/extensions/pdfjs/components.conf delete mode 100644 browser/extensions/pdfjs/pdfjs.manifest diff --git a/browser/extensions/pdfjs/components.conf b/browser/extensions/pdfjs/components.conf new file mode 100644 index 000000000000..8bbc6698e1d2 --- /dev/null +++ b/browser/extensions/pdfjs/components.conf @@ -0,0 +1,17 @@ +# -*- Mode: python; 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/. + +Classes = [ + { + 'cid': '{d0c5195d-e798-49d4-b1d3-9324328b2291}', + 'contract_ids': [ + '@mozilla.org/streamconv;1?from=application/pdf&to=*/*', + '@mozilla.org/streamconv;1?from=application/pdf&to=text/html', + ], + 'jsm': 'resource:///modules/pdfjs.js', + 'constructor': 'StreamConverterFactory', + }, +] diff --git a/browser/extensions/pdfjs/moz.build b/browser/extensions/pdfjs/moz.build index c203fe8df685..a248e89a24bc 100644 --- a/browser/extensions/pdfjs/moz.build +++ b/browser/extensions/pdfjs/moz.build @@ -11,7 +11,10 @@ BROWSER_CHROME_MANIFESTS += ['test/browser.ini'] JAR_MANIFESTS += ['jar.mn'] -EXTRA_COMPONENTS += [ +EXTRA_JS_MODULES += [ 'pdfjs.js', - 'pdfjs.manifest', +] + +XPCOM_MANIFESTS += [ + 'components.conf', ] diff --git a/browser/extensions/pdfjs/pdfjs.js b/browser/extensions/pdfjs/pdfjs.js index 5e04eeeb6714..4bd8f09269c8 100644 --- a/browser/extensions/pdfjs/pdfjs.js +++ b/browser/extensions/pdfjs/pdfjs.js @@ -16,7 +16,6 @@ "use strict"; const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); -const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); ChromeUtils.defineModuleGetter(this, "PdfStreamConverter", "resource://pdf.js/PdfStreamConverter.jsm"); @@ -28,10 +27,5 @@ function StreamConverterFactory() { } throw Cr.NS_ERROR_FACTORY_NOT_REGISTERED; } -StreamConverterFactory.prototype = { - // properties required for XPCOM registration: - classID: Components.ID("{d0c5195d-e798-49d4-b1d3-9324328b2291}"), - classDescription: "pdf.js Component", -}; -var NSGetFactory = XPCOMUtils.generateNSGetFactory([StreamConverterFactory]); +var EXPORTED_SYMBOLS = ["StreamConverterFactory"]; diff --git a/browser/extensions/pdfjs/pdfjs.manifest b/browser/extensions/pdfjs/pdfjs.manifest deleted file mode 100644 index a4fbbf5bac53..000000000000 --- a/browser/extensions/pdfjs/pdfjs.manifest +++ /dev/null @@ -1,3 +0,0 @@ -component {d0c5195d-e798-49d4-b1d3-9324328b2291} pdfjs.js -contract @mozilla.org/streamconv;1?from=application/pdf&to=*/* {d0c5195d-e798-49d4-b1d3-9324328b2291} -contract @mozilla.org/streamconv;1?from=application/pdf&to=text/html {d0c5195d-e798-49d4-b1d3-9324328b2291} diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in index f1bfabf41b47..b0eb9fb51f19 100644 --- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -306,10 +306,6 @@ @RESPATH@/components/shield.manifest @RESPATH@/components/shield-content-process.js -; [PDF Viewer] -@RESPATH@/browser/components/pdfjs.manifest -@RESPATH@/browser/components/pdfjs.js - ; Modules @RESPATH@/browser/modules/* @RESPATH@/modules/*