[Pkg-javascript-commits] [pdf.js] 02/109: Removes PdfRedirector.js and PlayPreview support.
David Prévot
taffit at moszumanska.debian.org
Fri Sep 25 03:04:10 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit 4f3f983a214867011dda8c5597a4d3523c5f1423
Author: Yury Delendik <ydelendik at mozilla.com>
Date: Thu Aug 6 10:38:45 2015 -0500
Removes PdfRedirector.js and PlayPreview support.
---
extensions/firefox/bootstrap.js | 24 +----
extensions/firefox/content/PdfJs.jsm | 2 +-
extensions/firefox/content/PdfRedirector.jsm | 137 ---------------------------
make.js | 3 +-
4 files changed, 3 insertions(+), 163 deletions(-)
diff --git a/extensions/firefox/bootstrap.js b/extensions/firefox/bootstrap.js
index 6d7f68d..7724463 100644
--- a/extensions/firefox/bootstrap.js
+++ b/extensions/firefox/bootstrap.js
@@ -16,7 +16,7 @@
*/
/* jshint esnext:true */
/* globals Components, Services, dump, XPCOMUtils, PdfStreamConverter,
- PdfRedirector, APP_SHUTDOWN, PdfjsChromeUtils, PdfjsContentUtils,
+ APP_SHUTDOWN, PdfjsChromeUtils, PdfjsContentUtils,
DEFAULT_PREFERENCES */
'use strict';
@@ -33,9 +33,6 @@ const Cr = Components.results;
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
Cu.import('resource://gre/modules/Services.jsm');
-var Ph = Cc['@mozilla.org/plugin/host;1'].getService(Ci.nsIPluginHost);
-var registerOverlayPreview = 'getPlayPreviewInfo' in Ph;
-
function getBoolPref(pref, def) {
try {
return Services.prefs.getBoolPref(pref);
@@ -120,7 +117,6 @@ Factory.prototype = {
var pdfStreamConverterFactory = new Factory();
var pdfBaseUrl = null;
-var pdfRedirectorFactory = new Factory();
var e10sEnabled = false;
// As of Firefox 13 bootstrapped add-ons don't support automatic registering and
@@ -147,15 +143,6 @@ function startup(aData, aReason) {
Cu.import(pdfStreamConverterUrl);
pdfStreamConverterFactory.register(PdfStreamConverter);
- if (registerOverlayPreview) {
- var pdfRedirectorUrl = pdfBaseUrl + 'content/PdfRedirector.jsm';
- Cu.import(pdfRedirectorUrl);
- pdfRedirectorFactory.register(PdfRedirector);
-
- Ph.registerPlayPreviewMimeType('application/pdf', true,
- 'data:application/x-moz-playpreview-pdfjs;,');
- }
-
try {
let globalMM = Cc['@mozilla.org/globalmessagemanager;1']
.getService(Ci.nsIFrameScriptLoader);
@@ -190,15 +177,6 @@ function shutdown(aData, aReason) {
var pdfStreamConverterUrl = pdfBaseUrl + 'content/PdfStreamConverter.jsm';
Cu.unload(pdfStreamConverterUrl);
- if (registerOverlayPreview) {
- pdfRedirectorFactory.unregister();
- var pdfRedirectorUrl = pdfBaseUrl + 'content/PdfRedirector.jsm';
- Cu.unload(pdfRedirectorUrl);
- pdfRedirectorUrl = null;
-
- Ph.unregisterPlayPreviewMimeType('application/pdf');
- }
-
PdfjsContentUtils.uninit();
Cu.unload(pdfBaseUrl + 'content/PdfjsContentUtils.jsm');
PdfjsChromeUtils.uninit();
diff --git a/extensions/firefox/content/PdfJs.jsm b/extensions/firefox/content/PdfJs.jsm
index 2503eec..a6594cd 100644
--- a/extensions/firefox/content/PdfJs.jsm
+++ b/extensions/firefox/content/PdfJs.jsm
@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* jshint esnext:true */
-/* globals Components, Services, XPCOMUtils, PdfjsChromeUtils, PdfRedirector,
+/* globals Components, Services, XPCOMUtils, PdfjsChromeUtils,
PdfjsContentUtils, DEFAULT_PREFERENCES, PdfStreamConverter */
'use strict';
diff --git a/extensions/firefox/content/PdfRedirector.jsm b/extensions/firefox/content/PdfRedirector.jsm
deleted file mode 100644
index b942d5f..0000000
--- a/extensions/firefox/content/PdfRedirector.jsm
+++ /dev/null
@@ -1,137 +0,0 @@
-/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
-/* Copyright 2012 Mozilla Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/* jshint esnext:true */
-/* globals Components, Services, XPCOMUtils, NetUtil, dump */
-
-'use strict';
-
-var EXPORTED_SYMBOLS = ['PdfRedirector'];
-
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cr = Components.results;
-const Cu = Components.utils;
-
-const PDF_CONTENT_TYPE = 'application/pdf';
-const FIREFOX_ID = '{ec8030f7-c20a-464f-9b0e-13a3a9e97384}';
-
-Cu.import('resource://gre/modules/XPCOMUtils.jsm');
-Cu.import('resource://gre/modules/Services.jsm');
-Cu.import('resource://gre/modules/NetUtil.jsm');
-
-
-function getDOMWindow(aChannel) {
- var requestor = aChannel.notificationCallbacks ?
- aChannel.notificationCallbacks :
- aChannel.loadGroup.notificationCallbacks;
- var win = requestor.getInterface(Components.interfaces.nsIDOMWindow);
- return win;
-}
-
-function getObjectUrl(window) {
- // PlayPreview overlay "belongs" to the embed/object tag and consists of DIV
- // and IFRAME. Starting from IFRAME and looking for first object tag.
- var element = window.frameElement, containerElement;
- if (!element) {
- return null; // iframe tag
- }
- var tagName = element.nodeName;
- while (tagName !== 'EMBED' && tagName !== 'OBJECT') {
- containerElement = element;
- element = element.parentNode;
- if (!element) {
- return null; // object tag was not found
- }
- tagName = element.nodeName;
- }
-
- // Checking if overlay is a proper PlayPreview overlay.
- if (element.displayedType !== element.TYPE_NULL ||
- element.pluginFallbackType !== element.PLUGIN_PLAY_PREVIEW) {
- return null; // invalid plugin element overlay state
- }
- for (var i = 0; i < element.children.length; i++) {
- if (element.children[i] === containerElement) {
- return null; // invalid plugin element overlay
- }
- }
-
- return element.srcURI.spec;
-}
-
-function PdfRedirector() {
-}
-
-PdfRedirector.prototype = {
-
- // properties required for XPCOM registration:
- classID: Components.ID('{8cbfd8d0-2042-4976-b3ef-d9dee1efb975}'),
- classDescription: 'pdf.js Redirector',
- contractID:
- '@mozilla.org/streamconv;1?from=application/x-moz-playpreview-pdfjs&to=*/*',
-
- QueryInterface: XPCOMUtils.generateQI([
- Ci.nsIStreamConverter,
- Ci.nsIStreamListener,
- Ci.nsIRequestObserver
- ]),
-
- // nsIStreamConverter::convert
- convert: function(aFromStream, aFromType, aToType, aCtxt) {
- throw Cr.NS_ERROR_NOT_IMPLEMENTED;
- },
-
- // nsIStreamConverter::asyncConvertData
- asyncConvertData: function(aFromType, aToType, aListener, aCtxt) {
- // Store the listener passed to us
- this.listener = aListener;
- },
-
- // nsIStreamListener::onDataAvailable
- onDataAvailable: function(aRequest, aContext, aInputStream, aOffset, aCount) {
- // Do nothing since all the data loading is handled by the viewer.
- },
-
- // nsIRequestObserver::onStartRequest
- onStartRequest: function(aRequest, aContext) {
- // Setup the request so we can use it below.
- aRequest.QueryInterface(Ci.nsIChannel);
- // Cancel the request so the viewer can handle it.
- aRequest.cancel(Cr.NS_BINDING_ABORTED);
-
- var domWindow = getDOMWindow(aRequest);
- var pdfUrl = getObjectUrl(domWindow);
- if (!pdfUrl) {
- Services.console.logStringMessage(
- 'PdfRedirector.js: PDF location is not specified for OBJECT/EMBED tag');
- return;
- }
-
- // Create a new channel that is viewer loaded as a resource.
- var ioService = Services.io;
- var channel = ioService.newChannel(pdfUrl, null, null);
-
- channel.loadGroup = aRequest.loadGroup;
-
- channel.asyncOpen(this.listener, aContext);
- },
-
- // nsIRequestObserver::onStopRequest
- onStopRequest: function(aRequest, aContext, aStatusCode) {
- // Do nothing
- }
-};
diff --git a/make.js b/make.js
index b35b68e..01dea27 100644
--- a/make.js
+++ b/make.js
@@ -107,8 +107,7 @@ var COMMON_WEB_FILES =
COMMON_FIREFOX_FILES_PREPROCESS =
[FIREFOX_CONTENT_DIR + 'PdfStreamConverter.jsm',
FIREFOX_CONTENT_DIR + 'PdfjsContentUtils.jsm',
- FIREFOX_CONTENT_DIR + 'PdfjsChromeUtils.jsm',
- FIREFOX_CONTENT_DIR + 'PdfRedirector.jsm'];
+ FIREFOX_CONTENT_DIR + 'PdfjsChromeUtils.jsm'];
//
// make generic
// Builds the generic production viewer that should be compatible with most
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list