Fix code style in extensions/firefox/content/PdfjsContentUtils.jsm
This commit is contained in:
		
							parent
							
								
									3370b18e0b
								
							
						
					
					
						commit
						c4c5c2222b
					
				@ -1,3 +1,5 @@
 | 
			
		||||
/* -*- 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");
 | 
			
		||||
@ -12,6 +14,8 @@
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
/* jshint esnext:true */
 | 
			
		||||
/* globals Components, Services, XPCOMUtils */
 | 
			
		||||
 | 
			
		||||
'use strict';
 | 
			
		||||
 | 
			
		||||
@ -33,23 +37,25 @@ let PdfjsContentUtils = {
 | 
			
		||||
   */
 | 
			
		||||
 | 
			
		||||
  get isRemote() {
 | 
			
		||||
    return Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT;
 | 
			
		||||
    return (Services.appinfo.processType ===
 | 
			
		||||
            Services.appinfo.PROCESS_TYPE_CONTENT);
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  init: function () {
 | 
			
		||||
    // child *process* mm, or when loaded into the parent for in-content
 | 
			
		||||
    // support the psuedo child process mm 'child PPMM'.
 | 
			
		||||
    if (!this._mm) {
 | 
			
		||||
      this._mm = Cc["@mozilla.org/childprocessmessagemanager;1"].getService(Ci.nsISyncMessageSender);
 | 
			
		||||
      this._mm.addMessageListener("PDFJS:Child:refreshSettings", this);
 | 
			
		||||
      Services.obs.addObserver(this, "quit-application", false);
 | 
			
		||||
      this._mm = Cc['@mozilla.org/childprocessmessagemanager;1'].
 | 
			
		||||
        getService(Ci.nsISyncMessageSender);
 | 
			
		||||
      this._mm.addMessageListener('PDFJS:Child:refreshSettings', this);
 | 
			
		||||
      Services.obs.addObserver(this, 'quit-application', false);
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  uninit: function () {
 | 
			
		||||
    if (this._mm) {
 | 
			
		||||
      this._mm.removeMessageListener("PDFJS:Child:refreshSettings", this);
 | 
			
		||||
      Services.obs.removeObserver(this, "quit-application");
 | 
			
		||||
      this._mm.removeMessageListener('PDFJS:Child:refreshSettings', this);
 | 
			
		||||
      Services.obs.removeObserver(this, 'quit-application');
 | 
			
		||||
    }
 | 
			
		||||
    this._mm = null;
 | 
			
		||||
  },
 | 
			
		||||
@ -61,34 +67,34 @@ let PdfjsContentUtils = {
 | 
			
		||||
   */
 | 
			
		||||
 | 
			
		||||
  clearUserPref: function (aPrefName) {
 | 
			
		||||
    this._mm.sendSyncMessage("PDFJS:Parent:clearUserPref", {
 | 
			
		||||
    this._mm.sendSyncMessage('PDFJS:Parent:clearUserPref', {
 | 
			
		||||
      name: aPrefName
 | 
			
		||||
    });
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  setIntPref: function (aPrefName, aPrefValue) {
 | 
			
		||||
    this._mm.sendSyncMessage("PDFJS:Parent:setIntPref", {
 | 
			
		||||
    this._mm.sendSyncMessage('PDFJS:Parent:setIntPref', {
 | 
			
		||||
      name: aPrefName,
 | 
			
		||||
      value: aPrefValue
 | 
			
		||||
    });
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  setBoolPref: function (aPrefName, aPrefValue) {
 | 
			
		||||
    this._mm.sendSyncMessage("PDFJS:Parent:setBoolPref", {
 | 
			
		||||
    this._mm.sendSyncMessage('PDFJS:Parent:setBoolPref', {
 | 
			
		||||
      name: aPrefName,
 | 
			
		||||
      value: aPrefValue
 | 
			
		||||
    });
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  setCharPref: function (aPrefName, aPrefValue) {
 | 
			
		||||
    this._mm.sendSyncMessage("PDFJS:Parent:setCharPref", {
 | 
			
		||||
    this._mm.sendSyncMessage('PDFJS:Parent:setCharPref', {
 | 
			
		||||
      name: aPrefName,
 | 
			
		||||
      value: aPrefValue
 | 
			
		||||
    });
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  setStringPref: function (aPrefName, aPrefValue) {
 | 
			
		||||
    this._mm.sendSyncMessage("PDFJS:Parent:setStringPref", {
 | 
			
		||||
    this._mm.sendSyncMessage('PDFJS:Parent:setStringPref', {
 | 
			
		||||
      name: aPrefName,
 | 
			
		||||
      value: aPrefValue
 | 
			
		||||
    });
 | 
			
		||||
@ -99,7 +105,7 @@ let PdfjsContentUtils = {
 | 
			
		||||
   * handler app settings only available in the parent process.
 | 
			
		||||
   */
 | 
			
		||||
  isDefaultHandlerApp: function () {
 | 
			
		||||
    return this._mm.sendSyncMessage("PDFJS:Parent:isDefaultHandlerApp")[0];
 | 
			
		||||
    return this._mm.sendSyncMessage('PDFJS:Parent:isDefaultHandlerApp')[0];
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  /*
 | 
			
		||||
@ -112,7 +118,7 @@ let PdfjsContentUtils = {
 | 
			
		||||
                       .getInterface(Ci.nsIDocShell)
 | 
			
		||||
                       .QueryInterface(Ci.nsIInterfaceRequestor)
 | 
			
		||||
                       .getInterface(Ci.nsIContentFrameMessageManager);
 | 
			
		||||
    winmm.sendAsyncMessage("PDFJS:Parent:displayWarning", {
 | 
			
		||||
    winmm.sendAsyncMessage('PDFJS:Parent:displayWarning', {
 | 
			
		||||
      message: aMessage,
 | 
			
		||||
      label: aLabel,
 | 
			
		||||
      accessKey: accessKey
 | 
			
		||||
@ -126,17 +132,18 @@ let PdfjsContentUtils = {
 | 
			
		||||
   */
 | 
			
		||||
 | 
			
		||||
  observe: function(aSubject, aTopic, aData) {
 | 
			
		||||
    if (aTopic == "quit-application") {
 | 
			
		||||
    if (aTopic === 'quit-application') {
 | 
			
		||||
      this.uninit();
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  receiveMessage: function (aMsg) {
 | 
			
		||||
    switch (aMsg.name) {
 | 
			
		||||
      case "PDFJS:Child:refreshSettings":
 | 
			
		||||
      case 'PDFJS:Child:refreshSettings':
 | 
			
		||||
        // Only react to this if we are remote.
 | 
			
		||||
        if (Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT) {
 | 
			
		||||
          let jsm = "resource://pdf.js/PdfJs.jsm";
 | 
			
		||||
        if (Services.appinfo.processType ===
 | 
			
		||||
            Services.appinfo.PROCESS_TYPE_CONTENT) {
 | 
			
		||||
          let jsm = 'resource://pdf.js/PdfJs.jsm';
 | 
			
		||||
          let pdfjs = Components.utils.import(jsm, {}).PdfJs;
 | 
			
		||||
          pdfjs.updateRegistration();
 | 
			
		||||
        }
 | 
			
		||||
@ -159,12 +166,14 @@ let PdfjsContentUtils = {
 | 
			
		||||
    // send over a small container for the object we want.
 | 
			
		||||
    let suitcase = {
 | 
			
		||||
      _window: null,
 | 
			
		||||
      setChromeWindow: function (aObj) { this._window = aObj; }
 | 
			
		||||
      setChromeWindow: function (aObj) {
 | 
			
		||||
        this._window = aObj;
 | 
			
		||||
      }
 | 
			
		||||
    if (!winmm.sendSyncMessage("PDFJS:Parent:getChromeWindow", {},
 | 
			
		||||
    };
 | 
			
		||||
    if (!winmm.sendSyncMessage('PDFJS:Parent:getChromeWindow', {},
 | 
			
		||||
                               { suitcase: suitcase })[0]) {
 | 
			
		||||
      Cu.reportError("A request for a CPOW wrapped chrome window " +
 | 
			
		||||
                     "failed for unknown reasons.");
 | 
			
		||||
      Cu.reportError('A request for a CPOW wrapped chrome window ' +
 | 
			
		||||
                     'failed for unknown reasons.');
 | 
			
		||||
      return null;
 | 
			
		||||
    }
 | 
			
		||||
    return suitcase._window;
 | 
			
		||||
@ -179,12 +188,14 @@ let PdfjsContentUtils = {
 | 
			
		||||
                        .getInterface(Ci.nsIContentFrameMessageManager);
 | 
			
		||||
    let suitcase = {
 | 
			
		||||
      _findbar: null,
 | 
			
		||||
      setFindBar: function (aObj) { this._findbar = aObj; }
 | 
			
		||||
      setFindBar: function (aObj) {
 | 
			
		||||
        this._findbar = aObj;
 | 
			
		||||
      }
 | 
			
		||||
    if (!winmm.sendSyncMessage("PDFJS:Parent:getFindBar", {},
 | 
			
		||||
    };
 | 
			
		||||
    if (!winmm.sendSyncMessage('PDFJS:Parent:getFindBar', {},
 | 
			
		||||
                               { suitcase: suitcase })[0]) {
 | 
			
		||||
      Cu.reportError("A request for a CPOW wrapped findbar " +
 | 
			
		||||
                     "failed for unknown reasons.");
 | 
			
		||||
      Cu.reportError('A request for a CPOW wrapped findbar ' +
 | 
			
		||||
                     'failed for unknown reasons.');
 | 
			
		||||
      return null;
 | 
			
		||||
    }
 | 
			
		||||
    return suitcase._findbar;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user