Changeset 176


Ignore:
Timestamp:
05/14/13 13:55:35 (6 years ago)
Author:
nhoyt
Message:

Most changes relate to reducing global namespace pollution: scripts from utilities subdirectory are now loaded into private namespaces using either Components.utils.import or mozIJSSubScriptLoader.loadSubScript services/methods.

Also tweaked selectPreviousView and getViewName functions, and fixed problem in onGeneralPrefChange.

Location:
trunk/proto-13/chrome/content
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/proto-13/chrome/content/ai-sidebar.js

    r166 r176  
    77 
    88Components.utils.import("chrome://ai-sidebar/content/ai-common.js"); 
     9Components.utils.import("chrome://ai-sidebar/content/utilities/preferences.js", ainspector); 
    910 
    1011/** 
     
    7879    parent.AINSPECTOR.currentView = parent.AINSPECTOR.previousView; 
    7980 
     81  // load script with progressListener factory method 
     82  Components.classes["@mozilla.org/moz/jssubscript-loader;1"] 
     83    .getService(Components.interfaces.mozIJSSubScriptLoader) 
     84    .loadSubScript("chrome://ai-sidebar/content/utilities/progress.js", ainspectorSidebar); 
     85 
    8086  // instantiate progressListener 
    81   ainspectorSidebar.progressListener = OAA_WEB_ACCESSIBILITY_UTILS.getProgressListener( 
     87  ainspectorSidebar.progressListener = ainspectorSidebar.getProgressListener( 
    8288    ainspectorSidebar.showTransition, 
    8389    ainspectorSidebar.updateContext); 
     
    105111  parent.AINSPECTOR.updateContext = ainspectorSidebar.updateContext; 
    106112 
    107 // instantiate and register PrefListener for preferences in evaluation branch. 
    108   ainspectorSidebar.evaluationPrefListener = new OAA_WEB_ACCESSIBILITY_UTILS.PrefListener( 
     113// instantiate and register PrefListener for preferences in evaluation branch 
     114  ainspectorSidebar.evaluationPrefListener = new ainspector.PrefListener( 
    109115    "extensions.ainspector.evaluation.", ainspectorSidebar.updateContext); 
    110116  ainspectorSidebar.evaluationPrefListener.register(); 
     
    277283 
    278284ainspectorSidebar.selectPreviousView = function () { 
     285  ainspector.logger.log.debug("selectPreviousView: " + ainspector.getViewName(parent.AINSPECTOR.previousView)); 
     286 
    279287  // update currentView 
    280288  parent.AINSPECTOR.currentView = parent.AINSPECTOR.previousView; 
  • trunk/proto-13/chrome/content/ai-sidebar.xul

    r165 r176  
    1717      src="chrome://ai-sidebar/locale/ai-sidebar.properties"/> 
    1818  </stringbundleset> 
    19  
    20   <script src="utilities/inspection.js"/> 
    21   <script src="utilities/logging.js"/> 
    22   <script src="utilities/progress.js"/> 
    23   <script src="utilities/utils.js"/> 
    2419 
    2520  <script src="library/oaa_a11y_evaluation.js"/> 
  • trunk/proto-13/chrome/content/ff-overlay.js

    r173 r176  
    66 
    77Components.utils.import("chrome://ai-sidebar/content/ai-common.js"); 
    8  
    9 // initialize references to logging objects 
    10 ainspector.LOG_LEVEL = OAA_WEB_ACCESSIBILITY_LOGGING.LEVEL; 
    11 ainspector.logger    = OAA_WEB_ACCESSIBILITY_LOGGING.logger; 
    12  
    13 // initialize references to utility methods 
    14 ainspector.clearContent = OAA_WEB_ACCESSIBILITY_UTILS.removeChildNodes; 
    15 ainspector.getProps     = OAA_WEB_ACCESSIBILITY_UTILS.getProperties; 
    16 ainspector.getPropValue = OAA_WEB_ACCESSIBILITY_UTILS.getPropValue; 
    17 ainspector.getMethods   = OAA_WEB_ACCESSIBILITY_UTILS.getMethods; 
     8Components.utils.import("chrome://ai-sidebar/content/utilities/utils.js", ainspector); 
     9Components.utils.import("chrome://ai-sidebar/content/utilities/logging.js", ainspector); 
     10Components.utils.import("chrome://ai-sidebar/content/utilities/inspection.js", ainspector); 
    1811 
    1912// create constants for view selection 
    20 ainspector.viewEnum = new OAA_WEB_ACCESSIBILITY_UTILS.Enum(ainspector.viewStrings); 
     13ainspector.viewEnum = new ainspector.Enum(ainspector.viewStrings); 
    2114 
    2215// create constants for view types 
    23 ainspector.viewType = new OAA_WEB_ACCESSIBILITY_UTILS.Enum(['SUMMARY', 'CATEGORY', 'DETAILS']); 
     16ainspector.viewType = new ainspector.Enum(['SUMMARY', 'CATEGORY', 'DETAILS']); 
    2417 
    2518// Important: value of DETAILS constant must be distinct from all values in viewEnum 
     
    7366 
    7467ainspector.getViewName = function (index) { 
    75   return ainspector.viewStrings[index]; 
     68  var name = (index === ainspector.viewConst.DETAILS) ? 
     69    "DETAILS" : ainspector.viewStrings[index]; 
     70  return name; 
    7671}; 
    7772 
     
    138133ainspector.onLoad = function () { 
    139134  // change logger enabled and level properties here (and only here) 
    140   ainspector.logger.enabled = false; 
     135  ainspector.logger.enabled = true; 
    141136  ainspector.logger.level = ainspector.LOG_LEVEL.DEBUG; 
    142137  ainspector.logger.prefix = "AIS-"; 
  • trunk/proto-13/chrome/content/ff-overlay.xul

    r165 r176  
    55  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> 
    66 
    7   <script src="utilities/inspection.js"/> 
    8   <script src="utilities/logging.js"/> 
    9   <script src="utilities/utils.js"/> 
    107  <script src="preferences/general.js"/> 
    118  <script src="preferences/evaluation.js"/> 
  • trunk/proto-13/chrome/content/preferences/evaluation.js

    r147 r176  
    66 
    77Components.utils.import("chrome://ai-sidebar/content/ai-common.js"); 
    8  
    9 /** 
    10  * @namespace ainspector 
    11  */ 
    12 var ainspector = ainspector || {}; 
     8Components.utils.import("chrome://ai-sidebar/content/utilities/preferences.js", ainspector); 
    139 
    1410/** 
     
    2319ainspector.evaluationPrefs = (function () { 
    2420  // private member 
    25   var prefUtils = new OAA_WEB_ACCESSIBILITY_UTILS.PrefUtils("extensions.ainspector.evaluation."); 
     21  var prefUtils = new ainspector.PrefUtils("extensions.ainspector.evaluation."); 
    2622 
    2723  // public methods 
     
    113109// Instantiate and register PrefListener for preferences in evaluation branch. 
    114110 
    115 ainspector.evaluationPrefListener = new OAA_WEB_ACCESSIBILITY_UTILS.PrefListener( 
     111ainspector.evaluationPrefListener = new ainspector.PrefListener( 
    116112  "extensions.ainspector.evaluation.", ainspector.onEvaluationPrefChange); 
    117113 
  • trunk/proto-13/chrome/content/preferences/general.js

    r165 r176  
    66 
    77Components.utils.import("chrome://ai-sidebar/content/ai-common.js"); 
    8  
    9 /** 
    10  * @namespace ainspector 
    11  */ 
    12 var ainspector = ainspector || {}; 
     8Components.utils.import("chrome://ai-sidebar/content/utilities/preferences.js", ainspector); 
    139 
    1410/** 
     
    2319ainspector.generalPrefs = (function () { 
    2420  // private member 
    25   var prefUtils = new OAA_WEB_ACCESSIBILITY_UTILS.PrefUtils("extensions.ainspector.general."); 
     21  var prefUtils = new ainspector.PrefUtils("extensions.ainspector.general."); 
    2622 
    2723  // public methods 
     
    9086    break; 
    9187 
     88  case 'wcagMenuitems': 
     89    break; 
     90 
    9291  default: 
    9392    ainspector.reportError("onGeneralPrefChange: unmatched preference: " + name); 
     
    106105// Instantiate and register PrefListener for preferences in general branch. 
    107106 
    108 ainspector.generalPrefListener = new OAA_WEB_ACCESSIBILITY_UTILS.PrefListener( 
     107ainspector.generalPrefListener = new ainspector.PrefListener( 
    109108  "extensions.ainspector.general.", ainspector.onGeneralPrefChange); 
    110109 
  • trunk/proto-13/chrome/content/preferences/options.js

    r165 r176  
    66 
    77/** 
    8  * @namespace ainspector 
     8 * @namespace ainspector.options 
    99 */ 
    10 var ainspector = ainspector || {}; 
    1110ainspector.options = {}; 
    1211 
  • trunk/proto-13/chrome/content/view-category.js

    r173 r176  
    1111 */ 
    1212var ainspectorSidebar = ainspectorSidebar || {}; 
     13 
     14Components.classes["@mozilla.org/moz/jssubscript-loader;1"] 
     15  .getService(Components.interfaces.mozIJSSubScriptLoader) 
     16  .loadSubScript("chrome://ai-sidebar/content/utilities/dom.js", ainspectorSidebar); 
    1317 
    1418ainspectorSidebar.ruleResultConst = { 
     
    295299  var isRowSelected = tree.view.selection.isSelected(index); 
    296300  var nls = ainspectorSidebar.nlsProperties; 
    297   var getHTML = OAA_WEB_ACCESSIBILITY_UTILS.createXHTMLElement; 
     301  var getHTML = ainspectorSidebar.createXHTMLElement; 
    298302 
    299303  var h2, p; 
     
    307311 
    308312  // specify text for Selected Rule vbox 
    309   ainspector.clearContent(vbox); 
     313  ainspectorSidebar.clearContent(vbox); 
    310314 
    311315  if (isRowSelected) { 
  • trunk/proto-13/chrome/content/view-details.js

    r175 r176  
    1111 */ 
    1212var ainspectorSidebar = ainspectorSidebar || {}; 
     13 
     14Components.classes["@mozilla.org/moz/jssubscript-loader;1"] 
     15  .getService(Components.interfaces.mozIJSSubScriptLoader) 
     16  .loadSubScript("chrome://ai-sidebar/content/utilities/dom.js", ainspectorSidebar); 
    1317 
    1418/** 
     
    5559ainspectorSidebar.clearDetailsView = function () { 
    5660  var vboxSummary = document.getElementById("ainspector-details-summary"); 
    57   ainspector.clearContent(vboxSummary); 
     61  ainspectorSidebar.clearContent(vboxSummary); 
    5862 
    5963  var vboxRuleInfo = document.getElementById("ainspector-details-rule-info"); 
    60   ainspector.clearContent(vboxRuleInfo); 
     64  ainspectorSidebar.clearContent(vboxRuleInfo); 
    6165}; 
    6266 
     
    9296 
    9397ainspectorSidebar.setDetailsSummaryContent = function (ruleResult) { 
    94   var getHTML = OAA_WEB_ACCESSIBILITY_UTILS.createXHTMLElement; 
     98  var getHTML = ainspectorSidebar.createXHTMLElement; 
    9599  var h2, p; 
    96100  var h2FirstStyle = ainspector.h2FirstStyle; 
     
    99103 
    100104  var vbox = document.getElementById("ainspector-details-summary"); 
    101   ainspector.clearContent(vbox); 
     105  ainspectorSidebar.clearContent(vbox); 
    102106 
    103107  // get prefix labels 
     
    125129 
    126130ainspectorSidebar.setDetailsRuleInfoContent = function (ruleResult) { 
    127   var getHTML = OAA_WEB_ACCESSIBILITY_UTILS.createXHTMLElement; 
     131  var getHTML = ainspectorSidebar.createXHTMLElement; 
    128132  var h2, p, ul, li, a; 
    129133  var h2FirstStyle = ainspector.h2FirstStyle; 
     
    133137 
    134138  var vbox = document.getElementById("ainspector-details-rule-info"); 
    135   ainspector.clearContent(vbox); 
     139  ainspectorSidebar.clearContent(vbox); 
    136140 
    137141  // get prefix labels 
Note: See TracChangeset for help on using the changeset viewer.