diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -14,8 +14,10 @@ 21876a1c04b46d1c1e76f48a2015bced91afd7b7 CHATZILLA_0_9_92_RELEASE 35ff2f0f2ad833481b3cdc35ac201c07b9508cff SEA2_42_RELBRANCH 35ff2f0f2ad833481b3cdc35ac201c07b9508cff SEA2_42_RELBRANCH 64823e8eb6d77e3dfc8a7aabf1ca12cb92f9d02f SEA2_42_RELBRANCH 64823e8eb6d77e3dfc8a7aabf1ca12cb92f9d02f SEA2_42_RELBRANCH 2d483f9a47ace55591f37ccc0c4424c30d388f7a SEA2_42_RELBRANCH 2d483f9a47ace55591f37ccc0c4424c30d388f7a SEA2_42_RELBRANCH 2deb3332502bcf90302274375605d1fb5374b6f4 SEA2_42_RELBRANCH +b7a99fda77ea3b78708b5bc635a41f6e3ab19b5c SEA2_48_RELBRANCH +b122e17dfeda5320e76e13df2238519855cde797 CHATZILLA_0_9_93_RELEASE diff --git a/js/lib/file-utils.js b/js/lib/file-utils.js --- a/js/lib/file-utils.js +++ b/js/lib/file-utils.js @@ -62,30 +62,30 @@ * (title and filter, respectively); when using a string, * the following standard filters may be used: |$all|, |$html|, * |$text|, |$images|, |$xml|, |$xul|, |$noAll| (prevents "All * Files" filter being included). * @param attribs Optional. Takes an object with either or both of the * properties: |defaultString| (*defaultFile* in |pick| * functions) sets the initial/default filename, and * |defaultExtension| XXX FIXME (this seems wrong?) XXX. - * @returns An |Object| with |ok| (Boolean), |file| (|nsILocalFile|) and + * @returns An |Object| with |ok| (Boolean), |file| (|nsIFile|) and * |picker| (|nsIFilePicker|) properties. */ futils.getPicker = function futils_nosepicker(initialPath, typeList, attribs) { const classes = Components.classes; const interfaces = Components.interfaces; const PICKER_CTRID = "@mozilla.org/filepicker;1"; const LOCALFILE_CTRID = "@mozilla.org/file/local;1"; const nsIFilePicker = interfaces.nsIFilePicker; - const nsILocalFile = interfaces.nsILocalFile; + const nsIFile = interfaces.nsIFile; var picker = classes[PICKER_CTRID].createInstance(nsIFilePicker); if (attribs) { if (typeof attribs == "object") { for (var a in attribs) picker[a] = attribs[a]; @@ -98,22 +98,22 @@ if (initialPath) { var localFile; if (typeof initialPath == "string") { localFile = - classes[LOCALFILE_CTRID].createInstance(nsILocalFile); + classes[LOCALFILE_CTRID].createInstance(nsIFile); localFile.initWithPath(initialPath); } else { - if (!isinstance(initialPath, nsILocalFile)) + if (!isinstance(initialPath, nsIFile)) throw "bad type for argument |initialPath|"; localFile = initialPath; } picker.displayDirectory = localFile } @@ -204,17 +204,17 @@ /** * Displays a standard file save dialog. * * @param title Optional. The title for the dialog. * @param typeList Optional. See |futils.getPicker| for details. * @param defaultFile Optional. See |futils.getPicker| for details. * @param defaultDir Optional. See |futils.getPicker| for details. * @param defaultExt Optional. See |futils.getPicker| for details. - * @returns An |Object| with "ok" (Boolean), "file" (|nsILocalFile|) and + * @returns An |Object| with "ok" (Boolean), "file" (|nsIFile|) and * "picker" (|nsIFilePicker|) properties. */ function pickSaveAs (title, typeList, defaultFile, defaultDir, defaultExt) { if (!defaultDir && "lastSaveAsDir" in futils) defaultDir = futils.lastSaveAsDir; var picker = futils.getPicker (defaultDir, typeList, @@ -232,17 +232,17 @@ /** * Displays a standard file open dialog. * * @param title Optional. The title for the dialog. * @param typeList Optional. See |futils.getPicker| for details. * @param defaultFile Optional. See |futils.getPicker| for details. * @param defaultDir Optional. See |futils.getPicker| for details. - * @returns An |Object| with "ok" (Boolean), "file" (|nsILocalFile|) and + * @returns An |Object| with "ok" (Boolean), "file" (|nsIFile|) and * "picker" (|nsIFilePicker|) properties. */ function pickOpen (title, typeList, defaultFile, defaultDir) { if (!defaultDir && "lastOpenDir" in futils) defaultDir = futils.lastOpenDir; var picker = futils.getPicker (defaultDir, typeList, @@ -257,17 +257,17 @@ return rv; } /** * Displays a standard directory selection dialog. * * @param title Optional. The title for the dialog. * @param defaultDir Optional. See |futils.getPicker| for details. - * @returns An |Object| with "ok" (Boolean), "file" (|nsILocalFile|) and + * @returns An |Object| with "ok" (Boolean), "file" (|nsIFile|) and * "picker" (|nsIFilePicker|) properties. */ function pickGetFolder(title, defaultDir) { if (!defaultDir && "lastOpenDir" in futils) defaultDir = futils.lastOpenDir; var picker = futils.getPicker(defaultDir); @@ -295,20 +295,20 @@ tempFile.append(name); tempFile.createUnique(0, 0600); return tempFile; } function nsLocalFile(path) { const LOCALFILE_CTRID = "@mozilla.org/file/local;1"; - const nsILocalFile = Components.interfaces.nsILocalFile; + const nsIFile = Components.interfaces.nsIFile; var localFile = - Components.classes[LOCALFILE_CTRID].createInstance(nsILocalFile); + Components.classes[LOCALFILE_CTRID].createInstance(nsIFile); localFile.initWithPath(path); return localFile; } function fopen (path, mode, perms, tmp) { return new LocalFile(path, mode, perms, tmp); } @@ -319,17 +319,16 @@ const interfaces = Components.interfaces; const LOCALFILE_CTRID = "@mozilla.org/file/local;1"; const FILEIN_CTRID = "@mozilla.org/network/file-input-stream;1"; const FILEOUT_CTRID = "@mozilla.org/network/file-output-stream;1"; const SCRIPTSTREAM_CTRID = "@mozilla.org/scriptableinputstream;1"; const nsIFile = interfaces.nsIFile; - const nsILocalFile = interfaces.nsILocalFile; const nsIFileOutputStream = interfaces.nsIFileOutputStream; const nsIFileInputStream = interfaces.nsIFileInputStream; const nsIScriptableInputStream = interfaces.nsIScriptableInputStream; if (typeof perms == "undefined") perms = 0666 & ~futils.umask; if (typeof mode == "string") @@ -349,17 +348,17 @@ throw "Invalid mode ``" + mode + "''"; } } if (typeof file == "string") { this.localFile = new nsLocalFile(file); } - else if (isinstance(file, nsILocalFile)) + else if (isinstance(file, nsIFile)) { this.localFile = file; } else { throw "bad type for argument |file|."; } diff --git a/js/lib/pref-manager.js b/js/lib/pref-manager.js --- a/js/lib/pref-manager.js +++ b/js/lib/pref-manager.js @@ -28,34 +28,33 @@ function pm_observe (prefService, topic, prefName) { prefManager.onPrefChanged(prefName); }; const PREF_CTRID = "@mozilla.org/preferences-service;1"; const nsIPrefService = Components.interfaces.nsIPrefService; const nsIPrefBranch = Components.interfaces.nsIPrefBranch; - const nsIPrefBranchInternal = Components.interfaces.nsIPrefBranchInternal; this.prefService = Components.classes[PREF_CTRID].getService(nsIPrefService); this.prefBranch = this.prefService.getBranch(branchName); this.prefSaveTime = 0; this.prefSaveTimer = 0; this.branchName = branchName; this.defaultValues = new Object(); this.prefs = new Object(); this.prefNames = new Array(); this.prefRecords = new Object(); this.observer = { observe: pm_observe, branch: branchName }; this.observers = new Array(); - this.prefBranchInternal = - this.prefBranch.QueryInterface(nsIPrefBranchInternal); - this.prefBranchInternal.addObserver("", this.observer, false); + this.nsIPrefBranch = + this.prefBranch.QueryInterface(nsIPrefBranch); + this.nsIPrefBranch.addObserver("", this.observer, false); this.defaultBundle = defaultBundle; this.valid = true; } // Delay between change and save. PrefManager.prototype.PREF_SAVE_DELAY = 5000; // 5 seconds. @@ -65,17 +64,17 @@ PrefManager.prototype.PREF_MAX_DELAY = 15000; // 15 seconds. // PrefManager.prototype.destroy = function pm_destroy() { if (this.valid) { - this.prefBranchInternal.removeObserver("", this.observer); + this.nsIPrefBranch.removeObserver("", this.observer); this.valid = false; } } PrefManager.prototype.getBranch = function pm_getbranch(suffix) { return this.prefService.getBranch(this.prefBranch.root + suffix); diff --git a/js/lib/utils.js b/js/lib/utils.js --- a/js/lib/utils.js +++ b/js/lib/utils.js @@ -1000,17 +1000,17 @@ if ("getFileFromURLSpec" in service) return service.getFileFromURLSpec(url); /* In builds before 2002-08-15, there is no getFileFromURLSpec at all. * Instead, we have nsIIOservice.initFileFromURLSpec(nsIFile, string). */ if ("initFileFromURLSpec" in service) { - var file = newObject("@mozilla.org/file/local;1", "nsILocalFile"); + var file = newObject("@mozilla.org/file/local;1", "nsIFile"); service.initFileFromURLSpec(file, url); return file; } var handler = service.getProtocolHandler("file"); handler = handler.QueryInterface(nsIFileProtocolHandler); return handler.getFileFromURLSpec(url); } @@ -1019,22 +1019,22 @@ { if (!file) return null; const IOS_CTRID = "@mozilla.org/network/io-service;1"; const LOCALFILE_CTRID = "@mozilla.org/file/local;1"; const nsIIOService = Components.interfaces.nsIIOService; - const nsILocalFile = Components.interfaces.nsILocalFile; + const nsIFile = Components.interfaces.nsIFile; if (typeof file == "string") { var fileObj = - Components.classes[LOCALFILE_CTRID].createInstance(nsILocalFile); + Components.classes[LOCALFILE_CTRID].createInstance(nsIFile); fileObj.initWithPath(file); file = fileObj; } var service = Components.classes[IOS_CTRID].getService(nsIIOService); /* In sept 2002, bug 166792 moved this method to the nsIFileProtocolHandler * interface, but we need to support older versions too. */ if ("getURLSpecFromFile" in service) diff --git a/xul/content/ceip/ceip.js b/xul/content/ceip/ceip.js --- a/xul/content/ceip/ceip.js +++ b/xul/content/ceip/ceip.js @@ -247,29 +247,29 @@ catch (ex) {} } // @internal CEIP.prototype.uploadLogs = function ceip_uploadlogs() { - const nsILocalFile = Components.interfaces.nsILocalFile; + const nsIFile = Components.interfaces.nsIFile; try { var logPath = this.getLogFolder(); if (!logPath.exists()) return; var enumerator = logPath.directoryEntries; var re = new RegExp("^\\d+\\.xml", "i"); while (enumerator.hasMoreElements()) { - var file = enumerator.getNext().QueryInterface(nsILocalFile); + var file = enumerator.getNext().QueryInterface(nsIFile); if (re.test(file.leafName)) this.uploadLog(file); } } catch(ex) { this.logEvent({type: "logger", event: "error", method: "uploadLogs", error: formatException(ex)}); diff --git a/xul/content/commands.js b/xul/content/commands.js --- a/xul/content/commands.js +++ b/xul/content/commands.js @@ -4121,27 +4121,27 @@ { var pickerRv = pickOpen(MSG_DCCFILE_SEND); if (!pickerRv.ok) return false; file = pickerRv.file; } else { - // Wrap in try/catch because nsILocalFile creation throws a freaking + // Wrap in try/catch because nsIFile creation throws a freaking // error if it doesn't get a FULL path. try { file = nsLocalFile(e.file); } catch(ex) { // Ok, try user's home directory. var fl = Components.classes[DIRSVC_CID].getService(nsIProperties); - file = fl.get("Home", Components.interfaces.nsILocalFile); + file = fl.get("Home", Components.interfaces.nsIFile); // Another freaking try/catch wrapper. try { // NOTE: This is so pathetic it can't cope with any path // separators in it, so don't even THINK about lobing a // relative path at it. file.append(e.file); diff --git a/xul/content/static.js b/xul/content/static.js --- a/xul/content/static.js +++ b/xul/content/static.js @@ -1,14 +1,16 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +Components.utils.import("resource://gre/modules/Services.jsm"); + const __cz_version = "0.9.93"; const __cz_condition = "green"; const __cz_suffix = ""; const __cz_guid = "59c81df5-4b7a-477b-912d-4e0fdf64e5f2"; const __cz_locale = "0.9.92"; var warn; var ASSERT; @@ -243,16 +245,21 @@ } catch (ex) { dd("Global History failed to initialize: " + ex); } try { + // nsIScriptableDateFormat was removed from Gecko 57 + // The replacement function was not available in a stable version + // prior to Gecko 56. + if (Services.vc.compare(Services.appinfo.platformVersion, "56.0") < 0) + { const nsISDateFormat = Components.interfaces.nsIScriptableDateFormat; const DTFMT_CID = "@mozilla.org/intl/scriptabledateformat;1"; client.dtFormatter = Components.classes[DTFMT_CID].createInstance(nsISDateFormat); // Mmmm, fun. This ONLY affects the ChatZilla window, don't worry! Date.prototype.toStringInt = Date.prototype.toString; Date.prototype.toString = function() { @@ -260,16 +267,28 @@ return dtf.FormatDateTime("", dtf.dateFormatLong, dtf.timeFormatSeconds, this.getFullYear(), this.getMonth() + 1, this.getDate(), this.getHours(), this.getMinutes(), this.getSeconds() ); } } + else + { + client.dtFormatter = Services.intl.createDateTimeFormat( + undefined, { dateStyle: "full", timeStyle: "long" }); + + // Mmmm, fun. This ONLY affects the ChatZilla window, don't worry! + Date.prototype.toStringInt = Date.prototype.toString; + Date.prototype.toString = function() { + return client.dtFormatter.format(this); + } + } + } catch (ex) { dd("Locale-correct date formatting failed to initialize: " + ex); } // XXX Bug 335998: See cmdHideView for usage of this. client.hiddenDocument = document.implementation.createDocument(null, null, null); @@ -747,17 +766,17 @@ if (recurse < 1) return; var enumer = localPath.directoryEntries; while (enumer.hasMoreElements()) { var entry = enumer.getNext(); - entry = entry.QueryInterface(Components.interfaces.nsILocalFile); + entry = entry.QueryInterface(Components.interfaces.nsIFile); if (entry.isDirectory()) loadPluginDirectory(entry, recurse - 1); } } function loadLocalFile(localFile) { var url = getURLSpecFromFile(localFile);