Bug 1393642 - Update editorUtilities.js for the changes in nsIHTMLEditor. r=jorgk
authorNicholas Nethercote <nnethercote@mozilla.com>
Fri, 25 Aug 2017 16:27:39 +1000
changeset 22056 66b55e22b0c9f499ccb2373575fa68a2d9515740
parent 22055 799ad314120ff7db0d2e372c99036cd7ec30bbbd
child 22057 af8cdc1ef919b0adc5e1a2c7bccf2649878a9088
push id13460
push usermozilla@jorgk.com
push dateMon, 28 Aug 2017 00:52:58 +0000
treeherdercomm-central@66b55e22b0c9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorgk
bugs1393642
Bug 1393642 - Update editorUtilities.js for the changes in nsIHTMLEditor. r=jorgk Several nsIHTMLEditor methods now take strings instead of atoms, so we don't need to use nsIAtomService any more.
editor/ui/composer/content/editorUtilities.js
--- a/editor/ui/composer/content/editorUtilities.js
+++ b/editor/ui/composer/content/editorUtilities.js
@@ -325,54 +325,39 @@ function SetDocumentTitle(title)
     GetCurrentEditorElement().contentDocument.title = title;
 
     // Update window title (doesn't work if called from a dialog)
     if ("UpdateWindowTitle" in window)
       window.UpdateWindowTitle();
   } catch (e) {}
 }
 
-var gAtomService;
-function GetAtomService()
-{
-  gAtomService = Components.classes["@mozilla.org/atom-service;1"].getService(Components.interfaces.nsIAtomService);
-}
-
 function EditorGetTextProperty(property, attribute, value, firstHas, anyHas, allHas)
 {
   try {
-    if (!gAtomService) GetAtomService();
-    var propAtom = gAtomService.getAtom(property);
-
-    return GetCurrentEditor().getInlinePropertyWithAttrValue(propAtom,
+    return GetCurrentEditor().getInlinePropertyWithAttrValue(property,
                                 attribute, value, firstHas, anyHas, allHas);
   }
   catch(e) {}
 }
 
 function EditorSetTextProperty(property, attribute, value)
 {
   try {
-    if (!gAtomService) GetAtomService();
-    var propAtom = gAtomService.getAtom(property);
-
-    GetCurrentEditor().setInlineProperty(propAtom, attribute, value);
+    GetCurrentEditor().setInlineProperty(property, attribute, value);
     if ("gContentWindow" in window)
       window.gContentWindow.focus();
   }
   catch(e) {}
 }
 
 function EditorRemoveTextProperty(property, attribute)
 {
   try {
-    if (!gAtomService) GetAtomService();
-    var propAtom = gAtomService.getAtom(property);
-
-    GetCurrentEditor().removeInlineProperty(propAtom, attribute);
+    GetCurrentEditor().removeInlineProperty(property, attribute);
     if ("gContentWindow" in window)
       window.gContentWindow.focus();
   }
   catch(e) {}
 }
 
 /************* Element enbabling/disabling ***************/