mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 17:55:37 +02:00
[Firefox addon] Enforce double quotes, using ESLint, to avoid linting errors in mozilla-central (issue 7957)
Given that this patch causes a lot of churn in the addon code, I wouldn't really mind if we ultimately decide against doing this and just add a rule exception in mozilla-central instead.[1] --- [1] Note that I used the ESLint `--fix` option, hence writing this commit message actually took longer time than the creation of the patch :-)
This commit is contained in:
parent
e0a92a7f48
commit
a5d5b970af
13 changed files with 376 additions and 375 deletions
54
extensions/firefox/bootstrap.js
vendored
54
extensions/firefox/bootstrap.js
vendored
|
@ -15,10 +15,10 @@
|
|||
/* globals Components, Services, dump, XPCOMUtils, PdfStreamConverter,
|
||||
APP_SHUTDOWN, PdfjsChromeUtils, PdfjsContentUtils */
|
||||
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
const RESOURCE_NAME = 'pdf.js';
|
||||
const EXT_PREFIX = 'extensions.uriloader@pdf.js';
|
||||
const RESOURCE_NAME = "pdf.js";
|
||||
const EXT_PREFIX = "extensions.uriloader@pdf.js";
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
@ -26,8 +26,8 @@ const Cm = Components.manager;
|
|||
const Cu = Components.utils;
|
||||
const Cr = Components.results;
|
||||
|
||||
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
Cu.import('resource://gre/modules/Services.jsm');
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
function getBoolPref(pref, def) {
|
||||
try {
|
||||
|
@ -38,31 +38,31 @@ function getBoolPref(pref, def) {
|
|||
}
|
||||
|
||||
function log(str) {
|
||||
if (!getBoolPref(EXT_PREFIX + '.pdfBugEnabled', false)) {
|
||||
if (!getBoolPref(EXT_PREFIX + ".pdfBugEnabled", false)) {
|
||||
return;
|
||||
}
|
||||
dump(str + '\n');
|
||||
dump(str + "\n");
|
||||
}
|
||||
|
||||
function initializeDefaultPreferences() {
|
||||
var DEFAULT_PREFERENCES =
|
||||
//#include ../../web/default_preferences.json
|
||||
//#if false
|
||||
'end of DEFAULT_PREFERENCES';
|
||||
"end of DEFAULT_PREFERENCES";
|
||||
//#endif
|
||||
|
||||
var defaultBranch = Services.prefs.getDefaultBranch(EXT_PREFIX + '.');
|
||||
var defaultBranch = Services.prefs.getDefaultBranch(EXT_PREFIX + ".");
|
||||
var defaultValue;
|
||||
for (var key in DEFAULT_PREFERENCES) {
|
||||
defaultValue = DEFAULT_PREFERENCES[key];
|
||||
switch (typeof defaultValue) {
|
||||
case 'boolean':
|
||||
case "boolean":
|
||||
defaultBranch.setBoolPref(key, defaultValue);
|
||||
break;
|
||||
case 'number':
|
||||
case "number":
|
||||
defaultBranch.setIntPref(key, defaultValue);
|
||||
break;
|
||||
case 'string':
|
||||
case "string":
|
||||
defaultBranch.setCharPref(key, defaultValue);
|
||||
break;
|
||||
}
|
||||
|
@ -126,27 +126,27 @@ var e10sEnabled = false;
|
|||
function startup(aData, aReason) {
|
||||
// Setup the resource url.
|
||||
var ioService = Services.io;
|
||||
var resProt = ioService.getProtocolHandler('resource')
|
||||
var resProt = ioService.getProtocolHandler("resource")
|
||||
.QueryInterface(Ci.nsIResProtocolHandler);
|
||||
var aliasURI = ioService.newURI('content/', 'UTF-8', aData.resourceURI);
|
||||
var aliasURI = ioService.newURI("content/", "UTF-8", aData.resourceURI);
|
||||
resProt.setSubstitution(RESOURCE_NAME, aliasURI);
|
||||
|
||||
pdfBaseUrl = aData.resourceURI.spec;
|
||||
|
||||
Cu.import(pdfBaseUrl + 'content/PdfjsChromeUtils.jsm');
|
||||
Cu.import(pdfBaseUrl + "content/PdfjsChromeUtils.jsm");
|
||||
PdfjsChromeUtils.init();
|
||||
Cu.import(pdfBaseUrl + 'content/PdfjsContentUtils.jsm');
|
||||
Cu.import(pdfBaseUrl + "content/PdfjsContentUtils.jsm");
|
||||
PdfjsContentUtils.init();
|
||||
|
||||
// Load the component and register it.
|
||||
var pdfStreamConverterUrl = pdfBaseUrl + 'content/PdfStreamConverter.jsm';
|
||||
var pdfStreamConverterUrl = pdfBaseUrl + "content/PdfStreamConverter.jsm";
|
||||
Cu.import(pdfStreamConverterUrl);
|
||||
pdfStreamConverterFactory.register(PdfStreamConverter);
|
||||
|
||||
try {
|
||||
let globalMM = Cc['@mozilla.org/globalmessagemanager;1']
|
||||
let globalMM = Cc["@mozilla.org/globalmessagemanager;1"]
|
||||
.getService(Ci.nsIFrameScriptLoader);
|
||||
globalMM.loadFrameScript('chrome://pdf.js/content/content.js', true);
|
||||
globalMM.loadFrameScript("chrome://pdf.js/content/content.js", true);
|
||||
e10sEnabled = true;
|
||||
} catch (ex) {
|
||||
}
|
||||
|
@ -160,32 +160,32 @@ function shutdown(aData, aReason) {
|
|||
}
|
||||
|
||||
if (e10sEnabled) {
|
||||
let globalMM = Cc['@mozilla.org/globalmessagemanager;1']
|
||||
let globalMM = Cc["@mozilla.org/globalmessagemanager;1"]
|
||||
.getService(Ci.nsIMessageBroadcaster);
|
||||
globalMM.broadcastAsyncMessage('PDFJS:Child:shutdown');
|
||||
globalMM.removeDelayedFrameScript('chrome://pdf.js/content/content.js');
|
||||
globalMM.broadcastAsyncMessage("PDFJS:Child:shutdown");
|
||||
globalMM.removeDelayedFrameScript("chrome://pdf.js/content/content.js");
|
||||
}
|
||||
|
||||
var ioService = Services.io;
|
||||
var resProt = ioService.getProtocolHandler('resource')
|
||||
var resProt = ioService.getProtocolHandler("resource")
|
||||
.QueryInterface(Ci.nsIResProtocolHandler);
|
||||
// Remove the resource url.
|
||||
resProt.setSubstitution(RESOURCE_NAME, null);
|
||||
// Remove the contract/component.
|
||||
pdfStreamConverterFactory.unregister();
|
||||
// Unload the converter
|
||||
var pdfStreamConverterUrl = pdfBaseUrl + 'content/PdfStreamConverter.jsm';
|
||||
var pdfStreamConverterUrl = pdfBaseUrl + "content/PdfStreamConverter.jsm";
|
||||
Cu.unload(pdfStreamConverterUrl);
|
||||
|
||||
PdfjsContentUtils.uninit();
|
||||
Cu.unload(pdfBaseUrl + 'content/PdfjsContentUtils.jsm');
|
||||
Cu.unload(pdfBaseUrl + "content/PdfjsContentUtils.jsm");
|
||||
PdfjsChromeUtils.uninit();
|
||||
Cu.unload(pdfBaseUrl + 'content/PdfjsChromeUtils.jsm');
|
||||
Cu.unload(pdfBaseUrl + "content/PdfjsChromeUtils.jsm");
|
||||
}
|
||||
|
||||
function install(aData, aReason) {
|
||||
// TODO remove after some time -- cleanup of unused preferences
|
||||
Services.prefs.clearUserPref(EXT_PREFIX + '.database');
|
||||
Services.prefs.clearUserPref(EXT_PREFIX + ".database");
|
||||
}
|
||||
|
||||
function uninstall(aData, aReason) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue