Merge pull request #1373 from brendandahl/mcreview
Address MC Review Comments
This commit is contained in:
commit
75dcd2b6f9
5
Makefile
5
Makefile
@ -226,6 +226,7 @@ FIREFOX_CONTENT_DIR := $(EXTENSION_SRC)/firefox/$(CONTENT_DIR)/
|
|||||||
FIREFOX_EXTENSION_FILES_TO_COPY = \
|
FIREFOX_EXTENSION_FILES_TO_COPY = \
|
||||||
*.js \
|
*.js \
|
||||||
*.rdf \
|
*.rdf \
|
||||||
|
*.png \
|
||||||
install.rdf.in \
|
install.rdf.in \
|
||||||
README.mozilla \
|
README.mozilla \
|
||||||
components \
|
components \
|
||||||
@ -234,12 +235,16 @@ FIREFOX_EXTENSION_FILES_TO_COPY = \
|
|||||||
FIREFOX_EXTENSION_FILES = \
|
FIREFOX_EXTENSION_FILES = \
|
||||||
bootstrap.js \
|
bootstrap.js \
|
||||||
install.rdf \
|
install.rdf \
|
||||||
|
icon.png \
|
||||||
|
icon64.png \
|
||||||
components \
|
components \
|
||||||
content \
|
content \
|
||||||
LICENSE \
|
LICENSE \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
FIREFOX_MC_EXTENSION_FILES = \
|
FIREFOX_MC_EXTENSION_FILES = \
|
||||||
bootstrap.js \
|
bootstrap.js \
|
||||||
|
icon.png \
|
||||||
|
icon64.png \
|
||||||
components \
|
components \
|
||||||
content \
|
content \
|
||||||
LICENSE \
|
LICENSE \
|
||||||
|
22
extensions/firefox/bootstrap.js
vendored
22
extensions/firefox/bootstrap.js
vendored
@ -10,10 +10,14 @@ let Cc = Components.classes;
|
|||||||
let Ci = Components.interfaces;
|
let Ci = Components.interfaces;
|
||||||
let Cm = Components.manager;
|
let Cm = Components.manager;
|
||||||
let Cu = Components.utils;
|
let Cu = Components.utils;
|
||||||
|
let application = Cc['@mozilla.org/fuel/application;1']
|
||||||
|
.getService(Ci.fuelIApplication);
|
||||||
|
|
||||||
Cu.import('resource://gre/modules/Services.jsm');
|
Cu.import('resource://gre/modules/Services.jsm');
|
||||||
|
|
||||||
function log(str) {
|
function log(str) {
|
||||||
|
if (!application.prefs.getValue(EXT_PREFIX + '.pdfBugEnabled', false))
|
||||||
|
return;
|
||||||
dump(str + '\n');
|
dump(str + '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,12 +64,7 @@ function startup(aData, aReason) {
|
|||||||
var ioService = Services.io;
|
var ioService = Services.io;
|
||||||
var resProt = ioService.getProtocolHandler('resource')
|
var resProt = ioService.getProtocolHandler('resource')
|
||||||
.QueryInterface(Ci.nsIResProtocolHandler);
|
.QueryInterface(Ci.nsIResProtocolHandler);
|
||||||
var aliasFile = Cc['@mozilla.org/file/local;1']
|
var aliasURI = ioService.newURI('content/', 'UTF-8', aData.resourceURI);
|
||||||
.createInstance(Ci.nsILocalFile);
|
|
||||||
var componentPath = aData.installPath.clone();
|
|
||||||
componentPath.append('content');
|
|
||||||
aliasFile.initWithPath(componentPath.path);
|
|
||||||
var aliasURI = ioService.newFileURI(aliasFile);
|
|
||||||
resProt.setSubstitution(RESOURCE_NAME, aliasURI);
|
resProt.setSubstitution(RESOURCE_NAME, aliasURI);
|
||||||
|
|
||||||
// Load the component and register it.
|
// Load the component and register it.
|
||||||
@ -73,12 +72,9 @@ function startup(aData, aReason) {
|
|||||||
'components/PdfStreamConverter.js';
|
'components/PdfStreamConverter.js';
|
||||||
Cu.import(pdfStreamConverterUrl);
|
Cu.import(pdfStreamConverterUrl);
|
||||||
Factory.register(PdfStreamConverter);
|
Factory.register(PdfStreamConverter);
|
||||||
Services.prefs.setBoolPref('extensions.pdf.js.active', true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function shutdown(aData, aReason) {
|
function shutdown(aData, aReason) {
|
||||||
if (Services.prefs.getBoolPref('extensions.pdf.js.active'))
|
|
||||||
Services.prefs.setBoolPref('extensions.pdf.js.active', false);
|
|
||||||
if (aReason == APP_SHUTDOWN)
|
if (aReason == APP_SHUTDOWN)
|
||||||
return;
|
return;
|
||||||
var ioService = Services.io;
|
var ioService = Services.io;
|
||||||
@ -89,18 +85,14 @@ function shutdown(aData, aReason) {
|
|||||||
// Remove the contract/component.
|
// Remove the contract/component.
|
||||||
Factory.unregister();
|
Factory.unregister();
|
||||||
// Unload the converter
|
// Unload the converter
|
||||||
if (pdfStreamConverterUrl) {
|
Cu.unload(pdfStreamConverterUrl);
|
||||||
Cu.unload(pdfStreamConverterUrl);
|
pdfStreamConverterUrl = null;
|
||||||
pdfStreamConverterUrl = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function install(aData, aReason) {
|
function install(aData, aReason) {
|
||||||
Services.prefs.setBoolPref('extensions.pdf.js.active', false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function uninstall(aData, aReason) {
|
function uninstall(aData, aReason) {
|
||||||
Services.prefs.clearUserPref('extensions.pdf.js.active');
|
|
||||||
application.prefs.setValue(EXT_PREFIX + '.database', '{}');
|
application.prefs.setValue(EXT_PREFIX + '.database', '{}');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,15 @@ const MAX_DATABASE_LENGTH = 4096;
|
|||||||
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||||
Cu.import('resource://gre/modules/Services.jsm');
|
Cu.import('resource://gre/modules/Services.jsm');
|
||||||
|
|
||||||
|
let application = Cc['@mozilla.org/fuel/application;1']
|
||||||
|
.getService(Ci.fuelIApplication);
|
||||||
|
let privateBrowsing = Cc['@mozilla.org/privatebrowsing;1']
|
||||||
|
.getService(Ci.nsIPrivateBrowsingService);
|
||||||
|
let inPrivateBrowswing = privateBrowsing.privateBrowsingEnabled;
|
||||||
|
|
||||||
function log(aMsg) {
|
function log(aMsg) {
|
||||||
|
if (!application.prefs.getValue(EXT_PREFIX + '.pdfBugEnabled', false))
|
||||||
|
return;
|
||||||
let msg = 'PdfStreamConverter.js: ' + (aMsg.join ? aMsg.join('') : aMsg);
|
let msg = 'PdfStreamConverter.js: ' + (aMsg.join ? aMsg.join('') : aMsg);
|
||||||
Services.console.logStringMessage(msg);
|
Services.console.logStringMessage(msg);
|
||||||
dump(msg + '\n');
|
dump(msg + '\n');
|
||||||
@ -40,11 +48,6 @@ function topWindow(win) {
|
|||||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
.getInterface(Ci.nsIDOMWindow);
|
.getInterface(Ci.nsIDOMWindow);
|
||||||
}
|
}
|
||||||
let application = Cc['@mozilla.org/fuel/application;1']
|
|
||||||
.getService(Ci.fuelIApplication);
|
|
||||||
let privateBrowsing = Cc['@mozilla.org/privatebrowsing;1']
|
|
||||||
.getService(Ci.nsIPrivateBrowsingService);
|
|
||||||
let inPrivateBrowswing = privateBrowsing.privateBrowsingEnabled;
|
|
||||||
|
|
||||||
// All the priviledged actions.
|
// All the priviledged actions.
|
||||||
function ChromeActions() {
|
function ChromeActions() {
|
||||||
@ -125,9 +128,6 @@ PdfStreamConverter.prototype = {
|
|||||||
|
|
||||||
// nsIStreamConverter::asyncConvertData
|
// nsIStreamConverter::asyncConvertData
|
||||||
asyncConvertData: function(aFromType, aToType, aListener, aCtxt) {
|
asyncConvertData: function(aFromType, aToType, aListener, aCtxt) {
|
||||||
if (!Services.prefs.getBoolPref('extensions.pdf.js.active'))
|
|
||||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
|
||||||
|
|
||||||
// Ignoring HTTP POST requests -- pdf.js has to repeat the request.
|
// Ignoring HTTP POST requests -- pdf.js has to repeat the request.
|
||||||
var skipConversion = false;
|
var skipConversion = false;
|
||||||
try {
|
try {
|
||||||
|
BIN
extensions/firefox/icon.png
Normal file
BIN
extensions/firefox/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.5 KiB |
BIN
extensions/firefox/icon64.png
Normal file
BIN
extensions/firefox/icon64.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.7 KiB |
@ -5,9 +5,8 @@
|
|||||||
|
|
||||||
<Description about="urn:mozilla:install-manifest">
|
<Description about="urn:mozilla:install-manifest">
|
||||||
<em:id>uriloader@pdf.js</em:id>
|
<em:id>uriloader@pdf.js</em:id>
|
||||||
<em:name>pdf.js</em:name>
|
<em:name>PDF Viewer</em:name>
|
||||||
<em:version>PDFJSSCRIPT_VERSION</em:version>
|
<em:version>PDFJSSCRIPT_VERSION</em:version>
|
||||||
<em:iconURL>chrome://pdf.js/skin/logo.png</em:iconURL>
|
|
||||||
<em:targetApplication>
|
<em:targetApplication>
|
||||||
<Description>
|
<Description>
|
||||||
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
|
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
|
||||||
@ -16,9 +15,8 @@
|
|||||||
</Description>
|
</Description>
|
||||||
</em:targetApplication>
|
</em:targetApplication>
|
||||||
<em:bootstrap>true</em:bootstrap>
|
<em:bootstrap>true</em:bootstrap>
|
||||||
<em:unpack>true</em:unpack>
|
<em:creator>Mozilla</em:creator>
|
||||||
<em:creator>Mozilla Labs</em:creator>
|
<em:description>Uses HTML5 to display PDF files directly in Firefox.</em:description>
|
||||||
<em:description>pdf.js uri loader</em:description>
|
|
||||||
<em:homepageURL>https://github.com/mozilla/pdf.js/</em:homepageURL>
|
<em:homepageURL>https://github.com/mozilla/pdf.js/</em:homepageURL>
|
||||||
<em:type>2</em:type>
|
<em:type>2</em:type>
|
||||||
<!-- Use the raw link for updates so we we can use SSL. -->
|
<!-- Use the raw link for updates so we we can use SSL. -->
|
||||||
|
@ -7,22 +7,20 @@
|
|||||||
|
|
||||||
<Description about="urn:mozilla:install-manifest">
|
<Description about="urn:mozilla:install-manifest">
|
||||||
<em:id>uriloader@pdf.js</em:id>
|
<em:id>uriloader@pdf.js</em:id>
|
||||||
<em:name>pdf.js</em:name>
|
<em:name>PDF Viewer</em:name>
|
||||||
<em:version>PDFJSSCRIPT_VERSION</em:version>
|
<em:version>PDFJSSCRIPT_VERSION</em:version>
|
||||||
<em:iconURL>chrome://pdf.js/skin/logo.png</em:iconURL>
|
|
||||||
<em:targetApplication>
|
<em:targetApplication>
|
||||||
<Description>
|
<Description>
|
||||||
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
|
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
|
||||||
<em:minVersion>@FIREFOX_VERSION@</em:minVersion>
|
<em:minVersion>@FIREFOX_VERSION@</em:minVersion>
|
||||||
<em:maxVersion>@FIREFOX_VERSION@</em:maxVersion>
|
<em:maxVersion>@FIREFOX_VERSION@</em:maxVersion>
|
||||||
<em:strictCompatibility>true</em:strictCompatibility>
|
|
||||||
</Description>
|
</Description>
|
||||||
</em:targetApplication>
|
</em:targetApplication>
|
||||||
|
<em:strictCompatibility>true</em:strictCompatibility>
|
||||||
<em:bootstrap>true</em:bootstrap>
|
<em:bootstrap>true</em:bootstrap>
|
||||||
<em:unpack>true</em:unpack>
|
<em:creator>Mozilla</em:creator>
|
||||||
<em:creator>Mozilla Labs</em:creator>
|
<em:description>Uses HTML5 to display PDF files directly in Firefox.</em:description>
|
||||||
<em:description>pdf.js uri loader</em:description>
|
<em:homepageURL>http://support.mozilla.org/kb/using-mozilla-pdf-viewer</em:homepageURL>
|
||||||
<em:homepageURL>https://github.com/mozilla/pdf.js/</em:homepageURL>
|
|
||||||
<em:type>2</em:type>
|
<em:type>2</em:type>
|
||||||
</Description>
|
</Description>
|
||||||
</RDF>
|
</RDF>
|
||||||
|
5
make.js
5
make.js
@ -220,6 +220,7 @@ target.firefox = function() {
|
|||||||
FIREFOX_EXTENSION_FILES_TO_COPY =
|
FIREFOX_EXTENSION_FILES_TO_COPY =
|
||||||
['*.js',
|
['*.js',
|
||||||
'*.rdf',
|
'*.rdf',
|
||||||
|
'*.png',
|
||||||
'install.rdf.in',
|
'install.rdf.in',
|
||||||
'README.mozilla',
|
'README.mozilla',
|
||||||
'components',
|
'components',
|
||||||
@ -227,11 +228,15 @@ target.firefox = function() {
|
|||||||
FIREFOX_EXTENSION_FILES =
|
FIREFOX_EXTENSION_FILES =
|
||||||
['bootstrap.js',
|
['bootstrap.js',
|
||||||
'install.rdf',
|
'install.rdf',
|
||||||
|
'icon.png',
|
||||||
|
'icon64.png',
|
||||||
'components',
|
'components',
|
||||||
'content',
|
'content',
|
||||||
'LICENSE'];
|
'LICENSE'];
|
||||||
FIREFOX_MC_EXTENSION_FILES =
|
FIREFOX_MC_EXTENSION_FILES =
|
||||||
['bootstrap.js',
|
['bootstrap.js',
|
||||||
|
'icon.png',
|
||||||
|
'icon64.png',
|
||||||
'components',
|
'components',
|
||||||
'content',
|
'content',
|
||||||
'LICENSE'];
|
'LICENSE'];
|
||||||
|
Loading…
Reference in New Issue
Block a user