diff --git a/mozilla/editor/ui/composer/content/ComposerCommands.js b/mozilla/editor/ui/composer/content/ComposerCommands.js index 259b2a9a1c8..3d1cc65d373 100644 --- a/mozilla/editor/ui/composer/content/ComposerCommands.js +++ b/mozilla/editor/ui/composer/content/ComposerCommands.js @@ -601,7 +601,7 @@ function GetSuggestedFileName(aDocumentURLString, aMIMEType, aHTMLDoc) // returns file picker result function PromptForSaveLocation(aDoSaveAsText, aEditorType, aMIMEType, ahtmlDocument, aDocumentURLString) { - var dialogResult = new Object; + var dialogResult = {}; dialogResult.filepickerClick = nsIFilePicker.returnCancel; dialogResult.resultingURI = ""; dialogResult.resultingLocalFile = null; @@ -3105,8 +3105,8 @@ var nsJoinTableCellsCommand = { if (window.editorShell && window.editorShell.documentEditable && IsEditingRenderedHTML()) { - var tagNameObj = new Object; - var countObj = new Object; + var tagNameObj = { value: "" }; + var countObj = { value: 0 }; var cell = window.editorShell.GetSelectedOrParentTableElement(tagNameObj, countObj); // We need a cell and either > 1 selected cell or a cell to the right @@ -3153,8 +3153,8 @@ var nsSplitTableCellCommand = { if (window.editorShell && window.editorShell.documentEditable && IsEditingRenderedHTML()) { - var tagNameObj = new Object; - var countObj = new Object; + var tagNameObj = { value: "" }; + var countObj = { value: 0 }; var cell = window.editorShell.GetSelectedOrParentTableElement(tagNameObj, countObj); // We need a cell parent and there's just 1 selected cell // or selection is entirely inside 1 cell diff --git a/mozilla/editor/ui/composer/content/EditorCommandsDebug.js b/mozilla/editor/ui/composer/content/EditorCommandsDebug.js index 0185e61a8b9..2e5f716963f 100644 --- a/mozilla/editor/ui/composer/content/EditorCommandsDebug.js +++ b/mozilla/editor/ui/composer/content/EditorCommandsDebug.js @@ -149,13 +149,13 @@ function EditorTestTableLayout() } var cell; - var startRowIndexObj = new Object(); - var startColIndexObj = new Object(); - var rowSpanObj = new Object(); - var colSpanObj = new Object(); - var actualRowSpanObj = new Object(); - var actualColSpanObj = new Object(); - var isSelectedObj = new Object(); + var startRowIndexObj = { value: null }; + var startColIndexObj = { value: null }; + var rowSpanObj = { value: null }; + var colSpanObj = { value: null }; + var actualRowSpanObj = { value: null }; + var actualColSpanObj = { value: null }; + var isSelectedObj = { value: false }; var startRowIndex = 0; var startColIndex = 0; var rowSpan; diff --git a/mozilla/editor/ui/composer/content/editor.js b/mozilla/editor/ui/composer/content/editor.js index df4cadf5533..657b66219b8 100644 --- a/mozilla/editor/ui/composer/content/editor.js +++ b/mozilla/editor/ui/composer/content/editor.js @@ -70,14 +70,18 @@ var gTagModeButton; var gSourceModeButton; var gPreviewModeButton; var gIsHTMLEditor = false; -var gColorObj = new Object(); +var gColorObj = { LastTextColor:"", LastBackgroundColor:"", LastHighlightColor:"", + Type:"", SelectedType:"", NoDefault:false, Cancel:false, + HighlightColor:"", BackgroundColor:"", PageColor:"", + TextColor:"", TableColor:"", CellColor:"" + }; var gDefaultTextColor = ""; var gDefaultBackgroundColor = ""; var gCSSPrefListener; var gPrefs; // These must be kept in synch with the XUL lists -var gFontSizeNames = new Array("xx-small","x-small","small","medium","large","x-large","xx-large"); +var gFontSizeNames = ["xx-small","x-small","small","medium","large","x-large","xx-large"]; const nsIFilePicker = Components.interfaces.nsIFilePicker; @@ -102,11 +106,11 @@ nsButtonPrefListener.prototype = if (prefName.substr(0, this.domain.length) != this.domain) return; var cmd = document.getElementById("cmd_highlight"); - var mixedObj = new Object(); if (cmd && gIsHTMLEditor) { var prefs = GetPrefs(); var useCSS = prefs.getBoolPref(prefName); if (useCSS && gEditor && gIsHTMLEditor) { + var mixedObj = {}; var state = gEditor.getHighlightColorState(mixedObj); cmd.setAttribute("state", state); cmd.removeAttribute("collapsed"); @@ -128,7 +132,7 @@ function AfterHighlightColorChange() var button = document.getElementById("cmd_highlight"); if (button) { - var mixedObj = new Object(); + var mixedObj = {}; var state = gEditor.getHighlightColorState(mixedObj); button.setAttribute("state", state); onHighlightColorChange(); @@ -877,10 +881,9 @@ function initFontFaceMenu(menuPopup) var children = menuPopup.childNodes; if (!children) return; - var firstHas = new Object(); - var anyHas = new Object(); - var allHas = new Object(); - allHas.value = false; + var firstHas = { value: false }; + var anyHas = { value: false }; + var allHas = { value: false }; // we need to set or clear the checkmark for each menu item since the selection // may be in a new location from where it was when the menu was previously opened @@ -919,10 +922,9 @@ function initFontSizeMenu(menuPopup) var children = menuPopup.childNodes; if (!children) return; - var firstHas = new Object(); - var anyHas = new Object(); - var allHas = new Object(); - allHas.value = false; + var firstHas = { value: false }; + var anyHas = { value: false }; + var allHas = { value: false }; var sizeWasFound = false; @@ -1077,11 +1079,11 @@ function GetBackgroundElementWithColor() gColorObj.BackgroundColor = ""; gColorObj.SelectedType = ""; - var tagNameObj = new Object(); + var tagNameObj = { value: "" }; var numSelected; var element; try { - var elt = new Object(); + var elt = { value: null }; numSelected = gEditor.getSelectedOrParentTableElement(elt, tagNameObj); element = elt.value; } @@ -2035,7 +2037,7 @@ function InitObjectPropertiesMenuitem(id) function InitParagraphMenu() { - var mixedObj = new Object(); + var mixedObj = { value: null }; var state; try { state = gEditor.getParagraphState(mixedObj); @@ -2063,10 +2065,10 @@ function InitParagraphMenu() function GetListStateString() { - var mixedObj = new Object(); - var hasOL = new Object(); - var hasUL = new Object(); - var hasDL = new Object(); + var mixedObj = { value: null }; + var hasOL = { value: false }; + var hasUL = { value: false }; + var hasDL = { value: false }; gEditor.getListState(mixedObj, hasOL, hasUL, hasDL); if (mixedObj.value) @@ -2078,9 +2080,9 @@ function GetListStateString() if (hasDL.value) { - var hasLI = new Object(); - var hasDT = new Object(); - var hasDD = new Object(); + var hasLI = { value: false }; + var hasDT = { value: false }; + var hasDD = { value: false }; gEditor.getListItemState(mixedObj, hasLI, hasDT, hasDD); if (mixedObj.value) return "mixed"; @@ -2114,8 +2116,8 @@ function InitListMenu() function GetAlignmentString() { - var mixedObj = new Object(); - var alignObj = new Object(); + var mixedObj = { value: null }; + var alignObj = { value: null }; gEditor.getAlignment(mixedObj, alignObj); if (mixedObj.value) @@ -2543,12 +2545,12 @@ function InitJoinCellMenuitem(id) if (!menuItem) return; // Use "Join selected cells if there's more than 1 cell selected - var tagNameObj = new Object(); var numSelected; var foundElement; try { - var elt = new Object(); + var elt = { value: null }; + var tagNameObj = {}; numSelected = gEditor.getSelectedOrParentTableElement(elt, tagNameObj); foundElement = elt.value; @@ -2607,8 +2609,8 @@ function goUpdateTableMenuItems(commandset) if (!(flags & nsIPlaintextEditor.eEditorReadonlyMask) && IsEditingRenderedHTML()) { - var tagNameObj = new Object(); - var element = new Object(); + var tagNameObj = { value: "" }; + var element = { value: null }; try { gEditor.getSelectedOrParentTableElement(element, tagNameObj); } @@ -2740,9 +2742,9 @@ function GetNumberOfContiguousSelectedRows() { if (!gIsHTMLEditor) return 0; - var cellObj = new Object(); - var rowObj = new Object(); - var colObj = new Object(); + var cellObj = { value: null }; + var rowObj = { value: 0 }; + var colObj = { value: 0 }; gEditor.getFirstSelectedCellInTable(cellObj, rowObj, colObj); var cell = cellObj.value; if (!cell) @@ -2773,9 +2775,9 @@ function GetNumberOfContiguousSelectedColumns() { if (!gIsHTMLEditor) return 0; - var cellObj = new Object(); - var colObj = new Object(); - var rowObj = new Object(); + var cellObj = { value: null }; + var colObj = { value: 0 }; + var rowObj = { value: 0 }; gEditor.getFirstSelectedCellInTable(cellObj, rowObj, colObj); var cell = cellObj.value; if (!cell) diff --git a/mozilla/editor/ui/composer/content/editorUtilities.js b/mozilla/editor/ui/composer/content/editorUtilities.js index fb4e56aeab1..c121d51286c 100644 --- a/mozilla/editor/ui/composer/content/editorUtilities.js +++ b/mozilla/editor/ui/composer/content/editorUtilities.js @@ -424,10 +424,8 @@ function SaveFilePickerDirectory(filePicker, fileType) function GetDefaultBrowserColors() { var prefs = GetPrefs(); - var colors = new Object(); + var colors = { TextColor:0, BackgroundColor:0, LinkColor:0, VisitedLinkColor:0 }; var useSysColors = false; - colors.TextColor = 0; - colors.BackgroundColor = 0; try { useSysColors = prefs.getBoolPref("browser.display.use_system_colors"); } catch (e) {} if (!useSysColors) diff --git a/mozilla/editor/ui/composer/content/pref-composer.js b/mozilla/editor/ui/composer/content/pref-composer.js index 97cc2d606a7..5eed61cd36e 100644 --- a/mozilla/editor/ui/composer/content/pref-composer.js +++ b/mozilla/editor/ui/composer/content/pref-composer.js @@ -104,12 +104,11 @@ function GetColorAndUpdate(ColorWellID) // Only allow selecting when in custom mode if (!gDialog.CustomColorsRadio.selected) return; - var colorObj = new Object; var colorWell = document.getElementById(ColorWellID); if (!colorWell) return; // Don't allow a blank color, i.e., using the "default" - colorObj.NoDefault = true; + var colorObj = { NoDefault:true, Type:"", TextColor:0, PageColor:0, Cancel:false }; switch( ColorWellID ) { diff --git a/mozilla/editor/ui/composer/content/sb-bookmarks.js b/mozilla/editor/ui/composer/content/sb-bookmarks.js index 0d725858547..18eb87b0683 100644 --- a/mozilla/editor/ui/composer/content/sb-bookmarks.js +++ b/mozilla/editor/ui/composer/content/sb-bookmarks.js @@ -376,7 +376,7 @@ function fillContextMenu(name) dump("# of Nodes selected: " + select_list.length + "\n\n"); // perform intersection of commands over selected nodes - var cmdArray = new Array(); + var cmdArray = []; for (var nodeIndex=0; nodeIndex= 1){ - clipBoard = new Array(); + clipBoard = []; for (i=0; i 1 list type in selection gMixedListSelection = mixedObj.value; diff --git a/mozilla/editor/ui/dialogs/content/EdReplace.js b/mozilla/editor/ui/dialogs/content/EdReplace.js index de12605c7a0..e1c8175031d 100644 --- a/mozilla/editor/ui/dialogs/content/EdReplace.js +++ b/mozilla/editor/ui/dialogs/content/EdReplace.js @@ -32,7 +32,7 @@ var gEditor; // the editor we're using function initDialogObject() { // Create gReplaceDialog object and initialize. - gReplaceDialog = new Object(); + gReplaceDialog = {}; gReplaceDialog.findInput = document.getElementById("dialog.findInput"); gReplaceDialog.replaceInput = document.getElementById("dialog.replaceInput"); gReplaceDialog.caseSensitive = document.getElementById("dialog.caseSensitive"); diff --git a/mozilla/editor/ui/dialogs/content/EdTableProps.js b/mozilla/editor/ui/dialogs/content/EdTableProps.js index 4724fde5381..67b4aa78085 100644 --- a/mozilla/editor/ui/dialogs/content/EdTableProps.js +++ b/mozilla/editor/ui/dialogs/content/EdTableProps.js @@ -53,11 +53,13 @@ var curRowIndex; var curColIndex; var curColSpan; var SelectedCellsType = 1; -var SELECT_CELL = 1; -var SELECT_ROW = 2; -var SELECT_COLUMN = 3; -var RESET_SELECTION = 0; -var cellData = new Object; +const SELECT_CELL = 1; +const SELECT_ROW = 2; +const SELECT_COLUMN = 3; +const RESET_SELECTION = 0; +var cellData = { cell:null, startRowIndex:0, startColIndex:0, rowSpan:0, colSpan:0, + actualRowSpan:0, actualColSpan:0, isSelected:false + }; var AdvancedEditUsed; var alignWasChar = false; @@ -155,8 +157,8 @@ function Startup() } globalTableElement = TableElement.cloneNode(false); - var tagNameObj = new Object; - var countObj = new Object; + var tagNameObj = { value: "" }; + var countObj = { value: 0 }; var tableOrCellElement = editorShell.GetSelectedOrParentTableElement(tagNameObj, countObj); gSelectedCellCount = countObj.value; @@ -383,15 +385,15 @@ function InitCellPanel() function GetCellData(rowIndex, colIndex) { // Get actual rowspan and colspan - var startRowIndexObj = new Object; - var startColIndexObj = new Object; - var rowSpanObj = new Object; - var colSpanObj = new Object; - var actualRowSpanObj = new Object; - var actualColSpanObj = new Object; - var isSelectedObj = new Object; + var startRowIndexObj = { value: 0 }; + var startColIndexObj = { value: 0 }; + var rowSpanObj = { value: 0 }; + var colSpanObj = { value: 0 }; + var actualRowSpanObj = { value: 0 }; + var actualColSpanObj = { value: 0 }; + var isSelectedObj = { value: false }; if (!cellData) - cellData = new Object; + cellData = { cell: null }; try { cellData.cell = @@ -429,7 +431,7 @@ function GetColorAndUpdate(ColorWellID) var colorWell = document.getElementById(ColorWellID); if (!colorWell) return; - var colorObj = new Object; + var colorObj = { Type:"", TableColor:0, CellColor:0, NoDefault:false, Cancel:false, BackgroundColor:0 }; switch( ColorWellID ) { @@ -442,8 +444,6 @@ function GetColorAndUpdate(ColorWellID) colorObj.CellColor = CellColor; break; } - // Avoid the JS warning - colorObj.NoDefault = false; window.openDialog("chrome://editor/content/EdColorPicker.xul", "_blank", "chrome,close,titlebar,modal", "", colorObj); // User canceled the dialog @@ -707,9 +707,8 @@ function DoCellSelection() break; } // Get number of cells selected - var tagNameObj = new Object; - var countObj = new Object; - tagNameObj.value = ""; + var tagNameObj = { value: "" }; + var countObj = { value: 0 }; var tableOrCellElement = editorShell.GetSelectedOrParentTableElement(tagNameObj, countObj); if (tagNameObj.value == "td") gSelectedCellCount = countObj.value;