From 197ffe4af0b5e91e9e8628eb8c39fb94ac585dd0 Mon Sep 17 00:00:00 2001 From: "sayrer@gmail.com" Date: Tue, 11 Mar 2008 13:05:09 -0700 Subject: [PATCH 01/65] Bug 381357. Live bookmarks for feeds served as text/html don't load. r=gavin --- toolkit/components/feeds/src/FeedProcessor.js | 3 + .../places/tests/chrome/Makefile.in | 3 + .../places/tests/chrome/rss_as_html.rss | 27 +++++++ .../tests/chrome/rss_as_html.rss^headers^ | 2 + .../places/tests/chrome/test_381357.xul | 80 +++++++++++++++++++ 5 files changed, 115 insertions(+) create mode 100644 toolkit/components/places/tests/chrome/rss_as_html.rss create mode 100644 toolkit/components/places/tests/chrome/rss_as_html.rss^headers^ create mode 100644 toolkit/components/places/tests/chrome/test_381357.xul diff --git a/toolkit/components/feeds/src/FeedProcessor.js b/toolkit/components/feeds/src/FeedProcessor.js index 8df8eec3712..e23858550c0 100644 --- a/toolkit/components/feeds/src/FeedProcessor.js +++ b/toolkit/components/feeds/src/FeedProcessor.js @@ -1421,6 +1421,9 @@ FeedProcessor.prototype = { // The XMLReader will throw sensible exceptions if these get called // out of order. onStartRequest: function FP_onStartRequest(request, context) { + var channel = request.QueryInterface(Ci.nsIChannel); + if (channel) + channel.contentType = "application/xml"; this._reader.onStartRequest(request, context); }, diff --git a/toolkit/components/places/tests/chrome/Makefile.in b/toolkit/components/places/tests/chrome/Makefile.in index 1b2a4585dfb..4c987aa4bdb 100644 --- a/toolkit/components/places/tests/chrome/Makefile.in +++ b/toolkit/components/places/tests/chrome/Makefile.in @@ -47,12 +47,15 @@ include $(topsrcdir)/config/rules.mk _HTTP_FILES = \ sample_feed.atom \ bad_links.atom \ + rss_as_html.rss \ + rss_as_html.rss^headers^ \ $(NULL) _CHROME_FILES = \ test_371798.xul \ test_342484.xul \ test_341972a.xul \ + test_381357.xul \ $(NULL) libs:: $(_HTTP_FILES) diff --git a/toolkit/components/places/tests/chrome/rss_as_html.rss b/toolkit/components/places/tests/chrome/rss_as_html.rss new file mode 100644 index 00000000000..e8230503533 --- /dev/null +++ b/toolkit/components/places/tests/chrome/rss_as_html.rss @@ -0,0 +1,27 @@ + + + +sadfasdfasdfasfasdf +http://www.example.com +asdfasdfasdf.example.com +de +asdfasdfasdfasdf +Tue, 11 Mar 2008 18:52:52 +0100 +http://blogs.law.harvard.edu/tech/rss +10 + +The First Title +http://www.example.com/index.html +Tue, 11 Mar 2008 18:24:43 +0100 + + +askdlfjas;dfkjas;fkdj +

+]]> +
+aklsjdhfasdjfahasdfhj +http://foo.example.com/asdfasdf +
+
+
diff --git a/toolkit/components/places/tests/chrome/rss_as_html.rss^headers^ b/toolkit/components/places/tests/chrome/rss_as_html.rss^headers^ new file mode 100644 index 00000000000..04fbaa08fe9 --- /dev/null +++ b/toolkit/components/places/tests/chrome/rss_as_html.rss^headers^ @@ -0,0 +1,2 @@ +HTTP 200 OK +Content-Type: text/html diff --git a/toolkit/components/places/tests/chrome/test_381357.xul b/toolkit/components/places/tests/chrome/test_381357.xul new file mode 100644 index 00000000000..ac7aa0f8b8d --- /dev/null +++ b/toolkit/components/places/tests/chrome/test_381357.xul @@ -0,0 +1,80 @@ + + + + + + + + + + + + From e0ecaf93b4797d918b1a3aa713e9d28318da76dd Mon Sep 17 00:00:00 2001 From: "mozilla@weilbacher.org" Date: Tue, 11 Mar 2008 13:06:48 -0700 Subject: [PATCH 02/65] [OS/2] Bug 411573: Update the OS/2 ReadMe file with information on WPS support by using RWS --- browser/locales/en-US/os2/README.txt | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/browser/locales/en-US/os2/README.txt b/browser/locales/en-US/os2/README.txt index 63bf0cb21d0..c65d1a88327 100755 --- a/browser/locales/en-US/os2/README.txt +++ b/browser/locales/en-US/os2/README.txt @@ -77,6 +77,7 @@ problems and installation issues with Firefox. - Useful optional software The following packages enable additional features in Firefox. Download locations are listed below with a detailed description of the features. + + Remote Workplace Server (RWS), version 0.8 + Doodle's Screen Saver (DSSaver), version 1.8 or later ================================================================================ @@ -193,10 +194,33 @@ behavior of Firefox on OS/2: Use this to run two instances of Firefox simultaneously (like e.g. debug and optimized version). +- set MOZ_NO_RWS=1 + Use this to disable Remote Workplace Server support (see below). + Find more information on this topic and other tips on http://www.os2bbs.com/os2news/Warpzilla.html +Support for WPS objects in the browser +-------------------------------------- + +Firefox can make use of Rich Walsh's Remote Workplace Server (RWS) library to +access Workplace Shell objects from the browser. This allows helper applications +for downloaded files to be selected based on their default WPS association. In +addition, the WPS icons of files will be displayed in the download dialog and in +directory views. + +To enable this functionality, Firefox has to find the RWS DLLs. They have to be +located in a directory on the LIBPATH, in the Firefox directory, or already be +registered as a WPS class. For eComStation 2 this is already the case. If RWS +is not yet available on your system, download it from + http://hobbes.nmsu.edu/cgi-bin/h-search?key=rws08dll + +If RWS is found on the system, it is used by Firefox automatically. In case you +need to disable RWS support, create an environment variable MOZ_NO_RWS and set +it to 1. + + Idle timer for internal cleanups -------------------------------- From aa2caca4dd9637b78fc4bed5293d6f819d8c3328 Mon Sep 17 00:00:00 2001 From: "bhearsum@mozilla.com" Date: Tue, 11 Mar 2008 14:02:59 -0700 Subject: [PATCH 03/65] bug 422122: bootstrap.cfg updates for Fx20013 release. r=joduinn, patch=me --- tools/release/configs/fx-moz18-bootstrap.cfg | 22 ++++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tools/release/configs/fx-moz18-bootstrap.cfg b/tools/release/configs/fx-moz18-bootstrap.cfg index 17789546c5d..78236bc2374 100644 --- a/tools/release/configs/fx-moz18-bootstrap.cfg +++ b/tools/release/configs/fx-moz18-bootstrap.cfg @@ -1,16 +1,16 @@ -version = 2.0.0.12 -milestone = 1.8.1.12 +version = 2.0.0.13 +milestone = 1.8.1.13 # _RCn and _RELEASE will be appended as-needed -productTag = FIREFOX_2_0_0_12 +productTag = FIREFOX_2_0_0_13 # Branch name and pull dates to use for base tag branchTag = MOZILLA_1_8_BRANCH #RelbranchOverride = GECKO181_20080128_RELBRANCH -pullDate = 2008-02-01 20:00 PST -l10n_pullDate = 2008-01-28 16:00 PST -rc = 4 +pullDate = 2008-03-09 23:00 PDT +l10n_pullDate = 2008-03-09 23:00 PDT +rc = 1 # oldVersion and oldRc refer to the previous release -oldVersion = 2.0.0.11 -oldRc = 1 +oldVersion = 2.0.0.12 +oldRc = 4 appName = browser product = firefox # Absolute path to tinderbox build directory @@ -47,7 +47,7 @@ to = build@mozilla.org cc = nobody@mozilla.org patcherConfig = moz18-branch-patcher2.cfg # Tag to use for building MAR/MBSDIFF and other update tools -patcherToolsRev = UPDATE_PACKAGING_R1 +patcherToolsRev = UPDATE_PACKAGING_R2 linux_verifyConfig = moz18-firefox-linux.cfg win32_verifyConfig = moz18-firefox-win32.cfg macosx_verifyConfig = moz18-firefox-mac.cfg @@ -65,7 +65,7 @@ buildTree = MozillaRelease stagingUser = cltbld stagingServer = production-1.8-master.build.mozilla.org externalStagingUser = cltbld -externalStagingServer = stage.mozilla.org +externalStagingServer = stage-old.mozilla.org # where beta updates/builds go ftpServer = ftp.mozilla.org # where release updates/builds go @@ -75,7 +75,7 @@ sshUser = cltbld sshServer = production-1.8-master.build.mozilla.org # force 1.8 specific behavior useTalkback = 0 -symbolServer = stage.mozilla.org +symbolServer = stage-old.mozilla.org symbolServerUser = ffxbld symbolServerPath = /mnt/netapp/breakpad/symbols_ffx symbolServerKey = /home/cltbld/.ssh/ffxbld_dsa From 7dcf1e0ab8d58a190d31648feeac1dcf129a0cbd Mon Sep 17 00:00:00 2001 From: "dougt@meer.net" Date: Tue, 11 Mar 2008 14:31:34 -0700 Subject: [PATCH 04/65] Bug: 420928 default entry on win32+wince should be mainWCRTStartup r=bsmedberg, a=damons --- browser/app/Makefile.in | 2 +- toolkit/mozapps/update/src/updater/Makefile.in | 2 +- xulrunner/app/Makefile.in | 2 +- xulrunner/stub/Makefile.in | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/browser/app/Makefile.in b/browser/app/Makefile.in index 52526484d50..61777da6b96 100644 --- a/browser/app/Makefile.in +++ b/browser/app/Makefile.in @@ -157,7 +157,7 @@ include $(topsrcdir)/config/config.mk ifdef _MSC_VER # Always enter a Windows program through wmain, whether or not we're # a console application. -WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup +WIN32_EXE_LDFLAGS += -ENTRY:mainWCRTStartup endif ifndef BUILD_STATIC_LIBS diff --git a/toolkit/mozapps/update/src/updater/Makefile.in b/toolkit/mozapps/update/src/updater/Makefile.in index d020d6f4fe4..c5eb139f650 100644 --- a/toolkit/mozapps/update/src/updater/Makefile.in +++ b/toolkit/mozapps/update/src/updater/Makefile.in @@ -111,7 +111,7 @@ include $(topsrcdir)/config/rules.mk DEFINES += -DNS_NO_XPCOM ifdef _MSC_VER -WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup +WIN32_EXE_LDFLAGS += -ENTRY:mainWCRTStartup endif ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT))) diff --git a/xulrunner/app/Makefile.in b/xulrunner/app/Makefile.in index 14b859f6c3b..41957313f66 100644 --- a/xulrunner/app/Makefile.in +++ b/xulrunner/app/Makefile.in @@ -136,7 +136,7 @@ include $(topsrcdir)/config/config.mk ifdef _MSC_VER # Always enter a Windows program through wmain, whether or not we're # a console application. -WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup +WIN32_EXE_LDFLAGS += -ENTRY:mainWCRTStartup endif ifdef NS_TRACE_MALLOC diff --git a/xulrunner/stub/Makefile.in b/xulrunner/stub/Makefile.in index 880606808d7..19403be3890 100644 --- a/xulrunner/stub/Makefile.in +++ b/xulrunner/stub/Makefile.in @@ -94,7 +94,7 @@ endif include $(topsrcdir)/config/config.mk ifdef _MSC_VER -WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup +WIN32_EXE_LDFLAGS += -ENTRY:mainWCRTStartup endif include $(topsrcdir)/config/rules.mk From 5cc36da1894ffb997f1645b1d44cf4bb06864ca8 Mon Sep 17 00:00:00 2001 From: "edward.lee@engineering.uiuc.edu" Date: Tue, 11 Mar 2008 14:34:19 -0700 Subject: [PATCH 05/65] Bug 413093 - With "Remember what I've download" disabled/unchecked (browser.download.manager.retention set to 0), the Download Manager window remains open until clicked/focused. p=sdwilsh, r=Mardak, b-ff3=beltzner --- .../downloads/tests/browser/Makefile.in | 1 + .../tests/browser/browser_bug_413093.js | 174 ++++++++++++++++++ 2 files changed, 175 insertions(+) create mode 100644 toolkit/mozapps/downloads/tests/browser/browser_bug_413093.js diff --git a/toolkit/mozapps/downloads/tests/browser/Makefile.in b/toolkit/mozapps/downloads/tests/browser/Makefile.in index 00d8b20cf55..8a57e4a9ea0 100644 --- a/toolkit/mozapps/downloads/tests/browser/Makefile.in +++ b/toolkit/mozapps/downloads/tests/browser/Makefile.in @@ -52,6 +52,7 @@ _BROWSER_FILES = \ browser_bug_410289.js \ browser_bug_411172.js \ browser_bug_412360.js \ + browser_bug_413093.js \ browser_bug_413985.js \ browser_bug_416303.js \ $(NULL) diff --git a/toolkit/mozapps/downloads/tests/browser/browser_bug_413093.js b/toolkit/mozapps/downloads/tests/browser/browser_bug_413093.js new file mode 100644 index 00000000000..dc98b7aa87d --- /dev/null +++ b/toolkit/mozapps/downloads/tests/browser/browser_bug_413093.js @@ -0,0 +1,174 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Mozilla Corporation. + * Portions created by the Initial Developer are Copyright (C) 2008 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Shawn Wilsher (Original Author) + * Edward Lee + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +function bug413093obs() +{ + this.mDownload = null; + this.wasPaused = false; +} +bug413093obs.prototype = { + observe: function(aSubject, aTopic, aData) + { + if ("domwindowopened" == aTopic) { + let ww = Cc["@mozilla.org/embedcomp/window-watcher;1"]. + getService(Ci.nsIWindowWatcher); + ww.unregisterNotification(this); + + // If we opened before we were paused, we need to set up our proper state + // We also should not try to resume (we weren't paused!) + if (!this.wasPaused) { + dump("domwindowopened callback - not pausing or resuming\n"); + this.wasPaused = true; + return; + } + + dump("domwindowopened callback - resuming download\n"); + + // Resume the download now that UI is up and running + let dm = Cc["@mozilla.org/download-manager;1"]. + getService(Ci.nsIDownloadManager); + dm.resumeDownload(this.mDownload.id); + } else if ("timer-callback" == aTopic) { + this.setPref(false); + + let dmui = Cc["@mozilla.org/download-manager-ui;1"]. + getService(Ci.nsIDownloadManagerUI); + ok(!dmui.visible, "Download Manager UI is not showing"); + + finish(); + } + }, + + onDownloadStateChange: function(aOldState, aDownload) + { + if (aDownload.state == Ci.nsIDownloadManager.DOWNLOAD_DOWNLOADING && + !this.wasPaused) { + dump("onDownloadStateChange - pausing download\n"); + this.wasPaused = true; + + // Pause the download until the UI shows up + let dm = Cc["@mozilla.org/download-manager;1"]. + getService(Ci.nsIDownloadManager); + dm.pauseDownload(aDownload.id); + } + + if (aDownload.state == Ci.nsIDownloadManager.DOWNLOAD_FINISHED) { + aDownload.targetFile.remove(false); + + let dm = Cc["@mozilla.org/download-manager;1"]. + getService(Ci.nsIDownloadManager); + dm.removeListener(this); + + // We have to do this on a timer so other JS stuff that handles the UI + // can actually catch up to us... + let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); + timer.init(this, 1000, Ci.nsITimer.TYPE_ONE_SHOT); + } + }, + onStateChange: function(a, b, c, d, e) { }, + onProgressChange: function(a, b, c, d, e, f, g) { }, + onSecurityChange: function(a, b, c, d) { }, + + setPref: function(aDoTest) + { + let prefs = Cc["@mozilla.org/preferences-service;1"]. + getService(Ci.nsIPrefBranch); + + // If we're testing, set retention to auto-remove and auto-close + prefs.setIntPref("browser.download.manager.retention", aDoTest ? 0 : 2); + prefs.setBoolPref("browser.download.manager.closeWhenDone", aDoTest); + } +}; +function test() +{ + function addDownload() { + function createURI(aObj) { + let ios = Cc["@mozilla.org/network/io-service;1"]. + getService(Ci.nsIIOService); + return (aObj instanceof Ci.nsIFile) ? ios.newFileURI(aObj) : + ios.newURI(aObj, null, null); + } + + const nsIWBP = Ci.nsIWebBrowserPersist; + let persist = Cc["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"] + .createInstance(Ci.nsIWebBrowserPersist); + persist.persistFlags = nsIWBP.PERSIST_FLAGS_REPLACE_EXISTING_FILES | + nsIWBP.PERSIST_FLAGS_BYPASS_CACHE | + nsIWBP.PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION; + + let dirSvc = Cc["@mozilla.org/file/directory_service;1"]. + getService(Ci.nsIProperties); + let destFile = dirSvc.get("ProfD", Ci.nsIFile); + destFile.append("download.result"); + if (destFile.exists()) + destFile.remove(false); + + let src = createURI("http://example.com/httpd.js"); + let target = createURI(destFile); + let tr = Cc["@mozilla.org/transfer;1"].createInstance(Ci.nsITransfer); + tr.init(src, target, "test download", null, Math.round(Date.now() * 1000), + null, persist); + persist.progressListener = tr; + persist.saveURI(src, null, null, null, null, destFile); + } + + // First, we clear out the database + let dm = Cc["@mozilla.org/download-manager;1"]. + getService(Ci.nsIDownloadManager); + dm.DBConnection.executeSimpleSQL("DELETE FROM moz_downloads"); + + // See if the DM is already open, and if it is, close it! + let wm = Cc["@mozilla.org/appshell/window-mediator;1"]. + getService(Ci.nsIWindowMediator); + let win = wm.getMostRecentWindow("Download:Manager"); + if (win) + win.close(); + + let obs = new bug413093obs(); + dm.addListener(obs); + obs.setPref(true); + + // Start the test when the download manager window loads + let ww = Cc["@mozilla.org/embedcomp/window-watcher;1"]. + getService(Ci.nsIWindowWatcher); + ww.registerNotification(obs); + + addDownload(); + + waitForExplicitFinish(); +} From eeea24bde6eb67427dd05a6673377a0d17d7c405 Mon Sep 17 00:00:00 2001 From: "blassey@mozilla.com" Date: Tue, 11 Mar 2008 14:49:53 -0700 Subject: [PATCH 06/65] switching narrow char system calls to wide char in windows b=418703 r=bsmedberg r=dougt also looked at by stuart and roc a=beltzner and a=damon --- accessible/src/msaa/nsAccessNodeWrap.cpp | 2 +- accessible/src/msaa/nsAccessibleWrap.cpp | 2 +- browser/app/nsBrowserApp.cpp | 8 +- .../migration/src/nsIEProfileMigrator.cpp | 13 +- .../shell/src/nsWindowsShellService.cpp | 8 +- db/mork/src/morkFile.cpp | 10 - .../activex/src/plugin/LegacyPlugin.cpp | 3 +- .../activex/src/plugin/XPCDocument.cpp | 2 +- .../browser/activex/src/plugin/XPConnect.cpp | 2 +- extensions/auth/nsAuthSSPI.cpp | 34 ++- gfx/src/thebes/nsSystemFontsWin.cpp | 38 ++- gfx/src/thebes/nsSystemFontsWin.h | 5 +- gfx/src/windows/nsDeviceContextWin.cpp | 30 +-- gfx/src/windows/nsDeviceContextWin.h | 3 +- gfx/src/windows/nsFontMetricsWin.cpp | 35 +-- gfx/thebes/src/gfxWindowsFonts.cpp | 4 +- gfx/thebes/src/gfxWindowsSurface.cpp | 34 +-- intl/uconv/src/nsWinCharset.cpp | 6 +- ipc/ipcd/client/src/ipcConnectionWin.cpp | 2 +- .../decoders/icon/win/nsIconChannel.cpp | 33 +-- .../libpr0n/decoders/icon/win/nsIconChannel.h | 2 +- modules/oji/src/scd.cpp | 2 +- .../base/src/nsPluginDirServiceProvider.cpp | 229 +++++++++--------- modules/plugin/base/src/nsPluginHostImpl.cpp | 12 +- .../base/src/nsPluginNativeWindowWin.cpp | 10 +- modules/plugin/base/src/nsPluginsDirWin.cpp | 67 +++-- .../samples/default/windows/dialogs.cpp | 45 ++-- .../samples/default/windows/npshell.cpp | 14 +- .../plugin/samples/default/windows/plugin.cpp | 105 ++++---- .../plugin/samples/default/windows/plugin.h | 6 +- .../plugin/samples/default/windows/utils.cpp | 65 ++--- .../plugin/samples/default/windows/utils.h | 2 +- .../sdk/samples/basic/windows/plugin.cpp | 4 +- .../sdk/samples/scriptable/windows/plugin.cpp | 4 +- rdf/datasource/src/nsFileSystemDataSource.cpp | 7 +- .../components/startup/src/nsUserInfoWin.cpp | 9 +- uriloader/exthandler/win/nsMIMEInfoWin.cpp | 14 +- .../exthandler/win/nsOSHelperAppService.cpp | 4 +- widget/src/windows/nsAppShell.cpp | 14 +- widget/src/windows/nsBidiKeyboard.cpp | 31 +-- widget/src/windows/nsBidiKeyboard.h | 6 +- widget/src/windows/nsClipboard.cpp | 8 +- widget/src/windows/nsDataObj.h | 8 +- widget/src/windows/nsFilePicker.cpp | 8 +- widget/src/windows/nsLookAndFeel.cpp | 8 +- widget/src/windows/nsNativeThemeWin.cpp | 4 +- widget/src/windows/nsSound.cpp | 22 +- widget/src/windows/nsSound.h | 2 +- widget/src/windows/nsToolkit.cpp | 6 +- widget/src/windows/nsWindow.cpp | 34 +-- widget/src/windows/nsWindow.h | 7 + xpcom/base/nsDebugImpl.cpp | 27 ++- xpcom/base/nsStackWalk.cpp | 4 +- xpcom/io/SpecialSystemDirectory.cpp | 2 +- xpcom/io/nsLocalFileWin.cpp | 9 +- xpcom/threads/nsProcessCommon.cpp | 39 +-- xpcom/windbgdlg/Makefile.in | 2 + xpcom/windbgdlg/windbgdlg.cpp | 26 +- xpfe/bootstrap/showOSAlert.cpp | 14 +- 59 files changed, 566 insertions(+), 590 deletions(-) diff --git a/accessible/src/msaa/nsAccessNodeWrap.cpp b/accessible/src/msaa/nsAccessNodeWrap.cpp index 575a26485b8..96ebfdb0696 100644 --- a/accessible/src/msaa/nsAccessNodeWrap.cpp +++ b/accessible/src/msaa/nsAccessNodeWrap.cpp @@ -576,7 +576,7 @@ void nsAccessNodeWrap::InitAccessibility() } if (!gmUserLib) { - gmUserLib =::LoadLibrary("USER32.DLL"); + gmUserLib =::LoadLibraryW(L"USER32.DLL"); } if (gmUserLib) { diff --git a/accessible/src/msaa/nsAccessibleWrap.cpp b/accessible/src/msaa/nsAccessibleWrap.cpp index 036c72c47f7..3ec887a044e 100644 --- a/accessible/src/msaa/nsAccessibleWrap.cpp +++ b/accessible/src/msaa/nsAccessibleWrap.cpp @@ -156,7 +156,7 @@ STDMETHODIMP nsAccessibleWrap::AccessibleObjectFromWindow(HWND hwnd, { // open the dll dynamically if (!gmAccLib) - gmAccLib =::LoadLibrary("OLEACC.DLL"); + gmAccLib =::LoadLibraryW(L"OLEACC.DLL"); if (gmAccLib) { if (!gmAccessibleObjectFromWindow) diff --git a/browser/app/nsBrowserApp.cpp b/browser/app/nsBrowserApp.cpp index 0c867f701ff..6e7c518b366 100644 --- a/browser/app/nsBrowserApp.cpp +++ b/browser/app/nsBrowserApp.cpp @@ -64,11 +64,9 @@ static void Output(const char *fmt, ... ) va_start(ap, fmt); #if defined(XP_WIN) && !MOZ_WINCONSOLE - char msg[2048]; - - _vsnprintf(msg, sizeof(msg), fmt, ap); - - MessageBox(NULL, msg, "XULRunner", MB_OK | MB_ICONERROR); + PRUnichar msg[2048]; + _vsnwprintf(msg, sizeof(msg), NS_ConvertUTF8toUTF16(fmt).get(), ap); + MessageBoxW(NULL, msg, L"XULRunner", MB_OK | MB_ICONERROR); #else vfprintf(stderr, fmt, ap); #endif diff --git a/browser/components/migration/src/nsIEProfileMigrator.cpp b/browser/components/migration/src/nsIEProfileMigrator.cpp index 500d66caeaf..8db597a5566 100644 --- a/browser/components/migration/src/nsIEProfileMigrator.cpp +++ b/browser/components/migration/src/nsIEProfileMigrator.cpp @@ -867,7 +867,7 @@ nsIEProfileMigrator::CopyPasswords(PRBool aReplace) nsresult rv; nsVoidArray signonsFound; - HMODULE pstoreDLL = ::LoadLibrary("pstorec.dll"); + HMODULE pstoreDLL = ::LoadLibraryW(L"pstorec.dll"); if (!pstoreDLL) { // XXXben TODO // Need to figure out what to do here on Windows 98 etc... it may be that the key is universal read @@ -1177,7 +1177,7 @@ nsIEProfileMigrator::CopyFormData(PRBool aReplace) { HRESULT hr; - HMODULE pstoreDLL = ::LoadLibrary("pstorec.dll"); + HMODULE pstoreDLL = ::LoadLibraryW(L"pstorec.dll"); if (!pstoreDLL) { // XXXben TODO // Need to figure out what to do here on Windows 98 etc... it may be that the key is universal read @@ -1410,20 +1410,19 @@ nsIEProfileMigrator::ResolveShortcut(const nsString &aFileName, char** aOutURL) { HRESULT result; - IUniformResourceLocator* urlLink = nsnull; + IUniformResourceLocatorW* urlLink = nsnull; result = ::CoCreateInstance(CLSID_InternetShortcut, NULL, CLSCTX_INPROC_SERVER, - IID_IUniformResourceLocator, (void**)&urlLink); + IID_IUniformResourceLocatorW, (void**)&urlLink); if (SUCCEEDED(result) && urlLink) { IPersistFile* urlFile = nsnull; result = urlLink->QueryInterface(IID_IPersistFile, (void**)&urlFile); if (SUCCEEDED(result) && urlFile) { result = urlFile->Load(aFileName.get(), STGM_READ); if (SUCCEEDED(result) ) { - LPSTR lpTemp = nsnull; + LPWSTR lpTemp = nsnull; result = urlLink->GetURL(&lpTemp); if (SUCCEEDED(result) && lpTemp) { - *aOutURL = PL_strdup(lpTemp); - + *aOutURL = (char*)ToNewUTF8String(nsDependentString(lpTemp)); // free the string that GetURL alloc'd ::CoTaskMemFree(lpTemp); } diff --git a/browser/components/shell/src/nsWindowsShellService.cpp b/browser/components/shell/src/nsWindowsShellService.cpp index 65b58570062..30c716af3b0 100644 --- a/browser/components/shell/src/nsWindowsShellService.cpp +++ b/browser/components/shell/src/nsWindowsShellService.cpp @@ -396,8 +396,8 @@ nsWindowsShellService::SetDefaultBrowser(PRBool aClaimAllTypes, PRBool aForAllUs rv = appHelper->AppendNative(NS_LITERAL_CSTRING("helper.exe")); NS_ENSURE_SUCCESS(rv, rv); - nsCAutoString appHelperPath; - rv = appHelper->GetNativePath(appHelperPath); + nsAutoString appHelperPath; + rv = appHelper->GetPath(appHelperPath); NS_ENSURE_SUCCESS(rv, rv); if (aForAllUsers) { @@ -406,10 +406,10 @@ nsWindowsShellService::SetDefaultBrowser(PRBool aClaimAllTypes, PRBool aForAllUs appHelperPath.AppendLiteral(" /SetAsDefaultAppUser"); } - STARTUPINFO si = {sizeof(si), 0}; + STARTUPINFOW si = {sizeof(si), 0}; PROCESS_INFORMATION pi = {0}; - BOOL ok = CreateProcess(NULL, (LPSTR)appHelperPath.get(), NULL, NULL, + BOOL ok = CreateProcessW(NULL, (LPWSTR)appHelperPath.get(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); if (!ok) diff --git a/db/mork/src/morkFile.cpp b/db/mork/src/morkFile.cpp index 011056fa81b..a3167afa095 100644 --- a/db/mork/src/morkFile.cpp +++ b/db/mork/src/morkFile.cpp @@ -929,16 +929,6 @@ morkStdioFile::Steal(nsIMdbEnv* ev, nsIMdbFile* ioThief) void mork_fileflush(FILE * file) { fflush(file); -#ifndef WINCE - OSVERSIONINFOA vi = { sizeof(OSVERSIONINFOA) }; - if ((GetVersionExA(&vi) && vi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)) - { - // Win9x/ME - int fd = fileno(file); - HANDLE fh = (HANDLE)_get_osfhandle(fd); - FlushFileBuffers(fh); - } -#endif } #endif /*MORK_WIN*/ diff --git a/embedding/browser/activex/src/plugin/LegacyPlugin.cpp b/embedding/browser/activex/src/plugin/LegacyPlugin.cpp index 8ab3fe738dc..f0044c2217c 100644 --- a/embedding/browser/activex/src/plugin/LegacyPlugin.cpp +++ b/embedding/browser/activex/src/plugin/LegacyPlugin.cpp @@ -303,8 +303,7 @@ ShowError(MozAxPluginErrors errorCode, const CLSID &clsid) LPOLESTR szClsid; StringFromCLSID(clsid, &szClsid); _sntprintf(szBuffer, kBufSize - 1, - _T("Could not create the control %s. Check that it has been installed on your computer " - "and that this page correctly references it."), OLE2T(szClsid)); + _T("Could not create the control %s. Check that it has been installed on your computer and that this page correctly references it."), OLE2T(szClsid)); CoTaskMemFree(szClsid); szMsg = szBuffer; } diff --git a/embedding/browser/activex/src/plugin/XPCDocument.cpp b/embedding/browser/activex/src/plugin/XPCDocument.cpp index 1c6a9235ae0..60f9c86a6b6 100644 --- a/embedding/browser/activex/src/plugin/XPCDocument.cpp +++ b/embedding/browser/activex/src/plugin/XPCDocument.cpp @@ -1915,7 +1915,7 @@ END_COM_MAP() NS_SUCCEEDED(baseURI->GetSpec(spec))) { USES_CONVERSION; - if (FAILED(CreateURLMoniker(NULL, T2CW(spec.get()), &baseURLMoniker))) + if (FAILED(CreateURLMoniker(NULL, A2CW(spec.get()), &baseURLMoniker))) return E_UNEXPECTED; } } diff --git a/embedding/browser/activex/src/plugin/XPConnect.cpp b/embedding/browser/activex/src/plugin/XPConnect.cpp index c5dc232d467..0620194ed36 100644 --- a/embedding/browser/activex/src/plugin/XPConnect.cpp +++ b/embedding/browser/activex/src/plugin/XPConnect.cpp @@ -372,7 +372,7 @@ nsScriptablePeer::ConvertVariants(VARIANT *aIn, nsIVariant **aOut) { // do_CreateInstance macro is broken so load the component manager by // hand and get it to create the component. - HMODULE hlib = ::LoadLibrary("xpcom.dll"); + HMODULE hlib = ::LoadLibraryW(L"xpcom.dll"); if (hlib) { nsIComponentManager *pManager = nsnull; // A frozen interface, even in 1.0.x diff --git a/extensions/auth/nsAuthSSPI.cpp b/extensions/auth/nsAuthSSPI.cpp index ca70729e7c5..67ed8b0d91e 100644 --- a/extensions/auth/nsAuthSSPI.cpp +++ b/extensions/auth/nsAuthSSPI.cpp @@ -52,6 +52,8 @@ #include "nsNetCID.h" #include "nsCOMPtr.h" +#include + #define SEC_SUCCESS(Status) ((Status) >= 0) #ifndef KERB_WRAP_NO_ENCRYPT @@ -103,25 +105,25 @@ static const char *MapErrorCode(int rc) //----------------------------------------------------------------------------- static HINSTANCE sspi_lib; -static PSecurityFunctionTable sspi; +static PSecurityFunctionTableW sspi; static nsresult InitSSPI() { - PSecurityFunctionTable (*initFun)(void); + PSecurityFunctionTableW (*initFun)(void); LOG((" InitSSPI\n")); - sspi_lib = LoadLibrary("secur32.dll"); + sspi_lib = LoadLibraryW(L"secur32.dll"); if (!sspi_lib) { - sspi_lib = LoadLibrary("security.dll"); + sspi_lib = LoadLibraryW(L"security.dll"); if (!sspi_lib) { LOG(("SSPI library not found")); return NS_ERROR_UNEXPECTED; } } - initFun = (PSecurityFunctionTable (*)(void)) + initFun = (PSecurityFunctionTableW (*)(void)) GetProcAddress(sspi_lib, "InitSecurityInterfaceA"); if (!initFun) { LOG(("InitSecurityInterfaceA not found")); @@ -242,11 +244,9 @@ nsAuthSSPI::Init(const char *serviceName, if (NS_FAILED(rv)) return rv; } + SEC_WCHAR *package; - SEC_CHAR *package; - - package = (SEC_CHAR *) pTypeName[(int)mPackage]; - + package = (SEC_WCHAR *) pTypeName[(int)mPackage]; if (mPackage != PACKAGE_TYPE_NTLM) { rv = MakeSN(serviceName, mServiceName); @@ -257,8 +257,8 @@ nsAuthSSPI::Init(const char *serviceName, SECURITY_STATUS rc; - PSecPkgInfo pinfo; - rc = (sspi->QuerySecurityPackageInfo)(package, &pinfo); + PSecPkgInfoW pinfo; + rc = (sspi->QuerySecurityPackageInfoW)(package, &pinfo); if (rc != SEC_E_OK) { LOG(("%s package not found\n", package)); return NS_ERROR_UNEXPECTED; @@ -268,7 +268,7 @@ nsAuthSSPI::Init(const char *serviceName, TimeStamp useBefore; - rc = (sspi->AcquireCredentialsHandle)(NULL, + rc = (sspi->AcquireCredentialsHandleW)(NULL, package, SECPKG_CRED_OUTBOUND, NULL, @@ -336,15 +336,13 @@ nsAuthSSPI::GetNextToken(const void *inToken, if (!ob.pvBuffer) return NS_ERROR_OUT_OF_MEMORY; memset(ob.pvBuffer, 0, ob.cbBuffer); - - SEC_CHAR *sn; - + SEC_WCHAR *sn; if (mPackage == PACKAGE_TYPE_NTLM) sn = NULL; else - sn = (SEC_CHAR *) mServiceName.get(); + sn = (SEC_WCHAR *) mServiceName.get(); - rc = (sspi->InitializeSecurityContext)(&mCred, + rc = (sspi->InitializeSecurityContextW)(&mCred, ctxIn, sn, ctxReq, @@ -461,7 +459,7 @@ nsAuthSSPI::Wrap(const void *inToken, secBuffers bufs; SecPkgContext_Sizes sizes; - rc = (sspi->QueryContextAttributes)( + rc = (sspi->QueryContextAttributesW)( &mCtxt, SECPKG_ATTR_SIZES, &sizes); diff --git a/gfx/src/thebes/nsSystemFontsWin.cpp b/gfx/src/thebes/nsSystemFontsWin.cpp index f53f06ae102..40fc0aa8010 100644 --- a/gfx/src/thebes/nsSystemFontsWin.cpp +++ b/gfx/src/thebes/nsSystemFontsWin.cpp @@ -43,19 +43,13 @@ #include "nsSystemFontsWin.h" -nsresult nsSystemFontsWin::CopyLogFontToNSFont(HDC* aHDC, const LOGFONT* ptrLogFont, - nsString *aFontName, - gfxFontStyle *aFontStyle, - PRBool aIsWide) const +nsresult nsSystemFontsWin::CopyLogFontToNSFont(HDC* aHDC, const LOGFONTW* ptrLogFont, + nsString *aFontName, + gfxFontStyle *aFontStyle) const { PRUnichar name[LF_FACESIZE]; name[0] = 0; - if (aIsWide) - memcpy(name, ptrLogFont->lfFaceName, LF_FACESIZE*2); - else { - MultiByteToWideChar(CP_ACP, 0, ptrLogFont->lfFaceName, - strlen(ptrLogFont->lfFaceName) + 1, name, sizeof(name)/sizeof(name[0])); - } + memcpy(name, ptrLogFont->lfFaceName, LF_FACESIZE*sizeof(PRUnichar)); *aFontName = name; // Do Style @@ -85,7 +79,7 @@ nsresult nsSystemFontsWin::CopyLogFontToNSFont(HDC* aHDC, const LOGFONT* ptrLogF // round, but take into account whether it is negative float pixelHeight = -ptrLogFont->lfHeight; if (pixelHeight < 0) { - HFONT hFont = ::CreateFontIndirect(ptrLogFont); + HFONT hFont = ::CreateFontIndirectW(ptrLogFont); if (!hFont) return NS_ERROR_OUT_OF_MEMORY; HGDIOBJ hObject = ::SelectObject(*aHDC, hFont); @@ -116,32 +110,32 @@ nsresult nsSystemFontsWin::GetSysFontInfo(HDC aHDC, nsSystemFontID anID, { HGDIOBJ hGDI; - LOGFONT logFont; - LOGFONT* ptrLogFont = NULL; + LOGFONTW logFont; + LOGFONTW* ptrLogFont = NULL; #ifdef WINCE hGDI = ::GetStockObject(SYSTEM_FONT); if (hGDI == NULL) return NS_ERROR_UNEXPECTED; - if (::GetObject(hGDI, sizeof(logFont), &logFont) > 0) + if (::GetObjectW(hGDI, sizeof(logFont), &logFont) > 0) ptrLogFont = &logFont; #else - NONCLIENTMETRICS ncm; + NONCLIENTMETRICSW ncm; BOOL status; if (anID == eSystemFont_Icon) { - status = ::SystemParametersInfo(SPI_GETICONTITLELOGFONT, - sizeof(logFont), - (PVOID)&logFont, - 0); + status = ::SystemParametersInfoW(SPI_GETICONTITLELOGFONT, + sizeof(logFont), + (PVOID)&logFont, + 0); } else { - ncm.cbSize = sizeof(NONCLIENTMETRICS); - status = ::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, + ncm.cbSize = sizeof(NONCLIENTMETRICSW); + status = ::SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(ncm), (PVOID)&ncm, 0); @@ -196,7 +190,7 @@ nsresult nsSystemFontsWin::GetSysFontInfo(HDC aHDC, nsSystemFontID anID, hGDI = ::GetStockObject(DEFAULT_GUI_FONT); if (hGDI != NULL) { - if (::GetObject(hGDI, sizeof(logFont), &logFont) > 0) + if (::GetObjectW(hGDI, sizeof(logFont), &logFont) > 0) { ptrLogFont = &logFont; } diff --git a/gfx/src/thebes/nsSystemFontsWin.h b/gfx/src/thebes/nsSystemFontsWin.h index a8a047e0ed4..420abe840cf 100644 --- a/gfx/src/thebes/nsSystemFontsWin.h +++ b/gfx/src/thebes/nsSystemFontsWin.h @@ -50,9 +50,8 @@ public: nsresult GetSystemFont(nsSystemFontID anID, nsString *aFontName, gfxFontStyle *aFontStyle) const; private: - nsresult CopyLogFontToNSFont(HDC* aHDC, const LOGFONT* ptrLogFont, - nsString *aFontName, gfxFontStyle *aFontStyle, - PRBool aIsWide = PR_FALSE) const; + nsresult CopyLogFontToNSFont(HDC* aHDC, const LOGFONTW* ptrLogFont, + nsString *aFontName, gfxFontStyle *aFontStyle) const; nsresult GetSysFontInfo(HDC aHDC, nsSystemFontID anID, nsString *aFontName, gfxFontStyle *aFontStyle) const; diff --git a/gfx/src/windows/nsDeviceContextWin.cpp b/gfx/src/windows/nsDeviceContextWin.cpp index 28e15736360..3c150ac81c6 100644 --- a/gfx/src/windows/nsDeviceContextWin.cpp +++ b/gfx/src/windows/nsDeviceContextWin.cpp @@ -309,13 +309,13 @@ NS_IMETHODIMP nsDeviceContextWin :: SetCanonicalPixelScale(float aScale) } -nsresult nsDeviceContextWin::CopyLogFontToNSFont(HDC* aHDC, const LOGFONT* ptrLogFont, - nsFont* aFont, PRBool aIsWide) const +nsresult nsDeviceContextWin::CopyLogFontToNSFont(HDC* aHDC, const LOGFONTW* ptrLogFont, + nsFont* aFont) const { PRUnichar name[LF_FACESIZE]; name[0] = 0; if (aIsWide) - memcpy(name, ptrLogFont->lfFaceName, LF_FACESIZE*2); + memcpy(name, ptrLogFont->lfFaceName, LF_FACESIZE*sizeof(PRUnichar)); else { MultiByteToWideChar(CP_ACP, 0, ptrLogFont->lfFaceName, strlen(ptrLogFont->lfFaceName) + 1, name, sizeof(name)/sizeof(name[0])); @@ -360,7 +360,7 @@ nsresult nsDeviceContextWin::CopyLogFontToNSFont(HDC* aHDC, const LOGFONT* ptrLo // round, but take into account whether it is negative float pixelHeight = -ptrLogFont->lfHeight; if (pixelHeight < 0) { - HFONT hFont = ::CreateFontIndirect(ptrLogFont); + HFONT hFont = ::CreateFontIndirectW(ptrLogFont); if (!hFont) return NS_ERROR_OUT_OF_MEMORY; HGDIOBJ hObject = ::SelectObject(*aHDC, hFont); @@ -388,32 +388,32 @@ nsresult nsDeviceContextWin :: GetSysFontInfo(HDC aHDC, nsSystemFontID anID, nsF { HGDIOBJ hGDI; - LOGFONT logFont; - LOGFONT* ptrLogFont = NULL; + LOGFONTW logFont; + LOGFONTW* ptrLogFont = NULL; #ifdef WINCE hGDI = ::GetStockObject(SYSTEM_FONT); if (hGDI == NULL) return NS_ERROR_UNEXPECTED; - if (::GetObject(hGDI, sizeof(logFont), &logFont) > 0) + if (::GetObjectW(hGDI, sizeof(logFont), &logFont) > 0) ptrLogFont = &logFont; #else - NONCLIENTMETRICS ncm; + NONCLIENTMETRICSW ncm; BOOL status; if (anID == eSystemFont_Icon) { - status = ::SystemParametersInfo(SPI_GETICONTITLELOGFONT, - sizeof(logFont), - (PVOID)&logFont, - 0); + status = ::SystemParametersInfoW(SPI_GETICONTITLELOGFONT, + sizeof(logFont), + (PVOID)&logFont, + 0); } else { - ncm.cbSize = sizeof(NONCLIENTMETRICS); - status = ::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, + ncm.cbSize = sizeof(NONCLIENTMETRICSW); + status = ::SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(ncm), (PVOID)&ncm, 0); @@ -468,7 +468,7 @@ nsresult nsDeviceContextWin :: GetSysFontInfo(HDC aHDC, nsSystemFontID anID, nsF hGDI = ::GetStockObject(DEFAULT_GUI_FONT); if (hGDI != NULL) { - if (::GetObject(hGDI, sizeof(logFont), &logFont) > 0) + if (::GetObjectW(hGDI, sizeof(logFont), &logFont) > 0) { ptrLogFont = &logFont; } diff --git a/gfx/src/windows/nsDeviceContextWin.h b/gfx/src/windows/nsDeviceContextWin.h index 6a02af01b93..f4ce86c7f8e 100644 --- a/gfx/src/windows/nsDeviceContextWin.h +++ b/gfx/src/windows/nsDeviceContextWin.h @@ -101,8 +101,7 @@ protected: void ComputeFullAreaUsingScreen ( nsRect* outRect ) ; nsresult GetSysFontInfo(HDC aHDC, nsSystemFontID anID, nsFont* aFont) const; - nsresult CopyLogFontToNSFont(HDC* aHDC, const LOGFONT* ptrLogFont, nsFont* aFont, - PRBool aIsWide = PR_FALSE) const; + nsresult CopyLogFontToNSFont(HDC* aHDC, const LOGFONTW* ptrLogFont, nsFont* aFont) const; PRBool mCachedClientRect; PRBool mCachedFullRect; diff --git a/gfx/src/windows/nsFontMetricsWin.cpp b/gfx/src/windows/nsFontMetricsWin.cpp index d6fbf78a31e..c7c79134331 100644 --- a/gfx/src/windows/nsFontMetricsWin.cpp +++ b/gfx/src/windows/nsFontMetricsWin.cpp @@ -2121,40 +2121,9 @@ nsGlyphAgent::GetGlyphMetrics(HDC aDC, GLYPHMETRICS* aGlyphMetrics) { memset(aGlyphMetrics, 0, sizeof(GLYPHMETRICS)); // UMR: bug 46438 - if (eGlyphAgent_UNKNOWN == mState) { // first time we have been in this function - // see if this platform implements GetGlyphOutlineW() - DWORD len = GetGlyphOutlineW(aDC, aChar, GGO_METRICS, aGlyphMetrics, 0, nsnull, &mMat); - if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) { - // next time, we won't bother trying GetGlyphOutlineW() - mState = eGlyphAgent_ANSI; - } - else { - // all is well with GetGlyphOutlineW(), we will be using it from now on - mState = eGlyphAgent_UNICODE; - return len; - } - } + mState = eGlyphAgent_UNICODE; + return GetGlyphOutlineW(aDC, aChar, GGO_METRICS, aGlyphMetrics, 0, nsnull, &mMat); - if (eGlyphAgent_UNICODE == mState) { - return GetGlyphOutlineW(aDC, aChar, GGO_METRICS, aGlyphMetrics, 0, nsnull, &mMat); - } - - // Otherwise, we are on a platform that doesn't implement GetGlyphOutlineW() - // (see Q241358: The GetGlyphOutlineW Function Fails on Windows 95 & 98 - // http://support.microsoft.com/support/kb/articles/Q241/3/58.ASP) - // we will use glyph indices as a work around. - if (0 == aGlyphIndex) { // caller doesn't know the glyph index, so find it - nsAutoChar16Buffer buf; - if (NS_SUCCEEDED(GetGlyphIndices(aDC, nsnull, &aChar, 1, buf))) - aGlyphIndex = *(buf.Elements()); - } - if (0 < aGlyphIndex) { - return GetGlyphOutlineA(aDC, aGlyphIndex, GGO_METRICS | GGO_GLYPH_INDEX, aGlyphMetrics, 0, nsnull, &mMat); - } - - // if we ever reach here, something went wrong in GetGlyphIndices() above - // because the current font in aDC wasn't a Unicode font - return GDI_ERROR; } // the global glyph agent that we will be using diff --git a/gfx/thebes/src/gfxWindowsFonts.cpp b/gfx/thebes/src/gfxWindowsFonts.cpp index c20abc17104..63e3837cfe2 100644 --- a/gfx/thebes/src/gfxWindowsFonts.cpp +++ b/gfx/thebes/src/gfxWindowsFonts.cpp @@ -340,13 +340,13 @@ gfxWindowsFont::ComputeMetrics() // Cache the width of a single space. SIZE size; - GetTextExtentPoint32(dc, " ", 1, &size); + GetTextExtentPoint32W(dc, L" ", 1, &size); mMetrics->spaceWidth = ROUND(size.cx); mSpaceGlyph = 0; if (metrics.tmPitchAndFamily & TMPF_TRUETYPE) { WORD glyph; - DWORD ret = GetGlyphIndicesA(dc, " ", 1, &glyph, + DWORD ret = GetGlyphIndicesW(dc, L" ", 1, &glyph, GGI_MARK_NONEXISTING_GLYPHS); if (ret != GDI_ERROR && glyph != 0xFFFF) { mSpaceGlyph = glyph; diff --git a/gfx/thebes/src/gfxWindowsSurface.cpp b/gfx/thebes/src/gfxWindowsSurface.cpp index a2a7c8a636a..83cf0ff9533 100644 --- a/gfx/thebes/src/gfxWindowsSurface.cpp +++ b/gfx/thebes/src/gfxWindowsSurface.cpp @@ -168,27 +168,11 @@ gfxWindowsSurface::OptimizeToDDB(HDC dc, const gfxIntSize& size, gfxImageFormat return raw; } -static char* -GetACPString(const nsAString& aStr) -{ - int acplen = aStr.Length() * 2 + 1; - char * acp = new char[acplen]; - if(acp) { - int outlen = ::WideCharToMultiByte(CP_ACP, 0, - PromiseFlatString(aStr).get(), - aStr.Length(), - acp, acplen, NULL, NULL); - if (outlen > 0) - acp[outlen] = '\0'; // null terminate - } - return acp; -} - nsresult gfxWindowsSurface::BeginPrinting(const nsAString& aTitle, const nsAString& aPrintToFileName) { #define DOC_TITLE_LENGTH 30 - DOCINFO docinfo; + DOCINFOW docinfo; nsString titleStr; titleStr = aTitle; @@ -196,23 +180,21 @@ nsresult gfxWindowsSurface::BeginPrinting(const nsAString& aTitle, titleStr.SetLength(DOC_TITLE_LENGTH-3); titleStr.AppendLiteral("..."); } - char *title = GetACPString(titleStr); - - char *docName = nsnull; + nsPromiseFlatString flatTitleStr(titleStr); + const PRUnichar *title = (const PRUnichar*)(flatTitleStr.get()); + const PRUnichar *docName = nsnull; + nsPromiseFlatString printToFileNameStr(aPrintToFileName); if (!aPrintToFileName.IsEmpty()) { - docName = ToNewCString(aPrintToFileName); + docName = (const PRUnichar*)(printToFileNameStr.get()); } - docinfo.cbSize = sizeof(docinfo); - docinfo.lpszDocName = title ? title : "Mozilla Document"; + docinfo.lpszDocName = title ? title : L"Mozilla Document"; docinfo.lpszOutput = docName; docinfo.lpszDatatype = NULL; docinfo.fwType = 0; - ::StartDoc(mDC, &docinfo); + ::StartDocW(mDC, &docinfo); - delete [] title; - if (docName != nsnull) nsMemory::Free(docName); return NS_OK; } diff --git a/intl/uconv/src/nsWinCharset.cpp b/intl/uconv/src/nsWinCharset.cpp index c3eae316a33..6ae1c75b88f 100644 --- a/intl/uconv/src/nsWinCharset.cpp +++ b/intl/uconv/src/nsWinCharset.cpp @@ -133,7 +133,7 @@ nsPlatformCharset::GetDefaultCharsetForLocale(const nsAString& localeName, nsACS { nsCOMPtr winLocale; LCID localeAsLCID; - char acp_name[6]; + PRUnichar acp_name[6]; // // convert locale name to a code page (through the LCID) @@ -147,11 +147,11 @@ nsPlatformCharset::GetDefaultCharsetForLocale(const nsAString& localeName, nsACS rv = winLocale->GetPlatformLocale(localeName, &localeAsLCID); if (NS_FAILED(rv)) { return rv; } - if (GetLocaleInfo(localeAsLCID, LOCALE_IDEFAULTANSICODEPAGE, acp_name, sizeof(acp_name))==0) { + if (GetLocaleInfoW(localeAsLCID, LOCALE_IDEFAULTANSICODEPAGE, acp_name, sizeof(acp_name))==0) { return NS_ERROR_FAILURE; } nsAutoString acp_key(NS_LITERAL_STRING("acp.")); - acp_key.AppendWithConversion(acp_name); + acp_key.Append(acp_name); return MapToCharset(acp_key, oResult); } diff --git a/ipc/ipcd/client/src/ipcConnectionWin.cpp b/ipc/ipcd/client/src/ipcConnectionWin.cpp index 9a99c1956b5..b6ac516ff17 100644 --- a/ipc/ipcd/client/src/ipcConnectionWin.cpp +++ b/ipc/ipcd/client/src/ipcConnectionWin.cpp @@ -112,7 +112,7 @@ ipcThreadWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) cd.dwData = GetCurrentProcessId(); cd.cbData = (DWORD) msg->MsgLen(); cd.lpData = (PVOID) msg->MsgBuf(); - SendMessageA(ipcDaemonHwnd, WM_COPYDATA, (WPARAM) hWnd, (LPARAM) &cd); + SendMessage(ipcDaemonHwnd, WM_COPYDATA, (WPARAM) hWnd, (LPARAM) &cd); LOG((" done.\n")); delete msg; } diff --git a/modules/libpr0n/decoders/icon/win/nsIconChannel.cpp b/modules/libpr0n/decoders/icon/win/nsIconChannel.cpp index e0e896a57d1..d63219c19d7 100644 --- a/modules/libpr0n/decoders/icon/win/nsIconChannel.cpp +++ b/modules/libpr0n/decoders/icon/win/nsIconChannel.cpp @@ -63,6 +63,7 @@ #include #include #include +#include struct ICONFILEHEADER { PRUint16 ifhReserved; @@ -189,7 +190,7 @@ nsIconChannel::Open(nsIInputStream **_retval) return MakeInputStream(_retval, PR_FALSE); } -nsresult nsIconChannel::ExtractIconInfoFromUrl(nsIFile ** aLocalFile, PRUint32 * aDesiredImageSize, nsACString &aContentType, nsACString &aFileExtension) +nsresult nsIconChannel::ExtractIconInfoFromUrl(nsIFile ** aLocalFile, PRUint32 * aDesiredImageSize, nsCString &aContentType, nsCString &aFileExtension) { nsresult rv = NS_OK; nsCOMPtr iconURI (do_QueryInterface(mUrl, &rv)); @@ -236,29 +237,28 @@ NS_IMETHODIMP nsIconChannel::AsyncOpen(nsIStreamListener *aListener, nsISupports return rv; } -static DWORD GetSpecialFolderIcon(nsIFile* aFile, int aFolder, SHFILEINFO* aSFI, UINT aInfoFlags) +static DWORD GetSpecialFolderIcon(nsIFile* aFile, int aFolder, SHFILEINFOW* aSFI, UINT aInfoFlags) { DWORD shellResult = 0; if (!aFile) return shellResult; - char fileNativePath[MAX_PATH]; - nsCAutoString fileNativePathStr; - aFile->GetNativePath(fileNativePathStr); - ::GetShortPathName(fileNativePathStr.get(), fileNativePath, sizeof(fileNativePath)); + PRUnichar fileNativePath[MAX_PATH]; + nsAutoString fileNativePathStr; + aFile->GetPath(fileNativePathStr); + ::GetShortPathNameW(fileNativePathStr.get(), fileNativePath, sizeof(fileNativePath)); LPITEMIDLIST idList; HRESULT hr = ::SHGetSpecialFolderLocation(NULL, aFolder, &idList); if (SUCCEEDED(hr)) { - char specialNativePath[MAX_PATH]; - ::SHGetPathFromIDList(idList, specialNativePath); - ::GetShortPathName(specialNativePath, specialNativePath, sizeof(specialNativePath)); - - if (nsDependentCString(fileNativePath).EqualsIgnoreCase(specialNativePath)) { + PRUnichar specialNativePath[MAX_PATH]; + ::SHGetPathFromIDListW(idList, specialNativePath); + ::GetShortPathNameW(specialNativePath, specialNativePath, sizeof(specialNativePath)); + if (!wcsicmp(fileNativePath,specialNativePath)) { aInfoFlags |= (SHGFI_PIDL | SHGFI_SYSICONINDEX); - shellResult = ::SHGetFileInfo((LPCTSTR)(LPCITEMIDLIST)idList, 0, aSFI, - sizeof(SHFILEINFO), aInfoFlags); + shellResult = ::SHGetFileInfoW((LPCWSTR)(LPCITEMIDLIST)idList, 0, aSFI, + sizeof(SHFILEINFOW), aInfoFlags); IMalloc* pMalloc; hr = ::SHGetMalloc(&pMalloc); if (SUCCEEDED(hr)) { @@ -273,14 +273,14 @@ static DWORD GetSpecialFolderIcon(nsIFile* aFile, int aFolder, SHFILEINFO* aSFI, nsresult nsIconChannel::MakeInputStream(nsIInputStream** _retval, PRBool nonBlocking) { nsXPIDLCString contentType; - nsCAutoString filePath; + nsCString filePath; nsCOMPtr localFile; // file we want an icon for PRUint32 desiredImageSize; nsresult rv = ExtractIconInfoFromUrl(getter_AddRefs(localFile), &desiredImageSize, contentType, filePath); NS_ENSURE_SUCCESS(rv, rv); // if the file exists, we are going to use it's real attributes...otherwise we only want to use it for it's extension... - SHFILEINFO sfi; + SHFILEINFOW sfi; UINT infoFlags = SHGFI_ICON; PRBool fileExists = PR_FALSE; @@ -342,7 +342,8 @@ nsresult nsIconChannel::MakeInputStream(nsIInputStream** _retval, PRBool nonBloc // Not a special folder, or something else failed above. if (!shellResult) - shellResult = ::SHGetFileInfo(filePath.get(), FILE_ATTRIBUTE_ARCHIVE, &sfi, sizeof(sfi), infoFlags); + shellResult = ::SHGetFileInfoW(NS_ConvertUTF8toUTF16(filePath).get(), + FILE_ATTRIBUTE_ARCHIVE, &sfi, sizeof(sfi), infoFlags); if (shellResult && sfi.hIcon) { diff --git a/modules/libpr0n/decoders/icon/win/nsIconChannel.h b/modules/libpr0n/decoders/icon/win/nsIconChannel.h index bf59799ae8b..a69ea61c0d8 100644 --- a/modules/libpr0n/decoders/icon/win/nsIconChannel.h +++ b/modules/libpr0n/decoders/icon/win/nsIconChannel.h @@ -77,7 +77,7 @@ protected: nsCOMPtr mPump; nsCOMPtr mListener; - nsresult ExtractIconInfoFromUrl(nsIFile ** aLocalFile, PRUint32 * aDesiredImageSize, nsACString &aContentType, nsACString &aFileExtension); + nsresult ExtractIconInfoFromUrl(nsIFile ** aLocalFile, PRUint32 * aDesiredImageSize, nsCString &aContentType, nsCString &aFileExtension); nsresult MakeInputStream(nsIInputStream** _retval, PRBool nonBlocking); }; diff --git a/modules/oji/src/scd.cpp b/modules/oji/src/scd.cpp index 34e9925318f..6b49e7058fa 100644 --- a/modules/oji/src/scd.cpp +++ b/modules/oji/src/scd.cpp @@ -100,7 +100,7 @@ nsSymantecDebugManager::SetDebugAgentPassword(PRInt32 pwd) // ("SetWindowLong returned %ld (err=%d)\n", err, GetLastError())); /* continue so that we try to wake up the DebugManager */ } - sem = OpenSemaphore(SEMAPHORE_MODIFY_STATE, FALSE, "Netscape-Symantec Debugger"); + sem = OpenSemaphoreW(SEMAPHORE_MODIFY_STATE, FALSE, L"Netscape-Symantec Debugger"); if (sem) { ReleaseSemaphore(sem, 1, NULL); CloseHandle(sem); diff --git a/modules/plugin/base/src/nsPluginDirServiceProvider.cpp b/modules/plugin/base/src/nsPluginDirServiceProvider.cpp index db6e4c56bc0..89310077632 100644 --- a/modules/plugin/base/src/nsPluginDirServiceProvider.cpp +++ b/modules/plugin/base/src/nsPluginDirServiceProvider.cpp @@ -66,14 +66,14 @@ ClearVersion(verBlock *ver) } static BOOL -FileExists(LPCSTR szFile) +FileExists(wchar_t* szFile) { - return GetFileAttributes(szFile) != 0xFFFFFFFF; + return GetFileAttributesW(szFile) != 0xFFFFFFFF; } // Get file version information from a file static BOOL -GetFileVersion(LPSTR szFile, verBlock *vbVersion) +GetFileVersion(wchar_t* szFile, verBlock *vbVersion) { UINT uLen; UINT dwLen; @@ -86,12 +86,12 @@ GetFileVersion(LPSTR szFile, verBlock *vbVersion) ClearVersion(vbVersion); if (FileExists(szFile)) { bRv = TRUE; - dwLen = GetFileVersionInfoSize(szFile, &dwHandle); + dwLen = GetFileVersionInfoSizeW(szFile, &dwHandle); lpData = (LPVOID)malloc(dwLen); uLen = 0; - if (lpData && GetFileVersionInfo(szFile, dwHandle, dwLen, lpData) != 0) { - if (VerQueryValue(lpData, "\\", &lpBuffer, &uLen) != 0) { + if (lpData && GetFileVersionInfoW(szFile, dwHandle, dwLen, lpData) != 0) { + if (VerQueryValueW(lpData, L"\\", &lpBuffer, &uLen) != 0) { lpBuffer2 = (VS_FIXEDFILEINFO *)lpBuffer; vbVersion->wMajor = HIWORD(lpBuffer2->dwFileVersionMS); @@ -124,15 +124,15 @@ CopyVersion(verBlock *ver1, verBlock *ver2) static void TranslateVersionStr(const char* szVersion, verBlock *vbVersion) { - LPSTR szNum1 = NULL; - LPSTR szNum2 = NULL; - LPSTR szNum3 = NULL; - LPSTR szNum4 = NULL; - LPSTR szJavaBuild = NULL; + char* szNum1 = NULL; + char* szNum2 = NULL; + char* szNum3 = NULL; + char* szNum4 = NULL; + char* szJavaBuild = NULL; - char *strVer = nsnull; + char* strVer = nsnull; if (szVersion) { - strVer = PL_strdup(szVersion); + strVer = strdup(szVersion); } if (!strVer) { @@ -157,7 +157,7 @@ TranslateVersionStr(const char* szVersion, verBlock *vbVersion) vbVersion->wRelease = szNum3 ? atoi(szNum3) : 0; vbVersion->wBuild = szNum4 ? atoi(szNum4) : 0; - PL_strfree(strVer); + free(strVer); } // Compare two version struct, return zero if the same @@ -195,26 +195,28 @@ CompareVersion(verBlock vbVersionOld, verBlock vbVersionNew) // Indicate whether we should try to use the new NPRuntime-based Java // Plug-In if it's available static PRBool -TryToUseNPRuntimeJavaPlugIn(const char* javaVersion) +TryToUseNPRuntimeJavaPlugIn(const wchar_t* javaVersion) { HKEY javaKey = NULL; - char keyName[_MAX_PATH]; - keyName[0] = 0; - PL_strcat(keyName, "Software\\JavaSoft\\Java Plug-in\\"); - PL_strcat(keyName, javaVersion); + wchar_t keyName[_MAX_PATH]; + + wcsncpy(keyName, L"Software\\JavaSoft\\Java Plug-in\\", wcslen(L"Software\\JavaSoft\\Java Plug-in\\")); + wcscpy(keyName, javaVersion); + DWORD val; DWORD valSize = sizeof(DWORD); - if (ERROR_SUCCESS != ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, + if (ERROR_SUCCESS != ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, keyName, 0, KEY_READ, &javaKey)) { return FALSE; } // Look for "UseNewJavaPlugin" - if (ERROR_SUCCESS != ::RegQueryValueEx(javaKey, "UseNewJavaPlugin", - NULL, NULL, - (LPBYTE) &val, - &valSize)) { + if (ERROR_SUCCESS != ::RegQueryValueExW(javaKey, + L"UseNewJavaPlugin", + NULL, NULL, + (LPBYTE) &val, + &valSize)) { val = 0; } @@ -262,7 +264,7 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant, return rv; } - if (nsCRT::strcmp(prop, NS_WIN_4DOTX_SCAN_KEY) == 0) { + if (strcmp(prop, NS_WIN_4DOTX_SCAN_KEY) == 0) { // Check our prefs to see if scanning the 4.x folder has been // explictly overriden failure to get the pref is okay, we'll do // what we've been doing -- a filtered scan @@ -277,38 +279,38 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant, HKEY keyloc; long result; DWORD type; - char szKey[_MAX_PATH] = "Software\\Netscape\\Netscape Navigator"; - char path[_MAX_PATH]; + wchar_t szKey[_MAX_PATH] = L"Software\\Netscape\\Netscape Navigator"; + wchar_t path[_MAX_PATH]; - result = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, KEY_READ, &keyloc); + result = ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, szKey, 0, KEY_READ, &keyloc); if (result == ERROR_SUCCESS) { - char current_version[80]; + wchar_t current_version[80]; DWORD length = sizeof(current_version); - result = ::RegQueryValueEx(keyloc, "CurrentVersion", NULL, &type, + result = ::RegQueryValueExW(keyloc, L"CurrentVersion", NULL, &type, (LPBYTE)¤t_version, &length); ::RegCloseKey(keyloc); - PL_strcat(szKey, "\\"); - PL_strcat(szKey, current_version); - PL_strcat(szKey, "\\Main"); - result = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, KEY_READ, &keyloc); + wcscat(szKey, L"\\"); + wcscat(szKey, current_version); + wcscat(szKey, L"\\Main"); + result = ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, szKey, 0, KEY_READ, &keyloc); if (result == ERROR_SUCCESS) { DWORD pathlen = sizeof(path); - result = ::RegQueryValueEx(keyloc, "Plugins Directory", NULL, &type, + result = ::RegQueryValueExW(keyloc, L"Plugins Directory", NULL, &type, (LPBYTE)&path, &pathlen); if (result == ERROR_SUCCESS) { - rv = NS_NewNativeLocalFile(nsDependentCString(path), PR_TRUE, - getter_AddRefs(localFile)); + rv = NS_NewLocalFile(nsDependentString(path), PR_TRUE, + getter_AddRefs(localFile)); } ::RegCloseKey(keyloc); } } - } else if (nsCRT::strcmp(prop, NS_WIN_JRE_SCAN_KEY) == 0) { + } else if (strcmp(prop, NS_WIN_JRE_SCAN_KEY) == 0) { nsXPIDLCString strVer; #ifdef OJI if (NS_FAILED(prefs->GetCharPref(prop, getter_Copies(strVer)))) @@ -328,24 +330,25 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant, DWORD pathlen; verBlock maxVer; ClearVersion(&maxVer); - char curKey[_MAX_PATH] = "Software\\JavaSoft\\Java Runtime Environment"; - char path[_MAX_PATH]; + wchar_t curKey[_MAX_PATH] = L"Software\\JavaSoft\\Java Runtime Environment"; + wchar_t path[_MAX_PATH]; + // Add + 15 to prevent buffer overrun when adding \bin (+ optionally // \new_plugin) #define JAVA_PATH_SIZE _MAX_PATH + 15 - char newestPath[JAVA_PATH_SIZE]; - const char mozPath[_MAX_PATH] = "Software\\mozilla.org\\Mozilla"; - char browserJavaVersion[_MAX_PATH]; + wchar_t newestPath[JAVA_PATH_SIZE]; + const wchar_t mozPath[_MAX_PATH] = L"Software\\mozilla.org\\Mozilla"; + wchar_t browserJavaVersion[_MAX_PATH]; PRBool tryNPRuntimeJavaPlugIn = PR_FALSE; newestPath[0] = 0; - LONG result = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, curKey, 0, KEY_READ, + LONG result = ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, curKey, 0, KEY_READ, &baseloc); if (ERROR_SUCCESS != result) return NS_ERROR_FAILURE; // Look for "BrowserJavaVersion" - if (ERROR_SUCCESS != ::RegQueryValueEx(baseloc, "BrowserJavaVersion", NULL, + if (ERROR_SUCCESS != ::RegQueryValueExW(baseloc, L"BrowserJavaVersion", NULL, NULL, (LPBYTE)&browserJavaVersion, &numChars)) browserJavaVersion[0] = 0; @@ -356,13 +359,13 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant, path[0] = 0; numChars = _MAX_PATH; pathlen = sizeof(path); - result = ::RegEnumKeyEx(baseloc, index, curKey, &numChars, NULL, NULL, + result = ::RegEnumKeyExW(baseloc, index, curKey, &numChars, NULL, NULL, NULL, &modTime); index++; // Skip major.minor as it always points to latest in its family numChars = 0; - for (char *p = curKey; *p; p++) { + for (wchar_t *p = curKey; *p; p++) { // can I do this with wchar_t xxx? if (*p == '.') { numChars++; } @@ -371,24 +374,24 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant, continue; if (ERROR_SUCCESS == result) { - if (ERROR_SUCCESS == ::RegOpenKeyEx(baseloc, curKey, 0, + if (ERROR_SUCCESS == ::RegOpenKeyExW(baseloc, curKey, 0, KEY_QUERY_VALUE, &keyloc)) { // We have a sub key - if (ERROR_SUCCESS == ::RegQueryValueEx(keyloc, "JavaHome", NULL, + if (ERROR_SUCCESS == ::RegQueryValueExW(keyloc, L"JavaHome", NULL, &type, (LPBYTE)&path, &pathlen)) { verBlock curVer; - TranslateVersionStr(curKey, &curVer); + TranslateVersionStr(NS_ConvertUTF16toUTF8(curKey).get(), &curVer); if (CompareVersion(curVer, minVer) >= 0) { - if (!strncmp(browserJavaVersion, curKey, _MAX_PATH)) { - PL_strcpy(newestPath, path); + if (!wcsncmp(browserJavaVersion, curKey, _MAX_PATH)) { + wcscpy(newestPath, path); tryNPRuntimeJavaPlugIn = TryToUseNPRuntimeJavaPlugIn(curKey); ::RegCloseKey(keyloc); break; } if (CompareVersion(curVer, maxVer) >= 0) { - PL_strcpy(newestPath, path); + wcscpy(newestPath, path); CopyVersion(&maxVer, &curVer); tryNPRuntimeJavaPlugIn = TryToUseNPRuntimeJavaPlugIn(curKey); } @@ -404,20 +407,20 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant, // If nothing is found, then don't add \bin dir and don't set // CurrentVersion for Mozilla if (newestPath[0] != 0) { - if (ERROR_SUCCESS == ::RegCreateKeyEx(HKEY_LOCAL_MACHINE, mozPath, 0, + if (ERROR_SUCCESS == ::RegCreateKeyExW(HKEY_LOCAL_MACHINE, mozPath, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE|KEY_QUERY_VALUE, NULL, &entryloc, NULL)) { - if (ERROR_SUCCESS != ::RegQueryValueEx(entryloc, "CurrentVersion", 0, + if (ERROR_SUCCESS != ::RegQueryValueExW(entryloc, L"CurrentVersion", 0, NULL, NULL, NULL)) { - ::RegSetValueEx(entryloc, "CurrentVersion", 0, REG_SZ, + ::RegSetValueExW(entryloc, L"CurrentVersion", 0, REG_SZ, (const BYTE*)MOZILLA_VERSION, sizeof(MOZILLA_VERSION)); } ::RegCloseKey(entryloc); } - PL_strcat(newestPath,"\\bin"); + wcscat(newestPath,L"\\bin"); // See whether we should use the new NPRuntime-based Java Plug-In: // - If tryNPRuntimeJavaPlugIn is true, and @@ -427,13 +430,13 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant, // one any more. if (tryNPRuntimeJavaPlugIn) { // See whether the "new_plugin" directory exists - char tmpPath[JAVA_PATH_SIZE]; - PL_strcpy(tmpPath, newestPath); - PL_strcat(tmpPath, "\\new_plugin"); + wchar_t tmpPath[JAVA_PATH_SIZE]; + wcscpy(tmpPath, newestPath); + wcscat(tmpPath, L"\\new_plugin"); nsCOMPtr tmpFile; - if (NS_SUCCEEDED(NS_NewNativeLocalFile(nsDependentCString(tmpPath), - PR_TRUE, - getter_AddRefs(tmpFile))) && + if (NS_SUCCEEDED(NS_NewLocalFile(nsDependentString(tmpPath), + PR_TRUE, + getter_AddRefs(tmpFile))) && tmpFile) { PRBool exists = PR_FALSE; PRBool isDir = PR_FALSE; @@ -442,15 +445,15 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant, // Assume we're supposed to use this as the search // directory for the Java Plug-In instead of the normal // one - PL_strcpy(newestPath, tmpPath); + wcscpy(newestPath, tmpPath); } } } - rv = NS_NewNativeLocalFile(nsDependentCString(newestPath), PR_TRUE, - getter_AddRefs(localFile)); + rv = NS_NewLocalFile(nsDependentString(newestPath), PR_TRUE, + getter_AddRefs(localFile)); } - } else if (nsCRT::strcmp(prop, NS_WIN_QUICKTIME_SCAN_KEY) == 0) { + } else if (strcmp(prop, NS_WIN_QUICKTIME_SCAN_KEY) == 0) { nsXPIDLCString strVer; if (NS_FAILED(prefs->GetCharPref(prop, getter_Copies(strVer)))) return NS_ERROR_FAILURE; @@ -463,33 +466,33 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant, DWORD type; verBlock qtVer; ClearVersion(&qtVer); - char path[_MAX_PATH]; + wchar_t path[_MAX_PATH]; DWORD pathlen = sizeof(path); // First we need to check the version of Quicktime via checking // the EXE's version table - if (ERROR_SUCCESS == ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, "software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\QuickTimePlayer.exe", 0, KEY_READ, &keyloc)) { - if (ERROR_SUCCESS == ::RegQueryValueEx(keyloc, NULL, NULL, &type, - (LPBYTE)&path, &pathlen)) { - GetFileVersion((char*)path, &qtVer); + if (ERROR_SUCCESS == ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\QuickTimePlayer.exe", 0, KEY_READ, &keyloc)) { + if (ERROR_SUCCESS == ::RegQueryValueExW(keyloc, NULL, NULL, &type, + (LPBYTE)&path, &pathlen)) { + GetFileVersion(path, &qtVer); } ::RegCloseKey(keyloc); } if (CompareVersion(qtVer, minVer) < 0) return rv; - if (ERROR_SUCCESS == ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, "software\\Apple Computer, Inc.\\QuickTime", 0, KEY_READ, &keyloc)) { + if (ERROR_SUCCESS == ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"software\\Apple Computer, Inc.\\QuickTime", 0, KEY_READ, &keyloc)) { DWORD pathlen = sizeof(path); - result = ::RegQueryValueEx(keyloc, "InstallDir", NULL, &type, + result = ::RegQueryValueExW(keyloc, L"InstallDir", NULL, &type, (LPBYTE)&path, &pathlen); - PL_strcat(path, "\\Plugins"); + wcscat(path, L"\\Plugins"); if (result == ERROR_SUCCESS) - rv = NS_NewNativeLocalFile(nsDependentCString(path), PR_TRUE, - getter_AddRefs(localFile)); + rv = NS_NewLocalFile(nsDependentString(path), PR_TRUE, + getter_AddRefs(localFile)); ::RegCloseKey(keyloc); } - } else if (nsCRT::strcmp(prop, NS_WIN_WMP_SCAN_KEY) == 0) { + } else if (strcmp(prop, NS_WIN_WMP_SCAN_KEY) == 0) { nsXPIDLCString strVer; if (NS_FAILED(prefs->GetCharPref(prop, getter_Copies(strVer)))) return NS_ERROR_FAILURE; @@ -501,33 +504,33 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant, DWORD type; verBlock wmpVer; ClearVersion(&wmpVer); - char path[_MAX_PATH]; + wchar_t path[_MAX_PATH]; DWORD pathlen = sizeof(path); // First we need to check the version of WMP - if (ERROR_SUCCESS == ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, "software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\wmplayer.exe", 0, KEY_READ, &keyloc)) { - if (ERROR_SUCCESS == ::RegQueryValueEx(keyloc, NULL, NULL, &type, - (LPBYTE)&path, &pathlen)) { - GetFileVersion((char*)path, &wmpVer); + if (ERROR_SUCCESS == ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\wmplayer.exe", 0, KEY_READ, &keyloc)) { + if (ERROR_SUCCESS == ::RegQueryValueExW(keyloc, NULL, NULL, &type, + (LPBYTE)&path, &pathlen)) { + GetFileVersion(path, &wmpVer); } ::RegCloseKey(keyloc); } if (CompareVersion(wmpVer, minVer) < 0) return rv; - if (ERROR_SUCCESS == ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, - "software\\Microsoft\\MediaPlayer", 0, + if (ERROR_SUCCESS == ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, + L"software\\Microsoft\\MediaPlayer", 0, KEY_READ, &keyloc)) { - if (ERROR_SUCCESS == ::RegQueryValueEx(keyloc, "Installation Directory", + if (ERROR_SUCCESS == ::RegQueryValueExW(keyloc, L"Installation Directory", NULL, &type, (LPBYTE)&path, &pathlen)) { - rv = NS_NewNativeLocalFile(nsDependentCString(path), PR_TRUE, - getter_AddRefs(localFile)); + rv = NS_NewLocalFile(nsDependentString(path), PR_TRUE, + getter_AddRefs(localFile)); } ::RegCloseKey(keyloc); } - } else if (nsCRT::strcmp(prop, NS_WIN_ACROBAT_SCAN_KEY) == 0) { + } else if (strcmp(prop, NS_WIN_ACROBAT_SCAN_KEY) == 0) { nsXPIDLCString strVer; if (NS_FAILED(prefs->GetCharPref(prop, getter_Copies(strVer)))) { return NS_ERROR_FAILURE; @@ -546,16 +549,16 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant, DWORD pathlen; verBlock maxVer; ClearVersion(&maxVer); - char curKey[_MAX_PATH] = "software\\Adobe\\Acrobat Reader"; - char path[_MAX_PATH]; + wchar_t curKey[_MAX_PATH] = L"software\\Adobe\\Acrobat Reader"; + wchar_t path[_MAX_PATH]; // Add + 8 to prevent buffer overrun when adding \browser - char newestPath[_MAX_PATH + 8]; + wchar_t newestPath[_MAX_PATH + 8]; newestPath[0] = 0; - if (ERROR_SUCCESS != ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, curKey, 0, + if (ERROR_SUCCESS != ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, curKey, 0, KEY_READ, &baseloc)) { - PL_strcpy(curKey, "software\\Adobe\\Adobe Acrobat"); - if (ERROR_SUCCESS != ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, curKey, 0, + wcscpy(curKey, L"software\\Adobe\\Adobe Acrobat"); + if (ERROR_SUCCESS != ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, curKey, 0, KEY_READ, &baseloc)) { return NS_ERROR_FAILURE; } @@ -568,22 +571,22 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant, path[0] = 0; numChars = _MAX_PATH; pathlen = sizeof(path); - result = ::RegEnumKeyEx(baseloc, index, curKey, &numChars, NULL, NULL, + result = ::RegEnumKeyExW(baseloc, index, curKey, &numChars, NULL, NULL, NULL, &modTime); index++; if (ERROR_SUCCESS == result) { verBlock curVer; - TranslateVersionStr(curKey, &curVer); - PL_strcat(curKey, "\\InstallPath"); - if (ERROR_SUCCESS == ::RegOpenKeyEx(baseloc, curKey, 0, + TranslateVersionStr(NS_ConvertUTF16toUTF8(curKey).get(), &curVer); + wcscat(curKey, L"\\InstallPath"); + if (ERROR_SUCCESS == ::RegOpenKeyExW(baseloc, curKey, 0, KEY_QUERY_VALUE, &keyloc)) { // We have a sub key - if (ERROR_SUCCESS == ::RegQueryValueEx(keyloc, NULL, NULL, &type, + if (ERROR_SUCCESS == ::RegQueryValueExW(keyloc, NULL, NULL, &type, (LPBYTE)&path, &pathlen)) { if (CompareVersion(curVer, maxVer) >= 0 && CompareVersion(curVer, minVer) >= 0) { - PL_strcpy(newestPath, path); + wcscpy(newestPath, path); CopyVersion(&maxVer, &curVer); } } @@ -596,9 +599,9 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant, ::RegCloseKey(baseloc); if (newestPath[0] != 0) { - PL_strcat(newestPath,"\\browser"); - rv = NS_NewNativeLocalFile(nsDependentCString(newestPath), PR_TRUE, - getter_AddRefs(localFile)); + wcscat(newestPath, L"\\browser"); + rv = NS_NewLocalFile(nsDependentString(newestPath), PR_TRUE, + getter_AddRefs(localFile)); } } @@ -626,32 +629,32 @@ nsPluginDirServiceProvider::GetPLIDDirectories(nsISimpleEnumerator **aEnumerator nsresult nsPluginDirServiceProvider::GetPLIDDirectoriesWithHKEY(HKEY aKey, nsCOMArray &aDirs) { - char subkey[_MAX_PATH] = "Software\\MozillaPlugins"; + wchar_t subkey[_MAX_PATH] = L"Software\\MozillaPlugins"; HKEY baseloc; - if (ERROR_SUCCESS != ::RegOpenKeyEx(aKey, subkey, 0, KEY_READ, &baseloc)) + if (ERROR_SUCCESS != ::RegOpenKeyExW(aKey, subkey, 0, KEY_READ, &baseloc)) return NS_ERROR_FAILURE; DWORD index = 0; DWORD subkeylen = _MAX_PATH; FILETIME modTime; - while (ERROR_SUCCESS == ::RegEnumKeyEx(baseloc, index++, subkey, &subkeylen, + while (ERROR_SUCCESS == ::RegEnumKeyExW(baseloc, index++, subkey, &subkeylen, NULL, NULL, NULL, &modTime)) { subkeylen = _MAX_PATH; HKEY keyloc; - if (ERROR_SUCCESS == ::RegOpenKeyEx(baseloc, subkey, 0, KEY_QUERY_VALUE, + if (ERROR_SUCCESS == ::RegOpenKeyExW(baseloc, subkey, 0, KEY_QUERY_VALUE, &keyloc)) { DWORD type; - char path[_MAX_PATH]; + wchar_t path[_MAX_PATH]; DWORD pathlen = sizeof(path); - if (ERROR_SUCCESS == ::RegQueryValueEx(keyloc, "Path", NULL, &type, + if (ERROR_SUCCESS == ::RegQueryValueExW(keyloc, L"Path", NULL, &type, (LPBYTE)&path, &pathlen)) { nsCOMPtr localFile; - if (NS_SUCCEEDED(NS_NewNativeLocalFile(nsDependentCString(path), - PR_TRUE, - getter_AddRefs(localFile))) && + if (NS_SUCCEEDED(NS_NewLocalFile(nsDependentString(path), + PR_TRUE, + getter_AddRefs(localFile))) && localFile) { // Some vendors use a path directly to the DLL so chop off // the filename diff --git a/modules/plugin/base/src/nsPluginHostImpl.cpp b/modules/plugin/base/src/nsPluginHostImpl.cpp index e20cf13b8a5..aa1b905bd27 100644 --- a/modules/plugin/base/src/nsPluginHostImpl.cpp +++ b/modules/plugin/base/src/nsPluginHostImpl.cpp @@ -4052,18 +4052,18 @@ nsPluginHostImpl::TrySetUpPluginInstance(const char *aMimeType, #ifdef XP_WIN static BOOL firstJavaPlugin = FALSE; BOOL restoreOrigDir = FALSE; - char origDir[_MAX_PATH]; + PRUnichar origDir[_MAX_PATH]; if (isJavaPlugin && !firstJavaPlugin) { - DWORD dw = ::GetCurrentDirectory(_MAX_PATH, origDir); + DWORD dw = ::GetCurrentDirectoryW(_MAX_PATH, origDir); NS_ASSERTION(dw <= _MAX_PATH, "Falied to obtain the current directory, which may leads to incorrect class laoding"); nsCOMPtr binDirectory; result = NS_GetSpecialDirectory(NS_XPCOM_CURRENT_PROCESS_DIR, getter_AddRefs(binDirectory)); if (NS_SUCCEEDED(result)) { - nsCAutoString path; - binDirectory->GetNativePath(path); - restoreOrigDir = ::SetCurrentDirectory(path.get()); + nsAutoString path; + binDirectory->GetPath(path); + restoreOrigDir = ::SetCurrentDirectoryW(path.get()); } } #endif @@ -4071,7 +4071,7 @@ nsPluginHostImpl::TrySetUpPluginInstance(const char *aMimeType, #ifdef XP_WIN if (!firstJavaPlugin && restoreOrigDir) { - BOOL bCheck = ::SetCurrentDirectory(origDir); + BOOL bCheck = ::SetCurrentDirectoryW(origDir); NS_ASSERTION(bCheck, " Error restoring driectoy"); firstJavaPlugin = TRUE; } diff --git a/modules/plugin/base/src/nsPluginNativeWindowWin.cpp b/modules/plugin/base/src/nsPluginNativeWindowWin.cpp index 27b74b160d0..fc702c79108 100644 --- a/modules/plugin/base/src/nsPluginNativeWindowWin.cpp +++ b/modules/plugin/base/src/nsPluginNativeWindowWin.cpp @@ -62,7 +62,7 @@ static NS_DEFINE_CID(kCPluginManagerCID, NS_PLUGINMANAGER_CID); // needed for NS_TRY_SAFE_CALL -#define NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION "MozillaPluginWindowPropertyAssociation" +#define NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION L"MozillaPluginWindowPropertyAssociation" typedef nsTWeakRef PluginWindowWeakRef; @@ -203,7 +203,7 @@ NS_IMETHODIMP nsDelayedPopupsEnabledEvent::Run() */ static LRESULT CALLBACK PluginWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { - nsPluginNativeWindowWin * win = (nsPluginNativeWindowWin *)::GetProp(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION); + nsPluginNativeWindowWin * win = (nsPluginNativeWindowWin *)::GetPropW(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION); if (!win) return TRUE; @@ -526,10 +526,10 @@ nsresult nsPluginNativeWindowWin::SubclassAndAssociateWindow() if (!mPluginWinProc) return NS_ERROR_FAILURE; - nsPluginNativeWindowWin * win = (nsPluginNativeWindowWin *)::GetProp(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION); + nsPluginNativeWindowWin * win = (nsPluginNativeWindowWin *)::GetPropW(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION); NS_ASSERTION(!win || (win == this), "plugin window already has property and this is not us"); - if (!::SetProp(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION, (HANDLE)this)) + if (!::SetPropW(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION, (HANDLE)this)) return NS_ERROR_FAILURE; return NS_OK; @@ -543,7 +543,7 @@ nsresult nsPluginNativeWindowWin::UndoSubclassAndAssociateWindow() // remove window property HWND hWnd = (HWND)window; if (IsWindow(hWnd)) - ::RemoveProp(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION); + ::RemovePropW(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION); // restore the original win proc // but only do this if this were us last time diff --git a/modules/plugin/base/src/nsPluginsDirWin.cpp b/modules/plugin/base/src/nsPluginsDirWin.cpp index 35d07f9eaa0..97b31f2d2de 100644 --- a/modules/plugin/base/src/nsPluginsDirWin.cpp +++ b/modules/plugin/base/src/nsPluginsDirWin.cpp @@ -58,25 +58,18 @@ /* Local helper functions */ -static char* GetKeyValue(char* verbuf, char* key) +static char* GetKeyValue(wchar_t* verbuf, wchar_t* key) { - char *buf = NULL; + wchar_t *buf = NULL; UINT blen; - ::VerQueryValue(verbuf, - TEXT(key), + ::VerQueryValueW(verbuf, + key, (void **)&buf, &blen); if(buf != NULL) { -#ifdef WINCE - // On windows CE, the verbuf is wide and the shunt - // layer can't do much about it. So, here we - // convert the wide string. - return PL_strdup(NS_ConvertUTF16toUTF8((PRUnichar*)buf).get()); -#else - return PL_strdup(buf); -#endif + return strdup(NS_ConvertUTF16toUTF8(buf).get()); } return nsnull; @@ -216,35 +209,35 @@ nsresult nsPluginFile::LoadPlugin(PRLibrary* &outLibrary) if (!mPlugin) return NS_ERROR_NULL_POINTER; - nsCAutoString temp; - mPlugin->GetNativePath(temp); + nsAutoString temp; + mPlugin->GetPath(temp); - char* index; - char* pluginFolderPath = PL_strdup(temp.get()); + PRUnichar* index; + PRUnichar* pluginFolderPath = _wcsdup(temp.get()); - index = PL_strrchr(pluginFolderPath, '\\'); + index = wcsrchr(pluginFolderPath, '\\'); *index = 0; BOOL restoreOrigDir = FALSE; - char aOrigDir[MAX_PATH + 1]; - DWORD dwCheck = ::GetCurrentDirectory(sizeof(aOrigDir), aOrigDir); + PRUnichar aOrigDir[MAX_PATH + 1]; + DWORD dwCheck = ::GetCurrentDirectoryW(sizeof(aOrigDir), aOrigDir); NS_ASSERTION(dwCheck <= MAX_PATH + 1, "Error in Loading plugin"); if (dwCheck <= MAX_PATH + 1) { - restoreOrigDir = ::SetCurrentDirectory(pluginFolderPath); + restoreOrigDir = ::SetCurrentDirectoryW(pluginFolderPath); NS_ASSERTION(restoreOrigDir, "Error in Loading plugin"); } - outLibrary = PR_LoadLibrary(temp.get()); + outLibrary = PR_LoadLibrary(NS_ConvertUTF16toUTF8(temp).get()); if (restoreOrigDir) { - BOOL bCheck = ::SetCurrentDirectory(aOrigDir); + BOOL bCheck = ::SetCurrentDirectoryW(aOrigDir); NS_ASSERTION(bCheck, "Error in Loading plugin"); } - PL_strfree(pluginFolderPath); + free(pluginFolderPath); return NS_OK; } @@ -256,37 +249,39 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info) { nsresult res = NS_OK; DWORD zerome, versionsize; - char* verbuf = nsnull; + PRUnichar* verbuf = nsnull; - const char* path; + const PRUnichar* path; if (!mPlugin) return NS_ERROR_NULL_POINTER; - nsCAutoString temp; - mPlugin->GetNativePath(temp); + nsAutoString temp; + mPlugin->GetPath(temp); path = temp.get(); - versionsize = ::GetFileVersionInfoSize((char*)path, &zerome); + versionsize = ::GetFileVersionInfoSizeW(path, &zerome); if (versionsize > 0) - verbuf = (char *)PR_Malloc(versionsize); + verbuf = (wchar_t *)PR_Malloc(versionsize); if(!verbuf) return NS_ERROR_OUT_OF_MEMORY; - if(::GetFileVersionInfo((char*)path, NULL, versionsize, verbuf)) + if(::GetFileVersionInfoW(path, NULL, versionsize, verbuf)) { - info.fName = GetKeyValue(verbuf, "\\StringFileInfo\\040904E4\\ProductName"); - info.fDescription = GetKeyValue(verbuf, "\\StringFileInfo\\040904E4\\FileDescription"); + info.fName = GetKeyValue(verbuf, L"\\StringFileInfo\\040904E4\\ProductName"); + info.fDescription = GetKeyValue(verbuf, L"\\StringFileInfo\\040904E4\\FileDescription"); - char *mimeType = GetKeyValue(verbuf, "\\StringFileInfo\\040904E4\\MIMEType"); - char *mimeDescription = GetKeyValue(verbuf, "\\StringFileInfo\\040904E4\\FileOpenName"); - char *extensions = GetKeyValue(verbuf, "\\StringFileInfo\\040904E4\\FileExtents"); + char *mimeType = GetKeyValue(verbuf, L"\\StringFileInfo\\040904E4\\MIMEType"); + char *mimeDescription = GetKeyValue(verbuf, L"\\StringFileInfo\\040904E4\\FileOpenName"); + char *extensions = GetKeyValue(verbuf, L"\\StringFileInfo\\040904E4\\FileExtents"); info.fVariantCount = CalculateVariantCount(mimeType); info.fMimeTypeArray = MakeStringArray(info.fVariantCount, mimeType); info.fMimeDescriptionArray = MakeStringArray(info.fVariantCount, mimeDescription); info.fExtensionArray = MakeStringArray(info.fVariantCount, extensions); - info.fFileName = PL_strdup(path); + + // fFileName is narrow. fix? + info.fFileName = PL_strdup(NS_ConvertUTF16toUTF8(path).get()); PL_strfree(mimeType); PL_strfree(mimeDescription); diff --git a/modules/plugin/samples/default/windows/dialogs.cpp b/modules/plugin/samples/default/windows/dialogs.cpp index eae460d2dcb..4c8efb03f73 100644 --- a/modules/plugin/samples/default/windows/dialogs.cpp +++ b/modules/plugin/samples/default/windows/dialogs.cpp @@ -79,17 +79,18 @@ static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam) pPlugin->m_hWndDialog = hWnd; - char szString[512]; - LoadString(hInst, IDS_TITLE, szString, sizeof(szString)); - SetWindowText(hWnd, szString); + wchar_t szString[512]; + LoadStringW(hInst, IDS_TITLE, szString, sizeof(szString)); + SetWindowTextW(hWnd, szString); - LoadString(hInst, IDS_INFO, szString, sizeof(szString)); - SetDlgItemText(hWnd, IDC_STATIC_INFO, szString); + LoadStringW(hInst, IDS_INFO, szString, sizeof(szString)); + SetDlgItemTextW(hWnd, IDC_STATIC_INFO, szString); - SetDlgItemText(hWnd, IDC_STATIC_INFOTYPE, (LPSTR)pPlugin->m_pNPMIMEType); + // convert m_pNPMIMEType dougt + SetDlgItemTextA(hWnd, IDC_STATIC_INFOTYPE, pPlugin->m_pNPMIMEType); - LoadString(hInst, IDS_LOCATION, szString, sizeof(szString)); - SetDlgItemText(hWnd, IDC_STATIC_LOCATION, szString); + LoadStringW(hInst, IDS_LOCATION, szString, sizeof(szString)); + SetDlgItemTextW(hWnd, IDC_STATIC_LOCATION, szString); char contentTypeIsJava = 0; @@ -99,30 +100,36 @@ static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam) } if(pPlugin->m_szPageURL == NULL || contentTypeIsJava) - LoadString(hInst, IDS_FINDER_PAGE, szString, sizeof(szString)); + LoadStringW(hInst, IDS_FINDER_PAGE, szString, sizeof(szString)); else - strncpy(szString, pPlugin->m_szPageURL,511); // defect #362738 - + { + MultiByteToWideChar( CP_ACP, 0, + pPlugin->m_szPageURL, + strlen(pPlugin->m_szPageURL)+1, + szString, + 511 ); // defect #362738 + } + SetDlgItemTextWrapped(hWnd, IDC_STATIC_URL, szString); - LoadString(hInst, IDS_QUESTION, szString, sizeof(szString)); - SetDlgItemText(hWnd, IDC_STATIC_QUESTION, szString); + LoadStringW(hInst, IDS_QUESTION, szString, sizeof(szString)); + SetDlgItemTextW(hWnd, IDC_STATIC_QUESTION, szString); - SetDlgItemText(hWnd, IDC_STATIC_WARNING, ""); + SetDlgItemTextW(hWnd, IDC_STATIC_WARNING, L""); if(!pPlugin->m_bOnline) { EnableWindow(GetDlgItem(hWnd, IDC_GET_PLUGIN), FALSE); - LoadString(hInst, IDS_WARNING_OFFLINE, szString, sizeof(szString)); - SetDlgItemText(hWnd, IDC_STATIC_WARNING, szString); - SetDlgItemText(hWnd, IDC_STATIC_QUESTION, ""); + LoadStringW(hInst, IDS_WARNING_OFFLINE, szString, sizeof(szString)); + SetDlgItemTextW(hWnd, IDC_STATIC_WARNING, szString); + SetDlgItemTextW(hWnd, IDC_STATIC_QUESTION, L""); return TRUE; } if((!pPlugin->m_bJava) || (!pPlugin->m_bJavaScript) || (!pPlugin->m_bSmartUpdate)) { - LoadString(hInst, IDS_WARNING_JS, szString, sizeof(szString)); - SetDlgItemText(hWnd, IDC_STATIC_WARNING, szString); + LoadStringW(hInst, IDS_WARNING_JS, szString, sizeof(szString)); + SetDlgItemTextW(hWnd, IDC_STATIC_WARNING, szString); return TRUE; } diff --git a/modules/plugin/samples/default/windows/npshell.cpp b/modules/plugin/samples/default/windows/npshell.cpp index b7d2683d4a1..1525b84cc96 100644 --- a/modules/plugin/samples/default/windows/npshell.cpp +++ b/modules/plugin/samples/default/windows/npshell.cpp @@ -86,18 +86,18 @@ NPError NP_LOADDS NPP_New(NPMIMEType pluginType, for(int i = 0; i < argc; i++) { - if(lstrcmpi(argn[i],"pluginspage") == 0 && argv[i] != NULL) + if(strcmpi(argn[i],"pluginspage") == 0 && argv[i] != NULL) szPageURL = (char *)argv[i]; - else if(lstrcmpi(argn[i],"codebase") == 0 && argv[i] != NULL) + else if(strcmpi(argn[i],"codebase") == 0 && argv[i] != NULL) szPageURL = (char *)argv[i]; - else if(lstrcmpi(argn[i],"pluginurl") == 0 && argv[i] != NULL) + else if(strcmpi(argn[i],"pluginurl") == 0 && argv[i] != NULL) szFileURL = (char *)argv[i]; - else if(lstrcmpi(argn[i],"classid") == 0 && argv[i] != NULL) + else if(strcmpi(argn[i],"classid") == 0 && argv[i] != NULL) szFileURL = (char *)argv[i]; - else if(lstrcmpi(argn[i],"SRC") == 0 && argv[i] != NULL) + else if(strcmpi(argn[i],"SRC") == 0 && argv[i] != NULL) buf = (char *)argv[i]; - else if(lstrcmpi(argn[i],"HIDDEN") == 0 && argv[i] != NULL) - bHidden = (lstrcmp((char *)argv[i], "TRUE") == 0); + else if(strcmpi(argn[i],"HIDDEN") == 0 && argv[i] != NULL) + bHidden = (strcmp((char *)argv[i], "TRUE") == 0); } /* some post-processing on the filename to attempt to extract the extension: */ diff --git a/modules/plugin/samples/default/windows/plugin.cpp b/modules/plugin/samples/default/windows/plugin.cpp index c22de1023b4..2b5fac54d40 100644 --- a/modules/plugin/samples/default/windows/plugin.cpp +++ b/modules/plugin/samples/default/windows/plugin.cpp @@ -51,7 +51,7 @@ nsIServiceManager * gServiceManager = NULL; -static char szNullPluginWindowClassName[] = CLASS_NULL_PLUGIN; +static wchar_t szNullPluginWindowClassName[] = CLASS_NULL_PLUGIN; static LRESULT CALLBACK NP_LOADDS PluginWndProc(HWND, UINT, WPARAM, LPARAM); @@ -66,7 +66,7 @@ BOOL RegisterNullPluginWindowClass() { assert(hInst != NULL); - WNDCLASS wc; + WNDCLASSW wc; memset(&wc, 0, sizeof(wc)); @@ -78,14 +78,14 @@ BOOL RegisterNullPluginWindowClass() wc.hbrBackground = HBRUSH(COLOR_WINDOW + 1); wc.lpszClassName = szNullPluginWindowClassName; - ATOM aRet = RegisterClass(&wc); + ATOM aRet = RegisterClassW(&wc); return (aRet != NULL); } void UnregisterNullPluginWindowClass() { assert(hInst != NULL); - UnregisterClass(szNullPluginWindowClassName, hInst); + UnregisterClassW(szNullPluginWindowClassName, hInst); } /*********************************************/ @@ -129,41 +129,41 @@ CPlugin::CPlugin(HINSTANCE hInst, if(pluginType && *pluginType) { - m_pNPMIMEType = (NPMIMEType)new char[lstrlen((LPSTR)pluginType) + 1]; + m_pNPMIMEType = (NPMIMEType) new char[strlen(pluginType) + 1]; if(m_pNPMIMEType != NULL) - lstrcpy((LPSTR)m_pNPMIMEType, pluginType); + strcpy(m_pNPMIMEType, pluginType); } if(szPageURL && *szPageURL) { - m_szPageURL = new char[lstrlen(szPageURL) + 1]; + m_szPageURL = new char[strlen(szPageURL) + 1]; if(m_szPageURL != NULL) - lstrcpy(m_szPageURL, szPageURL); + strcpy(m_szPageURL, szPageURL); } if(szFileURL && *szFileURL) { - m_szFileURL = new char[lstrlen(szFileURL) + 1]; + m_szFileURL = new char[strlen(szFileURL) + 1]; if(m_szFileURL != NULL) - lstrcpy(m_szFileURL, szFileURL); + strcpy(m_szFileURL, szFileURL); } if(szFileExtension && *szFileExtension) { - m_szFileExtension = new char[lstrlen(szFileExtension) + 1]; + m_szFileExtension = new char[strlen(szFileExtension) + 1]; if(m_szFileExtension != NULL) - lstrcpy(m_szFileExtension, szFileExtension); + strcpy(m_szFileExtension, szFileExtension); } m_hIcon = LoadIcon(m_hInst, MAKEINTRESOURCE(IDI_PLUGICON)); - char szString[1024] = {'\0'}; - LoadString(m_hInst, IDS_CLICK_TO_GET, szString, sizeof(szString)); + wchar_t szString[1024] = {'\0'}; + LoadStringW(m_hInst, IDS_CLICK_TO_GET, szString, sizeof(szString)); if(*szString) { - m_szCommandMessage = new char[lstrlen(szString) + 1]; + m_szCommandMessage = new wchar_t[wcslen(szString) + 1]; if(m_szCommandMessage != NULL) - lstrcpy(m_szCommandMessage, szString); + wcscpy(m_szCommandMessage, szString); } } @@ -253,8 +253,8 @@ BOOL CPlugin::init(HWND hWndParent) RECT rcParent; GetClientRect(m_hWndParent, &rcParent); - CreateWindow(szNullPluginWindowClassName, - "NULL Plugin", + CreateWindowW(szNullPluginWindowClassName, + L"NULL Plugin", WS_CHILD, 0,0, rcParent.right, rcParent.bottom, m_hWndParent, @@ -332,10 +332,10 @@ LPSTR CPlugin::createURLString() // check if there is file URL first if(!m_bSmartUpdate && m_szFileURL != NULL) { - m_szURLString = new char[lstrlen(m_szFileURL) + 1]; + m_szURLString = new char[strlen(m_szFileURL) + 1]; if(m_szURLString == NULL) return NULL; - lstrcpy(m_szURLString, m_szFileURL); + strcpy(m_szURLString, m_szFileURL); return m_szURLString; } @@ -351,18 +351,18 @@ LPSTR CPlugin::createURLString() if(!m_bSmartUpdate && m_szPageURL != NULL && !contentTypeIsJava) { - szAddress = new char[lstrlen(m_szPageURL) + 1]; + szAddress = new char[strlen(m_szPageURL) + 1]; if(szAddress == NULL) return NULL; - lstrcpy(szAddress, m_szPageURL); + strcpy(szAddress, m_szPageURL); - m_szURLString = new char[lstrlen(szAddress) + 1 + lstrlen((LPSTR)m_pNPMIMEType) + 1]; + m_szURLString = new char[strlen(szAddress) + 1 + strlen(m_pNPMIMEType) + 1]; if(m_szURLString == NULL) return NULL; // Append the MIME type to the URL - wsprintf(m_szURLString, "%s?%s", szAddress, (LPSTR)m_pNPMIMEType); + sprintf(m_szURLString, "%s?%s", szAddress, (LPSTR)m_pNPMIMEType); } else // default { @@ -374,20 +374,20 @@ LPSTR CPlugin::createURLString() urlToOpen = szPageUrlForJVM; } - szAddress = new char[lstrlen(urlToOpen) + 1]; + szAddress = new char[strlen(urlToOpen) + 1]; if(szAddress == NULL) return NULL; - lstrcpy(szAddress, urlToOpen); + strcpy(szAddress, urlToOpen); - m_szURLString = new char[lstrlen(szAddress) + 10 + - lstrlen((LPSTR)m_pNPMIMEType) + 1]; + m_szURLString = new char[strlen(szAddress) + 10 + + strlen(m_pNPMIMEType) + 1]; if(m_szURLString == NULL) return NULL; // Append the MIME type to the URL - wsprintf(m_szURLString, "%s?mimetype=%s", - szAddress, (LPSTR)m_pNPMIMEType); + sprintf(m_szURLString, "%s?mimetype=%s", + szAddress, m_pNPMIMEType); } else { @@ -409,14 +409,15 @@ LPSTR CPlugin::createURLString() m_szFileURL[0] = '\0'; } - m_szURLString = new char[lstrlen(szPluginFinderCommandBeginning) + lstrlen(urlToOpen) + 10 + - lstrlen((LPSTR)m_pNPMIMEType) + 13 + - lstrlen((LPSTR)m_szPageURL) + 11 + - lstrlen((LPSTR)m_szFileURL) + - lstrlen(szPluginFinderCommandEnd) + 1]; - wsprintf(m_szURLString, "%s%s?mimetype=%s&pluginspage=%s&pluginurl=%s%s", - szPluginFinderCommandBeginning, urlToOpen, - (LPSTR)m_pNPMIMEType, m_szPageURL, m_szFileURL, szPluginFinderCommandEnd); + m_szURLString = new char[strlen(szPluginFinderCommandBeginning) + strlen(urlToOpen) + 10 + + strlen((LPSTR)m_pNPMIMEType) + 13 + + strlen((LPSTR)m_szPageURL) + 11 + + strlen((LPSTR)m_szFileURL) + + strlen(szPluginFinderCommandEnd) + 1]; + sprintf(m_szURLString, "%s%s?mimetype=%s&pluginspage=%s&pluginurl=%s%s", + szPluginFinderCommandBeginning, urlToOpen, + m_pNPMIMEType, m_szPageURL, m_szFileURL, + szPluginFinderCommandEnd); } } @@ -512,13 +513,13 @@ void CPlugin::getPlugin() m_szCommandMessage = NULL; } - char szString[1024] = {'\0'}; - LoadString(m_hInst, IDS_CLICK_WHEN_DONE, szString, sizeof(szString)); + wchar_t szString[1024] = {'\0'}; + LoadStringW(m_hInst, IDS_CLICK_WHEN_DONE, szString, sizeof(szString)); if(*szString) { - m_szCommandMessage = new char[lstrlen(szString) + 1]; + m_szCommandMessage = new wchar_t[wcslen(szString) + 1]; if(m_szCommandMessage != NULL) - lstrcpy(m_szCommandMessage, szString); + wcscpy(m_szCommandMessage, szString); } InvalidateRect(m_hWnd, NULL, TRUE); @@ -548,20 +549,20 @@ void CPlugin::URLNotify(const char * szURL) dbgOut2("CPlugin::URLNotify(), URL '%s'", szURL); NPStream * pStream = NULL; - char buf[256]; + wchar_t buf[256]; assert(m_hInst != NULL); assert(m_pNPInstance != NULL); - int iSize = LoadString(m_hInst, IDS_GOING2HTML, buf, sizeof(buf)); + int iSize = LoadStringW(m_hInst, IDS_GOING2HTML, buf, sizeof(buf)); NPError rc = NPN_NewStream(m_pNPInstance, "text/html", "asd_plugin_finder", &pStream); if (rc != NPERR_NO_ERROR) return; - //char buf[] = "\n\n\n

NPN_NewStream / NPN_Write - This seems to work.

\n\n\n"; + //wchar_t buf[] = L"\n\n\n

NPN_NewStream / NPN_Write - This seems to work.

\n\n\n"; - NPN_Write(m_pNPInstance, pStream, iSize, buf); + NPN_Write(m_pNPInstance, pStream, iSize, buf); // buf is unicode now. NPN_DestroyStream(m_pNPInstance, pStream, NPRES_DONE); } @@ -594,12 +595,12 @@ NPError CPlugin::destroyStream(NPStream *stream, NPError reason) BOOL CPlugin::readyToRefresh() { - char szString[1024] = {'\0'}; - LoadString(m_hInst, IDS_CLICK_WHEN_DONE, szString, sizeof(szString)); + wchar_t szString[1024] = {'\0'}; + LoadStringW(m_hInst, IDS_CLICK_WHEN_DONE, szString, sizeof(szString)); if(m_szCommandMessage == NULL) return FALSE; - return (lstrcmp(m_szCommandMessage, szString) == 0); + return (wcscmp(m_szCommandMessage, szString) == 0); } //*************************** @@ -626,7 +627,7 @@ void CPlugin::onRButtonUp(HWND hWnd, int x, int y, UINT keyFlags) NPN_GetURL(m_pNPInstance, "javascript:navigator.plugins.refresh(true)", "_self"); } -static void DrawCommandMessage(HDC hDC, LPSTR szString, LPRECT lprc) +static void DrawCommandMessage(HDC hDC, wchar_t* szString, LPRECT lprc) { if(szString == NULL) return; @@ -637,7 +638,7 @@ static void DrawCommandMessage(HDC hDC, LPSTR szString, LPRECT lprc) HFONT hFontOld = SelectFont(hDC, hFont); SIZE sz; - GetTextExtentPoint32(hDC, szString, lstrlen(szString), &sz); + GetTextExtentPoint32W(hDC, szString, wcslen(szString), &sz); POINT pt; pt.x = sz.cx; pt.y = sz.cy; @@ -659,7 +660,7 @@ static void DrawCommandMessage(HDC hDC, LPSTR szString, LPRECT lprc) int iModeOld = SetBkMode(hDC, TRANSPARENT); COLORREF crColorOld = SetTextColor(hDC, RGB(0,0,0)); - DrawText(hDC, szString, lstrlen(szString), &rcText, DT_CENTER|DT_VCENTER); + DrawTextW(hDC, szString, wcslen(szString), &rcText, DT_CENTER|DT_VCENTER); SetTextColor(hDC, crColorOld); SetBkMode(hDC, iModeOld); SelectFont(hDC, hFontOld); diff --git a/modules/plugin/samples/default/windows/plugin.h b/modules/plugin/samples/default/windows/plugin.h index 34961aa4369..21b6f45c50f 100644 --- a/modules/plugin/samples/default/windows/plugin.h +++ b/modules/plugin/samples/default/windows/plugin.h @@ -51,7 +51,7 @@ private: HICON m_hIcon; char* m_szURLString; - char* m_szCommandMessage; + wchar_t* m_szCommandMessage; BOOL m_bWaitingStreamFromPFS; NPStream* m_PFSStream; @@ -118,7 +118,7 @@ public: #define JVM_SMARTUPDATE_URL "http://java.com/download" #ifdef WIN32 -#define REGISTRY_PLACE "Software\\Netscape\\Netscape Navigator\\Default Plugin" +#define REGISTRY_PLACE L"Software\\Netscape\\Netscape Navigator\\Default Plugin" #else #define GWL_USERDATA 0 #define COLOR_3DSHADOW COLOR_BTNFACE @@ -126,7 +126,7 @@ public: #define COLOR_3DDKSHADOW COLOR_BTNSHADOW #endif -#define CLASS_NULL_PLUGIN "NullPluginClass" +#define CLASS_NULL_PLUGIN L"NullPluginClass" BOOL RegisterNullPluginWindowClass(); void UnregisterNullPluginWindowClass(); diff --git a/modules/plugin/samples/default/windows/utils.cpp b/modules/plugin/samples/default/windows/utils.cpp index 2371e71430c..01cf1f3928a 100644 --- a/modules/plugin/samples/default/windows/utils.cpp +++ b/modules/plugin/samples/default/windows/utils.cpp @@ -45,8 +45,8 @@ HKEY openRegistry() { HKEY phkResult; - if(RegCreateKey(HKEY_CURRENT_USER, REGISTRY_PLACE, &phkResult) != ERROR_SUCCESS) - MessageBox(0, "Error creating Default Plugin registry key", "Default Plugin", MB_OK); + if(RegCreateKeyW(HKEY_CURRENT_USER, REGISTRY_PLACE, &phkResult) != ERROR_SUCCESS) + MessageBoxW(0, L"Error creating Default Plugin registry key", L"Default Plugin", MB_OK); return phkResult; } @@ -56,30 +56,37 @@ BOOL IsNewMimeType(LPSTR mime) { HKEY hkey = openRegistry(); DWORD dwType, keysize = 512; - char keybuf[512]; + wchar_t keybuf[512]; + wchar_t wideMime[64]; - if(RegQueryValueEx(hkey, mime, 0, &dwType, (LPBYTE) &keybuf, &keysize) == ERROR_SUCCESS) + MultiByteToWideChar(CP_ACP, 0, + mime, + strlen(mime) + 1, + wideMime, + 64); + + if(RegQueryValueExW(hkey, wideMime, 0, &dwType, (LPBYTE) &keybuf, &keysize) == ERROR_SUCCESS) { // key exists, must have already been here... return FALSE; } else { - if(RegSetValueEx(hkey, mime, 0, REG_SZ, (LPBYTE) "(none)", 7) != ERROR_SUCCESS) - MessageBox(0, "Error adding MIME type value", "Default Plugin", MB_OK); + if(RegSetValueExW(hkey, wideMime, 0, REG_SZ, (LPBYTE) L"(none)", 7) != ERROR_SUCCESS) + MessageBoxW(0, L"Error adding MIME type value", L"Default Plugin", MB_OK); return TRUE; } } // string length in pixels for the specific window (selected font) -static int getWindowStringLength(HWND hWnd, LPSTR lpsz) +static int getWindowStringLength(HWND hWnd, wchar_t* lpsz) { SIZE sz; HDC hDC = GetDC(hWnd); HFONT hWindowFont = GetWindowFont(hWnd); HFONT hFontOld = SelectFont(hDC, hWindowFont); - GetTextExtentPoint32(hDC, lpsz, lstrlen(lpsz), &sz); + GetTextExtentPoint32W(hDC, lpsz, wcslen(lpsz), &sz); POINT pt; pt.x = sz.cx; pt.y = sz.cy; @@ -89,20 +96,20 @@ static int getWindowStringLength(HWND hWnd, LPSTR lpsz) return (int)pt.x; } -/****************************************************************/ -/* */ -/* void SetDlgItemTextWrapped(HWND hWnd, int iID, LPSTR szText) */ -/* */ -/* helper to wrap long lines in a static control, which do not */ -/* wrap automatically if they do not have space characters */ -/* */ -/****************************************************************/ -void SetDlgItemTextWrapped(HWND hWnd, int iID, LPSTR szText) +/*******************************************************************/ +/* */ +/* void SetDlgItemTextWrapped(HWND hWnd, int iID, wchar_t* szText) */ +/* */ +/* helper to wrap long lines in a static control, which do not */ +/* wrap automatically if they do not have space characters */ +/* */ +/*******************************************************************/ +void SetDlgItemTextWrapped(HWND hWnd, int iID, wchar_t* szText) { HWND hWndStatic = GetDlgItem(hWnd, iID); - if((szText == NULL) || (lstrlen(szText) == 0)) + if((szText == NULL) || (wcslen(szText) == 0)) { - SetDlgItemText(hWnd, iID, ""); + SetDlgItemTextW(hWnd, iID, L""); return; } @@ -114,7 +121,7 @@ void SetDlgItemTextWrapped(HWND hWnd, int iID, LPSTR szText) if(iStringLength <= iStaticLength) { - SetDlgItemText(hWnd, iID, szText); + SetDlgItemTextW(hWnd, iID, szText); return; } @@ -122,19 +129,19 @@ void SetDlgItemTextWrapped(HWND hWnd, int iID, LPSTR szText) if(iBreaks <= 0) return; - char * pBuf = new char[iStringLength + iBreaks + 1]; + wchar_t * pBuf = new wchar_t[iStringLength + iBreaks + 1]; if(pBuf == NULL) return; - lstrcpy(pBuf, ""); + wcscpy(pBuf, L""); int iStart = 0; int iLines = 0; for(int i = 0; i < iStringLength; i++) { - char * sz = &szText[iStart]; + wchar_t* sz = &szText[iStart]; int iIndex = i - iStart; - char ch = sz[iIndex + 1]; + wchar_t ch = sz[iIndex + 1]; sz[iIndex + 1] = '\0'; @@ -145,7 +152,7 @@ void SetDlgItemTextWrapped(HWND hWnd, int iID, LPSTR szText) sz[iIndex + 1] = ch; if(iLines == iBreaks) { - lstrcat(pBuf, sz); + wcscat(pBuf, sz); break; } continue; @@ -157,15 +164,15 @@ void SetDlgItemTextWrapped(HWND hWnd, int iID, LPSTR szText) ch = sz[iIndex]; sz[iIndex] = '\0'; // terminate string one char shorter - lstrcat(pBuf, sz); // append the string - lstrcat(pBuf, " "); // append space character for successful wrapping + wcscat(pBuf, sz); // append the string + wcscat(pBuf, L" "); // append space character for successful wrapping - iStart += lstrlen(sz);// shift new start position + iStart += wcslen(sz); // shift new start position sz[iIndex] = ch; // restore zeroed element iLines++; // count lines } - SetDlgItemText(hWnd, iID, pBuf); + SetDlgItemTextW(hWnd, iID, pBuf); delete [] pBuf; } diff --git a/modules/plugin/samples/default/windows/utils.h b/modules/plugin/samples/default/windows/utils.h index 1e1691d7828..a4b5a44443e 100644 --- a/modules/plugin/samples/default/windows/utils.h +++ b/modules/plugin/samples/default/windows/utils.h @@ -40,6 +40,6 @@ HKEY openRegistry(); BOOL IsNewMimeType(LPSTR szMimeType); -void SetDlgItemTextWrapped(HWND hWnd, int iID, LPSTR szText); +void SetDlgItemTextWrapped(HWND hWnd, int iID, wchar_t* szText); #endif // __UTILS_H__ diff --git a/modules/plugin/tools/sdk/samples/basic/windows/plugin.cpp b/modules/plugin/tools/sdk/samples/basic/windows/plugin.cpp index 8443ce501f0..923f6ef2ea1 100644 --- a/modules/plugin/tools/sdk/samples/basic/windows/plugin.cpp +++ b/modules/plugin/tools/sdk/samples/basic/windows/plugin.cpp @@ -146,11 +146,11 @@ static LRESULT CALLBACK PluginWinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM nsPluginInstance *plugin = (nsPluginInstance *)GetWindowLong(hWnd, GWL_USERDATA); if (plugin) { const char * string = plugin->getVersion(); - DrawText(hdc, string, strlen(string), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER); + DrawTextA(hdc, string, strlen(string), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER); } else { char string[] = "Error occured"; - DrawText(hdc, string, strlen(string), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER); + DrawTextA(hdc, string, strlen(string), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER); } EndPaint(hWnd, &ps); diff --git a/modules/plugin/tools/sdk/samples/scriptable/windows/plugin.cpp b/modules/plugin/tools/sdk/samples/scriptable/windows/plugin.cpp index 23d06902ccc..a2bed6b1802 100644 --- a/modules/plugin/tools/sdk/samples/scriptable/windows/plugin.cpp +++ b/modules/plugin/tools/sdk/samples/scriptable/windows/plugin.cpp @@ -220,10 +220,10 @@ static LRESULT CALLBACK PluginWinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM // get our plugin instance object and ask it for the version string nsPluginInstance *plugin = (nsPluginInstance *)GetWindowLong(hWnd, GWL_USERDATA); if (plugin) - DrawText(hdc, plugin->mString, strlen(plugin->mString), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER); + DrawTextA(hdc, plugin->mString, strlen(plugin->mString), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER); else { char string[] = "Error occured"; - DrawText(hdc, string, strlen(string), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER); + DrawTextA(hdc, string, strlen(string), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER); } EndPaint(hWnd, &ps); diff --git a/rdf/datasource/src/nsFileSystemDataSource.cpp b/rdf/datasource/src/nsFileSystemDataSource.cpp index cd1bf5eb8fc..d88221b77f2 100644 --- a/rdf/datasource/src/nsFileSystemDataSource.cpp +++ b/rdf/datasource/src/nsFileSystemDataSource.cpp @@ -928,14 +928,15 @@ FileSystemDataSource::GetVolumeList(nsISimpleEnumerator** aResult) #if defined (XP_WIN) && !defined (WINCE) PRInt32 driveType; - char drive[32]; + PRUnichar drive[32]; PRInt32 volNum; char *url; for (volNum = 0; volNum < 26; volNum++) { - sprintf(drive, "%c:\\", volNum + 'A'); - driveType = GetDriveType(drive); + swprintf( drive, L"%c:\\", volNum + (PRUnichar)'A'); + + driveType = GetDriveTypeW(drive); if (driveType != DRIVE_UNKNOWN && driveType != DRIVE_NO_ROOT_DIR) { if (nsnull != (url = PR_smprintf("file:///%c|/", volNum + 'A'))) diff --git a/toolkit/components/startup/src/nsUserInfoWin.cpp b/toolkit/components/startup/src/nsUserInfoWin.cpp index bbb16c7a099..4bdc29fa246 100644 --- a/toolkit/components/startup/src/nsUserInfoWin.cpp +++ b/toolkit/components/startup/src/nsUserInfoWin.cpp @@ -58,14 +58,13 @@ nsUserInfo::GetUsername(char **aUsername) { *aUsername = nsnull; - TCHAR username[256]; + PRUnichar username[256]; DWORD size = 256; - if (!GetUserName(username, &size)) + if (!GetUserNameW(username, &size)) return NS_ERROR_FAILURE; - - *aUsername = nsCRT::strdup(username); - + + *aUsername = ToNewUTF8String(nsDependentString(username)); if (*aUsername) return NS_OK; return NS_ERROR_FAILURE; diff --git a/uriloader/exthandler/win/nsMIMEInfoWin.cpp b/uriloader/exthandler/win/nsMIMEInfoWin.cpp index 2ed61c0e760..c4e2a59e41e 100755 --- a/uriloader/exthandler/win/nsMIMEInfoWin.cpp +++ b/uriloader/exthandler/win/nsMIMEInfoWin.cpp @@ -266,7 +266,7 @@ nsMIMEInfoWin::LoadUriInternal(nsIURI * aURL) SFGAOF sfgao; // Bug 394974 - HMODULE hDll = ::LoadLibrary("shell32.dll"); + HMODULE hDll = ::LoadLibraryW(L"shell32.dll"); MySHParseDisplayName pMySHParseDisplayName = NULL; // Version 6.0 and higher if (pMySHParseDisplayName = @@ -274,19 +274,19 @@ nsMIMEInfoWin::LoadUriInternal(nsIURI * aURL) "SHParseDisplayName")) { if (SUCCEEDED(pMySHParseDisplayName(NS_ConvertUTF8toUTF16(urlSpec).get(), NULL, &pidl, 0, &sfgao))) { - static const char cmdVerb[] = "open"; - SHELLEXECUTEINFO sinfo; + static const PRUnichar cmdVerb[] = L"open"; + SHELLEXECUTEINFOW sinfo; memset(&sinfo, 0, sizeof(SHELLEXECUTEINFO)); sinfo.cbSize = sizeof(SHELLEXECUTEINFO); sinfo.fMask = SEE_MASK_FLAG_DDEWAIT | SEE_MASK_FLAG_NO_UI | SEE_MASK_INVOKEIDLIST; sinfo.hwnd = NULL; - sinfo.lpVerb = (LPCSTR)&cmdVerb; + sinfo.lpVerb = (LPWSTR)&cmdVerb; sinfo.nShow = SW_SHOWNORMAL; sinfo.lpIDList = pidl; - BOOL result = ShellExecuteEx(&sinfo); + BOOL result = ShellExecuteExW(&sinfo); CoTaskMemFree(pidl); @@ -295,7 +295,9 @@ nsMIMEInfoWin::LoadUriInternal(nsIURI * aURL) } } else { // Version of shell32.dll < 6.0 - LONG r = (LONG) ::ShellExecute(NULL, "open", urlSpec.get(), NULL, NULL, + LONG r = (LONG) ::ShellExecuteW(NULL, L"open", + NS_ConvertUTF8toUTF16(urlSpec).get(), + NULL, NULL, SW_SHOWNORMAL); if (r < 32) rv = NS_ERROR_FAILURE; diff --git a/uriloader/exthandler/win/nsOSHelperAppService.cpp b/uriloader/exthandler/win/nsOSHelperAppService.cpp index bfe39446ec5..8d63241533b 100644 --- a/uriloader/exthandler/win/nsOSHelperAppService.cpp +++ b/uriloader/exthandler/win/nsOSHelperAppService.cpp @@ -145,11 +145,11 @@ nsresult nsOSHelperAppService::OSProtocolHandlerExists(const char * aProtocolSch if (aProtocolScheme && *aProtocolScheme) { HKEY hKey; - LONG err = ::RegOpenKeyEx(HKEY_CLASSES_ROOT, aProtocolScheme, 0, + LONG err = ::RegOpenKeyExA(HKEY_CLASSES_ROOT, aProtocolScheme, 0, KEY_QUERY_VALUE, &hKey); if (err == ERROR_SUCCESS) { - err = ::RegQueryValueEx(hKey, "URL Protocol", NULL, NULL, NULL, NULL); + err = ::RegQueryValueExW(hKey, L"URL Protocol", NULL, NULL, NULL, NULL); *aHandlerExists = (err == ERROR_SUCCESS); // close the key ::RegCloseKey(hKey); diff --git a/widget/src/windows/nsAppShell.cpp b/widget/src/windows/nsAppShell.cpp index 9b81af7060f..9dd15f5bfa2 100644 --- a/widget/src/windows/nsAppShell.cpp +++ b/widget/src/windows/nsAppShell.cpp @@ -93,13 +93,13 @@ nsresult nsAppShell::Init() { if (!sMsgId) - sMsgId = RegisterWindowMessage("nsAppShell:EventID"); + sMsgId = RegisterWindowMessageW(L"nsAppShell:EventID"); - WNDCLASS wc; + WNDCLASSW wc; HINSTANCE module = GetModuleHandle(NULL); - const char *const kWindowClass = "nsAppShell:EventWindowClass"; - if (!GetClassInfo(module, kWindowClass, &wc)) { + const PRUnichar *const kWindowClass = L"nsAppShell:EventWindowClass"; + if (!GetClassInfoW(module, kWindowClass, &wc)) { wc.style = 0; wc.lpfnWndProc = EventWindowProc; wc.cbClsExtra = 0; @@ -108,12 +108,12 @@ nsAppShell::Init() wc.hIcon = NULL; wc.hCursor = NULL; wc.hbrBackground = (HBRUSH) NULL; - wc.lpszMenuName = (LPCSTR) NULL; + wc.lpszMenuName = (LPCWSTR) NULL; wc.lpszClassName = kWindowClass; - RegisterClass(&wc); + RegisterClassW(&wc); } - mEventWnd = CreateWindow(kWindowClass, "nsAppShell:EventWindow", + mEventWnd = CreateWindowW(kWindowClass, L"nsAppShell:EventWindow", 0, 0, 0, 10, 10, NULL, NULL, module, NULL); NS_ENSURE_STATE(mEventWnd); diff --git a/widget/src/windows/nsBidiKeyboard.cpp b/widget/src/windows/nsBidiKeyboard.cpp index 03c7df9c72c..89e4ade8ad9 100644 --- a/widget/src/windows/nsBidiKeyboard.cpp +++ b/widget/src/windows/nsBidiKeyboard.cpp @@ -40,6 +40,7 @@ #include #include "nsBidiKeyboard.h" #include "prmem.h" +#include NS_IMPL_ISUPPORTS1(nsBidiKeyboard, nsIBidiKeyboard) @@ -63,8 +64,8 @@ NS_IMETHODIMP nsBidiKeyboard::SetLangFromBidiLevel(PRUint8 aLevel) return result; // call LoadKeyboardLayout() only if the target keyboard layout is different from the current - char currentLocaleName[KL_NAMELENGTH]; - strncpy(currentLocaleName, (aLevel & 1) ? mRTLKeyboard : mLTRKeyboard, KL_NAMELENGTH); + PRUnichar currentLocaleName[KL_NAMELENGTH]; + wcsncpy(currentLocaleName, (aLevel & 1) ? mRTLKeyboard : mLTRKeyboard, KL_NAMELENGTH); currentLocaleName[KL_NAMELENGTH-1] = '\0'; // null terminate NS_ASSERTION(*currentLocaleName, @@ -96,26 +97,26 @@ NS_IMETHODIMP nsBidiKeyboard::IsLangRTL(PRBool *aIsRTL) currentLocale = ::GetKeyboardLayout(0); *aIsRTL = IsRTLLanguage(currentLocale); - if (!::GetKeyboardLayoutName(mCurrentLocaleName)) + if (!::GetKeyboardLayoutNameW(mCurrentLocaleName)) return NS_ERROR_FAILURE; NS_ASSERTION(*mCurrentLocaleName, "GetKeyboardLayoutName return string length == 0"); - NS_ASSERTION((strlen(mCurrentLocaleName) < KL_NAMELENGTH), + NS_ASSERTION((wcslen(mCurrentLocaleName) < KL_NAMELENGTH), "GetKeyboardLayoutName return string length >= KL_NAMELENGTH"); // The language set by the user overrides the default language for that direction if (*aIsRTL) { - strncpy(mRTLKeyboard, mCurrentLocaleName, KL_NAMELENGTH); + wcsncpy(mRTLKeyboard, mCurrentLocaleName, KL_NAMELENGTH); mRTLKeyboard[KL_NAMELENGTH-1] = '\0'; // null terminate } else { - strncpy(mLTRKeyboard, mCurrentLocaleName, KL_NAMELENGTH); + wcsncpy(mLTRKeyboard, mCurrentLocaleName, KL_NAMELENGTH); mLTRKeyboard[KL_NAMELENGTH-1] = '\0'; // null terminate } - NS_ASSERTION((strlen(mRTLKeyboard) < KL_NAMELENGTH), + NS_ASSERTION((wcslen(mRTLKeyboard) < KL_NAMELENGTH), "mLTRKeyboard has string length >= KL_NAMELENGTH"); - NS_ASSERTION((strlen(mLTRKeyboard) < KL_NAMELENGTH), + NS_ASSERTION((wcslen(mLTRKeyboard) < KL_NAMELENGTH), "mRTLKeyboard has string length >= KL_NAMELENGTH"); return NS_OK; } @@ -132,7 +133,7 @@ nsresult nsBidiKeyboard::SetupBidiKeyboards() int keyboards; HKL far* buf; HKL locale; - char localeName[KL_NAMELENGTH]; + PRUnichar localeName[KL_NAMELENGTH]; PRBool isLTRKeyboardSet = PR_FALSE; PRBool isRTLKeyboardSet = PR_FALSE; @@ -156,11 +157,11 @@ nsresult nsBidiKeyboard::SetupBidiKeyboards() while (keyboards--) { locale = buf[keyboards]; if (IsRTLLanguage(locale)) { - sprintf(mRTLKeyboard, "%.*x", KL_NAMELENGTH - 1, LANGIDFROMLCID(locale)); + swprintf(mRTLKeyboard, L"%.*x", KL_NAMELENGTH - 1, LANGIDFROMLCID(locale)); isRTLKeyboardSet = PR_TRUE; } else { - sprintf(mLTRKeyboard, "%.*x", KL_NAMELENGTH - 1, LANGIDFROMLCID(locale)); + swprintf( mLTRKeyboard, L"%.*x", KL_NAMELENGTH - 1, LANGIDFROMLCID(locale)); isLTRKeyboardSet = PR_TRUE; } } @@ -178,20 +179,20 @@ nsresult nsBidiKeyboard::SetupBidiKeyboards() // installed this prevents us from arbitrarily resetting the current // layout (bug 80274) locale = ::GetKeyboardLayout(0); - if (!::GetKeyboardLayoutName(localeName)) + if (!::GetKeyboardLayoutNameW(localeName)) return NS_ERROR_FAILURE; NS_ASSERTION(*localeName, "GetKeyboardLayoutName return string length == 0"); - NS_ASSERTION((strlen(localeName) < KL_NAMELENGTH), + NS_ASSERTION((wcslen(localeName) < KL_NAMELENGTH), "GetKeyboardLayout return string length >= KL_NAMELENGTH"); if (IsRTLLanguage(locale)) { - strncpy(mRTLKeyboard, localeName, KL_NAMELENGTH); + swprintf(mRTLKeyboard, localeName, KL_NAMELENGTH); mRTLKeyboard[KL_NAMELENGTH-1] = '\0'; // null terminate } else { - strncpy(mLTRKeyboard, localeName, KL_NAMELENGTH); + swprintf( mLTRKeyboard, localeName, KL_NAMELENGTH); mLTRKeyboard[KL_NAMELENGTH-1] = '\0'; // null terminate } diff --git a/widget/src/windows/nsBidiKeyboard.h b/widget/src/windows/nsBidiKeyboard.h index 71a9a40962f..de859f5f680 100644 --- a/widget/src/windows/nsBidiKeyboard.h +++ b/widget/src/windows/nsBidiKeyboard.h @@ -58,9 +58,9 @@ protected: PRPackedBool mInitialized; PRPackedBool mHaveBidiKeyboards; - char mLTRKeyboard[KL_NAMELENGTH]; - char mRTLKeyboard[KL_NAMELENGTH]; - char mCurrentLocaleName[KL_NAMELENGTH]; + PRUnichar mLTRKeyboard[KL_NAMELENGTH]; + PRUnichar mRTLKeyboard[KL_NAMELENGTH]; + PRUnichar mCurrentLocaleName[KL_NAMELENGTH]; }; diff --git a/widget/src/windows/nsClipboard.cpp b/widget/src/windows/nsClipboard.cpp index 8c54fc79a41..8b515f674c9 100644 --- a/widget/src/windows/nsClipboard.cpp +++ b/widget/src/windows/nsClipboard.cpp @@ -70,7 +70,7 @@ // oddly, this isn't in the MSVC headers anywhere. -UINT nsClipboard::CF_HTML = ::RegisterClipboardFormat("HTML Format"); +UINT nsClipboard::CF_HTML = ::RegisterClipboardFormatW(L"HTML Format"); //------------------------------------------------------------------------- @@ -111,7 +111,9 @@ UINT nsClipboard::GetFormat(const char* aMimeStr) else if (strcmp(aMimeStr, kNativeHTMLMime) == 0) format = CF_HTML; else - format = ::RegisterClipboardFormat(aMimeStr); + format = ::RegisterClipboardFormatW(NS_ConvertASCIItoUTF16(aMimeStr).get()); + + return format; } @@ -316,7 +318,7 @@ nsresult nsClipboard::GetGlobalData(HGLOBAL aHGBL, void ** aData, PRUint32 * aLe ); // Display the string. - MessageBox( NULL, (const char *)lpMsgBuf, "GetLastError", MB_OK|MB_ICONINFORMATION ); + MessageBoxW( NULL, (LPCWSTR)lpMsgBuf, L"GetLastError", MB_OK|MB_ICONINFORMATION ); // Free the buffer. LocalFree( lpMsgBuf ); diff --git a/widget/src/windows/nsDataObj.h b/widget/src/windows/nsDataObj.h index 95f33d5f44a..226e3e38f24 100644 --- a/widget/src/windows/nsDataObj.h +++ b/widget/src/windows/nsDataObj.h @@ -82,10 +82,10 @@ IAsyncOperation : public IUnknown * See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/shell_basics/shell_basics_programming/transferring/clipboard.asp */ #ifndef CFSTR_INETURLA -#define CFSTR_INETURLA "UniformResourceLocator" +#define CFSTR_INETURLA L"UniformResourceLocator" #endif #ifndef CFSTR_INETURLW -#define CFSTR_INETURLW "UniformResourceLocatorW" +#define CFSTR_INETURLW L"UniformResourceLocatorW" #endif // For support of MinGW w32api v2.4. @@ -93,10 +93,10 @@ IAsyncOperation : public IUnknown // http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/winsup/w32api/include/shlobj.h?cvsroot=src // then that can be made the base required version and this code should be removed. #ifndef CFSTR_FILEDESCRIPTORA -# define CFSTR_FILEDESCRIPTORA "FileGroupDescriptor" +# define CFSTR_FILEDESCRIPTORA L"FileGroupDescriptor" #endif #ifndef CFSTR_FILEDESCRIPTORW -# define CFSTR_FILEDESCRIPTORW "FileGroupDescriptorW" +# define CFSTR_FILEDESCRIPTORW L"FileGroupDescriptorW" #endif #ifdef __MINGW32__ diff --git a/widget/src/windows/nsFilePicker.cpp b/widget/src/windows/nsFilePicker.cpp index bd68753e977..1b1c708c59a 100644 --- a/widget/src/windows/nsFilePicker.cpp +++ b/widget/src/windows/nsFilePicker.cpp @@ -280,10 +280,10 @@ NS_IMETHODIMP nsFilePicker::ShowW(PRInt16 *aReturnVal) #ifndef WINCE } catch(...) { - MessageBox(ofn.hwndOwner, - 0, - "The filepicker was unexpectedly closed by Windows.", - MB_ICONERROR); + MessageBoxW(ofn.hwndOwner, + 0, + L"The filepicker was unexpectedly closed by Windows.", + MB_ICONERROR); result = PR_FALSE; } #endif diff --git a/widget/src/windows/nsLookAndFeel.cpp b/widget/src/windows/nsLookAndFeel.cpp index c07094aa8dc..642a3515b9b 100644 --- a/widget/src/windows/nsLookAndFeel.cpp +++ b/widget/src/windows/nsLookAndFeel.cpp @@ -56,7 +56,7 @@ static CloseThemeDataPtr closeTheme = NULL; static GetThemeColorPtr getThemeColor = NULL; static IsAppThemedPtr isAppThemed = NULL; -static const char kThemeLibraryName[] = "uxtheme.dll"; +static const PRUnichar kThemeLibraryName[] = L"uxtheme.dll"; static HINSTANCE gThemeDLLInst = NULL; static HANDLE gMenuTheme = NULL; @@ -105,13 +105,13 @@ static PRInt32 GetSystemParam(long flag, PRInt32 def) nsLookAndFeel::nsLookAndFeel() : nsXPLookAndFeel() { #ifndef WINCE - gShell32DLLInst = LoadLibrary("Shell32.dll"); + gShell32DLLInst = LoadLibraryW(L"shell32.dll"); if (gShell32DLLInst) { gSHAppBarMessage = (SHAppBarMessagePtr) GetProcAddress(gShell32DLLInst, "SHAppBarMessage"); } - gThemeDLLInst = LoadLibrary(kThemeLibraryName); + gThemeDLLInst = LoadLibraryW(kThemeLibraryName); if(gThemeDLLInst) { openTheme = (OpenThemeDataPtr)GetProcAddress(gThemeDLLInst, "OpenThemeData"); @@ -504,7 +504,7 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric) if (gSHAppBarMessage) { // Get task bar window handle - HWND shellWindow = FindWindow("Shell_TrayWnd", NULL); + HWND shellWindow = FindWindowW(L"Shell_TrayWnd", NULL); if (shellWindow != NULL) { diff --git a/widget/src/windows/nsNativeThemeWin.cpp b/widget/src/windows/nsNativeThemeWin.cpp index b7e62e44e8c..3d4e5482d5e 100644 --- a/widget/src/windows/nsNativeThemeWin.cpp +++ b/widget/src/windows/nsNativeThemeWin.cpp @@ -287,7 +287,7 @@ static GetThemeSysFontPtr getThemeSysFont = NULL; static GetThemeColorPtr getThemeColor = NULL; static GetThemeMarginsPtr getThemeMargins = NULL; -static const char kThemeLibraryName[] = "uxtheme.dll"; +static const PRUnichar kThemeLibraryName[] = L"uxtheme.dll"; static inline bool IsCheckboxWidgetType(PRUint8 aWidgetType) { @@ -326,7 +326,7 @@ nsNativeThemeWin::nsNativeThemeWin() { mHeaderTheme = NULL; mMenuTheme = NULL; - mThemeDLL = ::LoadLibrary(kThemeLibraryName); + mThemeDLL = ::LoadLibraryW(kThemeLibraryName); if (mThemeDLL) { openTheme = (OpenThemeDataPtr)GetProcAddress(mThemeDLL, "OpenThemeData"); closeTheme = (CloseThemeDataPtr)GetProcAddress(mThemeDLL, "CloseThemeData"); diff --git a/widget/src/windows/nsSound.cpp b/widget/src/windows/nsSound.cpp index 552171cb9ff..aaa1eca2932 100644 --- a/widget/src/windows/nsSound.cpp +++ b/widget/src/windows/nsSound.cpp @@ -40,7 +40,7 @@ #include "nscore.h" #include "plstr.h" #include - +#include "nsString.h" #include // mmsystem.h is needed to build with WIN32_LEAN_AND_MEAN @@ -118,14 +118,16 @@ NS_IMETHODIMP nsSound::OnStreamComplete(nsIStreamLoader *aLoader, if (data && dataLen > 0) { DWORD flags = SND_MEMORY | SND_NODEFAULT; // We try to make a copy so we can play it async. - mLastSound = (PRUint8 *) malloc(dataLen); + mLastSound = (PRUnichar *) malloc(512); if (mLastSound) { - memcpy(mLastSound, data, dataLen); - data = mLastSound; - flags |= SND_ASYNC; + MultiByteToWideChar(CP_ACP,0, reinterpret_cast(data), dataLen,mLastSound, 256); + flags |= SND_ASYNC; + ::PlaySoundW(mLastSound, 0, flags); + }else{ +#ifndef WINCE + ::PlaySoundA(reinterpret_cast(data), 0, flags); +#endif } - - ::PlaySound(reinterpret_cast(data), 0, flags); } return NS_OK; @@ -166,12 +168,10 @@ NS_IMETHODIMP nsSound::PlaySystemSound(const nsAString &aSoundAlias) PurgeLastSound(); if (aSoundAlias.EqualsLiteral("_moz_mailbeep")) { - ::PlaySound("MailBeep", nsnull, SND_ALIAS | SND_ASYNC); + ::PlaySoundW(L"MailBeep", nsnull, SND_ALIAS | SND_ASYNC); } else { - nsCAutoString nativeSoundAlias; - NS_CopyUnicodeToNative(aSoundAlias, nativeSoundAlias); - ::PlaySound(nativeSoundAlias.get(), nsnull, SND_ALIAS | SND_ASYNC); + ::PlaySoundW(PromiseFlatString(aSoundAlias).get(), nsnull, SND_ALIAS | SND_ASYNC); } return NS_OK; diff --git a/widget/src/windows/nsSound.h b/widget/src/windows/nsSound.h index 0845814fdb9..395d2ef7d44 100644 --- a/widget/src/windows/nsSound.h +++ b/widget/src/windows/nsSound.h @@ -59,7 +59,7 @@ private: void PurgeLastSound(); private: - PRUint8* mLastSound; + PRUnichar* mLastSound; }; #endif /* __nsSound_h__ */ diff --git a/widget/src/windows/nsToolkit.cpp b/widget/src/windows/nsToolkit.cpp index dcd19615055..1e62d2941ee 100644 --- a/widget/src/windows/nsToolkit.cpp +++ b/widget/src/windows/nsToolkit.cpp @@ -264,7 +264,7 @@ nsToolkit::Startup(HMODULE hModule) typedef BOOL (*SetProcessDPIAwareFunc)(VOID); SetProcessDPIAwareFunc setDPIAware = (SetProcessDPIAwareFunc) - GetProcAddress(LoadLibrary("user32.dll"), + GetProcAddress(LoadLibraryW(L"user32.dll"), "SetProcessDPIAware"); if (setDPIAware) @@ -295,8 +295,8 @@ void nsToolkit::CreateInternalWindow(PRThread *aThread) // create the internal window // - mDispatchWnd = ::CreateWindow("nsToolkitClass", - "NetscapeDispatchWnd", + mDispatchWnd = ::CreateWindowW(L"nsToolkitClass", + L"NetscapeDispatchWnd", WS_DISABLED, -50, -50, 10, 10, diff --git a/widget/src/windows/nsWindow.cpp b/widget/src/windows/nsWindow.cpp index 7171815afff..f50ea230322 100644 --- a/widget/src/windows/nsWindow.cpp +++ b/widget/src/windows/nsWindow.cpp @@ -150,7 +150,7 @@ #include "prprf.h" #include "prmem.h" -static const char kMozHeapDumpMessageString[] = "MOZ_HeapDump"; +static const PRUnichar kMozHeapDumpMessageString[] = L"MOZ_HeapDump"; #define kWindowPositionSlop 20 @@ -699,7 +699,7 @@ nsWindow::nsWindow() : nsBaseWidget() // Heap dump #ifndef WINCE - nsWindow::uWM_HEAP_DUMP = ::RegisterWindowMessage(kMozHeapDumpMessageString); + nsWindow::uWM_HEAP_DUMP = ::RegisterWindowMessageW(kMozHeapDumpMessageString); #endif } @@ -1119,26 +1119,26 @@ nsWindow::EventIsInsideWindow(UINT Msg, nsWindow* aWindow) return (PRBool) PtInRect(&r, mp); } -static char sPropName[40] = ""; -static char* GetNSWindowPropName() { +static PRUnichar sPropName[40] = L""; +static PRUnichar* GetNSWindowPropName() { if (!*sPropName) { - _snprintf(sPropName, 39, "MozillansIWidgetPtr%p", _getpid()); + _snwprintf(sPropName, 39, L"MozillansIWidgetPtr%p", _getpid()); sPropName[39] = '\0'; } return sPropName; } nsWindow * nsWindow::GetNSWindowPtr(HWND aWnd) { - return (nsWindow *) ::GetPropA(aWnd, GetNSWindowPropName()); + return (nsWindow *) ::GetPropW(aWnd, GetNSWindowPropName()); } BOOL nsWindow::SetNSWindowPtr(HWND aWnd, nsWindow * ptr) { if (ptr == NULL) { - ::RemovePropA(aWnd, GetNSWindowPropName()); + ::RemovePropW(aWnd, GetNSWindowPropName()); return TRUE; } else { - return ::SetPropA(aWnd, GetNSWindowPropName(), (HANDLE)ptr); + return ::SetPropW(aWnd, GetNSWindowPropName(), (HANDLE)ptr); } } @@ -1788,7 +1788,7 @@ NS_IMETHODIMP nsWindow::SetSizeMode(PRInt32 aMode) { // Play the minimize sound while we're here, since that is also // forgotten when we use SW_SHOWMINIMIZED. - ::PlaySound("Minimize", nsnull, SND_ALIAS | SND_NODEFAULT | SND_ASYNC); + ::PlaySoundW(L"Minimize", nsnull, SND_ALIAS | SND_NODEFAULT | SND_ASYNC); } #endif break; @@ -5192,7 +5192,7 @@ LPCWSTR nsWindow::WindowPopupClassW() return className; } -LPCSTR nsWindow::WindowClass() +LPCTSTR nsWindow::WindowClass() { // Call into the wide version to make sure things get // registered properly. @@ -5200,7 +5200,9 @@ LPCSTR nsWindow::WindowClass() // XXX: The class name used here must be kept in sync with // the classname used in WindowClassW(); - +#ifdef UNICODE + return classNameW; +#else if (classNameW == kWClassNameHidden) { return kClassNameHidden; } @@ -5217,17 +5219,21 @@ LPCSTR nsWindow::WindowClass() return kClassNameContentFrame; } return kClassNameGeneral; +#endif } -LPCSTR nsWindow::WindowPopupClass() +LPCTSTR nsWindow::WindowPopupClass() { // Call into the wide version to make sure things get // registered properly. - WindowPopupClassW(); +#ifdef UNICODE + return WindowPopupClassW(); +#else // XXX: The class name used here must be kept in sync with // the classname used in WindowPopupClassW(); return "MozillaDropShadowWindowClass"; +#endif } //------------------------------------------------------------------------- @@ -7718,7 +7724,7 @@ STDMETHODIMP_(LRESULT) nsWindow::LresultFromObject(REFIID riid, WPARAM wParam, L { // open the dll dynamically if (!gmAccLib) - gmAccLib =::LoadLibrary("OLEACC.DLL"); + gmAccLib =::LoadLibraryW(L"OLEACC.DLL"); if (gmAccLib) { if (!gmLresultFromObject) diff --git a/widget/src/windows/nsWindow.h b/widget/src/windows/nsWindow.h index ecdaf4b0cf4..77167963ac7 100644 --- a/widget/src/windows/nsWindow.h +++ b/widget/src/windows/nsWindow.h @@ -105,6 +105,13 @@ const LPCSTR kClassNameContent = "MozillaContentWindowClass"; const LPCSTR kClassNameContentFrame = "MozillaContentFrameWindowClass"; const LPCSTR kClassNameGeneral = "MozillaWindowClass"; const LPCSTR kClassNameDialog = "MozillaDialogClass"; +const LPCTSTR kTClassNameHidden = TEXT("MozillaHiddenWindowClass"); +const LPCTSTR kTClassNameUI = TEXT("MozillaUIWindowClass"); +const LPCTSTR kTClassNameContent = TEXT("MozillaContentWindowClass"); +const LPCTSTR kTClassNameContentFrame = TEXT("MozillaContentFrameWindowClass"); +const LPCTSTR kTClassNameGeneral = TEXT("MozillaWindowClass"); +const LPCTSTR kTClassNameDialog = TEXT("MozillaDialogClass"); + /** * Native WIN32 window wrapper. diff --git a/xpcom/base/nsDebugImpl.cpp b/xpcom/base/nsDebugImpl.cpp index 6c7a7f3576a..fe7aa06a37c 100644 --- a/xpcom/base/nsDebugImpl.cpp +++ b/xpcom/base/nsDebugImpl.cpp @@ -66,6 +66,11 @@ #include #endif +#if defined(XP_WIN) +#include +#include "nsString.h" +#endif + static void Abort(const char *aMsg); @@ -97,7 +102,7 @@ PRBool InDebugger() #ifndef WINCE PRBool fReturn = PR_FALSE; LPFNISDEBUGGERPRESENT lpfnIsDebuggerPresent = NULL; - HINSTANCE hKernel = LoadLibrary("Kernel32.dll"); + HINSTANCE hKernel = LoadLibraryW(L"Kernel32.dll"); if(hKernel) { @@ -401,9 +406,9 @@ Break(const char *aMsg) * See http://bugzilla.mozilla.org/show_bug.cgi?id=54792 */ PROCESS_INFORMATION pi; - STARTUPINFO si; - char executable[MAX_PATH]; - char* pName; + STARTUPINFOW si; + PRUnichar executable[MAX_PATH]; + PRUnichar* pName; memset(&pi, 0, sizeof(pi)); @@ -412,13 +417,15 @@ Break(const char *aMsg) si.wShowWindow = SW_SHOW; // 2nd arg of CreateProcess is in/out - char *msgCopy = (char*) _alloca(strlen(aMsg) + 1); - strcpy(msgCopy, aMsg); + PRUnichar *msgCopy = (PRUnichar*) _alloca((strlen(aMsg) + 1)*sizeof(PRUnichar)); + wcscpy(msgCopy , (PRUnichar*)NS_ConvertUTF8toUTF16(aMsg).get()); - if(GetModuleFileName(GetModuleHandle("xpcom.dll"), executable, MAX_PATH) && - NULL != (pName = strrchr(executable, '\\')) && - NULL != strcpy(pName+1, "windbgdlg.exe") && - CreateProcess(executable, msgCopy, NULL, NULL, PR_FALSE, + if(GetModuleFileNameW(GetModuleHandleW(L"xpcom.dll"), (LPWCH)executable, MAX_PATH) && + NULL != (pName = wcsrchr(executable, '\\')) && + NULL != + wcscpy((WCHAR*) + pName+1, L"windbgdlg.exe") && + CreateProcessW((LPCWSTR)executable, (LPWSTR)msgCopy, NULL, NULL, PR_FALSE, DETACHED_PROCESS | NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi)) { WaitForSingleObject(pi.hProcess, INFINITE); diff --git a/xpcom/base/nsStackWalk.cpp b/xpcom/base/nsStackWalk.cpp index 5a2059e35eb..3e26d76681e 100644 --- a/xpcom/base/nsStackWalk.cpp +++ b/xpcom/base/nsStackWalk.cpp @@ -328,9 +328,9 @@ EnsureImageHlpInitialized() ::InitializeCriticalSection(&gDbgHelpCS); - HMODULE module = ::LoadLibrary("DBGHELP.DLL"); + HMODULE module = ::LoadLibraryW(L"DBGHELP.DLL"); if (!module) { - module = ::LoadLibrary("IMAGEHLP.DLL"); + module = ::LoadLibraryW(L"IMAGEHLP.DLL"); if (!module) return PR_FALSE; } diff --git a/xpcom/io/SpecialSystemDirectory.cpp b/xpcom/io/SpecialSystemDirectory.cpp index 5ceea5ed105..7d22ec47aad 100644 --- a/xpcom/io/SpecialSystemDirectory.cpp +++ b/xpcom/io/SpecialSystemDirectory.cpp @@ -127,7 +127,7 @@ NS_COM void StartupSpecialSystemDirectory() #if defined (XP_WIN) && !defined (WINCE) // SHGetKnownFolderPath is only available on Windows Vista // so that we need to use GetProcAddress to get the pointer. - gShell32DLLInst = LoadLibrary("Shell32.dll"); + gShell32DLLInst = LoadLibraryW(L"shell32.dll"); if(gShell32DLLInst) { gGetKnownFolderPath = (nsGetKnownFolderPath) diff --git a/xpcom/io/nsLocalFileWin.cpp b/xpcom/io/nsLocalFileWin.cpp index c1779296346..871c0d443e7 100644 --- a/xpcom/io/nsLocalFileWin.cpp +++ b/xpcom/io/nsLocalFileWin.cpp @@ -108,8 +108,8 @@ private: * HasMoreElements reads mLetter. * GetNext advances mLetter. */ - nsCString mDrives; - const char *mLetter; + nsString mDrives; + const PRUnichar *mLetter; }; //---------------------------------------------------------------------------- @@ -2970,7 +2970,7 @@ nsresult nsDriveEnumerator::Init() /* The string is null terminated */ if (!EnsureStringLength(mDrives, length+1)) return NS_ERROR_OUT_OF_MEMORY; - if (!GetLogicalDriveStrings(length, mDrives.BeginWriting())) + if (!GetLogicalDriveStringsW(length, mDrives.BeginWriting())) return NS_ERROR_FAILURE; mLetter = mDrives.get(); return NS_OK; @@ -3000,8 +3000,9 @@ NS_IMETHODIMP nsDriveEnumerator::GetNext(nsISupports **aNext) *aNext = nsnull; return NS_OK; } - NS_ConvertASCIItoUTF16 drive(mLetter); + nsString drive(mDrives); mLetter += drive.Length() + 1; + nsILocalFile *file; nsresult rv = NS_NewLocalFile(drive, PR_FALSE, &file); diff --git a/xpcom/threads/nsProcessCommon.cpp b/xpcom/threads/nsProcessCommon.cpp index 21d45e1698e..ebf8e02cad0 100644 --- a/xpcom/threads/nsProcessCommon.cpp +++ b/xpcom/threads/nsProcessCommon.cpp @@ -106,10 +106,11 @@ nsProcess::Init(nsIFile* executable) #if defined(XP_WIN) -static int assembleCmdLine(char *const *argv, char **cmdLine) +static int assembleCmdLine(char *const *argv, PRUnichar **cmdLine) { char *const *arg; - char *p, *q; + PRUnichar *p; + char *q; int cmdLineSize; int numBackslashes; int i; @@ -131,7 +132,7 @@ static int assembleCmdLine(char *const *argv, char **cmdLine) + 2 /* we quote every argument */ + 1; /* space in between, or final null */ } - p = *cmdLine = (char *) PR_MALLOC(cmdLineSize); + p = *cmdLine = (PRUnichar *) PR_MALLOC(cmdLineSize*sizeof(PRUnichar)); if (p == NULL) { return -1; } @@ -237,10 +238,10 @@ nsProcess::Run(PRBool blocking, const char **args, PRUint32 count, my_argv[count+1] = NULL; #if defined(XP_WIN) && !defined (WINCE) /* wince uses nspr */ - STARTUPINFO startupInfo; + STARTUPINFOW startupInfo; PROCESS_INFORMATION procInfo; BOOL retVal; - char *cmdLine; + PRUnichar *cmdLine; if (assembleCmdLine(my_argv, &cmdLine) == -1) { nsMemory::Free(my_argv); @@ -250,20 +251,20 @@ nsProcess::Run(PRBool blocking, const char **args, PRUint32 count, ZeroMemory(&startupInfo, sizeof(startupInfo)); startupInfo.cb = sizeof(startupInfo); - retVal = CreateProcess(NULL, - // const_cast(mTargetPath.get()), - cmdLine, - NULL, /* security attributes for the new - * process */ - NULL, /* security attributes for the primary - * thread in the new process */ - FALSE, /* inherit handles */ - 0, /* creation flags */ - NULL, /* env */ - NULL, /* current drive and directory */ - &startupInfo, - &procInfo - ); + retVal = CreateProcessW(NULL, + // const_cast(mTargetPath.get()), + cmdLine, + NULL, /* security attributes for the new + * process */ + NULL, /* security attributes for the primary + * thread in the new process */ + FALSE, /* inherit handles */ + 0, /* creation flags */ + NULL, /* env */ + NULL, /* current drive and directory */ + &startupInfo, + &procInfo + ); PR_Free( cmdLine ); if (blocking) { diff --git a/xpcom/windbgdlg/Makefile.in b/xpcom/windbgdlg/Makefile.in index da1bcfae499..b2dcc1ef9d9 100644 --- a/xpcom/windbgdlg/Makefile.in +++ b/xpcom/windbgdlg/Makefile.in @@ -42,6 +42,8 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk +OS_LIBS += shell32.lib + SIMPLE_PROGRAMS = windbgdlg$(BIN_SUFFIX) CPPSRCS = windbgdlg.cpp diff --git a/xpcom/windbgdlg/windbgdlg.cpp b/xpcom/windbgdlg/windbgdlg.cpp index 1a19f016569..70be4238a67 100644 --- a/xpcom/windbgdlg/windbgdlg.cpp +++ b/xpcom/windbgdlg/windbgdlg.cpp @@ -42,6 +42,7 @@ #include #include +#include int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, @@ -59,15 +60,16 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, DWORD regValue = -1; DWORD regLength = sizeof regValue; HKEY hkeyCU, hkeyLM; - RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\mozilla.org\\windbgdlg", 0, KEY_READ, &hkeyCU); - RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\mozilla.org\\windbgdlg", 0, KEY_READ, &hkeyLM); - const char * const * argv = __argv; - for (int i = __argc - 1; regValue == (DWORD)-1 && i; --i) { + RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\mozilla.org\\windbgdlg", 0, KEY_READ, &hkeyCU); + RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\mozilla.org\\windbgdlg", 0, KEY_READ, &hkeyLM); + int argc =0; + LPWSTR *argv = CommandLineToArgvW(GetCommandLineW(), &argc); + for (int i = argc - 1; regValue == (DWORD)-1 && i; --i) { bool ok = false; if (hkeyCU) - ok = RegQueryValueEx(hkeyCU, argv[i], 0, ®Type, (LPBYTE)®Value, ®Length) == ERROR_SUCCESS; + ok = RegQueryValueExW(hkeyCU, argv[i], 0, ®Type, (LPBYTE)®Value, ®Length) == ERROR_SUCCESS; if (!ok && hkeyLM) - ok = RegQueryValueEx(hkeyLM, argv[i], 0, ®Type, (LPBYTE)®Value, ®Length) == ERROR_SUCCESS; + ok = RegQueryValueExW(hkeyLM, argv[i], 0, ®Type, (LPBYTE)®Value, ®Length) == ERROR_SUCCESS; if (!ok) regValue = -1; } @@ -77,15 +79,15 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, RegCloseKey(hkeyLM); if (regValue != (DWORD)-1 && regValue != (DWORD)-2) return regValue; - static char msg[4048]; + static WCHAR msg[4048]; - wsprintf(msg, - "%s\n\nClick Abort to exit the Application.\n" - "Click Retry to Debug the Application..\n" - "Click Ignore to continue running the Application.", + wsprintfW(msg, + L"%s\n\nClick Abort to exit the Application.\n" + L"Click Retry to Debug the Application..\n" + L"Click Ignore to continue running the Application.", lpszCmdLine); - return MessageBox(NULL, msg, "NSGlue_Assertion", + return MessageBoxW(NULL, msg, L"NSGlue_Assertion", MB_ICONSTOP | MB_SYSTEMMODAL| MB_ABORTRETRYIGNORE | MB_DEFBUTTON3); } diff --git a/xpfe/bootstrap/showOSAlert.cpp b/xpfe/bootstrap/showOSAlert.cpp index 7d0d70b02a4..346214fe61f 100644 --- a/xpfe/bootstrap/showOSAlert.cpp +++ b/xpfe/bootstrap/showOSAlert.cpp @@ -39,6 +39,7 @@ #include #include #include "nscore.h" +#include "nsString.h" //defines and includes for previous installation cleanup process #if defined (XP_WIN) @@ -63,15 +64,18 @@ printf("\n****Inside ShowOSAlert ***\n"); #endif const PRInt32 max_len = 255; - char message_copy[max_len+1] = { 0 }; PRInt32 input_len = strlen(aMessage); PRInt32 copy_len = (input_len > max_len) ? max_len : input_len; +#if defined (XP_WIN) + NS_ConvertUTF8toUTF16 msg_str(aMessage, copy_len); + PRUnichar* message_copy = (PRUnichar*)msg_str.get(); + MessageBoxW(NULL, message_copy, NULL, MB_OK | MB_ICONERROR | MB_SETFOREGROUND ); +#else + char message_copy[max_len+1] = { 0 }; strncpy(message_copy, aMessage, copy_len); message_copy[copy_len] = 0; - -#if defined (XP_WIN) - MessageBoxA(NULL, message_copy, NULL, MB_OK | MB_ICONERROR | MB_SETFOREGROUND ); -#elif (XP_MAC) +#endif +#if (XP_MAC) short buttonClicked; StandardAlert(kAlertStopAlert, c2pstr(message_copy), nil, nil, &buttonClicked); #elif defined (XP_OS2) From dce1edd834e6f3ee1276187bbae11a9f2b007c21 Mon Sep 17 00:00:00 2001 From: "uriber@gmail.com" Date: Tue, 11 Mar 2008 14:54:34 -0700 Subject: [PATCH 07/65] Don't reserve space for start (end) margin on the first- (last-) in-flow if it has a previous (next) bidi continuation. bug=421419 r+sr=dbaron a1.9=dsicore --- layout/generic/nsContainerFrame.cpp | 28 ++++++++++++++++++-------- layout/reftests/bugs/421419-1-ref.html | 14 +++++++++++++ layout/reftests/bugs/421419-1.html | 14 +++++++++++++ layout/reftests/bugs/reftest.list | 1 + 4 files changed, 49 insertions(+), 8 deletions(-) create mode 100644 layout/reftests/bugs/421419-1-ref.html create mode 100644 layout/reftests/bugs/421419-1.html diff --git a/layout/generic/nsContainerFrame.cpp b/layout/generic/nsContainerFrame.cpp index 9415cb75544..d6786b07b84 100644 --- a/layout/generic/nsContainerFrame.cpp +++ b/layout/generic/nsContainerFrame.cpp @@ -660,13 +660,19 @@ nsContainerFrame::DoInlineIntrinsicWidth(nsIRenderingContext *aRenderingContext, // messy the bidi situations are, since per CSS2.1 section 8.6 // (implemented in bug 328168), the startSide border is always on the // first line. - aData->currentLine += - GetCoord(stylePadding->mPadding.Get(startSide), 0) + - styleBorder->GetBorderWidth(startSide) + - GetCoord(styleMargin->mMargin.Get(startSide), 0); + // This frame is a first-in-flow, but it might have a previous bidi + // continuation, in which case that continuation should handle the startSide + // border. + if (!GetPrevContinuation()) { + aData->currentLine += + GetCoord(stylePadding->mPadding.Get(startSide), 0) + + styleBorder->GetBorderWidth(startSide) + + GetCoord(styleMargin->mMargin.Get(startSide), 0); + } const nsLineList_iterator* savedLine = aData->line; + nsContainerFrame *lastInFlow; for (nsContainerFrame *nif = this; nif; nif = (nsContainerFrame*) nif->GetNextInFlow()) { for (nsIFrame *kid = nif->mFrames.FirstChild(); kid; @@ -682,6 +688,7 @@ nsContainerFrame::DoInlineIntrinsicWidth(nsIRenderingContext *aRenderingContext, // After we advance to our next-in-flow, the stored line may not // longer be the correct line. Just forget it. aData->line = nsnull; + lastInFlow = nif; } aData->line = savedLine; @@ -690,10 +697,15 @@ nsContainerFrame::DoInlineIntrinsicWidth(nsIRenderingContext *aRenderingContext, // messy the bidi situations are, since per CSS2.1 section 8.6 // (implemented in bug 328168), the endSide border is always on the // last line. - aData->currentLine += - GetCoord(stylePadding->mPadding.Get(endSide), 0) + - styleBorder->GetBorderWidth(endSide) + - GetCoord(styleMargin->mMargin.Get(endSide), 0); + // We reached the last-in-flow, but it might have a next bidi + // continuation, in which case that continuation should handle + // the endSide border. + if (!lastInFlow->GetNextContinuation()) { + aData->currentLine += + GetCoord(stylePadding->mPadding.Get(endSide), 0) + + styleBorder->GetBorderWidth(endSide) + + GetCoord(styleMargin->mMargin.Get(endSide), 0); + } } /* virtual */ nsSize diff --git a/layout/reftests/bugs/421419-1-ref.html b/layout/reftests/bugs/421419-1-ref.html new file mode 100644 index 00000000000..0ee5a5c6c16 --- /dev/null +++ b/layout/reftests/bugs/421419-1-ref.html @@ -0,0 +1,14 @@ + + + + + + +

+ + \ No newline at end of file diff --git a/layout/reftests/bugs/421419-1.html b/layout/reftests/bugs/421419-1.html new file mode 100644 index 00000000000..1a3b5f79fd1 --- /dev/null +++ b/layout/reftests/bugs/421419-1.html @@ -0,0 +1,14 @@ + + + + + + +

+ + \ No newline at end of file diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index 196680426a1..9f77f8c3255 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -754,3 +754,4 @@ random == 403134-1.html 403134-1-ref.html # bug 405377 == 420069-2.html 420069-2-ref.html # == 420351-1.html 420351-1-ref.html == 421234-1.html 421234-1-ref.html +== 421419-1.html 421419-1-ref.html From aa9e07537c7de6422121bd760ebaf65aa47b084c Mon Sep 17 00:00:00 2001 From: "dougt@meer.net" Date: Tue, 11 Mar 2008 15:12:52 -0700 Subject: [PATCH 08/65] backing out. --- browser/app/Makefile.in | 2 +- toolkit/mozapps/update/src/updater/Makefile.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/browser/app/Makefile.in b/browser/app/Makefile.in index 61777da6b96..52526484d50 100644 --- a/browser/app/Makefile.in +++ b/browser/app/Makefile.in @@ -157,7 +157,7 @@ include $(topsrcdir)/config/config.mk ifdef _MSC_VER # Always enter a Windows program through wmain, whether or not we're # a console application. -WIN32_EXE_LDFLAGS += -ENTRY:mainWCRTStartup +WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup endif ifndef BUILD_STATIC_LIBS diff --git a/toolkit/mozapps/update/src/updater/Makefile.in b/toolkit/mozapps/update/src/updater/Makefile.in index c5eb139f650..d020d6f4fe4 100644 --- a/toolkit/mozapps/update/src/updater/Makefile.in +++ b/toolkit/mozapps/update/src/updater/Makefile.in @@ -111,7 +111,7 @@ include $(topsrcdir)/config/rules.mk DEFINES += -DNS_NO_XPCOM ifdef _MSC_VER -WIN32_EXE_LDFLAGS += -ENTRY:mainWCRTStartup +WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup endif ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT))) From adbe23d9ebe0c960928b7015da10734f17204205 Mon Sep 17 00:00:00 2001 From: "bclary@bclary.com" Date: Tue, 11 Mar 2008 15:18:23 -0700 Subject: [PATCH 09/65] JavaScript Tests - fix TimeWithinDay for negative arguments, bug 264727 --- js/tests/ecma/shell.js | 12 ++++-- js/tests/ecma_3/Date/15.9.1.2-01.js | 62 +++++++++++++++++++++++++++++ js/tests/ecma_3/Date/shell.js | 12 ++++-- 3 files changed, 78 insertions(+), 8 deletions(-) create mode 100755 js/tests/ecma_3/Date/15.9.1.2-01.js diff --git a/js/tests/ecma/shell.js b/js/tests/ecma/shell.js index 1c012601e65..9f55d743775 100644 --- a/js/tests/ecma/shell.js +++ b/js/tests/ecma/shell.js @@ -159,11 +159,15 @@ function DayNumber( t ) { return ( Math.floor( t / msPerDay ) ); } function TimeWithinDay( t ) { - if ( t < 0 ) { - return ( (t % msPerDay) + msPerDay ); - } else { - return ( t % msPerDay ); + + var r = t % msPerDay; + + if (r < 0) + { + r += msPerDay; } + return r; + } function YearNumber( t ) { } diff --git a/js/tests/ecma_3/Date/15.9.1.2-01.js b/js/tests/ecma_3/Date/15.9.1.2-01.js new file mode 100755 index 00000000000..61b1de6ef11 --- /dev/null +++ b/js/tests/ecma_3/Date/15.9.1.2-01.js @@ -0,0 +1,62 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is JavaScript Engine testing utilities. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2007 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +var gTestfile = '15.9.1.2-01.js'; +//----------------------------------------------------------------------------- +var BUGNUMBER = 264727; +var summary = '15.9.1.2 - TimeWithinDay(TIME_1900) == 0'; +var actual = ''; +var expect = ''; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + printStatus (summary); + + expect = 0; + actual = TimeWithinDay(TIME_1900); + + reportCompare(expect, actual, summary); + + exitFunc ('test'); +} diff --git a/js/tests/ecma_3/Date/shell.js b/js/tests/ecma_3/Date/shell.js index fefabd3b5ce..6111c3b9348 100644 --- a/js/tests/ecma_3/Date/shell.js +++ b/js/tests/ecma_3/Date/shell.js @@ -153,11 +153,15 @@ function DayNumber( t ) { return ( Math.floor( t / msPerDay ) ); } function TimeWithinDay( t ) { - if ( t < 0 ) { - return ( (t % msPerDay) + msPerDay ); - } else { - return ( t % msPerDay ); + + var r = t % msPerDay; + + if (r < 0) + { + r += msPerDay; } + return r; + } function YearNumber( t ) { } From 3c99833e3e31998864b2b7974d3637bb29cac60d Mon Sep 17 00:00:00 2001 From: "blassey@mozilla.com" Date: Tue, 11 Mar 2008 15:46:26 -0700 Subject: [PATCH 10/65] backing out: switching narrow char system calls to wide char in windows b=418703 --- accessible/src/msaa/nsAccessNodeWrap.cpp | 2 +- accessible/src/msaa/nsAccessibleWrap.cpp | 2 +- browser/app/nsBrowserApp.cpp | 8 +- .../migration/src/nsIEProfileMigrator.cpp | 13 +- .../shell/src/nsWindowsShellService.cpp | 8 +- db/mork/src/morkFile.cpp | 10 + .../activex/src/plugin/LegacyPlugin.cpp | 3 +- .../activex/src/plugin/XPCDocument.cpp | 2 +- .../browser/activex/src/plugin/XPConnect.cpp | 2 +- extensions/auth/nsAuthSSPI.cpp | 34 +-- gfx/src/thebes/nsSystemFontsWin.cpp | 38 +-- gfx/src/thebes/nsSystemFontsWin.h | 5 +- gfx/src/windows/nsDeviceContextWin.cpp | 30 +-- gfx/src/windows/nsDeviceContextWin.h | 3 +- gfx/src/windows/nsFontMetricsWin.cpp | 35 ++- gfx/thebes/src/gfxWindowsFonts.cpp | 4 +- gfx/thebes/src/gfxWindowsSurface.cpp | 34 ++- intl/uconv/src/nsWinCharset.cpp | 6 +- ipc/ipcd/client/src/ipcConnectionWin.cpp | 2 +- .../decoders/icon/win/nsIconChannel.cpp | 33 ++- .../libpr0n/decoders/icon/win/nsIconChannel.h | 2 +- modules/oji/src/scd.cpp | 2 +- .../base/src/nsPluginDirServiceProvider.cpp | 229 +++++++++--------- modules/plugin/base/src/nsPluginHostImpl.cpp | 12 +- .../base/src/nsPluginNativeWindowWin.cpp | 10 +- modules/plugin/base/src/nsPluginsDirWin.cpp | 67 ++--- .../samples/default/windows/dialogs.cpp | 45 ++-- .../samples/default/windows/npshell.cpp | 14 +- .../plugin/samples/default/windows/plugin.cpp | 105 ++++---- .../plugin/samples/default/windows/plugin.h | 6 +- .../plugin/samples/default/windows/utils.cpp | 65 +++-- .../plugin/samples/default/windows/utils.h | 2 +- .../sdk/samples/basic/windows/plugin.cpp | 4 +- .../sdk/samples/scriptable/windows/plugin.cpp | 4 +- rdf/datasource/src/nsFileSystemDataSource.cpp | 7 +- .../components/startup/src/nsUserInfoWin.cpp | 9 +- uriloader/exthandler/win/nsMIMEInfoWin.cpp | 14 +- .../exthandler/win/nsOSHelperAppService.cpp | 4 +- widget/src/windows/nsAppShell.cpp | 14 +- widget/src/windows/nsBidiKeyboard.cpp | 31 ++- widget/src/windows/nsBidiKeyboard.h | 6 +- widget/src/windows/nsClipboard.cpp | 8 +- widget/src/windows/nsDataObj.h | 8 +- widget/src/windows/nsFilePicker.cpp | 8 +- widget/src/windows/nsLookAndFeel.cpp | 8 +- widget/src/windows/nsNativeThemeWin.cpp | 4 +- widget/src/windows/nsSound.cpp | 22 +- widget/src/windows/nsSound.h | 2 +- widget/src/windows/nsToolkit.cpp | 6 +- widget/src/windows/nsWindow.cpp | 34 ++- widget/src/windows/nsWindow.h | 7 - xpcom/base/nsDebugImpl.cpp | 27 +-- xpcom/base/nsStackWalk.cpp | 4 +- xpcom/io/SpecialSystemDirectory.cpp | 2 +- xpcom/io/nsLocalFileWin.cpp | 9 +- xpcom/threads/nsProcessCommon.cpp | 39 ++- xpcom/windbgdlg/Makefile.in | 2 - xpcom/windbgdlg/windbgdlg.cpp | 26 +- xpfe/bootstrap/showOSAlert.cpp | 14 +- 59 files changed, 590 insertions(+), 566 deletions(-) diff --git a/accessible/src/msaa/nsAccessNodeWrap.cpp b/accessible/src/msaa/nsAccessNodeWrap.cpp index 96ebfdb0696..575a26485b8 100644 --- a/accessible/src/msaa/nsAccessNodeWrap.cpp +++ b/accessible/src/msaa/nsAccessNodeWrap.cpp @@ -576,7 +576,7 @@ void nsAccessNodeWrap::InitAccessibility() } if (!gmUserLib) { - gmUserLib =::LoadLibraryW(L"USER32.DLL"); + gmUserLib =::LoadLibrary("USER32.DLL"); } if (gmUserLib) { diff --git a/accessible/src/msaa/nsAccessibleWrap.cpp b/accessible/src/msaa/nsAccessibleWrap.cpp index 3ec887a044e..036c72c47f7 100644 --- a/accessible/src/msaa/nsAccessibleWrap.cpp +++ b/accessible/src/msaa/nsAccessibleWrap.cpp @@ -156,7 +156,7 @@ STDMETHODIMP nsAccessibleWrap::AccessibleObjectFromWindow(HWND hwnd, { // open the dll dynamically if (!gmAccLib) - gmAccLib =::LoadLibraryW(L"OLEACC.DLL"); + gmAccLib =::LoadLibrary("OLEACC.DLL"); if (gmAccLib) { if (!gmAccessibleObjectFromWindow) diff --git a/browser/app/nsBrowserApp.cpp b/browser/app/nsBrowserApp.cpp index 6e7c518b366..0c867f701ff 100644 --- a/browser/app/nsBrowserApp.cpp +++ b/browser/app/nsBrowserApp.cpp @@ -64,9 +64,11 @@ static void Output(const char *fmt, ... ) va_start(ap, fmt); #if defined(XP_WIN) && !MOZ_WINCONSOLE - PRUnichar msg[2048]; - _vsnwprintf(msg, sizeof(msg), NS_ConvertUTF8toUTF16(fmt).get(), ap); - MessageBoxW(NULL, msg, L"XULRunner", MB_OK | MB_ICONERROR); + char msg[2048]; + + _vsnprintf(msg, sizeof(msg), fmt, ap); + + MessageBox(NULL, msg, "XULRunner", MB_OK | MB_ICONERROR); #else vfprintf(stderr, fmt, ap); #endif diff --git a/browser/components/migration/src/nsIEProfileMigrator.cpp b/browser/components/migration/src/nsIEProfileMigrator.cpp index 8db597a5566..500d66caeaf 100644 --- a/browser/components/migration/src/nsIEProfileMigrator.cpp +++ b/browser/components/migration/src/nsIEProfileMigrator.cpp @@ -867,7 +867,7 @@ nsIEProfileMigrator::CopyPasswords(PRBool aReplace) nsresult rv; nsVoidArray signonsFound; - HMODULE pstoreDLL = ::LoadLibraryW(L"pstorec.dll"); + HMODULE pstoreDLL = ::LoadLibrary("pstorec.dll"); if (!pstoreDLL) { // XXXben TODO // Need to figure out what to do here on Windows 98 etc... it may be that the key is universal read @@ -1177,7 +1177,7 @@ nsIEProfileMigrator::CopyFormData(PRBool aReplace) { HRESULT hr; - HMODULE pstoreDLL = ::LoadLibraryW(L"pstorec.dll"); + HMODULE pstoreDLL = ::LoadLibrary("pstorec.dll"); if (!pstoreDLL) { // XXXben TODO // Need to figure out what to do here on Windows 98 etc... it may be that the key is universal read @@ -1410,19 +1410,20 @@ nsIEProfileMigrator::ResolveShortcut(const nsString &aFileName, char** aOutURL) { HRESULT result; - IUniformResourceLocatorW* urlLink = nsnull; + IUniformResourceLocator* urlLink = nsnull; result = ::CoCreateInstance(CLSID_InternetShortcut, NULL, CLSCTX_INPROC_SERVER, - IID_IUniformResourceLocatorW, (void**)&urlLink); + IID_IUniformResourceLocator, (void**)&urlLink); if (SUCCEEDED(result) && urlLink) { IPersistFile* urlFile = nsnull; result = urlLink->QueryInterface(IID_IPersistFile, (void**)&urlFile); if (SUCCEEDED(result) && urlFile) { result = urlFile->Load(aFileName.get(), STGM_READ); if (SUCCEEDED(result) ) { - LPWSTR lpTemp = nsnull; + LPSTR lpTemp = nsnull; result = urlLink->GetURL(&lpTemp); if (SUCCEEDED(result) && lpTemp) { - *aOutURL = (char*)ToNewUTF8String(nsDependentString(lpTemp)); + *aOutURL = PL_strdup(lpTemp); + // free the string that GetURL alloc'd ::CoTaskMemFree(lpTemp); } diff --git a/browser/components/shell/src/nsWindowsShellService.cpp b/browser/components/shell/src/nsWindowsShellService.cpp index 30c716af3b0..65b58570062 100644 --- a/browser/components/shell/src/nsWindowsShellService.cpp +++ b/browser/components/shell/src/nsWindowsShellService.cpp @@ -396,8 +396,8 @@ nsWindowsShellService::SetDefaultBrowser(PRBool aClaimAllTypes, PRBool aForAllUs rv = appHelper->AppendNative(NS_LITERAL_CSTRING("helper.exe")); NS_ENSURE_SUCCESS(rv, rv); - nsAutoString appHelperPath; - rv = appHelper->GetPath(appHelperPath); + nsCAutoString appHelperPath; + rv = appHelper->GetNativePath(appHelperPath); NS_ENSURE_SUCCESS(rv, rv); if (aForAllUsers) { @@ -406,10 +406,10 @@ nsWindowsShellService::SetDefaultBrowser(PRBool aClaimAllTypes, PRBool aForAllUs appHelperPath.AppendLiteral(" /SetAsDefaultAppUser"); } - STARTUPINFOW si = {sizeof(si), 0}; + STARTUPINFO si = {sizeof(si), 0}; PROCESS_INFORMATION pi = {0}; - BOOL ok = CreateProcessW(NULL, (LPWSTR)appHelperPath.get(), NULL, NULL, + BOOL ok = CreateProcess(NULL, (LPSTR)appHelperPath.get(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); if (!ok) diff --git a/db/mork/src/morkFile.cpp b/db/mork/src/morkFile.cpp index a3167afa095..011056fa81b 100644 --- a/db/mork/src/morkFile.cpp +++ b/db/mork/src/morkFile.cpp @@ -929,6 +929,16 @@ morkStdioFile::Steal(nsIMdbEnv* ev, nsIMdbFile* ioThief) void mork_fileflush(FILE * file) { fflush(file); +#ifndef WINCE + OSVERSIONINFOA vi = { sizeof(OSVERSIONINFOA) }; + if ((GetVersionExA(&vi) && vi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)) + { + // Win9x/ME + int fd = fileno(file); + HANDLE fh = (HANDLE)_get_osfhandle(fd); + FlushFileBuffers(fh); + } +#endif } #endif /*MORK_WIN*/ diff --git a/embedding/browser/activex/src/plugin/LegacyPlugin.cpp b/embedding/browser/activex/src/plugin/LegacyPlugin.cpp index f0044c2217c..8ab3fe738dc 100644 --- a/embedding/browser/activex/src/plugin/LegacyPlugin.cpp +++ b/embedding/browser/activex/src/plugin/LegacyPlugin.cpp @@ -303,7 +303,8 @@ ShowError(MozAxPluginErrors errorCode, const CLSID &clsid) LPOLESTR szClsid; StringFromCLSID(clsid, &szClsid); _sntprintf(szBuffer, kBufSize - 1, - _T("Could not create the control %s. Check that it has been installed on your computer and that this page correctly references it."), OLE2T(szClsid)); + _T("Could not create the control %s. Check that it has been installed on your computer " + "and that this page correctly references it."), OLE2T(szClsid)); CoTaskMemFree(szClsid); szMsg = szBuffer; } diff --git a/embedding/browser/activex/src/plugin/XPCDocument.cpp b/embedding/browser/activex/src/plugin/XPCDocument.cpp index 60f9c86a6b6..1c6a9235ae0 100644 --- a/embedding/browser/activex/src/plugin/XPCDocument.cpp +++ b/embedding/browser/activex/src/plugin/XPCDocument.cpp @@ -1915,7 +1915,7 @@ END_COM_MAP() NS_SUCCEEDED(baseURI->GetSpec(spec))) { USES_CONVERSION; - if (FAILED(CreateURLMoniker(NULL, A2CW(spec.get()), &baseURLMoniker))) + if (FAILED(CreateURLMoniker(NULL, T2CW(spec.get()), &baseURLMoniker))) return E_UNEXPECTED; } } diff --git a/embedding/browser/activex/src/plugin/XPConnect.cpp b/embedding/browser/activex/src/plugin/XPConnect.cpp index 0620194ed36..c5dc232d467 100644 --- a/embedding/browser/activex/src/plugin/XPConnect.cpp +++ b/embedding/browser/activex/src/plugin/XPConnect.cpp @@ -372,7 +372,7 @@ nsScriptablePeer::ConvertVariants(VARIANT *aIn, nsIVariant **aOut) { // do_CreateInstance macro is broken so load the component manager by // hand and get it to create the component. - HMODULE hlib = ::LoadLibraryW(L"xpcom.dll"); + HMODULE hlib = ::LoadLibrary("xpcom.dll"); if (hlib) { nsIComponentManager *pManager = nsnull; // A frozen interface, even in 1.0.x diff --git a/extensions/auth/nsAuthSSPI.cpp b/extensions/auth/nsAuthSSPI.cpp index 67ed8b0d91e..ca70729e7c5 100644 --- a/extensions/auth/nsAuthSSPI.cpp +++ b/extensions/auth/nsAuthSSPI.cpp @@ -52,8 +52,6 @@ #include "nsNetCID.h" #include "nsCOMPtr.h" -#include - #define SEC_SUCCESS(Status) ((Status) >= 0) #ifndef KERB_WRAP_NO_ENCRYPT @@ -105,25 +103,25 @@ static const char *MapErrorCode(int rc) //----------------------------------------------------------------------------- static HINSTANCE sspi_lib; -static PSecurityFunctionTableW sspi; +static PSecurityFunctionTable sspi; static nsresult InitSSPI() { - PSecurityFunctionTableW (*initFun)(void); + PSecurityFunctionTable (*initFun)(void); LOG((" InitSSPI\n")); - sspi_lib = LoadLibraryW(L"secur32.dll"); + sspi_lib = LoadLibrary("secur32.dll"); if (!sspi_lib) { - sspi_lib = LoadLibraryW(L"security.dll"); + sspi_lib = LoadLibrary("security.dll"); if (!sspi_lib) { LOG(("SSPI library not found")); return NS_ERROR_UNEXPECTED; } } - initFun = (PSecurityFunctionTableW (*)(void)) + initFun = (PSecurityFunctionTable (*)(void)) GetProcAddress(sspi_lib, "InitSecurityInterfaceA"); if (!initFun) { LOG(("InitSecurityInterfaceA not found")); @@ -244,9 +242,11 @@ nsAuthSSPI::Init(const char *serviceName, if (NS_FAILED(rv)) return rv; } - SEC_WCHAR *package; - package = (SEC_WCHAR *) pTypeName[(int)mPackage]; + SEC_CHAR *package; + + package = (SEC_CHAR *) pTypeName[(int)mPackage]; + if (mPackage != PACKAGE_TYPE_NTLM) { rv = MakeSN(serviceName, mServiceName); @@ -257,8 +257,8 @@ nsAuthSSPI::Init(const char *serviceName, SECURITY_STATUS rc; - PSecPkgInfoW pinfo; - rc = (sspi->QuerySecurityPackageInfoW)(package, &pinfo); + PSecPkgInfo pinfo; + rc = (sspi->QuerySecurityPackageInfo)(package, &pinfo); if (rc != SEC_E_OK) { LOG(("%s package not found\n", package)); return NS_ERROR_UNEXPECTED; @@ -268,7 +268,7 @@ nsAuthSSPI::Init(const char *serviceName, TimeStamp useBefore; - rc = (sspi->AcquireCredentialsHandleW)(NULL, + rc = (sspi->AcquireCredentialsHandle)(NULL, package, SECPKG_CRED_OUTBOUND, NULL, @@ -336,13 +336,15 @@ nsAuthSSPI::GetNextToken(const void *inToken, if (!ob.pvBuffer) return NS_ERROR_OUT_OF_MEMORY; memset(ob.pvBuffer, 0, ob.cbBuffer); - SEC_WCHAR *sn; + + SEC_CHAR *sn; + if (mPackage == PACKAGE_TYPE_NTLM) sn = NULL; else - sn = (SEC_WCHAR *) mServiceName.get(); + sn = (SEC_CHAR *) mServiceName.get(); - rc = (sspi->InitializeSecurityContextW)(&mCred, + rc = (sspi->InitializeSecurityContext)(&mCred, ctxIn, sn, ctxReq, @@ -459,7 +461,7 @@ nsAuthSSPI::Wrap(const void *inToken, secBuffers bufs; SecPkgContext_Sizes sizes; - rc = (sspi->QueryContextAttributesW)( + rc = (sspi->QueryContextAttributes)( &mCtxt, SECPKG_ATTR_SIZES, &sizes); diff --git a/gfx/src/thebes/nsSystemFontsWin.cpp b/gfx/src/thebes/nsSystemFontsWin.cpp index 40fc0aa8010..f53f06ae102 100644 --- a/gfx/src/thebes/nsSystemFontsWin.cpp +++ b/gfx/src/thebes/nsSystemFontsWin.cpp @@ -43,13 +43,19 @@ #include "nsSystemFontsWin.h" -nsresult nsSystemFontsWin::CopyLogFontToNSFont(HDC* aHDC, const LOGFONTW* ptrLogFont, - nsString *aFontName, - gfxFontStyle *aFontStyle) const +nsresult nsSystemFontsWin::CopyLogFontToNSFont(HDC* aHDC, const LOGFONT* ptrLogFont, + nsString *aFontName, + gfxFontStyle *aFontStyle, + PRBool aIsWide) const { PRUnichar name[LF_FACESIZE]; name[0] = 0; - memcpy(name, ptrLogFont->lfFaceName, LF_FACESIZE*sizeof(PRUnichar)); + if (aIsWide) + memcpy(name, ptrLogFont->lfFaceName, LF_FACESIZE*2); + else { + MultiByteToWideChar(CP_ACP, 0, ptrLogFont->lfFaceName, + strlen(ptrLogFont->lfFaceName) + 1, name, sizeof(name)/sizeof(name[0])); + } *aFontName = name; // Do Style @@ -79,7 +85,7 @@ nsresult nsSystemFontsWin::CopyLogFontToNSFont(HDC* aHDC, const LOGFONTW* ptrLog // round, but take into account whether it is negative float pixelHeight = -ptrLogFont->lfHeight; if (pixelHeight < 0) { - HFONT hFont = ::CreateFontIndirectW(ptrLogFont); + HFONT hFont = ::CreateFontIndirect(ptrLogFont); if (!hFont) return NS_ERROR_OUT_OF_MEMORY; HGDIOBJ hObject = ::SelectObject(*aHDC, hFont); @@ -110,32 +116,32 @@ nsresult nsSystemFontsWin::GetSysFontInfo(HDC aHDC, nsSystemFontID anID, { HGDIOBJ hGDI; - LOGFONTW logFont; - LOGFONTW* ptrLogFont = NULL; + LOGFONT logFont; + LOGFONT* ptrLogFont = NULL; #ifdef WINCE hGDI = ::GetStockObject(SYSTEM_FONT); if (hGDI == NULL) return NS_ERROR_UNEXPECTED; - if (::GetObjectW(hGDI, sizeof(logFont), &logFont) > 0) + if (::GetObject(hGDI, sizeof(logFont), &logFont) > 0) ptrLogFont = &logFont; #else - NONCLIENTMETRICSW ncm; + NONCLIENTMETRICS ncm; BOOL status; if (anID == eSystemFont_Icon) { - status = ::SystemParametersInfoW(SPI_GETICONTITLELOGFONT, - sizeof(logFont), - (PVOID)&logFont, - 0); + status = ::SystemParametersInfo(SPI_GETICONTITLELOGFONT, + sizeof(logFont), + (PVOID)&logFont, + 0); } else { - ncm.cbSize = sizeof(NONCLIENTMETRICSW); - status = ::SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, + ncm.cbSize = sizeof(NONCLIENTMETRICS); + status = ::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), (PVOID)&ncm, 0); @@ -190,7 +196,7 @@ nsresult nsSystemFontsWin::GetSysFontInfo(HDC aHDC, nsSystemFontID anID, hGDI = ::GetStockObject(DEFAULT_GUI_FONT); if (hGDI != NULL) { - if (::GetObjectW(hGDI, sizeof(logFont), &logFont) > 0) + if (::GetObject(hGDI, sizeof(logFont), &logFont) > 0) { ptrLogFont = &logFont; } diff --git a/gfx/src/thebes/nsSystemFontsWin.h b/gfx/src/thebes/nsSystemFontsWin.h index 420abe840cf..a8a047e0ed4 100644 --- a/gfx/src/thebes/nsSystemFontsWin.h +++ b/gfx/src/thebes/nsSystemFontsWin.h @@ -50,8 +50,9 @@ public: nsresult GetSystemFont(nsSystemFontID anID, nsString *aFontName, gfxFontStyle *aFontStyle) const; private: - nsresult CopyLogFontToNSFont(HDC* aHDC, const LOGFONTW* ptrLogFont, - nsString *aFontName, gfxFontStyle *aFontStyle) const; + nsresult CopyLogFontToNSFont(HDC* aHDC, const LOGFONT* ptrLogFont, + nsString *aFontName, gfxFontStyle *aFontStyle, + PRBool aIsWide = PR_FALSE) const; nsresult GetSysFontInfo(HDC aHDC, nsSystemFontID anID, nsString *aFontName, gfxFontStyle *aFontStyle) const; diff --git a/gfx/src/windows/nsDeviceContextWin.cpp b/gfx/src/windows/nsDeviceContextWin.cpp index 3c150ac81c6..28e15736360 100644 --- a/gfx/src/windows/nsDeviceContextWin.cpp +++ b/gfx/src/windows/nsDeviceContextWin.cpp @@ -309,13 +309,13 @@ NS_IMETHODIMP nsDeviceContextWin :: SetCanonicalPixelScale(float aScale) } -nsresult nsDeviceContextWin::CopyLogFontToNSFont(HDC* aHDC, const LOGFONTW* ptrLogFont, - nsFont* aFont) const +nsresult nsDeviceContextWin::CopyLogFontToNSFont(HDC* aHDC, const LOGFONT* ptrLogFont, + nsFont* aFont, PRBool aIsWide) const { PRUnichar name[LF_FACESIZE]; name[0] = 0; if (aIsWide) - memcpy(name, ptrLogFont->lfFaceName, LF_FACESIZE*sizeof(PRUnichar)); + memcpy(name, ptrLogFont->lfFaceName, LF_FACESIZE*2); else { MultiByteToWideChar(CP_ACP, 0, ptrLogFont->lfFaceName, strlen(ptrLogFont->lfFaceName) + 1, name, sizeof(name)/sizeof(name[0])); @@ -360,7 +360,7 @@ nsresult nsDeviceContextWin::CopyLogFontToNSFont(HDC* aHDC, const LOGFONTW* ptrL // round, but take into account whether it is negative float pixelHeight = -ptrLogFont->lfHeight; if (pixelHeight < 0) { - HFONT hFont = ::CreateFontIndirectW(ptrLogFont); + HFONT hFont = ::CreateFontIndirect(ptrLogFont); if (!hFont) return NS_ERROR_OUT_OF_MEMORY; HGDIOBJ hObject = ::SelectObject(*aHDC, hFont); @@ -388,32 +388,32 @@ nsresult nsDeviceContextWin :: GetSysFontInfo(HDC aHDC, nsSystemFontID anID, nsF { HGDIOBJ hGDI; - LOGFONTW logFont; - LOGFONTW* ptrLogFont = NULL; + LOGFONT logFont; + LOGFONT* ptrLogFont = NULL; #ifdef WINCE hGDI = ::GetStockObject(SYSTEM_FONT); if (hGDI == NULL) return NS_ERROR_UNEXPECTED; - if (::GetObjectW(hGDI, sizeof(logFont), &logFont) > 0) + if (::GetObject(hGDI, sizeof(logFont), &logFont) > 0) ptrLogFont = &logFont; #else - NONCLIENTMETRICSW ncm; + NONCLIENTMETRICS ncm; BOOL status; if (anID == eSystemFont_Icon) { - status = ::SystemParametersInfoW(SPI_GETICONTITLELOGFONT, - sizeof(logFont), - (PVOID)&logFont, - 0); + status = ::SystemParametersInfo(SPI_GETICONTITLELOGFONT, + sizeof(logFont), + (PVOID)&logFont, + 0); } else { - ncm.cbSize = sizeof(NONCLIENTMETRICSW); - status = ::SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, + ncm.cbSize = sizeof(NONCLIENTMETRICS); + status = ::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), (PVOID)&ncm, 0); @@ -468,7 +468,7 @@ nsresult nsDeviceContextWin :: GetSysFontInfo(HDC aHDC, nsSystemFontID anID, nsF hGDI = ::GetStockObject(DEFAULT_GUI_FONT); if (hGDI != NULL) { - if (::GetObjectW(hGDI, sizeof(logFont), &logFont) > 0) + if (::GetObject(hGDI, sizeof(logFont), &logFont) > 0) { ptrLogFont = &logFont; } diff --git a/gfx/src/windows/nsDeviceContextWin.h b/gfx/src/windows/nsDeviceContextWin.h index f4ce86c7f8e..6a02af01b93 100644 --- a/gfx/src/windows/nsDeviceContextWin.h +++ b/gfx/src/windows/nsDeviceContextWin.h @@ -101,7 +101,8 @@ protected: void ComputeFullAreaUsingScreen ( nsRect* outRect ) ; nsresult GetSysFontInfo(HDC aHDC, nsSystemFontID anID, nsFont* aFont) const; - nsresult CopyLogFontToNSFont(HDC* aHDC, const LOGFONTW* ptrLogFont, nsFont* aFont) const; + nsresult CopyLogFontToNSFont(HDC* aHDC, const LOGFONT* ptrLogFont, nsFont* aFont, + PRBool aIsWide = PR_FALSE) const; PRBool mCachedClientRect; PRBool mCachedFullRect; diff --git a/gfx/src/windows/nsFontMetricsWin.cpp b/gfx/src/windows/nsFontMetricsWin.cpp index c7c79134331..d6fbf78a31e 100644 --- a/gfx/src/windows/nsFontMetricsWin.cpp +++ b/gfx/src/windows/nsFontMetricsWin.cpp @@ -2121,9 +2121,40 @@ nsGlyphAgent::GetGlyphMetrics(HDC aDC, GLYPHMETRICS* aGlyphMetrics) { memset(aGlyphMetrics, 0, sizeof(GLYPHMETRICS)); // UMR: bug 46438 - mState = eGlyphAgent_UNICODE; - return GetGlyphOutlineW(aDC, aChar, GGO_METRICS, aGlyphMetrics, 0, nsnull, &mMat); + if (eGlyphAgent_UNKNOWN == mState) { // first time we have been in this function + // see if this platform implements GetGlyphOutlineW() + DWORD len = GetGlyphOutlineW(aDC, aChar, GGO_METRICS, aGlyphMetrics, 0, nsnull, &mMat); + if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) { + // next time, we won't bother trying GetGlyphOutlineW() + mState = eGlyphAgent_ANSI; + } + else { + // all is well with GetGlyphOutlineW(), we will be using it from now on + mState = eGlyphAgent_UNICODE; + return len; + } + } + if (eGlyphAgent_UNICODE == mState) { + return GetGlyphOutlineW(aDC, aChar, GGO_METRICS, aGlyphMetrics, 0, nsnull, &mMat); + } + + // Otherwise, we are on a platform that doesn't implement GetGlyphOutlineW() + // (see Q241358: The GetGlyphOutlineW Function Fails on Windows 95 & 98 + // http://support.microsoft.com/support/kb/articles/Q241/3/58.ASP) + // we will use glyph indices as a work around. + if (0 == aGlyphIndex) { // caller doesn't know the glyph index, so find it + nsAutoChar16Buffer buf; + if (NS_SUCCEEDED(GetGlyphIndices(aDC, nsnull, &aChar, 1, buf))) + aGlyphIndex = *(buf.Elements()); + } + if (0 < aGlyphIndex) { + return GetGlyphOutlineA(aDC, aGlyphIndex, GGO_METRICS | GGO_GLYPH_INDEX, aGlyphMetrics, 0, nsnull, &mMat); + } + + // if we ever reach here, something went wrong in GetGlyphIndices() above + // because the current font in aDC wasn't a Unicode font + return GDI_ERROR; } // the global glyph agent that we will be using diff --git a/gfx/thebes/src/gfxWindowsFonts.cpp b/gfx/thebes/src/gfxWindowsFonts.cpp index 63e3837cfe2..c20abc17104 100644 --- a/gfx/thebes/src/gfxWindowsFonts.cpp +++ b/gfx/thebes/src/gfxWindowsFonts.cpp @@ -340,13 +340,13 @@ gfxWindowsFont::ComputeMetrics() // Cache the width of a single space. SIZE size; - GetTextExtentPoint32W(dc, L" ", 1, &size); + GetTextExtentPoint32(dc, " ", 1, &size); mMetrics->spaceWidth = ROUND(size.cx); mSpaceGlyph = 0; if (metrics.tmPitchAndFamily & TMPF_TRUETYPE) { WORD glyph; - DWORD ret = GetGlyphIndicesW(dc, L" ", 1, &glyph, + DWORD ret = GetGlyphIndicesA(dc, " ", 1, &glyph, GGI_MARK_NONEXISTING_GLYPHS); if (ret != GDI_ERROR && glyph != 0xFFFF) { mSpaceGlyph = glyph; diff --git a/gfx/thebes/src/gfxWindowsSurface.cpp b/gfx/thebes/src/gfxWindowsSurface.cpp index 83cf0ff9533..a2a7c8a636a 100644 --- a/gfx/thebes/src/gfxWindowsSurface.cpp +++ b/gfx/thebes/src/gfxWindowsSurface.cpp @@ -168,11 +168,27 @@ gfxWindowsSurface::OptimizeToDDB(HDC dc, const gfxIntSize& size, gfxImageFormat return raw; } +static char* +GetACPString(const nsAString& aStr) +{ + int acplen = aStr.Length() * 2 + 1; + char * acp = new char[acplen]; + if(acp) { + int outlen = ::WideCharToMultiByte(CP_ACP, 0, + PromiseFlatString(aStr).get(), + aStr.Length(), + acp, acplen, NULL, NULL); + if (outlen > 0) + acp[outlen] = '\0'; // null terminate + } + return acp; +} + nsresult gfxWindowsSurface::BeginPrinting(const nsAString& aTitle, const nsAString& aPrintToFileName) { #define DOC_TITLE_LENGTH 30 - DOCINFOW docinfo; + DOCINFO docinfo; nsString titleStr; titleStr = aTitle; @@ -180,21 +196,23 @@ nsresult gfxWindowsSurface::BeginPrinting(const nsAString& aTitle, titleStr.SetLength(DOC_TITLE_LENGTH-3); titleStr.AppendLiteral("..."); } - nsPromiseFlatString flatTitleStr(titleStr); - const PRUnichar *title = (const PRUnichar*)(flatTitleStr.get()); - const PRUnichar *docName = nsnull; - nsPromiseFlatString printToFileNameStr(aPrintToFileName); + char *title = GetACPString(titleStr); + + char *docName = nsnull; if (!aPrintToFileName.IsEmpty()) { - docName = (const PRUnichar*)(printToFileNameStr.get()); + docName = ToNewCString(aPrintToFileName); } + docinfo.cbSize = sizeof(docinfo); - docinfo.lpszDocName = title ? title : L"Mozilla Document"; + docinfo.lpszDocName = title ? title : "Mozilla Document"; docinfo.lpszOutput = docName; docinfo.lpszDatatype = NULL; docinfo.fwType = 0; - ::StartDocW(mDC, &docinfo); + ::StartDoc(mDC, &docinfo); + delete [] title; + if (docName != nsnull) nsMemory::Free(docName); return NS_OK; } diff --git a/intl/uconv/src/nsWinCharset.cpp b/intl/uconv/src/nsWinCharset.cpp index 6ae1c75b88f..c3eae316a33 100644 --- a/intl/uconv/src/nsWinCharset.cpp +++ b/intl/uconv/src/nsWinCharset.cpp @@ -133,7 +133,7 @@ nsPlatformCharset::GetDefaultCharsetForLocale(const nsAString& localeName, nsACS { nsCOMPtr winLocale; LCID localeAsLCID; - PRUnichar acp_name[6]; + char acp_name[6]; // // convert locale name to a code page (through the LCID) @@ -147,11 +147,11 @@ nsPlatformCharset::GetDefaultCharsetForLocale(const nsAString& localeName, nsACS rv = winLocale->GetPlatformLocale(localeName, &localeAsLCID); if (NS_FAILED(rv)) { return rv; } - if (GetLocaleInfoW(localeAsLCID, LOCALE_IDEFAULTANSICODEPAGE, acp_name, sizeof(acp_name))==0) { + if (GetLocaleInfo(localeAsLCID, LOCALE_IDEFAULTANSICODEPAGE, acp_name, sizeof(acp_name))==0) { return NS_ERROR_FAILURE; } nsAutoString acp_key(NS_LITERAL_STRING("acp.")); - acp_key.Append(acp_name); + acp_key.AppendWithConversion(acp_name); return MapToCharset(acp_key, oResult); } diff --git a/ipc/ipcd/client/src/ipcConnectionWin.cpp b/ipc/ipcd/client/src/ipcConnectionWin.cpp index b6ac516ff17..9a99c1956b5 100644 --- a/ipc/ipcd/client/src/ipcConnectionWin.cpp +++ b/ipc/ipcd/client/src/ipcConnectionWin.cpp @@ -112,7 +112,7 @@ ipcThreadWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) cd.dwData = GetCurrentProcessId(); cd.cbData = (DWORD) msg->MsgLen(); cd.lpData = (PVOID) msg->MsgBuf(); - SendMessage(ipcDaemonHwnd, WM_COPYDATA, (WPARAM) hWnd, (LPARAM) &cd); + SendMessageA(ipcDaemonHwnd, WM_COPYDATA, (WPARAM) hWnd, (LPARAM) &cd); LOG((" done.\n")); delete msg; } diff --git a/modules/libpr0n/decoders/icon/win/nsIconChannel.cpp b/modules/libpr0n/decoders/icon/win/nsIconChannel.cpp index d63219c19d7..e0e896a57d1 100644 --- a/modules/libpr0n/decoders/icon/win/nsIconChannel.cpp +++ b/modules/libpr0n/decoders/icon/win/nsIconChannel.cpp @@ -63,7 +63,6 @@ #include #include #include -#include struct ICONFILEHEADER { PRUint16 ifhReserved; @@ -190,7 +189,7 @@ nsIconChannel::Open(nsIInputStream **_retval) return MakeInputStream(_retval, PR_FALSE); } -nsresult nsIconChannel::ExtractIconInfoFromUrl(nsIFile ** aLocalFile, PRUint32 * aDesiredImageSize, nsCString &aContentType, nsCString &aFileExtension) +nsresult nsIconChannel::ExtractIconInfoFromUrl(nsIFile ** aLocalFile, PRUint32 * aDesiredImageSize, nsACString &aContentType, nsACString &aFileExtension) { nsresult rv = NS_OK; nsCOMPtr iconURI (do_QueryInterface(mUrl, &rv)); @@ -237,28 +236,29 @@ NS_IMETHODIMP nsIconChannel::AsyncOpen(nsIStreamListener *aListener, nsISupports return rv; } -static DWORD GetSpecialFolderIcon(nsIFile* aFile, int aFolder, SHFILEINFOW* aSFI, UINT aInfoFlags) +static DWORD GetSpecialFolderIcon(nsIFile* aFile, int aFolder, SHFILEINFO* aSFI, UINT aInfoFlags) { DWORD shellResult = 0; if (!aFile) return shellResult; - PRUnichar fileNativePath[MAX_PATH]; - nsAutoString fileNativePathStr; - aFile->GetPath(fileNativePathStr); - ::GetShortPathNameW(fileNativePathStr.get(), fileNativePath, sizeof(fileNativePath)); + char fileNativePath[MAX_PATH]; + nsCAutoString fileNativePathStr; + aFile->GetNativePath(fileNativePathStr); + ::GetShortPathName(fileNativePathStr.get(), fileNativePath, sizeof(fileNativePath)); LPITEMIDLIST idList; HRESULT hr = ::SHGetSpecialFolderLocation(NULL, aFolder, &idList); if (SUCCEEDED(hr)) { - PRUnichar specialNativePath[MAX_PATH]; - ::SHGetPathFromIDListW(idList, specialNativePath); - ::GetShortPathNameW(specialNativePath, specialNativePath, sizeof(specialNativePath)); - if (!wcsicmp(fileNativePath,specialNativePath)) { + char specialNativePath[MAX_PATH]; + ::SHGetPathFromIDList(idList, specialNativePath); + ::GetShortPathName(specialNativePath, specialNativePath, sizeof(specialNativePath)); + + if (nsDependentCString(fileNativePath).EqualsIgnoreCase(specialNativePath)) { aInfoFlags |= (SHGFI_PIDL | SHGFI_SYSICONINDEX); - shellResult = ::SHGetFileInfoW((LPCWSTR)(LPCITEMIDLIST)idList, 0, aSFI, - sizeof(SHFILEINFOW), aInfoFlags); + shellResult = ::SHGetFileInfo((LPCTSTR)(LPCITEMIDLIST)idList, 0, aSFI, + sizeof(SHFILEINFO), aInfoFlags); IMalloc* pMalloc; hr = ::SHGetMalloc(&pMalloc); if (SUCCEEDED(hr)) { @@ -273,14 +273,14 @@ static DWORD GetSpecialFolderIcon(nsIFile* aFile, int aFolder, SHFILEINFOW* aSFI nsresult nsIconChannel::MakeInputStream(nsIInputStream** _retval, PRBool nonBlocking) { nsXPIDLCString contentType; - nsCString filePath; + nsCAutoString filePath; nsCOMPtr localFile; // file we want an icon for PRUint32 desiredImageSize; nsresult rv = ExtractIconInfoFromUrl(getter_AddRefs(localFile), &desiredImageSize, contentType, filePath); NS_ENSURE_SUCCESS(rv, rv); // if the file exists, we are going to use it's real attributes...otherwise we only want to use it for it's extension... - SHFILEINFOW sfi; + SHFILEINFO sfi; UINT infoFlags = SHGFI_ICON; PRBool fileExists = PR_FALSE; @@ -342,8 +342,7 @@ nsresult nsIconChannel::MakeInputStream(nsIInputStream** _retval, PRBool nonBloc // Not a special folder, or something else failed above. if (!shellResult) - shellResult = ::SHGetFileInfoW(NS_ConvertUTF8toUTF16(filePath).get(), - FILE_ATTRIBUTE_ARCHIVE, &sfi, sizeof(sfi), infoFlags); + shellResult = ::SHGetFileInfo(filePath.get(), FILE_ATTRIBUTE_ARCHIVE, &sfi, sizeof(sfi), infoFlags); if (shellResult && sfi.hIcon) { diff --git a/modules/libpr0n/decoders/icon/win/nsIconChannel.h b/modules/libpr0n/decoders/icon/win/nsIconChannel.h index a69ea61c0d8..bf59799ae8b 100644 --- a/modules/libpr0n/decoders/icon/win/nsIconChannel.h +++ b/modules/libpr0n/decoders/icon/win/nsIconChannel.h @@ -77,7 +77,7 @@ protected: nsCOMPtr mPump; nsCOMPtr mListener; - nsresult ExtractIconInfoFromUrl(nsIFile ** aLocalFile, PRUint32 * aDesiredImageSize, nsCString &aContentType, nsCString &aFileExtension); + nsresult ExtractIconInfoFromUrl(nsIFile ** aLocalFile, PRUint32 * aDesiredImageSize, nsACString &aContentType, nsACString &aFileExtension); nsresult MakeInputStream(nsIInputStream** _retval, PRBool nonBlocking); }; diff --git a/modules/oji/src/scd.cpp b/modules/oji/src/scd.cpp index 6b49e7058fa..34e9925318f 100644 --- a/modules/oji/src/scd.cpp +++ b/modules/oji/src/scd.cpp @@ -100,7 +100,7 @@ nsSymantecDebugManager::SetDebugAgentPassword(PRInt32 pwd) // ("SetWindowLong returned %ld (err=%d)\n", err, GetLastError())); /* continue so that we try to wake up the DebugManager */ } - sem = OpenSemaphoreW(SEMAPHORE_MODIFY_STATE, FALSE, L"Netscape-Symantec Debugger"); + sem = OpenSemaphore(SEMAPHORE_MODIFY_STATE, FALSE, "Netscape-Symantec Debugger"); if (sem) { ReleaseSemaphore(sem, 1, NULL); CloseHandle(sem); diff --git a/modules/plugin/base/src/nsPluginDirServiceProvider.cpp b/modules/plugin/base/src/nsPluginDirServiceProvider.cpp index 89310077632..db6e4c56bc0 100644 --- a/modules/plugin/base/src/nsPluginDirServiceProvider.cpp +++ b/modules/plugin/base/src/nsPluginDirServiceProvider.cpp @@ -66,14 +66,14 @@ ClearVersion(verBlock *ver) } static BOOL -FileExists(wchar_t* szFile) +FileExists(LPCSTR szFile) { - return GetFileAttributesW(szFile) != 0xFFFFFFFF; + return GetFileAttributes(szFile) != 0xFFFFFFFF; } // Get file version information from a file static BOOL -GetFileVersion(wchar_t* szFile, verBlock *vbVersion) +GetFileVersion(LPSTR szFile, verBlock *vbVersion) { UINT uLen; UINT dwLen; @@ -86,12 +86,12 @@ GetFileVersion(wchar_t* szFile, verBlock *vbVersion) ClearVersion(vbVersion); if (FileExists(szFile)) { bRv = TRUE; - dwLen = GetFileVersionInfoSizeW(szFile, &dwHandle); + dwLen = GetFileVersionInfoSize(szFile, &dwHandle); lpData = (LPVOID)malloc(dwLen); uLen = 0; - if (lpData && GetFileVersionInfoW(szFile, dwHandle, dwLen, lpData) != 0) { - if (VerQueryValueW(lpData, L"\\", &lpBuffer, &uLen) != 0) { + if (lpData && GetFileVersionInfo(szFile, dwHandle, dwLen, lpData) != 0) { + if (VerQueryValue(lpData, "\\", &lpBuffer, &uLen) != 0) { lpBuffer2 = (VS_FIXEDFILEINFO *)lpBuffer; vbVersion->wMajor = HIWORD(lpBuffer2->dwFileVersionMS); @@ -124,15 +124,15 @@ CopyVersion(verBlock *ver1, verBlock *ver2) static void TranslateVersionStr(const char* szVersion, verBlock *vbVersion) { - char* szNum1 = NULL; - char* szNum2 = NULL; - char* szNum3 = NULL; - char* szNum4 = NULL; - char* szJavaBuild = NULL; + LPSTR szNum1 = NULL; + LPSTR szNum2 = NULL; + LPSTR szNum3 = NULL; + LPSTR szNum4 = NULL; + LPSTR szJavaBuild = NULL; - char* strVer = nsnull; + char *strVer = nsnull; if (szVersion) { - strVer = strdup(szVersion); + strVer = PL_strdup(szVersion); } if (!strVer) { @@ -157,7 +157,7 @@ TranslateVersionStr(const char* szVersion, verBlock *vbVersion) vbVersion->wRelease = szNum3 ? atoi(szNum3) : 0; vbVersion->wBuild = szNum4 ? atoi(szNum4) : 0; - free(strVer); + PL_strfree(strVer); } // Compare two version struct, return zero if the same @@ -195,28 +195,26 @@ CompareVersion(verBlock vbVersionOld, verBlock vbVersionNew) // Indicate whether we should try to use the new NPRuntime-based Java // Plug-In if it's available static PRBool -TryToUseNPRuntimeJavaPlugIn(const wchar_t* javaVersion) +TryToUseNPRuntimeJavaPlugIn(const char* javaVersion) { HKEY javaKey = NULL; - wchar_t keyName[_MAX_PATH]; - - wcsncpy(keyName, L"Software\\JavaSoft\\Java Plug-in\\", wcslen(L"Software\\JavaSoft\\Java Plug-in\\")); - wcscpy(keyName, javaVersion); - + char keyName[_MAX_PATH]; + keyName[0] = 0; + PL_strcat(keyName, "Software\\JavaSoft\\Java Plug-in\\"); + PL_strcat(keyName, javaVersion); DWORD val; DWORD valSize = sizeof(DWORD); - if (ERROR_SUCCESS != ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, + if (ERROR_SUCCESS != ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, keyName, 0, KEY_READ, &javaKey)) { return FALSE; } // Look for "UseNewJavaPlugin" - if (ERROR_SUCCESS != ::RegQueryValueExW(javaKey, - L"UseNewJavaPlugin", - NULL, NULL, - (LPBYTE) &val, - &valSize)) { + if (ERROR_SUCCESS != ::RegQueryValueEx(javaKey, "UseNewJavaPlugin", + NULL, NULL, + (LPBYTE) &val, + &valSize)) { val = 0; } @@ -264,7 +262,7 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant, return rv; } - if (strcmp(prop, NS_WIN_4DOTX_SCAN_KEY) == 0) { + if (nsCRT::strcmp(prop, NS_WIN_4DOTX_SCAN_KEY) == 0) { // Check our prefs to see if scanning the 4.x folder has been // explictly overriden failure to get the pref is okay, we'll do // what we've been doing -- a filtered scan @@ -279,38 +277,38 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant, HKEY keyloc; long result; DWORD type; - wchar_t szKey[_MAX_PATH] = L"Software\\Netscape\\Netscape Navigator"; - wchar_t path[_MAX_PATH]; + char szKey[_MAX_PATH] = "Software\\Netscape\\Netscape Navigator"; + char path[_MAX_PATH]; - result = ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, szKey, 0, KEY_READ, &keyloc); + result = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, KEY_READ, &keyloc); if (result == ERROR_SUCCESS) { - wchar_t current_version[80]; + char current_version[80]; DWORD length = sizeof(current_version); - result = ::RegQueryValueExW(keyloc, L"CurrentVersion", NULL, &type, + result = ::RegQueryValueEx(keyloc, "CurrentVersion", NULL, &type, (LPBYTE)¤t_version, &length); ::RegCloseKey(keyloc); - wcscat(szKey, L"\\"); - wcscat(szKey, current_version); - wcscat(szKey, L"\\Main"); - result = ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, szKey, 0, KEY_READ, &keyloc); + PL_strcat(szKey, "\\"); + PL_strcat(szKey, current_version); + PL_strcat(szKey, "\\Main"); + result = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, KEY_READ, &keyloc); if (result == ERROR_SUCCESS) { DWORD pathlen = sizeof(path); - result = ::RegQueryValueExW(keyloc, L"Plugins Directory", NULL, &type, + result = ::RegQueryValueEx(keyloc, "Plugins Directory", NULL, &type, (LPBYTE)&path, &pathlen); if (result == ERROR_SUCCESS) { - rv = NS_NewLocalFile(nsDependentString(path), PR_TRUE, - getter_AddRefs(localFile)); + rv = NS_NewNativeLocalFile(nsDependentCString(path), PR_TRUE, + getter_AddRefs(localFile)); } ::RegCloseKey(keyloc); } } - } else if (strcmp(prop, NS_WIN_JRE_SCAN_KEY) == 0) { + } else if (nsCRT::strcmp(prop, NS_WIN_JRE_SCAN_KEY) == 0) { nsXPIDLCString strVer; #ifdef OJI if (NS_FAILED(prefs->GetCharPref(prop, getter_Copies(strVer)))) @@ -330,25 +328,24 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant, DWORD pathlen; verBlock maxVer; ClearVersion(&maxVer); - wchar_t curKey[_MAX_PATH] = L"Software\\JavaSoft\\Java Runtime Environment"; - wchar_t path[_MAX_PATH]; - + char curKey[_MAX_PATH] = "Software\\JavaSoft\\Java Runtime Environment"; + char path[_MAX_PATH]; // Add + 15 to prevent buffer overrun when adding \bin (+ optionally // \new_plugin) #define JAVA_PATH_SIZE _MAX_PATH + 15 - wchar_t newestPath[JAVA_PATH_SIZE]; - const wchar_t mozPath[_MAX_PATH] = L"Software\\mozilla.org\\Mozilla"; - wchar_t browserJavaVersion[_MAX_PATH]; + char newestPath[JAVA_PATH_SIZE]; + const char mozPath[_MAX_PATH] = "Software\\mozilla.org\\Mozilla"; + char browserJavaVersion[_MAX_PATH]; PRBool tryNPRuntimeJavaPlugIn = PR_FALSE; newestPath[0] = 0; - LONG result = ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, curKey, 0, KEY_READ, + LONG result = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, curKey, 0, KEY_READ, &baseloc); if (ERROR_SUCCESS != result) return NS_ERROR_FAILURE; // Look for "BrowserJavaVersion" - if (ERROR_SUCCESS != ::RegQueryValueExW(baseloc, L"BrowserJavaVersion", NULL, + if (ERROR_SUCCESS != ::RegQueryValueEx(baseloc, "BrowserJavaVersion", NULL, NULL, (LPBYTE)&browserJavaVersion, &numChars)) browserJavaVersion[0] = 0; @@ -359,13 +356,13 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant, path[0] = 0; numChars = _MAX_PATH; pathlen = sizeof(path); - result = ::RegEnumKeyExW(baseloc, index, curKey, &numChars, NULL, NULL, + result = ::RegEnumKeyEx(baseloc, index, curKey, &numChars, NULL, NULL, NULL, &modTime); index++; // Skip major.minor as it always points to latest in its family numChars = 0; - for (wchar_t *p = curKey; *p; p++) { // can I do this with wchar_t xxx? + for (char *p = curKey; *p; p++) { if (*p == '.') { numChars++; } @@ -374,24 +371,24 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant, continue; if (ERROR_SUCCESS == result) { - if (ERROR_SUCCESS == ::RegOpenKeyExW(baseloc, curKey, 0, + if (ERROR_SUCCESS == ::RegOpenKeyEx(baseloc, curKey, 0, KEY_QUERY_VALUE, &keyloc)) { // We have a sub key - if (ERROR_SUCCESS == ::RegQueryValueExW(keyloc, L"JavaHome", NULL, + if (ERROR_SUCCESS == ::RegQueryValueEx(keyloc, "JavaHome", NULL, &type, (LPBYTE)&path, &pathlen)) { verBlock curVer; - TranslateVersionStr(NS_ConvertUTF16toUTF8(curKey).get(), &curVer); + TranslateVersionStr(curKey, &curVer); if (CompareVersion(curVer, minVer) >= 0) { - if (!wcsncmp(browserJavaVersion, curKey, _MAX_PATH)) { - wcscpy(newestPath, path); + if (!strncmp(browserJavaVersion, curKey, _MAX_PATH)) { + PL_strcpy(newestPath, path); tryNPRuntimeJavaPlugIn = TryToUseNPRuntimeJavaPlugIn(curKey); ::RegCloseKey(keyloc); break; } if (CompareVersion(curVer, maxVer) >= 0) { - wcscpy(newestPath, path); + PL_strcpy(newestPath, path); CopyVersion(&maxVer, &curVer); tryNPRuntimeJavaPlugIn = TryToUseNPRuntimeJavaPlugIn(curKey); } @@ -407,20 +404,20 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant, // If nothing is found, then don't add \bin dir and don't set // CurrentVersion for Mozilla if (newestPath[0] != 0) { - if (ERROR_SUCCESS == ::RegCreateKeyExW(HKEY_LOCAL_MACHINE, mozPath, 0, + if (ERROR_SUCCESS == ::RegCreateKeyEx(HKEY_LOCAL_MACHINE, mozPath, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE|KEY_QUERY_VALUE, NULL, &entryloc, NULL)) { - if (ERROR_SUCCESS != ::RegQueryValueExW(entryloc, L"CurrentVersion", 0, + if (ERROR_SUCCESS != ::RegQueryValueEx(entryloc, "CurrentVersion", 0, NULL, NULL, NULL)) { - ::RegSetValueExW(entryloc, L"CurrentVersion", 0, REG_SZ, + ::RegSetValueEx(entryloc, "CurrentVersion", 0, REG_SZ, (const BYTE*)MOZILLA_VERSION, sizeof(MOZILLA_VERSION)); } ::RegCloseKey(entryloc); } - wcscat(newestPath,L"\\bin"); + PL_strcat(newestPath,"\\bin"); // See whether we should use the new NPRuntime-based Java Plug-In: // - If tryNPRuntimeJavaPlugIn is true, and @@ -430,13 +427,13 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant, // one any more. if (tryNPRuntimeJavaPlugIn) { // See whether the "new_plugin" directory exists - wchar_t tmpPath[JAVA_PATH_SIZE]; - wcscpy(tmpPath, newestPath); - wcscat(tmpPath, L"\\new_plugin"); + char tmpPath[JAVA_PATH_SIZE]; + PL_strcpy(tmpPath, newestPath); + PL_strcat(tmpPath, "\\new_plugin"); nsCOMPtr tmpFile; - if (NS_SUCCEEDED(NS_NewLocalFile(nsDependentString(tmpPath), - PR_TRUE, - getter_AddRefs(tmpFile))) && + if (NS_SUCCEEDED(NS_NewNativeLocalFile(nsDependentCString(tmpPath), + PR_TRUE, + getter_AddRefs(tmpFile))) && tmpFile) { PRBool exists = PR_FALSE; PRBool isDir = PR_FALSE; @@ -445,15 +442,15 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant, // Assume we're supposed to use this as the search // directory for the Java Plug-In instead of the normal // one - wcscpy(newestPath, tmpPath); + PL_strcpy(newestPath, tmpPath); } } } - rv = NS_NewLocalFile(nsDependentString(newestPath), PR_TRUE, - getter_AddRefs(localFile)); + rv = NS_NewNativeLocalFile(nsDependentCString(newestPath), PR_TRUE, + getter_AddRefs(localFile)); } - } else if (strcmp(prop, NS_WIN_QUICKTIME_SCAN_KEY) == 0) { + } else if (nsCRT::strcmp(prop, NS_WIN_QUICKTIME_SCAN_KEY) == 0) { nsXPIDLCString strVer; if (NS_FAILED(prefs->GetCharPref(prop, getter_Copies(strVer)))) return NS_ERROR_FAILURE; @@ -466,33 +463,33 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant, DWORD type; verBlock qtVer; ClearVersion(&qtVer); - wchar_t path[_MAX_PATH]; + char path[_MAX_PATH]; DWORD pathlen = sizeof(path); // First we need to check the version of Quicktime via checking // the EXE's version table - if (ERROR_SUCCESS == ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\QuickTimePlayer.exe", 0, KEY_READ, &keyloc)) { - if (ERROR_SUCCESS == ::RegQueryValueExW(keyloc, NULL, NULL, &type, - (LPBYTE)&path, &pathlen)) { - GetFileVersion(path, &qtVer); + if (ERROR_SUCCESS == ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, "software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\QuickTimePlayer.exe", 0, KEY_READ, &keyloc)) { + if (ERROR_SUCCESS == ::RegQueryValueEx(keyloc, NULL, NULL, &type, + (LPBYTE)&path, &pathlen)) { + GetFileVersion((char*)path, &qtVer); } ::RegCloseKey(keyloc); } if (CompareVersion(qtVer, minVer) < 0) return rv; - if (ERROR_SUCCESS == ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"software\\Apple Computer, Inc.\\QuickTime", 0, KEY_READ, &keyloc)) { + if (ERROR_SUCCESS == ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, "software\\Apple Computer, Inc.\\QuickTime", 0, KEY_READ, &keyloc)) { DWORD pathlen = sizeof(path); - result = ::RegQueryValueExW(keyloc, L"InstallDir", NULL, &type, + result = ::RegQueryValueEx(keyloc, "InstallDir", NULL, &type, (LPBYTE)&path, &pathlen); - wcscat(path, L"\\Plugins"); + PL_strcat(path, "\\Plugins"); if (result == ERROR_SUCCESS) - rv = NS_NewLocalFile(nsDependentString(path), PR_TRUE, - getter_AddRefs(localFile)); + rv = NS_NewNativeLocalFile(nsDependentCString(path), PR_TRUE, + getter_AddRefs(localFile)); ::RegCloseKey(keyloc); } - } else if (strcmp(prop, NS_WIN_WMP_SCAN_KEY) == 0) { + } else if (nsCRT::strcmp(prop, NS_WIN_WMP_SCAN_KEY) == 0) { nsXPIDLCString strVer; if (NS_FAILED(prefs->GetCharPref(prop, getter_Copies(strVer)))) return NS_ERROR_FAILURE; @@ -504,33 +501,33 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant, DWORD type; verBlock wmpVer; ClearVersion(&wmpVer); - wchar_t path[_MAX_PATH]; + char path[_MAX_PATH]; DWORD pathlen = sizeof(path); // First we need to check the version of WMP - if (ERROR_SUCCESS == ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\wmplayer.exe", 0, KEY_READ, &keyloc)) { - if (ERROR_SUCCESS == ::RegQueryValueExW(keyloc, NULL, NULL, &type, - (LPBYTE)&path, &pathlen)) { - GetFileVersion(path, &wmpVer); + if (ERROR_SUCCESS == ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, "software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\wmplayer.exe", 0, KEY_READ, &keyloc)) { + if (ERROR_SUCCESS == ::RegQueryValueEx(keyloc, NULL, NULL, &type, + (LPBYTE)&path, &pathlen)) { + GetFileVersion((char*)path, &wmpVer); } ::RegCloseKey(keyloc); } if (CompareVersion(wmpVer, minVer) < 0) return rv; - if (ERROR_SUCCESS == ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, - L"software\\Microsoft\\MediaPlayer", 0, + if (ERROR_SUCCESS == ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, + "software\\Microsoft\\MediaPlayer", 0, KEY_READ, &keyloc)) { - if (ERROR_SUCCESS == ::RegQueryValueExW(keyloc, L"Installation Directory", + if (ERROR_SUCCESS == ::RegQueryValueEx(keyloc, "Installation Directory", NULL, &type, (LPBYTE)&path, &pathlen)) { - rv = NS_NewLocalFile(nsDependentString(path), PR_TRUE, - getter_AddRefs(localFile)); + rv = NS_NewNativeLocalFile(nsDependentCString(path), PR_TRUE, + getter_AddRefs(localFile)); } ::RegCloseKey(keyloc); } - } else if (strcmp(prop, NS_WIN_ACROBAT_SCAN_KEY) == 0) { + } else if (nsCRT::strcmp(prop, NS_WIN_ACROBAT_SCAN_KEY) == 0) { nsXPIDLCString strVer; if (NS_FAILED(prefs->GetCharPref(prop, getter_Copies(strVer)))) { return NS_ERROR_FAILURE; @@ -549,16 +546,16 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant, DWORD pathlen; verBlock maxVer; ClearVersion(&maxVer); - wchar_t curKey[_MAX_PATH] = L"software\\Adobe\\Acrobat Reader"; - wchar_t path[_MAX_PATH]; + char curKey[_MAX_PATH] = "software\\Adobe\\Acrobat Reader"; + char path[_MAX_PATH]; // Add + 8 to prevent buffer overrun when adding \browser - wchar_t newestPath[_MAX_PATH + 8]; + char newestPath[_MAX_PATH + 8]; newestPath[0] = 0; - if (ERROR_SUCCESS != ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, curKey, 0, + if (ERROR_SUCCESS != ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, curKey, 0, KEY_READ, &baseloc)) { - wcscpy(curKey, L"software\\Adobe\\Adobe Acrobat"); - if (ERROR_SUCCESS != ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, curKey, 0, + PL_strcpy(curKey, "software\\Adobe\\Adobe Acrobat"); + if (ERROR_SUCCESS != ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, curKey, 0, KEY_READ, &baseloc)) { return NS_ERROR_FAILURE; } @@ -571,22 +568,22 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant, path[0] = 0; numChars = _MAX_PATH; pathlen = sizeof(path); - result = ::RegEnumKeyExW(baseloc, index, curKey, &numChars, NULL, NULL, + result = ::RegEnumKeyEx(baseloc, index, curKey, &numChars, NULL, NULL, NULL, &modTime); index++; if (ERROR_SUCCESS == result) { verBlock curVer; - TranslateVersionStr(NS_ConvertUTF16toUTF8(curKey).get(), &curVer); - wcscat(curKey, L"\\InstallPath"); - if (ERROR_SUCCESS == ::RegOpenKeyExW(baseloc, curKey, 0, + TranslateVersionStr(curKey, &curVer); + PL_strcat(curKey, "\\InstallPath"); + if (ERROR_SUCCESS == ::RegOpenKeyEx(baseloc, curKey, 0, KEY_QUERY_VALUE, &keyloc)) { // We have a sub key - if (ERROR_SUCCESS == ::RegQueryValueExW(keyloc, NULL, NULL, &type, + if (ERROR_SUCCESS == ::RegQueryValueEx(keyloc, NULL, NULL, &type, (LPBYTE)&path, &pathlen)) { if (CompareVersion(curVer, maxVer) >= 0 && CompareVersion(curVer, minVer) >= 0) { - wcscpy(newestPath, path); + PL_strcpy(newestPath, path); CopyVersion(&maxVer, &curVer); } } @@ -599,9 +596,9 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant, ::RegCloseKey(baseloc); if (newestPath[0] != 0) { - wcscat(newestPath, L"\\browser"); - rv = NS_NewLocalFile(nsDependentString(newestPath), PR_TRUE, - getter_AddRefs(localFile)); + PL_strcat(newestPath,"\\browser"); + rv = NS_NewNativeLocalFile(nsDependentCString(newestPath), PR_TRUE, + getter_AddRefs(localFile)); } } @@ -629,32 +626,32 @@ nsPluginDirServiceProvider::GetPLIDDirectories(nsISimpleEnumerator **aEnumerator nsresult nsPluginDirServiceProvider::GetPLIDDirectoriesWithHKEY(HKEY aKey, nsCOMArray &aDirs) { - wchar_t subkey[_MAX_PATH] = L"Software\\MozillaPlugins"; + char subkey[_MAX_PATH] = "Software\\MozillaPlugins"; HKEY baseloc; - if (ERROR_SUCCESS != ::RegOpenKeyExW(aKey, subkey, 0, KEY_READ, &baseloc)) + if (ERROR_SUCCESS != ::RegOpenKeyEx(aKey, subkey, 0, KEY_READ, &baseloc)) return NS_ERROR_FAILURE; DWORD index = 0; DWORD subkeylen = _MAX_PATH; FILETIME modTime; - while (ERROR_SUCCESS == ::RegEnumKeyExW(baseloc, index++, subkey, &subkeylen, + while (ERROR_SUCCESS == ::RegEnumKeyEx(baseloc, index++, subkey, &subkeylen, NULL, NULL, NULL, &modTime)) { subkeylen = _MAX_PATH; HKEY keyloc; - if (ERROR_SUCCESS == ::RegOpenKeyExW(baseloc, subkey, 0, KEY_QUERY_VALUE, + if (ERROR_SUCCESS == ::RegOpenKeyEx(baseloc, subkey, 0, KEY_QUERY_VALUE, &keyloc)) { DWORD type; - wchar_t path[_MAX_PATH]; + char path[_MAX_PATH]; DWORD pathlen = sizeof(path); - if (ERROR_SUCCESS == ::RegQueryValueExW(keyloc, L"Path", NULL, &type, + if (ERROR_SUCCESS == ::RegQueryValueEx(keyloc, "Path", NULL, &type, (LPBYTE)&path, &pathlen)) { nsCOMPtr localFile; - if (NS_SUCCEEDED(NS_NewLocalFile(nsDependentString(path), - PR_TRUE, - getter_AddRefs(localFile))) && + if (NS_SUCCEEDED(NS_NewNativeLocalFile(nsDependentCString(path), + PR_TRUE, + getter_AddRefs(localFile))) && localFile) { // Some vendors use a path directly to the DLL so chop off // the filename diff --git a/modules/plugin/base/src/nsPluginHostImpl.cpp b/modules/plugin/base/src/nsPluginHostImpl.cpp index aa1b905bd27..e20cf13b8a5 100644 --- a/modules/plugin/base/src/nsPluginHostImpl.cpp +++ b/modules/plugin/base/src/nsPluginHostImpl.cpp @@ -4052,18 +4052,18 @@ nsPluginHostImpl::TrySetUpPluginInstance(const char *aMimeType, #ifdef XP_WIN static BOOL firstJavaPlugin = FALSE; BOOL restoreOrigDir = FALSE; - PRUnichar origDir[_MAX_PATH]; + char origDir[_MAX_PATH]; if (isJavaPlugin && !firstJavaPlugin) { - DWORD dw = ::GetCurrentDirectoryW(_MAX_PATH, origDir); + DWORD dw = ::GetCurrentDirectory(_MAX_PATH, origDir); NS_ASSERTION(dw <= _MAX_PATH, "Falied to obtain the current directory, which may leads to incorrect class laoding"); nsCOMPtr binDirectory; result = NS_GetSpecialDirectory(NS_XPCOM_CURRENT_PROCESS_DIR, getter_AddRefs(binDirectory)); if (NS_SUCCEEDED(result)) { - nsAutoString path; - binDirectory->GetPath(path); - restoreOrigDir = ::SetCurrentDirectoryW(path.get()); + nsCAutoString path; + binDirectory->GetNativePath(path); + restoreOrigDir = ::SetCurrentDirectory(path.get()); } } #endif @@ -4071,7 +4071,7 @@ nsPluginHostImpl::TrySetUpPluginInstance(const char *aMimeType, #ifdef XP_WIN if (!firstJavaPlugin && restoreOrigDir) { - BOOL bCheck = ::SetCurrentDirectoryW(origDir); + BOOL bCheck = ::SetCurrentDirectory(origDir); NS_ASSERTION(bCheck, " Error restoring driectoy"); firstJavaPlugin = TRUE; } diff --git a/modules/plugin/base/src/nsPluginNativeWindowWin.cpp b/modules/plugin/base/src/nsPluginNativeWindowWin.cpp index fc702c79108..27b74b160d0 100644 --- a/modules/plugin/base/src/nsPluginNativeWindowWin.cpp +++ b/modules/plugin/base/src/nsPluginNativeWindowWin.cpp @@ -62,7 +62,7 @@ static NS_DEFINE_CID(kCPluginManagerCID, NS_PLUGINMANAGER_CID); // needed for NS_TRY_SAFE_CALL -#define NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION L"MozillaPluginWindowPropertyAssociation" +#define NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION "MozillaPluginWindowPropertyAssociation" typedef nsTWeakRef PluginWindowWeakRef; @@ -203,7 +203,7 @@ NS_IMETHODIMP nsDelayedPopupsEnabledEvent::Run() */ static LRESULT CALLBACK PluginWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { - nsPluginNativeWindowWin * win = (nsPluginNativeWindowWin *)::GetPropW(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION); + nsPluginNativeWindowWin * win = (nsPluginNativeWindowWin *)::GetProp(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION); if (!win) return TRUE; @@ -526,10 +526,10 @@ nsresult nsPluginNativeWindowWin::SubclassAndAssociateWindow() if (!mPluginWinProc) return NS_ERROR_FAILURE; - nsPluginNativeWindowWin * win = (nsPluginNativeWindowWin *)::GetPropW(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION); + nsPluginNativeWindowWin * win = (nsPluginNativeWindowWin *)::GetProp(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION); NS_ASSERTION(!win || (win == this), "plugin window already has property and this is not us"); - if (!::SetPropW(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION, (HANDLE)this)) + if (!::SetProp(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION, (HANDLE)this)) return NS_ERROR_FAILURE; return NS_OK; @@ -543,7 +543,7 @@ nsresult nsPluginNativeWindowWin::UndoSubclassAndAssociateWindow() // remove window property HWND hWnd = (HWND)window; if (IsWindow(hWnd)) - ::RemovePropW(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION); + ::RemoveProp(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION); // restore the original win proc // but only do this if this were us last time diff --git a/modules/plugin/base/src/nsPluginsDirWin.cpp b/modules/plugin/base/src/nsPluginsDirWin.cpp index 97b31f2d2de..35d07f9eaa0 100644 --- a/modules/plugin/base/src/nsPluginsDirWin.cpp +++ b/modules/plugin/base/src/nsPluginsDirWin.cpp @@ -58,18 +58,25 @@ /* Local helper functions */ -static char* GetKeyValue(wchar_t* verbuf, wchar_t* key) +static char* GetKeyValue(char* verbuf, char* key) { - wchar_t *buf = NULL; + char *buf = NULL; UINT blen; - ::VerQueryValueW(verbuf, - key, + ::VerQueryValue(verbuf, + TEXT(key), (void **)&buf, &blen); if(buf != NULL) { - return strdup(NS_ConvertUTF16toUTF8(buf).get()); +#ifdef WINCE + // On windows CE, the verbuf is wide and the shunt + // layer can't do much about it. So, here we + // convert the wide string. + return PL_strdup(NS_ConvertUTF16toUTF8((PRUnichar*)buf).get()); +#else + return PL_strdup(buf); +#endif } return nsnull; @@ -209,35 +216,35 @@ nsresult nsPluginFile::LoadPlugin(PRLibrary* &outLibrary) if (!mPlugin) return NS_ERROR_NULL_POINTER; - nsAutoString temp; - mPlugin->GetPath(temp); + nsCAutoString temp; + mPlugin->GetNativePath(temp); - PRUnichar* index; - PRUnichar* pluginFolderPath = _wcsdup(temp.get()); + char* index; + char* pluginFolderPath = PL_strdup(temp.get()); - index = wcsrchr(pluginFolderPath, '\\'); + index = PL_strrchr(pluginFolderPath, '\\'); *index = 0; BOOL restoreOrigDir = FALSE; - PRUnichar aOrigDir[MAX_PATH + 1]; - DWORD dwCheck = ::GetCurrentDirectoryW(sizeof(aOrigDir), aOrigDir); + char aOrigDir[MAX_PATH + 1]; + DWORD dwCheck = ::GetCurrentDirectory(sizeof(aOrigDir), aOrigDir); NS_ASSERTION(dwCheck <= MAX_PATH + 1, "Error in Loading plugin"); if (dwCheck <= MAX_PATH + 1) { - restoreOrigDir = ::SetCurrentDirectoryW(pluginFolderPath); + restoreOrigDir = ::SetCurrentDirectory(pluginFolderPath); NS_ASSERTION(restoreOrigDir, "Error in Loading plugin"); } - outLibrary = PR_LoadLibrary(NS_ConvertUTF16toUTF8(temp).get()); + outLibrary = PR_LoadLibrary(temp.get()); if (restoreOrigDir) { - BOOL bCheck = ::SetCurrentDirectoryW(aOrigDir); + BOOL bCheck = ::SetCurrentDirectory(aOrigDir); NS_ASSERTION(bCheck, "Error in Loading plugin"); } - free(pluginFolderPath); + PL_strfree(pluginFolderPath); return NS_OK; } @@ -249,39 +256,37 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info) { nsresult res = NS_OK; DWORD zerome, versionsize; - PRUnichar* verbuf = nsnull; + char* verbuf = nsnull; - const PRUnichar* path; + const char* path; if (!mPlugin) return NS_ERROR_NULL_POINTER; - nsAutoString temp; - mPlugin->GetPath(temp); + nsCAutoString temp; + mPlugin->GetNativePath(temp); path = temp.get(); - versionsize = ::GetFileVersionInfoSizeW(path, &zerome); + versionsize = ::GetFileVersionInfoSize((char*)path, &zerome); if (versionsize > 0) - verbuf = (wchar_t *)PR_Malloc(versionsize); + verbuf = (char *)PR_Malloc(versionsize); if(!verbuf) return NS_ERROR_OUT_OF_MEMORY; - if(::GetFileVersionInfoW(path, NULL, versionsize, verbuf)) + if(::GetFileVersionInfo((char*)path, NULL, versionsize, verbuf)) { - info.fName = GetKeyValue(verbuf, L"\\StringFileInfo\\040904E4\\ProductName"); - info.fDescription = GetKeyValue(verbuf, L"\\StringFileInfo\\040904E4\\FileDescription"); + info.fName = GetKeyValue(verbuf, "\\StringFileInfo\\040904E4\\ProductName"); + info.fDescription = GetKeyValue(verbuf, "\\StringFileInfo\\040904E4\\FileDescription"); - char *mimeType = GetKeyValue(verbuf, L"\\StringFileInfo\\040904E4\\MIMEType"); - char *mimeDescription = GetKeyValue(verbuf, L"\\StringFileInfo\\040904E4\\FileOpenName"); - char *extensions = GetKeyValue(verbuf, L"\\StringFileInfo\\040904E4\\FileExtents"); + char *mimeType = GetKeyValue(verbuf, "\\StringFileInfo\\040904E4\\MIMEType"); + char *mimeDescription = GetKeyValue(verbuf, "\\StringFileInfo\\040904E4\\FileOpenName"); + char *extensions = GetKeyValue(verbuf, "\\StringFileInfo\\040904E4\\FileExtents"); info.fVariantCount = CalculateVariantCount(mimeType); info.fMimeTypeArray = MakeStringArray(info.fVariantCount, mimeType); info.fMimeDescriptionArray = MakeStringArray(info.fVariantCount, mimeDescription); info.fExtensionArray = MakeStringArray(info.fVariantCount, extensions); - - // fFileName is narrow. fix? - info.fFileName = PL_strdup(NS_ConvertUTF16toUTF8(path).get()); + info.fFileName = PL_strdup(path); PL_strfree(mimeType); PL_strfree(mimeDescription); diff --git a/modules/plugin/samples/default/windows/dialogs.cpp b/modules/plugin/samples/default/windows/dialogs.cpp index 4c8efb03f73..eae460d2dcb 100644 --- a/modules/plugin/samples/default/windows/dialogs.cpp +++ b/modules/plugin/samples/default/windows/dialogs.cpp @@ -79,18 +79,17 @@ static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam) pPlugin->m_hWndDialog = hWnd; - wchar_t szString[512]; - LoadStringW(hInst, IDS_TITLE, szString, sizeof(szString)); - SetWindowTextW(hWnd, szString); + char szString[512]; + LoadString(hInst, IDS_TITLE, szString, sizeof(szString)); + SetWindowText(hWnd, szString); - LoadStringW(hInst, IDS_INFO, szString, sizeof(szString)); - SetDlgItemTextW(hWnd, IDC_STATIC_INFO, szString); + LoadString(hInst, IDS_INFO, szString, sizeof(szString)); + SetDlgItemText(hWnd, IDC_STATIC_INFO, szString); - // convert m_pNPMIMEType dougt - SetDlgItemTextA(hWnd, IDC_STATIC_INFOTYPE, pPlugin->m_pNPMIMEType); + SetDlgItemText(hWnd, IDC_STATIC_INFOTYPE, (LPSTR)pPlugin->m_pNPMIMEType); - LoadStringW(hInst, IDS_LOCATION, szString, sizeof(szString)); - SetDlgItemTextW(hWnd, IDC_STATIC_LOCATION, szString); + LoadString(hInst, IDS_LOCATION, szString, sizeof(szString)); + SetDlgItemText(hWnd, IDC_STATIC_LOCATION, szString); char contentTypeIsJava = 0; @@ -100,36 +99,30 @@ static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam) } if(pPlugin->m_szPageURL == NULL || contentTypeIsJava) - LoadStringW(hInst, IDS_FINDER_PAGE, szString, sizeof(szString)); + LoadString(hInst, IDS_FINDER_PAGE, szString, sizeof(szString)); else - { - MultiByteToWideChar( CP_ACP, 0, - pPlugin->m_szPageURL, - strlen(pPlugin->m_szPageURL)+1, - szString, - 511 ); // defect #362738 - } - + strncpy(szString, pPlugin->m_szPageURL,511); // defect #362738 + SetDlgItemTextWrapped(hWnd, IDC_STATIC_URL, szString); - LoadStringW(hInst, IDS_QUESTION, szString, sizeof(szString)); - SetDlgItemTextW(hWnd, IDC_STATIC_QUESTION, szString); + LoadString(hInst, IDS_QUESTION, szString, sizeof(szString)); + SetDlgItemText(hWnd, IDC_STATIC_QUESTION, szString); - SetDlgItemTextW(hWnd, IDC_STATIC_WARNING, L""); + SetDlgItemText(hWnd, IDC_STATIC_WARNING, ""); if(!pPlugin->m_bOnline) { EnableWindow(GetDlgItem(hWnd, IDC_GET_PLUGIN), FALSE); - LoadStringW(hInst, IDS_WARNING_OFFLINE, szString, sizeof(szString)); - SetDlgItemTextW(hWnd, IDC_STATIC_WARNING, szString); - SetDlgItemTextW(hWnd, IDC_STATIC_QUESTION, L""); + LoadString(hInst, IDS_WARNING_OFFLINE, szString, sizeof(szString)); + SetDlgItemText(hWnd, IDC_STATIC_WARNING, szString); + SetDlgItemText(hWnd, IDC_STATIC_QUESTION, ""); return TRUE; } if((!pPlugin->m_bJava) || (!pPlugin->m_bJavaScript) || (!pPlugin->m_bSmartUpdate)) { - LoadStringW(hInst, IDS_WARNING_JS, szString, sizeof(szString)); - SetDlgItemTextW(hWnd, IDC_STATIC_WARNING, szString); + LoadString(hInst, IDS_WARNING_JS, szString, sizeof(szString)); + SetDlgItemText(hWnd, IDC_STATIC_WARNING, szString); return TRUE; } diff --git a/modules/plugin/samples/default/windows/npshell.cpp b/modules/plugin/samples/default/windows/npshell.cpp index 1525b84cc96..b7d2683d4a1 100644 --- a/modules/plugin/samples/default/windows/npshell.cpp +++ b/modules/plugin/samples/default/windows/npshell.cpp @@ -86,18 +86,18 @@ NPError NP_LOADDS NPP_New(NPMIMEType pluginType, for(int i = 0; i < argc; i++) { - if(strcmpi(argn[i],"pluginspage") == 0 && argv[i] != NULL) + if(lstrcmpi(argn[i],"pluginspage") == 0 && argv[i] != NULL) szPageURL = (char *)argv[i]; - else if(strcmpi(argn[i],"codebase") == 0 && argv[i] != NULL) + else if(lstrcmpi(argn[i],"codebase") == 0 && argv[i] != NULL) szPageURL = (char *)argv[i]; - else if(strcmpi(argn[i],"pluginurl") == 0 && argv[i] != NULL) + else if(lstrcmpi(argn[i],"pluginurl") == 0 && argv[i] != NULL) szFileURL = (char *)argv[i]; - else if(strcmpi(argn[i],"classid") == 0 && argv[i] != NULL) + else if(lstrcmpi(argn[i],"classid") == 0 && argv[i] != NULL) szFileURL = (char *)argv[i]; - else if(strcmpi(argn[i],"SRC") == 0 && argv[i] != NULL) + else if(lstrcmpi(argn[i],"SRC") == 0 && argv[i] != NULL) buf = (char *)argv[i]; - else if(strcmpi(argn[i],"HIDDEN") == 0 && argv[i] != NULL) - bHidden = (strcmp((char *)argv[i], "TRUE") == 0); + else if(lstrcmpi(argn[i],"HIDDEN") == 0 && argv[i] != NULL) + bHidden = (lstrcmp((char *)argv[i], "TRUE") == 0); } /* some post-processing on the filename to attempt to extract the extension: */ diff --git a/modules/plugin/samples/default/windows/plugin.cpp b/modules/plugin/samples/default/windows/plugin.cpp index 2b5fac54d40..c22de1023b4 100644 --- a/modules/plugin/samples/default/windows/plugin.cpp +++ b/modules/plugin/samples/default/windows/plugin.cpp @@ -51,7 +51,7 @@ nsIServiceManager * gServiceManager = NULL; -static wchar_t szNullPluginWindowClassName[] = CLASS_NULL_PLUGIN; +static char szNullPluginWindowClassName[] = CLASS_NULL_PLUGIN; static LRESULT CALLBACK NP_LOADDS PluginWndProc(HWND, UINT, WPARAM, LPARAM); @@ -66,7 +66,7 @@ BOOL RegisterNullPluginWindowClass() { assert(hInst != NULL); - WNDCLASSW wc; + WNDCLASS wc; memset(&wc, 0, sizeof(wc)); @@ -78,14 +78,14 @@ BOOL RegisterNullPluginWindowClass() wc.hbrBackground = HBRUSH(COLOR_WINDOW + 1); wc.lpszClassName = szNullPluginWindowClassName; - ATOM aRet = RegisterClassW(&wc); + ATOM aRet = RegisterClass(&wc); return (aRet != NULL); } void UnregisterNullPluginWindowClass() { assert(hInst != NULL); - UnregisterClassW(szNullPluginWindowClassName, hInst); + UnregisterClass(szNullPluginWindowClassName, hInst); } /*********************************************/ @@ -129,41 +129,41 @@ CPlugin::CPlugin(HINSTANCE hInst, if(pluginType && *pluginType) { - m_pNPMIMEType = (NPMIMEType) new char[strlen(pluginType) + 1]; + m_pNPMIMEType = (NPMIMEType)new char[lstrlen((LPSTR)pluginType) + 1]; if(m_pNPMIMEType != NULL) - strcpy(m_pNPMIMEType, pluginType); + lstrcpy((LPSTR)m_pNPMIMEType, pluginType); } if(szPageURL && *szPageURL) { - m_szPageURL = new char[strlen(szPageURL) + 1]; + m_szPageURL = new char[lstrlen(szPageURL) + 1]; if(m_szPageURL != NULL) - strcpy(m_szPageURL, szPageURL); + lstrcpy(m_szPageURL, szPageURL); } if(szFileURL && *szFileURL) { - m_szFileURL = new char[strlen(szFileURL) + 1]; + m_szFileURL = new char[lstrlen(szFileURL) + 1]; if(m_szFileURL != NULL) - strcpy(m_szFileURL, szFileURL); + lstrcpy(m_szFileURL, szFileURL); } if(szFileExtension && *szFileExtension) { - m_szFileExtension = new char[strlen(szFileExtension) + 1]; + m_szFileExtension = new char[lstrlen(szFileExtension) + 1]; if(m_szFileExtension != NULL) - strcpy(m_szFileExtension, szFileExtension); + lstrcpy(m_szFileExtension, szFileExtension); } m_hIcon = LoadIcon(m_hInst, MAKEINTRESOURCE(IDI_PLUGICON)); - wchar_t szString[1024] = {'\0'}; - LoadStringW(m_hInst, IDS_CLICK_TO_GET, szString, sizeof(szString)); + char szString[1024] = {'\0'}; + LoadString(m_hInst, IDS_CLICK_TO_GET, szString, sizeof(szString)); if(*szString) { - m_szCommandMessage = new wchar_t[wcslen(szString) + 1]; + m_szCommandMessage = new char[lstrlen(szString) + 1]; if(m_szCommandMessage != NULL) - wcscpy(m_szCommandMessage, szString); + lstrcpy(m_szCommandMessage, szString); } } @@ -253,8 +253,8 @@ BOOL CPlugin::init(HWND hWndParent) RECT rcParent; GetClientRect(m_hWndParent, &rcParent); - CreateWindowW(szNullPluginWindowClassName, - L"NULL Plugin", + CreateWindow(szNullPluginWindowClassName, + "NULL Plugin", WS_CHILD, 0,0, rcParent.right, rcParent.bottom, m_hWndParent, @@ -332,10 +332,10 @@ LPSTR CPlugin::createURLString() // check if there is file URL first if(!m_bSmartUpdate && m_szFileURL != NULL) { - m_szURLString = new char[strlen(m_szFileURL) + 1]; + m_szURLString = new char[lstrlen(m_szFileURL) + 1]; if(m_szURLString == NULL) return NULL; - strcpy(m_szURLString, m_szFileURL); + lstrcpy(m_szURLString, m_szFileURL); return m_szURLString; } @@ -351,18 +351,18 @@ LPSTR CPlugin::createURLString() if(!m_bSmartUpdate && m_szPageURL != NULL && !contentTypeIsJava) { - szAddress = new char[strlen(m_szPageURL) + 1]; + szAddress = new char[lstrlen(m_szPageURL) + 1]; if(szAddress == NULL) return NULL; - strcpy(szAddress, m_szPageURL); + lstrcpy(szAddress, m_szPageURL); - m_szURLString = new char[strlen(szAddress) + 1 + strlen(m_pNPMIMEType) + 1]; + m_szURLString = new char[lstrlen(szAddress) + 1 + lstrlen((LPSTR)m_pNPMIMEType) + 1]; if(m_szURLString == NULL) return NULL; // Append the MIME type to the URL - sprintf(m_szURLString, "%s?%s", szAddress, (LPSTR)m_pNPMIMEType); + wsprintf(m_szURLString, "%s?%s", szAddress, (LPSTR)m_pNPMIMEType); } else // default { @@ -374,20 +374,20 @@ LPSTR CPlugin::createURLString() urlToOpen = szPageUrlForJVM; } - szAddress = new char[strlen(urlToOpen) + 1]; + szAddress = new char[lstrlen(urlToOpen) + 1]; if(szAddress == NULL) return NULL; - strcpy(szAddress, urlToOpen); + lstrcpy(szAddress, urlToOpen); - m_szURLString = new char[strlen(szAddress) + 10 + - strlen(m_pNPMIMEType) + 1]; + m_szURLString = new char[lstrlen(szAddress) + 10 + + lstrlen((LPSTR)m_pNPMIMEType) + 1]; if(m_szURLString == NULL) return NULL; // Append the MIME type to the URL - sprintf(m_szURLString, "%s?mimetype=%s", - szAddress, m_pNPMIMEType); + wsprintf(m_szURLString, "%s?mimetype=%s", + szAddress, (LPSTR)m_pNPMIMEType); } else { @@ -409,15 +409,14 @@ LPSTR CPlugin::createURLString() m_szFileURL[0] = '\0'; } - m_szURLString = new char[strlen(szPluginFinderCommandBeginning) + strlen(urlToOpen) + 10 + - strlen((LPSTR)m_pNPMIMEType) + 13 + - strlen((LPSTR)m_szPageURL) + 11 + - strlen((LPSTR)m_szFileURL) + - strlen(szPluginFinderCommandEnd) + 1]; - sprintf(m_szURLString, "%s%s?mimetype=%s&pluginspage=%s&pluginurl=%s%s", - szPluginFinderCommandBeginning, urlToOpen, - m_pNPMIMEType, m_szPageURL, m_szFileURL, - szPluginFinderCommandEnd); + m_szURLString = new char[lstrlen(szPluginFinderCommandBeginning) + lstrlen(urlToOpen) + 10 + + lstrlen((LPSTR)m_pNPMIMEType) + 13 + + lstrlen((LPSTR)m_szPageURL) + 11 + + lstrlen((LPSTR)m_szFileURL) + + lstrlen(szPluginFinderCommandEnd) + 1]; + wsprintf(m_szURLString, "%s%s?mimetype=%s&pluginspage=%s&pluginurl=%s%s", + szPluginFinderCommandBeginning, urlToOpen, + (LPSTR)m_pNPMIMEType, m_szPageURL, m_szFileURL, szPluginFinderCommandEnd); } } @@ -513,13 +512,13 @@ void CPlugin::getPlugin() m_szCommandMessage = NULL; } - wchar_t szString[1024] = {'\0'}; - LoadStringW(m_hInst, IDS_CLICK_WHEN_DONE, szString, sizeof(szString)); + char szString[1024] = {'\0'}; + LoadString(m_hInst, IDS_CLICK_WHEN_DONE, szString, sizeof(szString)); if(*szString) { - m_szCommandMessage = new wchar_t[wcslen(szString) + 1]; + m_szCommandMessage = new char[lstrlen(szString) + 1]; if(m_szCommandMessage != NULL) - wcscpy(m_szCommandMessage, szString); + lstrcpy(m_szCommandMessage, szString); } InvalidateRect(m_hWnd, NULL, TRUE); @@ -549,20 +548,20 @@ void CPlugin::URLNotify(const char * szURL) dbgOut2("CPlugin::URLNotify(), URL '%s'", szURL); NPStream * pStream = NULL; - wchar_t buf[256]; + char buf[256]; assert(m_hInst != NULL); assert(m_pNPInstance != NULL); - int iSize = LoadStringW(m_hInst, IDS_GOING2HTML, buf, sizeof(buf)); + int iSize = LoadString(m_hInst, IDS_GOING2HTML, buf, sizeof(buf)); NPError rc = NPN_NewStream(m_pNPInstance, "text/html", "asd_plugin_finder", &pStream); if (rc != NPERR_NO_ERROR) return; - //wchar_t buf[] = L"\n\n\n

NPN_NewStream / NPN_Write - This seems to work.

\n\n\n"; + //char buf[] = "\n\n\n

NPN_NewStream / NPN_Write - This seems to work.

\n\n\n"; - NPN_Write(m_pNPInstance, pStream, iSize, buf); // buf is unicode now. + NPN_Write(m_pNPInstance, pStream, iSize, buf); NPN_DestroyStream(m_pNPInstance, pStream, NPRES_DONE); } @@ -595,12 +594,12 @@ NPError CPlugin::destroyStream(NPStream *stream, NPError reason) BOOL CPlugin::readyToRefresh() { - wchar_t szString[1024] = {'\0'}; - LoadStringW(m_hInst, IDS_CLICK_WHEN_DONE, szString, sizeof(szString)); + char szString[1024] = {'\0'}; + LoadString(m_hInst, IDS_CLICK_WHEN_DONE, szString, sizeof(szString)); if(m_szCommandMessage == NULL) return FALSE; - return (wcscmp(m_szCommandMessage, szString) == 0); + return (lstrcmp(m_szCommandMessage, szString) == 0); } //*************************** @@ -627,7 +626,7 @@ void CPlugin::onRButtonUp(HWND hWnd, int x, int y, UINT keyFlags) NPN_GetURL(m_pNPInstance, "javascript:navigator.plugins.refresh(true)", "_self"); } -static void DrawCommandMessage(HDC hDC, wchar_t* szString, LPRECT lprc) +static void DrawCommandMessage(HDC hDC, LPSTR szString, LPRECT lprc) { if(szString == NULL) return; @@ -638,7 +637,7 @@ static void DrawCommandMessage(HDC hDC, wchar_t* szString, LPRECT lprc) HFONT hFontOld = SelectFont(hDC, hFont); SIZE sz; - GetTextExtentPoint32W(hDC, szString, wcslen(szString), &sz); + GetTextExtentPoint32(hDC, szString, lstrlen(szString), &sz); POINT pt; pt.x = sz.cx; pt.y = sz.cy; @@ -660,7 +659,7 @@ static void DrawCommandMessage(HDC hDC, wchar_t* szString, LPRECT lprc) int iModeOld = SetBkMode(hDC, TRANSPARENT); COLORREF crColorOld = SetTextColor(hDC, RGB(0,0,0)); - DrawTextW(hDC, szString, wcslen(szString), &rcText, DT_CENTER|DT_VCENTER); + DrawText(hDC, szString, lstrlen(szString), &rcText, DT_CENTER|DT_VCENTER); SetTextColor(hDC, crColorOld); SetBkMode(hDC, iModeOld); SelectFont(hDC, hFontOld); diff --git a/modules/plugin/samples/default/windows/plugin.h b/modules/plugin/samples/default/windows/plugin.h index 21b6f45c50f..34961aa4369 100644 --- a/modules/plugin/samples/default/windows/plugin.h +++ b/modules/plugin/samples/default/windows/plugin.h @@ -51,7 +51,7 @@ private: HICON m_hIcon; char* m_szURLString; - wchar_t* m_szCommandMessage; + char* m_szCommandMessage; BOOL m_bWaitingStreamFromPFS; NPStream* m_PFSStream; @@ -118,7 +118,7 @@ public: #define JVM_SMARTUPDATE_URL "http://java.com/download" #ifdef WIN32 -#define REGISTRY_PLACE L"Software\\Netscape\\Netscape Navigator\\Default Plugin" +#define REGISTRY_PLACE "Software\\Netscape\\Netscape Navigator\\Default Plugin" #else #define GWL_USERDATA 0 #define COLOR_3DSHADOW COLOR_BTNFACE @@ -126,7 +126,7 @@ public: #define COLOR_3DDKSHADOW COLOR_BTNSHADOW #endif -#define CLASS_NULL_PLUGIN L"NullPluginClass" +#define CLASS_NULL_PLUGIN "NullPluginClass" BOOL RegisterNullPluginWindowClass(); void UnregisterNullPluginWindowClass(); diff --git a/modules/plugin/samples/default/windows/utils.cpp b/modules/plugin/samples/default/windows/utils.cpp index 01cf1f3928a..2371e71430c 100644 --- a/modules/plugin/samples/default/windows/utils.cpp +++ b/modules/plugin/samples/default/windows/utils.cpp @@ -45,8 +45,8 @@ HKEY openRegistry() { HKEY phkResult; - if(RegCreateKeyW(HKEY_CURRENT_USER, REGISTRY_PLACE, &phkResult) != ERROR_SUCCESS) - MessageBoxW(0, L"Error creating Default Plugin registry key", L"Default Plugin", MB_OK); + if(RegCreateKey(HKEY_CURRENT_USER, REGISTRY_PLACE, &phkResult) != ERROR_SUCCESS) + MessageBox(0, "Error creating Default Plugin registry key", "Default Plugin", MB_OK); return phkResult; } @@ -56,37 +56,30 @@ BOOL IsNewMimeType(LPSTR mime) { HKEY hkey = openRegistry(); DWORD dwType, keysize = 512; - wchar_t keybuf[512]; - wchar_t wideMime[64]; + char keybuf[512]; - MultiByteToWideChar(CP_ACP, 0, - mime, - strlen(mime) + 1, - wideMime, - 64); - - if(RegQueryValueExW(hkey, wideMime, 0, &dwType, (LPBYTE) &keybuf, &keysize) == ERROR_SUCCESS) + if(RegQueryValueEx(hkey, mime, 0, &dwType, (LPBYTE) &keybuf, &keysize) == ERROR_SUCCESS) { // key exists, must have already been here... return FALSE; } else { - if(RegSetValueExW(hkey, wideMime, 0, REG_SZ, (LPBYTE) L"(none)", 7) != ERROR_SUCCESS) - MessageBoxW(0, L"Error adding MIME type value", L"Default Plugin", MB_OK); + if(RegSetValueEx(hkey, mime, 0, REG_SZ, (LPBYTE) "(none)", 7) != ERROR_SUCCESS) + MessageBox(0, "Error adding MIME type value", "Default Plugin", MB_OK); return TRUE; } } // string length in pixels for the specific window (selected font) -static int getWindowStringLength(HWND hWnd, wchar_t* lpsz) +static int getWindowStringLength(HWND hWnd, LPSTR lpsz) { SIZE sz; HDC hDC = GetDC(hWnd); HFONT hWindowFont = GetWindowFont(hWnd); HFONT hFontOld = SelectFont(hDC, hWindowFont); - GetTextExtentPoint32W(hDC, lpsz, wcslen(lpsz), &sz); + GetTextExtentPoint32(hDC, lpsz, lstrlen(lpsz), &sz); POINT pt; pt.x = sz.cx; pt.y = sz.cy; @@ -96,20 +89,20 @@ static int getWindowStringLength(HWND hWnd, wchar_t* lpsz) return (int)pt.x; } -/*******************************************************************/ -/* */ -/* void SetDlgItemTextWrapped(HWND hWnd, int iID, wchar_t* szText) */ -/* */ -/* helper to wrap long lines in a static control, which do not */ -/* wrap automatically if they do not have space characters */ -/* */ -/*******************************************************************/ -void SetDlgItemTextWrapped(HWND hWnd, int iID, wchar_t* szText) +/****************************************************************/ +/* */ +/* void SetDlgItemTextWrapped(HWND hWnd, int iID, LPSTR szText) */ +/* */ +/* helper to wrap long lines in a static control, which do not */ +/* wrap automatically if they do not have space characters */ +/* */ +/****************************************************************/ +void SetDlgItemTextWrapped(HWND hWnd, int iID, LPSTR szText) { HWND hWndStatic = GetDlgItem(hWnd, iID); - if((szText == NULL) || (wcslen(szText) == 0)) + if((szText == NULL) || (lstrlen(szText) == 0)) { - SetDlgItemTextW(hWnd, iID, L""); + SetDlgItemText(hWnd, iID, ""); return; } @@ -121,7 +114,7 @@ void SetDlgItemTextWrapped(HWND hWnd, int iID, wchar_t* szText) if(iStringLength <= iStaticLength) { - SetDlgItemTextW(hWnd, iID, szText); + SetDlgItemText(hWnd, iID, szText); return; } @@ -129,19 +122,19 @@ void SetDlgItemTextWrapped(HWND hWnd, int iID, wchar_t* szText) if(iBreaks <= 0) return; - wchar_t * pBuf = new wchar_t[iStringLength + iBreaks + 1]; + char * pBuf = new char[iStringLength + iBreaks + 1]; if(pBuf == NULL) return; - wcscpy(pBuf, L""); + lstrcpy(pBuf, ""); int iStart = 0; int iLines = 0; for(int i = 0; i < iStringLength; i++) { - wchar_t* sz = &szText[iStart]; + char * sz = &szText[iStart]; int iIndex = i - iStart; - wchar_t ch = sz[iIndex + 1]; + char ch = sz[iIndex + 1]; sz[iIndex + 1] = '\0'; @@ -152,7 +145,7 @@ void SetDlgItemTextWrapped(HWND hWnd, int iID, wchar_t* szText) sz[iIndex + 1] = ch; if(iLines == iBreaks) { - wcscat(pBuf, sz); + lstrcat(pBuf, sz); break; } continue; @@ -164,15 +157,15 @@ void SetDlgItemTextWrapped(HWND hWnd, int iID, wchar_t* szText) ch = sz[iIndex]; sz[iIndex] = '\0'; // terminate string one char shorter - wcscat(pBuf, sz); // append the string - wcscat(pBuf, L" "); // append space character for successful wrapping + lstrcat(pBuf, sz); // append the string + lstrcat(pBuf, " "); // append space character for successful wrapping - iStart += wcslen(sz); // shift new start position + iStart += lstrlen(sz);// shift new start position sz[iIndex] = ch; // restore zeroed element iLines++; // count lines } - SetDlgItemTextW(hWnd, iID, pBuf); + SetDlgItemText(hWnd, iID, pBuf); delete [] pBuf; } diff --git a/modules/plugin/samples/default/windows/utils.h b/modules/plugin/samples/default/windows/utils.h index a4b5a44443e..1e1691d7828 100644 --- a/modules/plugin/samples/default/windows/utils.h +++ b/modules/plugin/samples/default/windows/utils.h @@ -40,6 +40,6 @@ HKEY openRegistry(); BOOL IsNewMimeType(LPSTR szMimeType); -void SetDlgItemTextWrapped(HWND hWnd, int iID, wchar_t* szText); +void SetDlgItemTextWrapped(HWND hWnd, int iID, LPSTR szText); #endif // __UTILS_H__ diff --git a/modules/plugin/tools/sdk/samples/basic/windows/plugin.cpp b/modules/plugin/tools/sdk/samples/basic/windows/plugin.cpp index 923f6ef2ea1..8443ce501f0 100644 --- a/modules/plugin/tools/sdk/samples/basic/windows/plugin.cpp +++ b/modules/plugin/tools/sdk/samples/basic/windows/plugin.cpp @@ -146,11 +146,11 @@ static LRESULT CALLBACK PluginWinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM nsPluginInstance *plugin = (nsPluginInstance *)GetWindowLong(hWnd, GWL_USERDATA); if (plugin) { const char * string = plugin->getVersion(); - DrawTextA(hdc, string, strlen(string), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER); + DrawText(hdc, string, strlen(string), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER); } else { char string[] = "Error occured"; - DrawTextA(hdc, string, strlen(string), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER); + DrawText(hdc, string, strlen(string), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER); } EndPaint(hWnd, &ps); diff --git a/modules/plugin/tools/sdk/samples/scriptable/windows/plugin.cpp b/modules/plugin/tools/sdk/samples/scriptable/windows/plugin.cpp index a2bed6b1802..23d06902ccc 100644 --- a/modules/plugin/tools/sdk/samples/scriptable/windows/plugin.cpp +++ b/modules/plugin/tools/sdk/samples/scriptable/windows/plugin.cpp @@ -220,10 +220,10 @@ static LRESULT CALLBACK PluginWinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM // get our plugin instance object and ask it for the version string nsPluginInstance *plugin = (nsPluginInstance *)GetWindowLong(hWnd, GWL_USERDATA); if (plugin) - DrawTextA(hdc, plugin->mString, strlen(plugin->mString), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER); + DrawText(hdc, plugin->mString, strlen(plugin->mString), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER); else { char string[] = "Error occured"; - DrawTextA(hdc, string, strlen(string), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER); + DrawText(hdc, string, strlen(string), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER); } EndPaint(hWnd, &ps); diff --git a/rdf/datasource/src/nsFileSystemDataSource.cpp b/rdf/datasource/src/nsFileSystemDataSource.cpp index d88221b77f2..cd1bf5eb8fc 100644 --- a/rdf/datasource/src/nsFileSystemDataSource.cpp +++ b/rdf/datasource/src/nsFileSystemDataSource.cpp @@ -928,15 +928,14 @@ FileSystemDataSource::GetVolumeList(nsISimpleEnumerator** aResult) #if defined (XP_WIN) && !defined (WINCE) PRInt32 driveType; - PRUnichar drive[32]; + char drive[32]; PRInt32 volNum; char *url; for (volNum = 0; volNum < 26; volNum++) { - swprintf( drive, L"%c:\\", volNum + (PRUnichar)'A'); - - driveType = GetDriveTypeW(drive); + sprintf(drive, "%c:\\", volNum + 'A'); + driveType = GetDriveType(drive); if (driveType != DRIVE_UNKNOWN && driveType != DRIVE_NO_ROOT_DIR) { if (nsnull != (url = PR_smprintf("file:///%c|/", volNum + 'A'))) diff --git a/toolkit/components/startup/src/nsUserInfoWin.cpp b/toolkit/components/startup/src/nsUserInfoWin.cpp index 4bdc29fa246..bbb16c7a099 100644 --- a/toolkit/components/startup/src/nsUserInfoWin.cpp +++ b/toolkit/components/startup/src/nsUserInfoWin.cpp @@ -58,13 +58,14 @@ nsUserInfo::GetUsername(char **aUsername) { *aUsername = nsnull; - PRUnichar username[256]; + TCHAR username[256]; DWORD size = 256; - if (!GetUserNameW(username, &size)) + if (!GetUserName(username, &size)) return NS_ERROR_FAILURE; - - *aUsername = ToNewUTF8String(nsDependentString(username)); + + *aUsername = nsCRT::strdup(username); + if (*aUsername) return NS_OK; return NS_ERROR_FAILURE; diff --git a/uriloader/exthandler/win/nsMIMEInfoWin.cpp b/uriloader/exthandler/win/nsMIMEInfoWin.cpp index c4e2a59e41e..2ed61c0e760 100755 --- a/uriloader/exthandler/win/nsMIMEInfoWin.cpp +++ b/uriloader/exthandler/win/nsMIMEInfoWin.cpp @@ -266,7 +266,7 @@ nsMIMEInfoWin::LoadUriInternal(nsIURI * aURL) SFGAOF sfgao; // Bug 394974 - HMODULE hDll = ::LoadLibraryW(L"shell32.dll"); + HMODULE hDll = ::LoadLibrary("shell32.dll"); MySHParseDisplayName pMySHParseDisplayName = NULL; // Version 6.0 and higher if (pMySHParseDisplayName = @@ -274,19 +274,19 @@ nsMIMEInfoWin::LoadUriInternal(nsIURI * aURL) "SHParseDisplayName")) { if (SUCCEEDED(pMySHParseDisplayName(NS_ConvertUTF8toUTF16(urlSpec).get(), NULL, &pidl, 0, &sfgao))) { - static const PRUnichar cmdVerb[] = L"open"; - SHELLEXECUTEINFOW sinfo; + static const char cmdVerb[] = "open"; + SHELLEXECUTEINFO sinfo; memset(&sinfo, 0, sizeof(SHELLEXECUTEINFO)); sinfo.cbSize = sizeof(SHELLEXECUTEINFO); sinfo.fMask = SEE_MASK_FLAG_DDEWAIT | SEE_MASK_FLAG_NO_UI | SEE_MASK_INVOKEIDLIST; sinfo.hwnd = NULL; - sinfo.lpVerb = (LPWSTR)&cmdVerb; + sinfo.lpVerb = (LPCSTR)&cmdVerb; sinfo.nShow = SW_SHOWNORMAL; sinfo.lpIDList = pidl; - BOOL result = ShellExecuteExW(&sinfo); + BOOL result = ShellExecuteEx(&sinfo); CoTaskMemFree(pidl); @@ -295,9 +295,7 @@ nsMIMEInfoWin::LoadUriInternal(nsIURI * aURL) } } else { // Version of shell32.dll < 6.0 - LONG r = (LONG) ::ShellExecuteW(NULL, L"open", - NS_ConvertUTF8toUTF16(urlSpec).get(), - NULL, NULL, + LONG r = (LONG) ::ShellExecute(NULL, "open", urlSpec.get(), NULL, NULL, SW_SHOWNORMAL); if (r < 32) rv = NS_ERROR_FAILURE; diff --git a/uriloader/exthandler/win/nsOSHelperAppService.cpp b/uriloader/exthandler/win/nsOSHelperAppService.cpp index 8d63241533b..bfe39446ec5 100644 --- a/uriloader/exthandler/win/nsOSHelperAppService.cpp +++ b/uriloader/exthandler/win/nsOSHelperAppService.cpp @@ -145,11 +145,11 @@ nsresult nsOSHelperAppService::OSProtocolHandlerExists(const char * aProtocolSch if (aProtocolScheme && *aProtocolScheme) { HKEY hKey; - LONG err = ::RegOpenKeyExA(HKEY_CLASSES_ROOT, aProtocolScheme, 0, + LONG err = ::RegOpenKeyEx(HKEY_CLASSES_ROOT, aProtocolScheme, 0, KEY_QUERY_VALUE, &hKey); if (err == ERROR_SUCCESS) { - err = ::RegQueryValueExW(hKey, L"URL Protocol", NULL, NULL, NULL, NULL); + err = ::RegQueryValueEx(hKey, "URL Protocol", NULL, NULL, NULL, NULL); *aHandlerExists = (err == ERROR_SUCCESS); // close the key ::RegCloseKey(hKey); diff --git a/widget/src/windows/nsAppShell.cpp b/widget/src/windows/nsAppShell.cpp index 9dd15f5bfa2..9b81af7060f 100644 --- a/widget/src/windows/nsAppShell.cpp +++ b/widget/src/windows/nsAppShell.cpp @@ -93,13 +93,13 @@ nsresult nsAppShell::Init() { if (!sMsgId) - sMsgId = RegisterWindowMessageW(L"nsAppShell:EventID"); + sMsgId = RegisterWindowMessage("nsAppShell:EventID"); - WNDCLASSW wc; + WNDCLASS wc; HINSTANCE module = GetModuleHandle(NULL); - const PRUnichar *const kWindowClass = L"nsAppShell:EventWindowClass"; - if (!GetClassInfoW(module, kWindowClass, &wc)) { + const char *const kWindowClass = "nsAppShell:EventWindowClass"; + if (!GetClassInfo(module, kWindowClass, &wc)) { wc.style = 0; wc.lpfnWndProc = EventWindowProc; wc.cbClsExtra = 0; @@ -108,12 +108,12 @@ nsAppShell::Init() wc.hIcon = NULL; wc.hCursor = NULL; wc.hbrBackground = (HBRUSH) NULL; - wc.lpszMenuName = (LPCWSTR) NULL; + wc.lpszMenuName = (LPCSTR) NULL; wc.lpszClassName = kWindowClass; - RegisterClassW(&wc); + RegisterClass(&wc); } - mEventWnd = CreateWindowW(kWindowClass, L"nsAppShell:EventWindow", + mEventWnd = CreateWindow(kWindowClass, "nsAppShell:EventWindow", 0, 0, 0, 10, 10, NULL, NULL, module, NULL); NS_ENSURE_STATE(mEventWnd); diff --git a/widget/src/windows/nsBidiKeyboard.cpp b/widget/src/windows/nsBidiKeyboard.cpp index 89e4ade8ad9..03c7df9c72c 100644 --- a/widget/src/windows/nsBidiKeyboard.cpp +++ b/widget/src/windows/nsBidiKeyboard.cpp @@ -40,7 +40,6 @@ #include #include "nsBidiKeyboard.h" #include "prmem.h" -#include NS_IMPL_ISUPPORTS1(nsBidiKeyboard, nsIBidiKeyboard) @@ -64,8 +63,8 @@ NS_IMETHODIMP nsBidiKeyboard::SetLangFromBidiLevel(PRUint8 aLevel) return result; // call LoadKeyboardLayout() only if the target keyboard layout is different from the current - PRUnichar currentLocaleName[KL_NAMELENGTH]; - wcsncpy(currentLocaleName, (aLevel & 1) ? mRTLKeyboard : mLTRKeyboard, KL_NAMELENGTH); + char currentLocaleName[KL_NAMELENGTH]; + strncpy(currentLocaleName, (aLevel & 1) ? mRTLKeyboard : mLTRKeyboard, KL_NAMELENGTH); currentLocaleName[KL_NAMELENGTH-1] = '\0'; // null terminate NS_ASSERTION(*currentLocaleName, @@ -97,26 +96,26 @@ NS_IMETHODIMP nsBidiKeyboard::IsLangRTL(PRBool *aIsRTL) currentLocale = ::GetKeyboardLayout(0); *aIsRTL = IsRTLLanguage(currentLocale); - if (!::GetKeyboardLayoutNameW(mCurrentLocaleName)) + if (!::GetKeyboardLayoutName(mCurrentLocaleName)) return NS_ERROR_FAILURE; NS_ASSERTION(*mCurrentLocaleName, "GetKeyboardLayoutName return string length == 0"); - NS_ASSERTION((wcslen(mCurrentLocaleName) < KL_NAMELENGTH), + NS_ASSERTION((strlen(mCurrentLocaleName) < KL_NAMELENGTH), "GetKeyboardLayoutName return string length >= KL_NAMELENGTH"); // The language set by the user overrides the default language for that direction if (*aIsRTL) { - wcsncpy(mRTLKeyboard, mCurrentLocaleName, KL_NAMELENGTH); + strncpy(mRTLKeyboard, mCurrentLocaleName, KL_NAMELENGTH); mRTLKeyboard[KL_NAMELENGTH-1] = '\0'; // null terminate } else { - wcsncpy(mLTRKeyboard, mCurrentLocaleName, KL_NAMELENGTH); + strncpy(mLTRKeyboard, mCurrentLocaleName, KL_NAMELENGTH); mLTRKeyboard[KL_NAMELENGTH-1] = '\0'; // null terminate } - NS_ASSERTION((wcslen(mRTLKeyboard) < KL_NAMELENGTH), + NS_ASSERTION((strlen(mRTLKeyboard) < KL_NAMELENGTH), "mLTRKeyboard has string length >= KL_NAMELENGTH"); - NS_ASSERTION((wcslen(mLTRKeyboard) < KL_NAMELENGTH), + NS_ASSERTION((strlen(mLTRKeyboard) < KL_NAMELENGTH), "mRTLKeyboard has string length >= KL_NAMELENGTH"); return NS_OK; } @@ -133,7 +132,7 @@ nsresult nsBidiKeyboard::SetupBidiKeyboards() int keyboards; HKL far* buf; HKL locale; - PRUnichar localeName[KL_NAMELENGTH]; + char localeName[KL_NAMELENGTH]; PRBool isLTRKeyboardSet = PR_FALSE; PRBool isRTLKeyboardSet = PR_FALSE; @@ -157,11 +156,11 @@ nsresult nsBidiKeyboard::SetupBidiKeyboards() while (keyboards--) { locale = buf[keyboards]; if (IsRTLLanguage(locale)) { - swprintf(mRTLKeyboard, L"%.*x", KL_NAMELENGTH - 1, LANGIDFROMLCID(locale)); + sprintf(mRTLKeyboard, "%.*x", KL_NAMELENGTH - 1, LANGIDFROMLCID(locale)); isRTLKeyboardSet = PR_TRUE; } else { - swprintf( mLTRKeyboard, L"%.*x", KL_NAMELENGTH - 1, LANGIDFROMLCID(locale)); + sprintf(mLTRKeyboard, "%.*x", KL_NAMELENGTH - 1, LANGIDFROMLCID(locale)); isLTRKeyboardSet = PR_TRUE; } } @@ -179,20 +178,20 @@ nsresult nsBidiKeyboard::SetupBidiKeyboards() // installed this prevents us from arbitrarily resetting the current // layout (bug 80274) locale = ::GetKeyboardLayout(0); - if (!::GetKeyboardLayoutNameW(localeName)) + if (!::GetKeyboardLayoutName(localeName)) return NS_ERROR_FAILURE; NS_ASSERTION(*localeName, "GetKeyboardLayoutName return string length == 0"); - NS_ASSERTION((wcslen(localeName) < KL_NAMELENGTH), + NS_ASSERTION((strlen(localeName) < KL_NAMELENGTH), "GetKeyboardLayout return string length >= KL_NAMELENGTH"); if (IsRTLLanguage(locale)) { - swprintf(mRTLKeyboard, localeName, KL_NAMELENGTH); + strncpy(mRTLKeyboard, localeName, KL_NAMELENGTH); mRTLKeyboard[KL_NAMELENGTH-1] = '\0'; // null terminate } else { - swprintf( mLTRKeyboard, localeName, KL_NAMELENGTH); + strncpy(mLTRKeyboard, localeName, KL_NAMELENGTH); mLTRKeyboard[KL_NAMELENGTH-1] = '\0'; // null terminate } diff --git a/widget/src/windows/nsBidiKeyboard.h b/widget/src/windows/nsBidiKeyboard.h index de859f5f680..71a9a40962f 100644 --- a/widget/src/windows/nsBidiKeyboard.h +++ b/widget/src/windows/nsBidiKeyboard.h @@ -58,9 +58,9 @@ protected: PRPackedBool mInitialized; PRPackedBool mHaveBidiKeyboards; - PRUnichar mLTRKeyboard[KL_NAMELENGTH]; - PRUnichar mRTLKeyboard[KL_NAMELENGTH]; - PRUnichar mCurrentLocaleName[KL_NAMELENGTH]; + char mLTRKeyboard[KL_NAMELENGTH]; + char mRTLKeyboard[KL_NAMELENGTH]; + char mCurrentLocaleName[KL_NAMELENGTH]; }; diff --git a/widget/src/windows/nsClipboard.cpp b/widget/src/windows/nsClipboard.cpp index 8b515f674c9..8c54fc79a41 100644 --- a/widget/src/windows/nsClipboard.cpp +++ b/widget/src/windows/nsClipboard.cpp @@ -70,7 +70,7 @@ // oddly, this isn't in the MSVC headers anywhere. -UINT nsClipboard::CF_HTML = ::RegisterClipboardFormatW(L"HTML Format"); +UINT nsClipboard::CF_HTML = ::RegisterClipboardFormat("HTML Format"); //------------------------------------------------------------------------- @@ -111,9 +111,7 @@ UINT nsClipboard::GetFormat(const char* aMimeStr) else if (strcmp(aMimeStr, kNativeHTMLMime) == 0) format = CF_HTML; else - format = ::RegisterClipboardFormatW(NS_ConvertASCIItoUTF16(aMimeStr).get()); - - + format = ::RegisterClipboardFormat(aMimeStr); return format; } @@ -318,7 +316,7 @@ nsresult nsClipboard::GetGlobalData(HGLOBAL aHGBL, void ** aData, PRUint32 * aLe ); // Display the string. - MessageBoxW( NULL, (LPCWSTR)lpMsgBuf, L"GetLastError", MB_OK|MB_ICONINFORMATION ); + MessageBox( NULL, (const char *)lpMsgBuf, "GetLastError", MB_OK|MB_ICONINFORMATION ); // Free the buffer. LocalFree( lpMsgBuf ); diff --git a/widget/src/windows/nsDataObj.h b/widget/src/windows/nsDataObj.h index 226e3e38f24..95f33d5f44a 100644 --- a/widget/src/windows/nsDataObj.h +++ b/widget/src/windows/nsDataObj.h @@ -82,10 +82,10 @@ IAsyncOperation : public IUnknown * See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/shell_basics/shell_basics_programming/transferring/clipboard.asp */ #ifndef CFSTR_INETURLA -#define CFSTR_INETURLA L"UniformResourceLocator" +#define CFSTR_INETURLA "UniformResourceLocator" #endif #ifndef CFSTR_INETURLW -#define CFSTR_INETURLW L"UniformResourceLocatorW" +#define CFSTR_INETURLW "UniformResourceLocatorW" #endif // For support of MinGW w32api v2.4. @@ -93,10 +93,10 @@ IAsyncOperation : public IUnknown // http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/winsup/w32api/include/shlobj.h?cvsroot=src // then that can be made the base required version and this code should be removed. #ifndef CFSTR_FILEDESCRIPTORA -# define CFSTR_FILEDESCRIPTORA L"FileGroupDescriptor" +# define CFSTR_FILEDESCRIPTORA "FileGroupDescriptor" #endif #ifndef CFSTR_FILEDESCRIPTORW -# define CFSTR_FILEDESCRIPTORW L"FileGroupDescriptorW" +# define CFSTR_FILEDESCRIPTORW "FileGroupDescriptorW" #endif #ifdef __MINGW32__ diff --git a/widget/src/windows/nsFilePicker.cpp b/widget/src/windows/nsFilePicker.cpp index 1b1c708c59a..bd68753e977 100644 --- a/widget/src/windows/nsFilePicker.cpp +++ b/widget/src/windows/nsFilePicker.cpp @@ -280,10 +280,10 @@ NS_IMETHODIMP nsFilePicker::ShowW(PRInt16 *aReturnVal) #ifndef WINCE } catch(...) { - MessageBoxW(ofn.hwndOwner, - 0, - L"The filepicker was unexpectedly closed by Windows.", - MB_ICONERROR); + MessageBox(ofn.hwndOwner, + 0, + "The filepicker was unexpectedly closed by Windows.", + MB_ICONERROR); result = PR_FALSE; } #endif diff --git a/widget/src/windows/nsLookAndFeel.cpp b/widget/src/windows/nsLookAndFeel.cpp index 642a3515b9b..c07094aa8dc 100644 --- a/widget/src/windows/nsLookAndFeel.cpp +++ b/widget/src/windows/nsLookAndFeel.cpp @@ -56,7 +56,7 @@ static CloseThemeDataPtr closeTheme = NULL; static GetThemeColorPtr getThemeColor = NULL; static IsAppThemedPtr isAppThemed = NULL; -static const PRUnichar kThemeLibraryName[] = L"uxtheme.dll"; +static const char kThemeLibraryName[] = "uxtheme.dll"; static HINSTANCE gThemeDLLInst = NULL; static HANDLE gMenuTheme = NULL; @@ -105,13 +105,13 @@ static PRInt32 GetSystemParam(long flag, PRInt32 def) nsLookAndFeel::nsLookAndFeel() : nsXPLookAndFeel() { #ifndef WINCE - gShell32DLLInst = LoadLibraryW(L"shell32.dll"); + gShell32DLLInst = LoadLibrary("Shell32.dll"); if (gShell32DLLInst) { gSHAppBarMessage = (SHAppBarMessagePtr) GetProcAddress(gShell32DLLInst, "SHAppBarMessage"); } - gThemeDLLInst = LoadLibraryW(kThemeLibraryName); + gThemeDLLInst = LoadLibrary(kThemeLibraryName); if(gThemeDLLInst) { openTheme = (OpenThemeDataPtr)GetProcAddress(gThemeDLLInst, "OpenThemeData"); @@ -504,7 +504,7 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric) if (gSHAppBarMessage) { // Get task bar window handle - HWND shellWindow = FindWindowW(L"Shell_TrayWnd", NULL); + HWND shellWindow = FindWindow("Shell_TrayWnd", NULL); if (shellWindow != NULL) { diff --git a/widget/src/windows/nsNativeThemeWin.cpp b/widget/src/windows/nsNativeThemeWin.cpp index 3d4e5482d5e..b7e62e44e8c 100644 --- a/widget/src/windows/nsNativeThemeWin.cpp +++ b/widget/src/windows/nsNativeThemeWin.cpp @@ -287,7 +287,7 @@ static GetThemeSysFontPtr getThemeSysFont = NULL; static GetThemeColorPtr getThemeColor = NULL; static GetThemeMarginsPtr getThemeMargins = NULL; -static const PRUnichar kThemeLibraryName[] = L"uxtheme.dll"; +static const char kThemeLibraryName[] = "uxtheme.dll"; static inline bool IsCheckboxWidgetType(PRUint8 aWidgetType) { @@ -326,7 +326,7 @@ nsNativeThemeWin::nsNativeThemeWin() { mHeaderTheme = NULL; mMenuTheme = NULL; - mThemeDLL = ::LoadLibraryW(kThemeLibraryName); + mThemeDLL = ::LoadLibrary(kThemeLibraryName); if (mThemeDLL) { openTheme = (OpenThemeDataPtr)GetProcAddress(mThemeDLL, "OpenThemeData"); closeTheme = (CloseThemeDataPtr)GetProcAddress(mThemeDLL, "CloseThemeData"); diff --git a/widget/src/windows/nsSound.cpp b/widget/src/windows/nsSound.cpp index aaa1eca2932..552171cb9ff 100644 --- a/widget/src/windows/nsSound.cpp +++ b/widget/src/windows/nsSound.cpp @@ -40,7 +40,7 @@ #include "nscore.h" #include "plstr.h" #include -#include "nsString.h" + #include // mmsystem.h is needed to build with WIN32_LEAN_AND_MEAN @@ -118,16 +118,14 @@ NS_IMETHODIMP nsSound::OnStreamComplete(nsIStreamLoader *aLoader, if (data && dataLen > 0) { DWORD flags = SND_MEMORY | SND_NODEFAULT; // We try to make a copy so we can play it async. - mLastSound = (PRUnichar *) malloc(512); + mLastSound = (PRUint8 *) malloc(dataLen); if (mLastSound) { - MultiByteToWideChar(CP_ACP,0, reinterpret_cast(data), dataLen,mLastSound, 256); - flags |= SND_ASYNC; - ::PlaySoundW(mLastSound, 0, flags); - }else{ -#ifndef WINCE - ::PlaySoundA(reinterpret_cast(data), 0, flags); -#endif + memcpy(mLastSound, data, dataLen); + data = mLastSound; + flags |= SND_ASYNC; } + + ::PlaySound(reinterpret_cast(data), 0, flags); } return NS_OK; @@ -168,10 +166,12 @@ NS_IMETHODIMP nsSound::PlaySystemSound(const nsAString &aSoundAlias) PurgeLastSound(); if (aSoundAlias.EqualsLiteral("_moz_mailbeep")) { - ::PlaySoundW(L"MailBeep", nsnull, SND_ALIAS | SND_ASYNC); + ::PlaySound("MailBeep", nsnull, SND_ALIAS | SND_ASYNC); } else { - ::PlaySoundW(PromiseFlatString(aSoundAlias).get(), nsnull, SND_ALIAS | SND_ASYNC); + nsCAutoString nativeSoundAlias; + NS_CopyUnicodeToNative(aSoundAlias, nativeSoundAlias); + ::PlaySound(nativeSoundAlias.get(), nsnull, SND_ALIAS | SND_ASYNC); } return NS_OK; diff --git a/widget/src/windows/nsSound.h b/widget/src/windows/nsSound.h index 395d2ef7d44..0845814fdb9 100644 --- a/widget/src/windows/nsSound.h +++ b/widget/src/windows/nsSound.h @@ -59,7 +59,7 @@ private: void PurgeLastSound(); private: - PRUnichar* mLastSound; + PRUint8* mLastSound; }; #endif /* __nsSound_h__ */ diff --git a/widget/src/windows/nsToolkit.cpp b/widget/src/windows/nsToolkit.cpp index 1e62d2941ee..dcd19615055 100644 --- a/widget/src/windows/nsToolkit.cpp +++ b/widget/src/windows/nsToolkit.cpp @@ -264,7 +264,7 @@ nsToolkit::Startup(HMODULE hModule) typedef BOOL (*SetProcessDPIAwareFunc)(VOID); SetProcessDPIAwareFunc setDPIAware = (SetProcessDPIAwareFunc) - GetProcAddress(LoadLibraryW(L"user32.dll"), + GetProcAddress(LoadLibrary("user32.dll"), "SetProcessDPIAware"); if (setDPIAware) @@ -295,8 +295,8 @@ void nsToolkit::CreateInternalWindow(PRThread *aThread) // create the internal window // - mDispatchWnd = ::CreateWindowW(L"nsToolkitClass", - L"NetscapeDispatchWnd", + mDispatchWnd = ::CreateWindow("nsToolkitClass", + "NetscapeDispatchWnd", WS_DISABLED, -50, -50, 10, 10, diff --git a/widget/src/windows/nsWindow.cpp b/widget/src/windows/nsWindow.cpp index f50ea230322..7171815afff 100644 --- a/widget/src/windows/nsWindow.cpp +++ b/widget/src/windows/nsWindow.cpp @@ -150,7 +150,7 @@ #include "prprf.h" #include "prmem.h" -static const PRUnichar kMozHeapDumpMessageString[] = L"MOZ_HeapDump"; +static const char kMozHeapDumpMessageString[] = "MOZ_HeapDump"; #define kWindowPositionSlop 20 @@ -699,7 +699,7 @@ nsWindow::nsWindow() : nsBaseWidget() // Heap dump #ifndef WINCE - nsWindow::uWM_HEAP_DUMP = ::RegisterWindowMessageW(kMozHeapDumpMessageString); + nsWindow::uWM_HEAP_DUMP = ::RegisterWindowMessage(kMozHeapDumpMessageString); #endif } @@ -1119,26 +1119,26 @@ nsWindow::EventIsInsideWindow(UINT Msg, nsWindow* aWindow) return (PRBool) PtInRect(&r, mp); } -static PRUnichar sPropName[40] = L""; -static PRUnichar* GetNSWindowPropName() { +static char sPropName[40] = ""; +static char* GetNSWindowPropName() { if (!*sPropName) { - _snwprintf(sPropName, 39, L"MozillansIWidgetPtr%p", _getpid()); + _snprintf(sPropName, 39, "MozillansIWidgetPtr%p", _getpid()); sPropName[39] = '\0'; } return sPropName; } nsWindow * nsWindow::GetNSWindowPtr(HWND aWnd) { - return (nsWindow *) ::GetPropW(aWnd, GetNSWindowPropName()); + return (nsWindow *) ::GetPropA(aWnd, GetNSWindowPropName()); } BOOL nsWindow::SetNSWindowPtr(HWND aWnd, nsWindow * ptr) { if (ptr == NULL) { - ::RemovePropW(aWnd, GetNSWindowPropName()); + ::RemovePropA(aWnd, GetNSWindowPropName()); return TRUE; } else { - return ::SetPropW(aWnd, GetNSWindowPropName(), (HANDLE)ptr); + return ::SetPropA(aWnd, GetNSWindowPropName(), (HANDLE)ptr); } } @@ -1788,7 +1788,7 @@ NS_IMETHODIMP nsWindow::SetSizeMode(PRInt32 aMode) { // Play the minimize sound while we're here, since that is also // forgotten when we use SW_SHOWMINIMIZED. - ::PlaySoundW(L"Minimize", nsnull, SND_ALIAS | SND_NODEFAULT | SND_ASYNC); + ::PlaySound("Minimize", nsnull, SND_ALIAS | SND_NODEFAULT | SND_ASYNC); } #endif break; @@ -5192,7 +5192,7 @@ LPCWSTR nsWindow::WindowPopupClassW() return className; } -LPCTSTR nsWindow::WindowClass() +LPCSTR nsWindow::WindowClass() { // Call into the wide version to make sure things get // registered properly. @@ -5200,9 +5200,7 @@ LPCTSTR nsWindow::WindowClass() // XXX: The class name used here must be kept in sync with // the classname used in WindowClassW(); -#ifdef UNICODE - return classNameW; -#else + if (classNameW == kWClassNameHidden) { return kClassNameHidden; } @@ -5219,21 +5217,17 @@ LPCTSTR nsWindow::WindowClass() return kClassNameContentFrame; } return kClassNameGeneral; -#endif } -LPCTSTR nsWindow::WindowPopupClass() +LPCSTR nsWindow::WindowPopupClass() { // Call into the wide version to make sure things get // registered properly. -#ifdef UNICODE - return WindowPopupClassW(); -#else + WindowPopupClassW(); // XXX: The class name used here must be kept in sync with // the classname used in WindowPopupClassW(); return "MozillaDropShadowWindowClass"; -#endif } //------------------------------------------------------------------------- @@ -7724,7 +7718,7 @@ STDMETHODIMP_(LRESULT) nsWindow::LresultFromObject(REFIID riid, WPARAM wParam, L { // open the dll dynamically if (!gmAccLib) - gmAccLib =::LoadLibraryW(L"OLEACC.DLL"); + gmAccLib =::LoadLibrary("OLEACC.DLL"); if (gmAccLib) { if (!gmLresultFromObject) diff --git a/widget/src/windows/nsWindow.h b/widget/src/windows/nsWindow.h index 77167963ac7..ecdaf4b0cf4 100644 --- a/widget/src/windows/nsWindow.h +++ b/widget/src/windows/nsWindow.h @@ -105,13 +105,6 @@ const LPCSTR kClassNameContent = "MozillaContentWindowClass"; const LPCSTR kClassNameContentFrame = "MozillaContentFrameWindowClass"; const LPCSTR kClassNameGeneral = "MozillaWindowClass"; const LPCSTR kClassNameDialog = "MozillaDialogClass"; -const LPCTSTR kTClassNameHidden = TEXT("MozillaHiddenWindowClass"); -const LPCTSTR kTClassNameUI = TEXT("MozillaUIWindowClass"); -const LPCTSTR kTClassNameContent = TEXT("MozillaContentWindowClass"); -const LPCTSTR kTClassNameContentFrame = TEXT("MozillaContentFrameWindowClass"); -const LPCTSTR kTClassNameGeneral = TEXT("MozillaWindowClass"); -const LPCTSTR kTClassNameDialog = TEXT("MozillaDialogClass"); - /** * Native WIN32 window wrapper. diff --git a/xpcom/base/nsDebugImpl.cpp b/xpcom/base/nsDebugImpl.cpp index fe7aa06a37c..6c7a7f3576a 100644 --- a/xpcom/base/nsDebugImpl.cpp +++ b/xpcom/base/nsDebugImpl.cpp @@ -66,11 +66,6 @@ #include #endif -#if defined(XP_WIN) -#include -#include "nsString.h" -#endif - static void Abort(const char *aMsg); @@ -102,7 +97,7 @@ PRBool InDebugger() #ifndef WINCE PRBool fReturn = PR_FALSE; LPFNISDEBUGGERPRESENT lpfnIsDebuggerPresent = NULL; - HINSTANCE hKernel = LoadLibraryW(L"Kernel32.dll"); + HINSTANCE hKernel = LoadLibrary("Kernel32.dll"); if(hKernel) { @@ -406,9 +401,9 @@ Break(const char *aMsg) * See http://bugzilla.mozilla.org/show_bug.cgi?id=54792 */ PROCESS_INFORMATION pi; - STARTUPINFOW si; - PRUnichar executable[MAX_PATH]; - PRUnichar* pName; + STARTUPINFO si; + char executable[MAX_PATH]; + char* pName; memset(&pi, 0, sizeof(pi)); @@ -417,15 +412,13 @@ Break(const char *aMsg) si.wShowWindow = SW_SHOW; // 2nd arg of CreateProcess is in/out - PRUnichar *msgCopy = (PRUnichar*) _alloca((strlen(aMsg) + 1)*sizeof(PRUnichar)); - wcscpy(msgCopy , (PRUnichar*)NS_ConvertUTF8toUTF16(aMsg).get()); + char *msgCopy = (char*) _alloca(strlen(aMsg) + 1); + strcpy(msgCopy, aMsg); - if(GetModuleFileNameW(GetModuleHandleW(L"xpcom.dll"), (LPWCH)executable, MAX_PATH) && - NULL != (pName = wcsrchr(executable, '\\')) && - NULL != - wcscpy((WCHAR*) - pName+1, L"windbgdlg.exe") && - CreateProcessW((LPCWSTR)executable, (LPWSTR)msgCopy, NULL, NULL, PR_FALSE, + if(GetModuleFileName(GetModuleHandle("xpcom.dll"), executable, MAX_PATH) && + NULL != (pName = strrchr(executable, '\\')) && + NULL != strcpy(pName+1, "windbgdlg.exe") && + CreateProcess(executable, msgCopy, NULL, NULL, PR_FALSE, DETACHED_PROCESS | NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi)) { WaitForSingleObject(pi.hProcess, INFINITE); diff --git a/xpcom/base/nsStackWalk.cpp b/xpcom/base/nsStackWalk.cpp index 3e26d76681e..5a2059e35eb 100644 --- a/xpcom/base/nsStackWalk.cpp +++ b/xpcom/base/nsStackWalk.cpp @@ -328,9 +328,9 @@ EnsureImageHlpInitialized() ::InitializeCriticalSection(&gDbgHelpCS); - HMODULE module = ::LoadLibraryW(L"DBGHELP.DLL"); + HMODULE module = ::LoadLibrary("DBGHELP.DLL"); if (!module) { - module = ::LoadLibraryW(L"IMAGEHLP.DLL"); + module = ::LoadLibrary("IMAGEHLP.DLL"); if (!module) return PR_FALSE; } diff --git a/xpcom/io/SpecialSystemDirectory.cpp b/xpcom/io/SpecialSystemDirectory.cpp index 7d22ec47aad..5ceea5ed105 100644 --- a/xpcom/io/SpecialSystemDirectory.cpp +++ b/xpcom/io/SpecialSystemDirectory.cpp @@ -127,7 +127,7 @@ NS_COM void StartupSpecialSystemDirectory() #if defined (XP_WIN) && !defined (WINCE) // SHGetKnownFolderPath is only available on Windows Vista // so that we need to use GetProcAddress to get the pointer. - gShell32DLLInst = LoadLibraryW(L"shell32.dll"); + gShell32DLLInst = LoadLibrary("Shell32.dll"); if(gShell32DLLInst) { gGetKnownFolderPath = (nsGetKnownFolderPath) diff --git a/xpcom/io/nsLocalFileWin.cpp b/xpcom/io/nsLocalFileWin.cpp index 871c0d443e7..c1779296346 100644 --- a/xpcom/io/nsLocalFileWin.cpp +++ b/xpcom/io/nsLocalFileWin.cpp @@ -108,8 +108,8 @@ private: * HasMoreElements reads mLetter. * GetNext advances mLetter. */ - nsString mDrives; - const PRUnichar *mLetter; + nsCString mDrives; + const char *mLetter; }; //---------------------------------------------------------------------------- @@ -2970,7 +2970,7 @@ nsresult nsDriveEnumerator::Init() /* The string is null terminated */ if (!EnsureStringLength(mDrives, length+1)) return NS_ERROR_OUT_OF_MEMORY; - if (!GetLogicalDriveStringsW(length, mDrives.BeginWriting())) + if (!GetLogicalDriveStrings(length, mDrives.BeginWriting())) return NS_ERROR_FAILURE; mLetter = mDrives.get(); return NS_OK; @@ -3000,9 +3000,8 @@ NS_IMETHODIMP nsDriveEnumerator::GetNext(nsISupports **aNext) *aNext = nsnull; return NS_OK; } - nsString drive(mDrives); + NS_ConvertASCIItoUTF16 drive(mLetter); mLetter += drive.Length() + 1; - nsILocalFile *file; nsresult rv = NS_NewLocalFile(drive, PR_FALSE, &file); diff --git a/xpcom/threads/nsProcessCommon.cpp b/xpcom/threads/nsProcessCommon.cpp index ebf8e02cad0..21d45e1698e 100644 --- a/xpcom/threads/nsProcessCommon.cpp +++ b/xpcom/threads/nsProcessCommon.cpp @@ -106,11 +106,10 @@ nsProcess::Init(nsIFile* executable) #if defined(XP_WIN) -static int assembleCmdLine(char *const *argv, PRUnichar **cmdLine) +static int assembleCmdLine(char *const *argv, char **cmdLine) { char *const *arg; - PRUnichar *p; - char *q; + char *p, *q; int cmdLineSize; int numBackslashes; int i; @@ -132,7 +131,7 @@ static int assembleCmdLine(char *const *argv, PRUnichar **cmdLine) + 2 /* we quote every argument */ + 1; /* space in between, or final null */ } - p = *cmdLine = (PRUnichar *) PR_MALLOC(cmdLineSize*sizeof(PRUnichar)); + p = *cmdLine = (char *) PR_MALLOC(cmdLineSize); if (p == NULL) { return -1; } @@ -238,10 +237,10 @@ nsProcess::Run(PRBool blocking, const char **args, PRUint32 count, my_argv[count+1] = NULL; #if defined(XP_WIN) && !defined (WINCE) /* wince uses nspr */ - STARTUPINFOW startupInfo; + STARTUPINFO startupInfo; PROCESS_INFORMATION procInfo; BOOL retVal; - PRUnichar *cmdLine; + char *cmdLine; if (assembleCmdLine(my_argv, &cmdLine) == -1) { nsMemory::Free(my_argv); @@ -251,20 +250,20 @@ nsProcess::Run(PRBool blocking, const char **args, PRUint32 count, ZeroMemory(&startupInfo, sizeof(startupInfo)); startupInfo.cb = sizeof(startupInfo); - retVal = CreateProcessW(NULL, - // const_cast(mTargetPath.get()), - cmdLine, - NULL, /* security attributes for the new - * process */ - NULL, /* security attributes for the primary - * thread in the new process */ - FALSE, /* inherit handles */ - 0, /* creation flags */ - NULL, /* env */ - NULL, /* current drive and directory */ - &startupInfo, - &procInfo - ); + retVal = CreateProcess(NULL, + // const_cast(mTargetPath.get()), + cmdLine, + NULL, /* security attributes for the new + * process */ + NULL, /* security attributes for the primary + * thread in the new process */ + FALSE, /* inherit handles */ + 0, /* creation flags */ + NULL, /* env */ + NULL, /* current drive and directory */ + &startupInfo, + &procInfo + ); PR_Free( cmdLine ); if (blocking) { diff --git a/xpcom/windbgdlg/Makefile.in b/xpcom/windbgdlg/Makefile.in index b2dcc1ef9d9..da1bcfae499 100644 --- a/xpcom/windbgdlg/Makefile.in +++ b/xpcom/windbgdlg/Makefile.in @@ -42,8 +42,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -OS_LIBS += shell32.lib - SIMPLE_PROGRAMS = windbgdlg$(BIN_SUFFIX) CPPSRCS = windbgdlg.cpp diff --git a/xpcom/windbgdlg/windbgdlg.cpp b/xpcom/windbgdlg/windbgdlg.cpp index 70be4238a67..1a19f016569 100644 --- a/xpcom/windbgdlg/windbgdlg.cpp +++ b/xpcom/windbgdlg/windbgdlg.cpp @@ -42,7 +42,6 @@ #include #include -#include int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, @@ -60,16 +59,15 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, DWORD regValue = -1; DWORD regLength = sizeof regValue; HKEY hkeyCU, hkeyLM; - RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\mozilla.org\\windbgdlg", 0, KEY_READ, &hkeyCU); - RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\mozilla.org\\windbgdlg", 0, KEY_READ, &hkeyLM); - int argc =0; - LPWSTR *argv = CommandLineToArgvW(GetCommandLineW(), &argc); - for (int i = argc - 1; regValue == (DWORD)-1 && i; --i) { + RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\mozilla.org\\windbgdlg", 0, KEY_READ, &hkeyCU); + RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\mozilla.org\\windbgdlg", 0, KEY_READ, &hkeyLM); + const char * const * argv = __argv; + for (int i = __argc - 1; regValue == (DWORD)-1 && i; --i) { bool ok = false; if (hkeyCU) - ok = RegQueryValueExW(hkeyCU, argv[i], 0, ®Type, (LPBYTE)®Value, ®Length) == ERROR_SUCCESS; + ok = RegQueryValueEx(hkeyCU, argv[i], 0, ®Type, (LPBYTE)®Value, ®Length) == ERROR_SUCCESS; if (!ok && hkeyLM) - ok = RegQueryValueExW(hkeyLM, argv[i], 0, ®Type, (LPBYTE)®Value, ®Length) == ERROR_SUCCESS; + ok = RegQueryValueEx(hkeyLM, argv[i], 0, ®Type, (LPBYTE)®Value, ®Length) == ERROR_SUCCESS; if (!ok) regValue = -1; } @@ -79,15 +77,15 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, RegCloseKey(hkeyLM); if (regValue != (DWORD)-1 && regValue != (DWORD)-2) return regValue; - static WCHAR msg[4048]; + static char msg[4048]; - wsprintfW(msg, - L"%s\n\nClick Abort to exit the Application.\n" - L"Click Retry to Debug the Application..\n" - L"Click Ignore to continue running the Application.", + wsprintf(msg, + "%s\n\nClick Abort to exit the Application.\n" + "Click Retry to Debug the Application..\n" + "Click Ignore to continue running the Application.", lpszCmdLine); - return MessageBoxW(NULL, msg, L"NSGlue_Assertion", + return MessageBox(NULL, msg, "NSGlue_Assertion", MB_ICONSTOP | MB_SYSTEMMODAL| MB_ABORTRETRYIGNORE | MB_DEFBUTTON3); } diff --git a/xpfe/bootstrap/showOSAlert.cpp b/xpfe/bootstrap/showOSAlert.cpp index 346214fe61f..7d0d70b02a4 100644 --- a/xpfe/bootstrap/showOSAlert.cpp +++ b/xpfe/bootstrap/showOSAlert.cpp @@ -39,7 +39,6 @@ #include #include #include "nscore.h" -#include "nsString.h" //defines and includes for previous installation cleanup process #if defined (XP_WIN) @@ -64,18 +63,15 @@ printf("\n****Inside ShowOSAlert ***\n"); #endif const PRInt32 max_len = 255; + char message_copy[max_len+1] = { 0 }; PRInt32 input_len = strlen(aMessage); PRInt32 copy_len = (input_len > max_len) ? max_len : input_len; -#if defined (XP_WIN) - NS_ConvertUTF8toUTF16 msg_str(aMessage, copy_len); - PRUnichar* message_copy = (PRUnichar*)msg_str.get(); - MessageBoxW(NULL, message_copy, NULL, MB_OK | MB_ICONERROR | MB_SETFOREGROUND ); -#else - char message_copy[max_len+1] = { 0 }; strncpy(message_copy, aMessage, copy_len); message_copy[copy_len] = 0; -#endif -#if (XP_MAC) + +#if defined (XP_WIN) + MessageBoxA(NULL, message_copy, NULL, MB_OK | MB_ICONERROR | MB_SETFOREGROUND ); +#elif (XP_MAC) short buttonClicked; StandardAlert(kAlertStopAlert, c2pstr(message_copy), nil, nil, &buttonClicked); #elif defined (XP_OS2) From 38a8595f76fbb1b97786467101c71be0a2c755fd Mon Sep 17 00:00:00 2001 From: "rhelmer@mozilla.com" Date: Tue, 11 Mar 2008 15:59:15 -0700 Subject: [PATCH 11/65] enable fast-patcher mode b=422235 r=nthomas --- tools/release/Bootstrap/Step/Updates.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/release/Bootstrap/Step/Updates.pm b/tools/release/Bootstrap/Step/Updates.pm index 6aaa2e6eb58..3497bc39fad 100644 --- a/tools/release/Bootstrap/Step/Updates.pm +++ b/tools/release/Bootstrap/Step/Updates.pm @@ -94,7 +94,8 @@ sub Execute { $this->Shell( cmd => './patcher2.pl', cmdArgs => ['--create-patches', '--app=' . $product, - '--config=../config/' . $patcherConfig], + '--config=../config/' . $patcherConfig, + '--partial-patchlist-file=patchlist.cfg'], logFile => catfile($logDir, 'updates_patcher-create-patches.log'), dir => catfile($versionedUpdateDir, 'patcher'), timeout => 18000, From 565106290eb82c723b77606ebecac4e66877a105 Mon Sep 17 00:00:00 2001 From: "rhelmer@mozilla.com" Date: Tue, 11 Mar 2008 16:09:13 -0700 Subject: [PATCH 12/65] bump to next version b=420005 r=nthomas --- .../fx-moz18-nightly-staging-bootstrap.cfg | 4 +- .../fx-moz19-nightly-staging-bootstrap.cfg | 92 +++++++++++++++++++ .../configs/fx-moz19-staging-bootstrap.cfg | 4 +- 3 files changed, 96 insertions(+), 4 deletions(-) create mode 100644 tools/release/configs/fx-moz19-nightly-staging-bootstrap.cfg diff --git a/tools/release/configs/fx-moz18-nightly-staging-bootstrap.cfg b/tools/release/configs/fx-moz18-nightly-staging-bootstrap.cfg index 8bcd895b68b..29e3ef9c1e4 100644 --- a/tools/release/configs/fx-moz18-nightly-staging-bootstrap.cfg +++ b/tools/release/configs/fx-moz18-nightly-staging-bootstrap.cfg @@ -2,7 +2,7 @@ version = nightly milestone = nightly # _RCn and _RELEASE will be appended as-needed # not used by nightly -productTag = FIREFOX_2_0_0_12pre +productTag = FIREFOX_2_0_0_13pre # Branch name and pull dates to use for base tag branchTag = MOZILLA_1_8_BRANCH # manually tagged from GECKO181_20070712_RELBRANCH @@ -87,4 +87,4 @@ symbolServerKey = /home/cltbld/.ssh/id_dsa symbolDir = /builds/symbols # turn off tests testsPhoneHome = 0 -bootstrapTag = RELEASE_AUTOMATION_M7_1 +bootstrapTag = RELEASE_AUTOMATION_M7_2 diff --git a/tools/release/configs/fx-moz19-nightly-staging-bootstrap.cfg b/tools/release/configs/fx-moz19-nightly-staging-bootstrap.cfg new file mode 100644 index 00000000000..1f235d7471e --- /dev/null +++ b/tools/release/configs/fx-moz19-nightly-staging-bootstrap.cfg @@ -0,0 +1,92 @@ +version = nightly +milestone = nightly +# _RCn and _RELEASE will be appended as-needed +# not used by nightly +productTag = FIREFOX_3_0b2pre +# Branch name and pull dates to use for base tag +branchTag = HEAD +#RelbranchOverride = GECKO190_20071207_RELBRANCH +# not used by nightly +pullDate = 2008-01-08 18:00 PST +l10n_pullDate = 2008-01-08 18:00 PST +rc = 1 +# oldVersion and oldRc refer to the previous release +# not used by nightly +oldVersion = 3.0b1 +oldRc = 3 +# app name and product name +appName = browser +product = firefox +# Absolute path to tinderbox build directory +# The win32 ones are kept short because of a long path issue detailed in +# bug# 400846 +linux_buildDir = /builds/tinderbox/Fx-Mozilla1.9-Nightly +macosx_buildDir = /builds/tinderbox/Fx-Mozilla1.9-Nightly +win32_buildDir = /e/fx19nit +linux_l10n_buildDir = /builds/tinderbox/Fx-Mozilla1.9-l10n-Nightly +macosx_l10n_buildDir = /builds/tinderbox/Fx-Mozilla1.9-l10n-Nightly +win32_l10n_buildDir = /e/fx19l10nit +# Absolute path to store bootstrap's logs +linux_logDir = /builds/logs.nightly +macosx_logDir = /builds/logs.nightly +win32_logDir = /builds/logs.nightly +mozillaCvsroot = staging-1.9-master.build.mozilla.org:/builds/cvsmirror/cvsroot +l10nCvsroot = staging-1.9-master.build.mozilla.org:/builds/cvsmirror/l10n +mofoCvsroot = staging-1.9-master.build.mozilla.org:/builds/cvsmirror/mofo +anonCvsroot = staging-1.9-master.build.mozilla.org:/builds/cvsmirror/cvsroot +# private staging area +stageHome = /data/cltbld +updateDir = /builds/updates +verifyDir = /builds/verify +tagDir = /builds/tags +configBumpDir = /builds/config +# Build platform, as specified by tinderbox +linux_buildPlatform = Linux_2.6.18-53.1.13.el5_Depend +macosx_buildPlatform = Darwin_8.8.4_Depend +win32_buildPlatform = WINNT_5.2_Depend +linux_l10n_buildPlatform = Linux_2.6.18-53.1.13.el5_Depend +macosx_l10n_buildPlatform = Darwin_8.8.4_Depend +win32_l10n_buildPlatform = WINNT_5.2_Depend +from = staging-bootstrap@mozilla.org +to = build-announce@mozilla.org +cc = nobody@mozilla.org +# not used by nightly +patcherConfig = moz19-patcher2.cfg +# Tag to use for building MAR/MBSDIFF and other update tools +patcherToolsRev = UPDATE_PACKAGING_R1 +linux_verifyConfig = moz19-firefox-linux.cfg +win32_verifyConfig = moz19-firefox-win32.cfg +macosx_verifyConfig = moz19-firefox-mac.cfg +blat = /d/mozilla-build/blat261/full/blat.exe +sendmail = /usr/sbin/sendmail +# dump Log output to stdout +dumpLogs = 1 +# username and server to push update snippets to +ausUser = cltbld +ausServer = staging-1.9-master.build.mozilla.org +ausServerUrl = http://staging-1.9-master.build.mozilla.org +buildTree = Firefox-Staging +# where QA updates/builds go +stagingUser = cltbld +stagingServer = staging-1.9-master.build.mozilla.org +externalStagingUser = cltbld +externalStagingServer = fx-linux-1.9-slave1.build.mozilla.org +# where beta updates/builds go +ftpServer = staging-1.9-master.build.mozilla.org +# where release updates/builds go +bouncerServer = staging-1.9-master.build.mozilla.org +# username and server to push builds +sshUser = cltbld +sshServer = staging-1.9-master.build.mozilla.org +useTalkback = 0 +# symbol server variables +symbolServer = staging-1.9-master.build.mozilla.org +symbolServerUser = cltbld +symbolServerPath = /data/symbols +win32_symbolServerKey = /c/Documents and Settings/cltbld/.ssh/ffxbld_dsa +linux_symbolServerKey = /home/cltbld/.ssh/ffxbld_dsa +macosx_symbolServerKey = /Users/cltbld/.ssh/ffxbld_dsa +useCvsCompression = 1 +# turn off tests +testsPhoneHome = 0 +bootstrapTag = RELEASE_AUTOMATION_M8 diff --git a/tools/release/configs/fx-moz19-staging-bootstrap.cfg b/tools/release/configs/fx-moz19-staging-bootstrap.cfg index 5baf03f183e..ef003e0997d 100644 --- a/tools/release/configs/fx-moz19-staging-bootstrap.cfg +++ b/tools/release/configs/fx-moz19-staging-bootstrap.cfg @@ -9,8 +9,8 @@ pullDate = 2008-01-07 09:00 PST l10n_pullDate = 2008-01-07 09:00 PST rc = 1 # oldVersion and oldRc refer to the previous release -oldVersion = 3.0b2 -oldRc = 1 +oldVersion = 3.0b4 +oldRc = 3 appName = browser product = firefox # Absolute path to tinderbox build directory From 176db0686bc4790402566509593027dd5b6bcdaf Mon Sep 17 00:00:00 2001 From: "dougt@meer.net" Date: Tue, 11 Mar 2008 16:32:26 -0700 Subject: [PATCH 13/65] back out --- xulrunner/app/Makefile.in | 2 +- xulrunner/stub/Makefile.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xulrunner/app/Makefile.in b/xulrunner/app/Makefile.in index 41957313f66..14b859f6c3b 100644 --- a/xulrunner/app/Makefile.in +++ b/xulrunner/app/Makefile.in @@ -136,7 +136,7 @@ include $(topsrcdir)/config/config.mk ifdef _MSC_VER # Always enter a Windows program through wmain, whether or not we're # a console application. -WIN32_EXE_LDFLAGS += -ENTRY:mainWCRTStartup +WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup endif ifdef NS_TRACE_MALLOC diff --git a/xulrunner/stub/Makefile.in b/xulrunner/stub/Makefile.in index 19403be3890..880606808d7 100644 --- a/xulrunner/stub/Makefile.in +++ b/xulrunner/stub/Makefile.in @@ -94,7 +94,7 @@ endif include $(topsrcdir)/config/config.mk ifdef _MSC_VER -WIN32_EXE_LDFLAGS += -ENTRY:mainWCRTStartup +WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup endif include $(topsrcdir)/config/rules.mk From e3d8869e0c0783a976c21833212344b848e58940 Mon Sep 17 00:00:00 2001 From: "dtownsend@oxymoronical.com" Date: Tue, 11 Mar 2008 16:35:21 -0700 Subject: [PATCH 14/65] Bug 415175 - Updating to an extension where the updated xpi requires a compatibility update fails. r=robstrong. --- toolkit/mozapps/extensions/src/nsExtensionManager.js.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toolkit/mozapps/extensions/src/nsExtensionManager.js.in b/toolkit/mozapps/extensions/src/nsExtensionManager.js.in index b5925304c09..38e92d016ea 100644 --- a/toolkit/mozapps/extensions/src/nsExtensionManager.js.in +++ b/toolkit/mozapps/extensions/src/nsExtensionManager.js.in @@ -2678,8 +2678,6 @@ ExtensionManager.prototype = { var isDirty = false; var forceAutoReg = false; - this._showUpdatesWindow(); - // Somehow the component list went away, and for that reason the new one // generated by this function is going to result in a different compreg. // We must force a restart. @@ -2701,6 +2699,8 @@ ExtensionManager.prototype = { if (this._checkForFileChanges()) isDirty = true; + this._showUpdatesWindow(); + if (PendingOperations.size != 0) isDirty = true; From 2f4360eecd51f7c1368ef742bf505e4139270e6e Mon Sep 17 00:00:00 2001 From: "ted.mielczarek@gmail.com" Date: Tue, 11 Mar 2008 16:39:34 -0700 Subject: [PATCH 15/65] bug 422082 - crash reporter remains open after submitting data. r=bsmedberg --- toolkit/crashreporter/client/crashreporter_osx.h | 2 +- toolkit/crashreporter/client/crashreporter_osx.mm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/toolkit/crashreporter/client/crashreporter_osx.h b/toolkit/crashreporter/client/crashreporter_osx.h index 755e880908c..15599b90d9d 100644 --- a/toolkit/crashreporter/client/crashreporter_osx.h +++ b/toolkit/crashreporter/client/crashreporter_osx.h @@ -86,7 +86,7 @@ - (void)showErrorUI:(const std::string&)dumpfile; - (void)showReportInfo; - (void)maybeSubmitReport; -- (void)closeMeDown; +- (void)closeMeDown:(id)unused; - (IBAction)submitReportClicked:(id)sender; - (IBAction)viewReportClicked:(id)sender; diff --git a/toolkit/crashreporter/client/crashreporter_osx.mm b/toolkit/crashreporter/client/crashreporter_osx.mm index 1cdc8e7174d..59196d408a8 100644 --- a/toolkit/crashreporter/client/crashreporter_osx.mm +++ b/toolkit/crashreporter/client/crashreporter_osx.mm @@ -236,7 +236,7 @@ static bool RestartApplication() } } --(void)closeMeDown +- (void)closeMeDown:(id)unused { [NSApp terminate:self]; } From ac13f0ce0c071106c2a3d2299d5d4cffb201b9ec Mon Sep 17 00:00:00 2001 From: "jst@mozilla.org" Date: Tue, 11 Mar 2008 16:47:23 -0700 Subject: [PATCH 16/65] Fixing bug 415324. Don't change principals on documents during document.load() now that document principals must remain unchanged. r=jonas@sicking.cc, sr=bzbarsky@mit.edu --- content/xml/document/src/nsXMLDocument.cpp | 28 ++-------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/content/xml/document/src/nsXMLDocument.cpp b/content/xml/document/src/nsXMLDocument.cpp index bb67975a04f..41e3e174fea 100644 --- a/content/xml/document/src/nsXMLDocument.cpp +++ b/content/xml/document/src/nsXMLDocument.cpp @@ -296,13 +296,6 @@ nsXMLDocument::OnChannelRedirect(nsIChannel *aOldChannel, return rv; } - // XXXbz Shouldn't we look at the owner on the new channel at some point? - // It's not gonna be right here, but eventually it will.... - nsCOMPtr principal; - rv = secMan->GetCodebasePrincipal(newLocation, getter_AddRefs(principal)); - NS_ENSURE_SUCCESS(rv, rv); - - SetPrincipal(principal); return NS_OK; } @@ -368,8 +361,9 @@ nsXMLDocument::Load(const nsAString& aUrl, PRBool *aReturn) return rv; } + nsCOMPtr principal = NodePrincipal(); nsCOMPtr codebase; - NodePrincipal()->GetURI(getter_AddRefs(codebase)); + principal->GetURI(getter_AddRefs(codebase)); // Get security manager, check to see whether the current document // is allowed to load this URI. It's important to use the current @@ -413,7 +407,6 @@ nsXMLDocument::Load(const nsAString& aUrl, PRBool *aReturn) // be loaded. Note that we need to hold a strong ref to |principal| // here, because ResetToURI will null out our node principal before // setting the new one. - nsCOMPtr principal = NodePrincipal(); nsCOMPtr elm(mListenerManager); mListenerManager = nsnull; @@ -441,23 +434,6 @@ nsXMLDocument::Load(const nsAString& aUrl, PRBool *aReturn) return rv; } - // Set a principal for this document - // XXXbz StartDocumentLoad should handle that.... And we shouldn't be calling - // StartDocumentLoad until we get an OnStartRequest from this channel! - nsCOMPtr channelOwner; - rv = channel->GetOwner(getter_AddRefs(channelOwner)); - - // We don't care if GetOwner() succeeded here, if it failed, - // channelOwner will be null, which is what we want in that case. - principal = do_QueryInterface(channelOwner); - - if (NS_FAILED(rv) || !principal) { - rv = secMan->GetCodebasePrincipal(uri, getter_AddRefs(principal)); - NS_ENSURE_TRUE(principal, rv); - } - - SetPrincipal(principal); - // Prepare for loading the XML document "into oneself" nsCOMPtr listener; if (NS_FAILED(rv = StartDocumentLoad(kLoadAsData, channel, From 10c363c28737ff96ae1d92f55aef268ed77413a1 Mon Sep 17 00:00:00 2001 From: "roc+@cs.cmu.edu" Date: Tue, 11 Mar 2008 17:35:00 -0700 Subject: [PATCH 17/65] Bug 418428. Don't force devpixels to be an integer multiple of CSS pixels when printing on Windows. r=stuart --- gfx/src/thebes/nsThebesDeviceContext.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/gfx/src/thebes/nsThebesDeviceContext.cpp b/gfx/src/thebes/nsThebesDeviceContext.cpp index d1c184f7d5b..cb7b76d5fdb 100644 --- a/gfx/src/thebes/nsThebesDeviceContext.cpp +++ b/gfx/src/thebes/nsThebesDeviceContext.cpp @@ -186,6 +186,7 @@ nsThebesDeviceContext::SetDPI() dpi = 144; mPrintingScale = float(OSVal)/dpi; + dotsArePixels = PR_FALSE; } else { dc = GetDC((HWND)nsnull); From 1ec364a8a57f051169fad537488a8fb058f21d46 Mon Sep 17 00:00:00 2001 From: "jruderman@hmc.edu" Date: Tue, 11 Mar 2008 17:42:51 -0700 Subject: [PATCH 18/65] Add crashtests --- gfx/thebes/crashtests/420945-1.html | 4 ++++ gfx/thebes/crashtests/420962-1.html | 4 ++++ gfx/thebes/crashtests/421393-1.html | 14 ++++++++++++++ gfx/thebes/crashtests/421813-1.html | 4 ++++ gfx/thebes/crashtests/crashtests.list | 5 ++++- 5 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 gfx/thebes/crashtests/420945-1.html create mode 100644 gfx/thebes/crashtests/420962-1.html create mode 100644 gfx/thebes/crashtests/421393-1.html create mode 100644 gfx/thebes/crashtests/421813-1.html diff --git a/gfx/thebes/crashtests/420945-1.html b/gfx/thebes/crashtests/420945-1.html new file mode 100644 index 00000000000..a6eb2d57c7d --- /dev/null +++ b/gfx/thebes/crashtests/420945-1.html @@ -0,0 +1,4 @@ + + +
‌

+ diff --git a/gfx/thebes/crashtests/420962-1.html b/gfx/thebes/crashtests/420962-1.html new file mode 100644 index 00000000000..f8cf8b453d7 --- /dev/null +++ b/gfx/thebes/crashtests/420962-1.html @@ -0,0 +1,4 @@ + + +
́

+ diff --git a/gfx/thebes/crashtests/421393-1.html b/gfx/thebes/crashtests/421393-1.html new file mode 100644 index 00000000000..82b69746753 --- /dev/null +++ b/gfx/thebes/crashtests/421393-1.html @@ -0,0 +1,14 @@ + + + + + +‮ּ + diff --git a/gfx/thebes/crashtests/421813-1.html b/gfx/thebes/crashtests/421813-1.html new file mode 100644 index 00000000000..885408b1b43 --- /dev/null +++ b/gfx/thebes/crashtests/421813-1.html @@ -0,0 +1,4 @@ + + +x
‍‭ك + diff --git a/gfx/thebes/crashtests/crashtests.list b/gfx/thebes/crashtests/crashtests.list index bb7db8720bd..67e1ffc60f3 100644 --- a/gfx/thebes/crashtests/crashtests.list +++ b/gfx/thebes/crashtests/crashtests.list @@ -28,4 +28,7 @@ load 407842.html load 410728-1.xml load 416637-1.html load 419095-1.html - +load 420945-1.html +load 420962-1.html +load 421393-1.html +load 421813-1.html From 736a43a02ccc94fd184590a8159d8493354fb96d Mon Sep 17 00:00:00 2001 From: "jruderman@hmc.edu" Date: Tue, 11 Mar 2008 17:44:46 -0700 Subject: [PATCH 19/65] Add crashtest --- layout/generic/crashtests/415685-1.html | 14 ++++++++++++++ layout/generic/crashtests/crashtests.list | 1 + 2 files changed, 15 insertions(+) create mode 100644 layout/generic/crashtests/415685-1.html diff --git a/layout/generic/crashtests/415685-1.html b/layout/generic/crashtests/415685-1.html new file mode 100644 index 00000000000..41f51c2a3c0 --- /dev/null +++ b/layout/generic/crashtests/415685-1.html @@ -0,0 +1,14 @@ + + + + + + + +
aaaa aaaa aaaa
xxxx xxxx xxxx + + diff --git a/layout/generic/crashtests/crashtests.list b/layout/generic/crashtests/crashtests.list index 6f17b85bffd..86bfcca0c19 100644 --- a/layout/generic/crashtests/crashtests.list +++ b/layout/generic/crashtests/crashtests.list @@ -92,4 +92,5 @@ load 407009-1.xhtml load 408749-1.xhtml load 408883-1.html load 410228-1.html +load 415685-1.html load 421404-1.html From 8dfb75f0cdabc91ef666b6e53c55d7c48e589d2f Mon Sep 17 00:00:00 2001 From: "roc+@cs.cmu.edu" Date: Tue, 11 Mar 2008 17:46:18 -0700 Subject: [PATCH 20/65] Bug 420351. Don't let empty list-bullets make a line non-empty. r+sr=dbaron --- layout/generic/nsBulletFrame.cpp | 12 ++++++++++++ layout/generic/nsBulletFrame.h | 3 +++ layout/generic/nsLineLayout.cpp | 23 +++++++++++++---------- layout/reftests/bugs/reftest.list | 2 +- 4 files changed, 29 insertions(+), 11 deletions(-) diff --git a/layout/generic/nsBulletFrame.cpp b/layout/generic/nsBulletFrame.cpp index 8f89eaffdc2..e4e1aa8b38a 100644 --- a/layout/generic/nsBulletFrame.cpp +++ b/layout/generic/nsBulletFrame.cpp @@ -120,6 +120,18 @@ nsBulletFrame::GetType() const return nsGkAtoms::bulletFrame; } +PRBool +nsBulletFrame::IsEmpty() +{ + return IsSelfEmpty(); +} + +PRBool +nsBulletFrame::IsSelfEmpty() +{ + return GetStyleList()->mListStyleType == NS_STYLE_LIST_STYLE_NONE; +} + NS_IMETHODIMP nsBulletFrame::DidSetStyleContext() { diff --git a/layout/generic/nsBulletFrame.h b/layout/generic/nsBulletFrame.h index 19f4dce1b8f..42e16faf514 100644 --- a/layout/generic/nsBulletFrame.h +++ b/layout/generic/nsBulletFrame.h @@ -101,6 +101,9 @@ public: void PaintBullet(nsIRenderingContext& aRenderingContext, nsPoint aPt, const nsRect& aDirtyRect); + + virtual PRBool IsEmpty(); + virtual PRBool IsSelfEmpty(); protected: void GetDesiredSize(nsPresContext* aPresContext, diff --git a/layout/generic/nsLineLayout.cpp b/layout/generic/nsLineLayout.cpp index 107ea824631..811508b44d7 100644 --- a/layout/generic/nsLineLayout.cpp +++ b/layout/generic/nsLineLayout.cpp @@ -868,10 +868,12 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, // the float. At the same time, check if the frame has any non-collapsed-away // content. PRBool placedFloat = PR_FALSE; - PRBool hasNoncollapsedContent = PR_TRUE; - if (frameType) { + PRBool isEmpty; + if (!frameType) { + isEmpty = pfd->mFrame->IsEmpty(); + } else { if (nsGkAtoms::placeholderFrame == frameType) { - hasNoncollapsedContent = PR_FALSE; + isEmpty = PR_TRUE; pfd->SetFlag(PFD_SKIPWHENTRIMMINGWHITESPACE, PR_TRUE); nsIFrame* outOfFlowFrame = nsLayoutUtils::GetFloatFromPlaceholder(aFrame); if (outOfFlowFrame) { @@ -893,9 +895,8 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, // Note non-empty text-frames for inline frame compatibility hackery pfd->SetFlag(PFD_ISTEXTFRAME, PR_TRUE); nsTextFrame* textFrame = static_cast(pfd->mFrame); - if (!textFrame->HasNoncollapsedCharacters()) { - hasNoncollapsedContent = PR_FALSE; - } else { + isEmpty = !textFrame->HasNoncollapsedCharacters(); + if (!isEmpty) { pfd->SetFlag(PFD_ISNONEMPTYTEXTFRAME, PR_TRUE); nsIContent* content = textFrame->GetContent(); @@ -924,13 +925,15 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, } else if (nsGkAtoms::brFrame == frameType) { pfd->SetFlag(PFD_SKIPWHENTRIMMINGWHITESPACE, PR_TRUE); + isEmpty = PR_FALSE; } else { if (nsGkAtoms::letterFrame==frameType) { pfd->SetFlag(PFD_ISLETTERFRAME, PR_TRUE); } - if (pfd->mSpan && - !pfd->mSpan->mHasNonemptyContent && pfd->mFrame->IsSelfEmpty()) { - hasNoncollapsedContent = PR_FALSE; + if (pfd->mSpan) { + isEmpty = !pfd->mSpan->mHasNonemptyContent && pfd->mFrame->IsSelfEmpty(); + } else { + isEmpty = pfd->mFrame->IsEmpty(); } } } @@ -1012,7 +1015,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, if (CanPlaceFrame(pfd, reflowState, notSafeToBreak, continuingTextRun, savedOptionalBreakContent != nsnull, metrics, aReflowStatus, &optionalBreakAfterFits)) { - if (hasNoncollapsedContent) { + if (!isEmpty) { psd->mHasNonemptyContent = PR_TRUE; } diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index 9f77f8c3255..25310f13f00 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -752,6 +752,6 @@ random == 403134-1.html 403134-1-ref.html # bug 405377 == 419531-1.html 419531-1-ref.html == 420069-1.html 420069-1-ref.html == 420069-2.html 420069-2-ref.html -# == 420351-1.html 420351-1-ref.html +== 420351-1.html 420351-1-ref.html == 421234-1.html 421234-1-ref.html == 421419-1.html 421419-1-ref.html From 05ecd33c3990dd5ae80e6dd02ee38a1ffd6ebe6b Mon Sep 17 00:00:00 2001 From: "roc+@cs.cmu.edu" Date: Tue, 11 Mar 2008 17:51:12 -0700 Subject: [PATCH 21/65] Bug 421662. Rename TextRectangle* to ClientRect*. r+sr=sicking,a=damon --- content/base/src/nsGenericElement.cpp | 28 ++--- content/html/content/src/Makefile.in | 2 +- content/html/content/src/nsClientRect.cpp | 112 +++++++++++++++++++ content/html/content/src/nsClientRect.h | 80 +++++++++++++ dom/public/idl/base/Makefile.in | 4 +- dom/public/idl/base/domstubs.idl | 4 +- dom/public/idl/base/nsIDOMClientRect.idl | 48 ++++++++ dom/public/idl/base/nsIDOMClientRectList.idl | 46 ++++++++ dom/public/idl/core/nsIDOMNSElement.idl | 4 +- dom/public/nsDOMClassInfoID.h | 4 +- 10 files changed, 309 insertions(+), 23 deletions(-) create mode 100644 content/html/content/src/nsClientRect.cpp create mode 100644 content/html/content/src/nsClientRect.h create mode 100644 dom/public/idl/base/nsIDOMClientRect.idl create mode 100644 dom/public/idl/base/nsIDOMClientRectList.idl diff --git a/content/base/src/nsGenericElement.cpp b/content/base/src/nsGenericElement.cpp index bc9d85ee910..d0feb33c29a 100644 --- a/content/base/src/nsGenericElement.cpp +++ b/content/base/src/nsGenericElement.cpp @@ -96,7 +96,7 @@ #include "nsPIBoxObject.h" #include "nsIDOMNSDocument.h" #include "nsIDOMNSElement.h" -#include "nsTextRectangle.h" +#include "nsClientRect.h" #ifdef MOZ_SVG #include "nsSVGUtils.h" #endif @@ -828,8 +828,8 @@ RoundFloat(double aValue) } static void -SetTextRectangle(const nsRect& aLayoutRect, nsPresContext* aPresContext, - nsTextRectangle* aRect) +SetClientRect(const nsRect& aLayoutRect, nsPresContext* aPresContext, + nsClientRect* aRect) { double scale = 65536.0; // Round to the nearest 1/scale units. We choose scale so it can be represented @@ -844,10 +844,10 @@ SetTextRectangle(const nsRect& aLayoutRect, nsPresContext* aPresContext, } NS_IMETHODIMP -nsNSElementTearoff::GetBoundingClientRect(nsIDOMTextRectangle** aResult) +nsNSElementTearoff::GetBoundingClientRect(nsIDOMClientRect** aResult) { // Weak ref, since we addref it below - nsTextRectangle* rect = new nsTextRectangle(); + nsClientRect* rect = new nsClientRect(); if (!rect) return NS_ERROR_OUT_OF_MEMORY; @@ -862,37 +862,37 @@ nsNSElementTearoff::GetBoundingClientRect(nsIDOMTextRectangle** aResult) nsPresContext* presContext = frame->PresContext(); nsRect r = nsLayoutUtils::GetAllInFlowRectsUnion(frame, GetContainingBlockForClientRect(frame)); - SetTextRectangle(r, presContext, rect); + SetClientRect(r, presContext, rect); return NS_OK; } struct RectListBuilder : public nsLayoutUtils::RectCallback { - nsPresContext* mPresContext; - nsTextRectangleList* mRectList; - nsresult mRV; + nsPresContext* mPresContext; + nsClientRectList* mRectList; + nsresult mRV; - RectListBuilder(nsPresContext* aPresContext, nsTextRectangleList* aList) + RectListBuilder(nsPresContext* aPresContext, nsClientRectList* aList) : mPresContext(aPresContext), mRectList(aList), mRV(NS_OK) {} virtual void AddRect(const nsRect& aRect) { - nsRefPtr rect = new nsTextRectangle(); + nsRefPtr rect = new nsClientRect(); if (!rect) { mRV = NS_ERROR_OUT_OF_MEMORY; return; } - SetTextRectangle(aRect, mPresContext, rect); + SetClientRect(aRect, mPresContext, rect); mRectList->Append(rect); } }; NS_IMETHODIMP -nsNSElementTearoff::GetClientRects(nsIDOMTextRectangleList** aResult) +nsNSElementTearoff::GetClientRects(nsIDOMClientRectList** aResult) { *aResult = nsnull; - nsRefPtr rectList = new nsTextRectangleList(); + nsRefPtr rectList = new nsClientRectList(); if (!rectList) return NS_ERROR_OUT_OF_MEMORY; diff --git a/content/html/content/src/Makefile.in b/content/html/content/src/Makefile.in index 8bae404ce80..0a5b977960a 100644 --- a/content/html/content/src/Makefile.in +++ b/content/html/content/src/Makefile.in @@ -81,6 +81,7 @@ EXPORTS = \ $(NULL) CPPSRCS = \ + nsClientRect.cpp \ nsGenericHTMLElement.cpp \ nsFormSubmission.cpp \ nsImageMapUtils.cpp \ @@ -130,7 +131,6 @@ CPPSRCS = \ nsHTMLTableSectionElement.cpp \ nsHTMLTextAreaElement.cpp \ nsHTMLTitleElement.cpp \ - nsTextRectangle.cpp \ $(NULL) # we don't want the shared lib, but we want to force the creation of a static lib. diff --git a/content/html/content/src/nsClientRect.cpp b/content/html/content/src/nsClientRect.cpp new file mode 100644 index 00000000000..fe6652517b8 --- /dev/null +++ b/content/html/content/src/nsClientRect.cpp @@ -0,0 +1,112 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Novell code. + * + * The Initial Developer of the Original Code is + * Novell Corporation. + * Portions created by the Initial Developer are Copyright (C) 2006 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Robert O'Callahan + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsClientRect.h" +#include "nsContentUtils.h" +#include "nsDOMClassInfoID.h" + +NS_INTERFACE_TABLE_HEAD(nsClientRect) + NS_INTERFACE_TABLE1(nsClientRect, nsIDOMClientRect) + NS_INTERFACE_TABLE_TO_MAP_SEGUE + NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(ClientRect) +NS_INTERFACE_MAP_END + +NS_IMPL_ADDREF(nsClientRect) +NS_IMPL_RELEASE(nsClientRect) + +nsClientRect::nsClientRect() + : mX(0.0), mY(0.0), mWidth(0.0), mHeight(0.0) +{ +} + +NS_IMETHODIMP +nsClientRect::GetLeft(float* aResult) +{ + *aResult = mX; + return NS_OK; +} + +NS_IMETHODIMP +nsClientRect::GetTop(float* aResult) +{ + *aResult = mY; + return NS_OK; +} + +NS_IMETHODIMP +nsClientRect::GetRight(float* aResult) +{ + *aResult = mX + mWidth; + return NS_OK; +} + +NS_IMETHODIMP +nsClientRect::GetBottom(float* aResult) +{ + *aResult = mY + mHeight; + return NS_OK; +} + +NS_INTERFACE_TABLE_HEAD(nsClientRectList) + NS_INTERFACE_TABLE1(nsClientRectList, nsIDOMClientRectList) + NS_INTERFACE_TABLE_TO_MAP_SEGUE + NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(ClientRectList) +NS_INTERFACE_MAP_END + +NS_IMPL_ADDREF(nsClientRectList) +NS_IMPL_RELEASE(nsClientRectList) + + +NS_IMETHODIMP +nsClientRectList::GetLength(PRUint32* aLength) +{ + *aLength = mArray.Count(); + return NS_OK; +} + +NS_IMETHODIMP +nsClientRectList::Item(PRUint32 aIndex, nsIDOMClientRect** aReturn) +{ + if (aIndex >= PRUint32(mArray.Count())) { + *aReturn = nsnull; + return NS_OK; + } + + NS_IF_ADDREF(*aReturn = mArray.ObjectAt(aIndex)); + return NS_OK; +} diff --git a/content/html/content/src/nsClientRect.h b/content/html/content/src/nsClientRect.h new file mode 100644 index 00000000000..9506bb0e35b --- /dev/null +++ b/content/html/content/src/nsClientRect.h @@ -0,0 +1,80 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Novell code. + * + * The Initial Developer of the Original Code is + * Novell Corporation. + * Portions created by the Initial Developer are Copyright (C) 2006 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Robert O'Callahan + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef NSCLIENTRECT_H_ +#define NSCLIENTRECT_H_ + +#include "nsIDOMClientRect.h" +#include "nsIDOMClientRectList.h" +#include "nsCOMArray.h" + +class nsClientRect : public nsIDOMClientRect +{ +public: + NS_DECL_ISUPPORTS + + nsClientRect(); + void SetRect(float aX, float aY, float aWidth, float aHeight) { + mX = aX; mY = aY; mWidth = aWidth; mHeight = aHeight; + } + virtual ~nsClientRect() {} + + NS_DECL_NSIDOMCLIENTRECT + +protected: + float mX, mY, mWidth, mHeight; +}; + +class nsClientRectList : public nsIDOMClientRectList +{ +public: + nsClientRectList() {} + + NS_DECL_ISUPPORTS + + NS_DECL_NSIDOMCLIENTRECTLIST + + void Append(nsIDOMClientRect* aElement) { mArray.AppendObject(aElement); } + +protected: + virtual ~nsClientRectList() {} + + nsCOMArray mArray; +}; + +#endif /*NSCLIENTRECT_H_*/ diff --git a/dom/public/idl/base/Makefile.in b/dom/public/idl/base/Makefile.in index 23ec2c59367..4c74292a8b4 100644 --- a/dom/public/idl/base/Makefile.in +++ b/dom/public/idl/base/Makefile.in @@ -77,8 +77,8 @@ XPIDLSRCS = \ nsIDOMModalContentWindow.idl \ nsIDOMChromeWindow.idl \ nsIDOMNSFeatureFactory.idl \ - nsIDOMTextRectangle.idl \ - nsIDOMTextRectangleList.idl \ + nsIDOMClientRect.idl \ + nsIDOMClientRectList.idl \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/dom/public/idl/base/domstubs.idl b/dom/public/idl/base/domstubs.idl index 751d13d173f..a09e1534654 100644 --- a/dom/public/idl/base/domstubs.idl +++ b/dom/public/idl/base/domstubs.idl @@ -63,8 +63,8 @@ interface nsIDOMProcessingInstruction; interface nsIDOMText; interface nsIDOMDOMStringList; interface nsIDOMNameList; -interface nsIDOMTextRectangle; -interface nsIDOMTextRectangleList; +interface nsIDOMClientRect; +interface nsIDOMClientRectList; // Needed for raises() in our IDL interface DOMException; diff --git a/dom/public/idl/base/nsIDOMClientRect.idl b/dom/public/idl/base/nsIDOMClientRect.idl new file mode 100644 index 00000000000..71179be80a6 --- /dev/null +++ b/dom/public/idl/base/nsIDOMClientRect.idl @@ -0,0 +1,48 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Novell code. + * + * The Initial Developer of the Original Code is + * Novell Corporation. + * Portions created by the Initial Developer are Copyright (C) 2006 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Robert O'Callahan + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "domstubs.idl" + +[scriptable, uuid(f8583bbc-c6de-4646-b39f-df7e766442e9)] +interface nsIDOMClientRect : nsISupports +{ + readonly attribute float left; + readonly attribute float top; + readonly attribute float right; + readonly attribute float bottom; +}; diff --git a/dom/public/idl/base/nsIDOMClientRectList.idl b/dom/public/idl/base/nsIDOMClientRectList.idl new file mode 100644 index 00000000000..0fda56260a0 --- /dev/null +++ b/dom/public/idl/base/nsIDOMClientRectList.idl @@ -0,0 +1,46 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Novell code. + * + * The Initial Developer of the Original Code is + * Novell Corporation. + * Portions created by the Initial Developer are Copyright (C) 2006 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Robert O'Callahan + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "domstubs.idl" + +[scriptable, uuid(917da19d-62f5-441d-b47e-9e35f05639c9)] +interface nsIDOMClientRectList : nsISupports +{ + readonly attribute unsigned long length; + nsIDOMClientRect item(in unsigned long index); +}; diff --git a/dom/public/idl/core/nsIDOMNSElement.idl b/dom/public/idl/core/nsIDOMNSElement.idl index 0dc3a9d1d01..7d8f4573edc 100644 --- a/dom/public/idl/core/nsIDOMNSElement.idl +++ b/dom/public/idl/core/nsIDOMNSElement.idl @@ -68,12 +68,12 @@ interface nsIDOMNSElement : nsISupports * HTML AREA elements, and SVG elements that do not render). Those return * an empty list. */ - nsIDOMTextRectangleList getClientRects(); + nsIDOMClientRectList getClientRects(); /** * Returns the union of all rectangles in the getClientRects() list. Empty * rectangles are ignored, except that if all rectangles are empty, * we return an empty rectangle positioned at the top-left of the first * rectangle in getClientRects(). */ - nsIDOMTextRectangle getBoundingClientRect(); + nsIDOMClientRect getBoundingClientRect(); }; diff --git a/dom/public/nsDOMClassInfoID.h b/dom/public/nsDOMClassInfoID.h index 25daf3d05c1..58c353229aa 100644 --- a/dom/public/nsDOMClassInfoID.h +++ b/dom/public/nsDOMClassInfoID.h @@ -390,8 +390,8 @@ enum nsDOMClassInfoID { eDOMClassInfo_XMLHttpProgressEvent_id, eDOMClassInfo_XMLHttpRequest_id, - eDOMClassInfo_TextRectangle_id, - eDOMClassInfo_TextRectangleList_id, + eDOMClassInfo_ClientRect_id, + eDOMClassInfo_ClientRectList_id, // We are now trying to preserve binary compat in classinfo. No more // putting things in those categories up there. New entries are to be From 8ffd8d307d66507bb93beeec3b7f0fdd43224d56 Mon Sep 17 00:00:00 2001 From: "vladimir@pobox.com" Date: Tue, 11 Mar 2008 17:54:51 -0700 Subject: [PATCH 22/65] b=365, disabled controls on vista get hover effect; r=stuart --- widget/src/windows/nsNativeThemeWin.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/widget/src/windows/nsNativeThemeWin.cpp b/widget/src/windows/nsNativeThemeWin.cpp index b7e62e44e8c..da3d3c0278c 100644 --- a/widget/src/windows/nsNativeThemeWin.cpp +++ b/widget/src/windows/nsNativeThemeWin.cpp @@ -1040,8 +1040,11 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType, else aPart = CBP_DROPFRAME; - PRBool isOpen = CheckBooleanAttr(aFrame, nsWidgetAtoms::open); - if (isOpen) { + if (IsDisabled(aFrame)) { + aState = TS_DISABLED; + } else if (IsReadOnly(aFrame)) { + aState = TS_NORMAL; + } else if (CheckBooleanAttr(aFrame, nsWidgetAtoms::open)) { aState = TS_ACTIVE; } else { PRInt32 eventState = GetContentState(aFrame, aWidgetType); From f081a45d7428d4d73aa25fb69ae985a4fabc2df0 Mon Sep 17 00:00:00 2001 From: "roc+@cs.cmu.edu" Date: Tue, 11 Mar 2008 17:59:15 -0700 Subject: [PATCH 23/65] Bug 421662. Rename TextRectangle* to ClientRect*. r+sr=sicking,a=damon --- dom/src/base/nsDOMClassInfo.cpp | 26 +++++++++++++------------- dom/src/base/nsDOMClassInfo.h | 10 +++++----- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/dom/src/base/nsDOMClassInfo.cpp b/dom/src/base/nsDOMClassInfo.cpp index 8751722146b..5bb93c18f69 100644 --- a/dom/src/base/nsDOMClassInfo.cpp +++ b/dom/src/base/nsDOMClassInfo.cpp @@ -113,8 +113,8 @@ #include "nsIDOMMediaList.h" #include "nsIDOMChromeWindow.h" #include "nsIDOMConstructor.h" -#include "nsIDOMTextRectangle.h" -#include "nsIDOMTextRectangleList.h" +#include "nsIDOMClientRect.h" +#include "nsIDOMClientRectList.h" // DOM core includes #include "nsDOMError.h" @@ -1185,9 +1185,9 @@ static nsDOMClassInfoData sClassInfoData[] = { NS_DEFINE_CLASSINFO_DATA(XMLHttpRequest, nsDOMGenericSH, DOM_DEFAULT_SCRIPTABLE_FLAGS) - NS_DEFINE_CLASSINFO_DATA(TextRectangle, nsDOMGenericSH, + NS_DEFINE_CLASSINFO_DATA(ClientRect, nsDOMGenericSH, DOM_DEFAULT_SCRIPTABLE_FLAGS) - NS_DEFINE_CLASSINFO_DATA(TextRectangleList, nsTextRectangleListSH, + NS_DEFINE_CLASSINFO_DATA(ClientRectList, nsClientRectListSH, ARRAY_SCRIPTABLE_FLAGS) // Define MOZ_SVG_FOREIGNOBJECT here so that when it gets switched on, @@ -3327,12 +3327,12 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_EVENT_MAP_ENTRIES DOM_CLASSINFO_MAP_END - DOM_CLASSINFO_MAP_BEGIN(TextRectangle, nsIDOMTextRectangle) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMTextRectangle) + DOM_CLASSINFO_MAP_BEGIN(ClientRect, nsIDOMClientRect) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMClientRect) DOM_CLASSINFO_MAP_END - DOM_CLASSINFO_MAP_BEGIN(TextRectangleList, nsIDOMTextRectangleList) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMTextRectangleList) + DOM_CLASSINFO_MAP_BEGIN(ClientRectList, nsIDOMClientRectList) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMClientRectList) DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_BEGIN(FileList, nsIDOMFileList) @@ -9753,16 +9753,16 @@ nsCSSRuleListSH::GetItemAt(nsISupports *aNative, PRUint32 aIndex, return rv; } -// TextRectangleList scriptable helper +// ClientRectList scriptable helper nsresult -nsTextRectangleListSH::GetItemAt(nsISupports *aNative, PRUint32 aIndex, - nsISupports **aResult) +nsClientRectListSH::GetItemAt(nsISupports *aNative, PRUint32 aIndex, + nsISupports **aResult) { - nsCOMPtr list(do_QueryInterface(aNative)); + nsCOMPtr list(do_QueryInterface(aNative)); NS_ENSURE_TRUE(list, NS_ERROR_UNEXPECTED); - nsIDOMTextRectangle *rule = nsnull; // Weak, transfer the ownership over to aResult + nsIDOMClientRect *rule = nsnull; // Weak, transfer the ownership over to aResult nsresult rv = list->Item(aIndex, &rule); *aResult = rule; diff --git a/dom/src/base/nsDOMClassInfo.h b/dom/src/base/nsDOMClassInfo.h index 0d806061d76..484c02ceba9 100644 --- a/dom/src/base/nsDOMClassInfo.h +++ b/dom/src/base/nsDOMClassInfo.h @@ -1331,16 +1331,16 @@ public: } }; -// TextRectangleList helper +// ClientRectList helper -class nsTextRectangleListSH : public nsArraySH +class nsClientRectListSH : public nsArraySH { protected: - nsTextRectangleListSH(nsDOMClassInfoData* aData) : nsArraySH(aData) + nsClientRectListSH(nsDOMClassInfoData* aData) : nsArraySH(aData) { } - virtual ~nsTextRectangleListSH() + virtual ~nsClientRectListSH() { } @@ -1352,7 +1352,7 @@ protected: public: static nsIClassInfo *doCreate(nsDOMClassInfoData* aData) { - return new nsTextRectangleListSH(aData); + return new nsClientRectListSH(aData); } }; From ea712ce5193a905d5db31e2dcf8fdbb33e2c8251 Mon Sep 17 00:00:00 2001 From: "roc+@cs.cmu.edu" Date: Tue, 11 Mar 2008 18:05:26 -0700 Subject: [PATCH 24/65] Bug 413027. The XUL pref and min height for a CSS block should be its height when reflowed at its preferred width, NOT the height of the tallest line. r+sr=dbaron. Relanding with extra instrumentation in the strangely-failing mochitest test_bug199692.xul --- content/xul/document/test/test_bug199692.xul | 4 ++- layout/generic/nsFrame.cpp | 27 +------------------- 2 files changed, 4 insertions(+), 27 deletions(-) diff --git a/content/xul/document/test/test_bug199692.xul b/content/xul/document/test/test_bug199692.xul index 7f219460c9c..0c557098fa4 100644 --- a/content/xul/document/test/test_bug199692.xul +++ b/content/xul/document/test/test_bug199692.xul @@ -64,7 +64,9 @@ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> function test(ptFunc, id, message) { var pt = ptFunc($(id)); - is(document.elementFromPoint(pt.x, pt.y).id, id, message); + var e = document.elementFromPoint(pt.x, pt.y); + ok(e != null, message + " (returned null)"); + is(e.id, id, message); } function do_test() { diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 472c1c60f53..4d265a23ebf 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -5854,32 +5854,7 @@ nsFrame::RefreshSizeCache(nsBoxLayoutState& aState) Redraw(aState, &newRect); } - metrics->mBlockMinSize.height = 0; - // ok we need the max ascent of the items on the line. So to do this - // ask the block for its line iterator. Get the max ascent. - nsCOMPtr lines = do_QueryInterface(static_cast(this)); - if (lines) - { - metrics->mBlockMinSize.height = 0; - int count = 0; - nsIFrame* firstFrame = nsnull; - PRInt32 framesOnLine; - nsRect lineBounds; - PRUint32 lineFlags; - - do { - lines->GetLine(count, &firstFrame, &framesOnLine, lineBounds, &lineFlags); - - if (lineBounds.height > metrics->mBlockMinSize.height) - metrics->mBlockMinSize.height = lineBounds.height; - - count++; - } while(firstFrame); - } else { - metrics->mBlockMinSize.height = desiredSize.height; - } - - metrics->mBlockPrefSize.height = metrics->mBlockMinSize.height; + metrics->mBlockMinSize.height = metrics->mBlockPrefSize.height = newRect.height; if (desiredSize.ascent == nsHTMLReflowMetrics::ASK_FOR_BASELINE) { if (!nsLayoutUtils::GetFirstLineBaseline(this, &metrics->mBlockAscent)) From 60d05a4f075580fc007ee4412be706c17cb40159 Mon Sep 17 00:00:00 2001 From: "roc+@cs.cmu.edu" Date: Tue, 11 Mar 2008 19:01:17 -0700 Subject: [PATCH 25/65] Bug 413027 backed out again --- layout/generic/nsFrame.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 4d265a23ebf..472c1c60f53 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -5854,7 +5854,32 @@ nsFrame::RefreshSizeCache(nsBoxLayoutState& aState) Redraw(aState, &newRect); } - metrics->mBlockMinSize.height = metrics->mBlockPrefSize.height = newRect.height; + metrics->mBlockMinSize.height = 0; + // ok we need the max ascent of the items on the line. So to do this + // ask the block for its line iterator. Get the max ascent. + nsCOMPtr lines = do_QueryInterface(static_cast(this)); + if (lines) + { + metrics->mBlockMinSize.height = 0; + int count = 0; + nsIFrame* firstFrame = nsnull; + PRInt32 framesOnLine; + nsRect lineBounds; + PRUint32 lineFlags; + + do { + lines->GetLine(count, &firstFrame, &framesOnLine, lineBounds, &lineFlags); + + if (lineBounds.height > metrics->mBlockMinSize.height) + metrics->mBlockMinSize.height = lineBounds.height; + + count++; + } while(firstFrame); + } else { + metrics->mBlockMinSize.height = desiredSize.height; + } + + metrics->mBlockPrefSize.height = metrics->mBlockMinSize.height; if (desiredSize.ascent == nsHTMLReflowMetrics::ASK_FOR_BASELINE) { if (!nsLayoutUtils::GetFirstLineBaseline(this, &metrics->mBlockAscent)) From 49be829b51d4203ca6cfd24465d119f9eb63b7f9 Mon Sep 17 00:00:00 2001 From: "ajschult@verizon.net" Date: Tue, 11 Mar 2008 21:44:02 -0700 Subject: [PATCH 26/65] Bug 422047: popup button test window too narrow, r=enndeakin --- toolkit/content/tests/widgets/test_popup_button.xul | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/content/tests/widgets/test_popup_button.xul b/toolkit/content/tests/widgets/test_popup_button.xul index eb4fe595e94..25fbec8aa68 100644 --- a/toolkit/content/tests/widgets/test_popup_button.xul +++ b/toolkit/content/tests/widgets/test_popup_button.xul @@ -15,7 +15,7 @@ SimpleTest.waitForExplicitFinish(); function runTest() { - window.open("window_popup_button.xul", "_blank", "width=600,height=700"); + window.open("window_popup_button.xul", "_blank", "width=700,height=700"); } From 1ddc65a4a0b0a0fac981057aad5f1469eb81f8ef Mon Sep 17 00:00:00 2001 From: "shaver@mozilla.org" Date: Tue, 11 Mar 2008 23:50:55 -0700 Subject: [PATCH 27/65] Bug 422286: fix accounting of array length when slicing dense arrays. r=mrbkap, a=mconnor. --- js/src/jsarray.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/src/jsarray.c b/js/src/jsarray.c index c68964e601d..53b1ed7188b 100644 --- a/js/src/jsarray.c +++ b/js/src/jsarray.c @@ -2478,7 +2478,7 @@ array_slice(JSContext *cx, uintN argc, jsval *vp) if (begin > end) begin = end; - if (OBJ_IS_DENSE_ARRAY(cx, obj)) { + if (OBJ_IS_DENSE_ARRAY(cx, obj) && end <= ARRAY_DENSE_LENGTH(obj)) { nobj = js_NewArrayObject(cx, end - begin, obj->dslots + begin); if (!nobj) return JS_FALSE; From 201f2e24121a5a80fde8ba122e957e2eb42f4fa7 Mon Sep 17 00:00:00 2001 From: "brendan@mozilla.org" Date: Wed, 12 Mar 2008 00:05:30 -0700 Subject: [PATCH 28/65] Fix indentation nit --- js/src/jsnum.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/src/jsnum.c b/js/src/jsnum.c index 33c9cd67c6d..cbb3877d2b1 100644 --- a/js/src/jsnum.c +++ b/js/src/jsnum.c @@ -741,7 +741,7 @@ js_ValueToNumber(JSContext *cx, jsval *vp) if ((!js_strtod(cx, bp, end, &ep, &d) || js_SkipWhiteSpace(ep, end) != end) && (!js_strtointeger(cx, bp, end, &ep, 0, &d) || - js_SkipWhiteSpace(ep, end) != end)) { + js_SkipWhiteSpace(ep, end) != end)) { break; } From 13effbe655c811b03b1b3b594742272eff5848f1 Mon Sep 17 00:00:00 2001 From: "dwitte@stanford.edu" Date: Wed, 12 Mar 2008 00:53:50 -0700 Subject: [PATCH 29/65] Bug 421494 - reimplement third party cookie blocking. r=mconnor, sr=bz, blocking1.9+ --- extensions/cookie/Makefile.in | 7 ++ extensions/cookie/makefiles.sh | 1 + extensions/cookie/nsCookiePermission.cpp | 98 +++++++++++++++- extensions/cookie/test/Makefile.in | 93 +++++++++++++++ .../cookie/test/browser_test_favicon.js | 44 +++++++ extensions/cookie/test/file_domain_inner.html | 14 +++ .../cookie/test/file_domain_inner_inner.html | 14 +++ extensions/cookie/test/file_image_inner.html | 15 +++ .../cookie/test/file_image_inner_inner.html | 20 ++++ .../cookie/test/file_loadflags_inner.html | 17 +++ .../cookie/test/file_localhost_inner.html | 14 +++ .../cookie/test/file_loopback_inner.html | 14 +++ .../cookie/test/file_subdomain_inner.html | 14 +++ extensions/cookie/test/file_testcommon.js | 67 +++++++++++ extensions/cookie/test/file_testloadflags.js | 111 ++++++++++++++++++ extensions/cookie/test/image1.png | Bin 0 -> 1242 bytes extensions/cookie/test/image1.png^headers^ | 3 + extensions/cookie/test/image2.png | Bin 0 -> 1242 bytes extensions/cookie/test/image2.png^headers^ | 3 + extensions/cookie/test/test1.css | 2 + extensions/cookie/test/test1.css^headers^ | 3 + extensions/cookie/test/test2.css | 2 + extensions/cookie/test/test2.css^headers^ | 3 + .../cookie/test/test_differentdomain.html | 16 +++ extensions/cookie/test/test_image.html | 15 +++ extensions/cookie/test/test_loadflags.html | 16 +++ .../cookie/test/test_same_base_domain.html | 16 +++ .../cookie/test/test_same_base_domain_2.html | 16 +++ .../cookie/test/test_same_base_domain_3.html | 16 +++ .../cookie/test/test_same_base_domain_4.html | 16 +++ .../cookie/test/test_same_base_domain_5.html | 16 +++ .../cookie/test/test_same_base_domain_6.html | 16 +++ .../cookie/test/test_same_base_domain_7.html | 16 +++ extensions/cookie/test/test_samedomain.html | 16 +++ extensions/cookie/test/unit/test_cookies.js | 49 ++++++++ netwerk/cookie/public/nsICookiePermission.idl | 24 +++- netwerk/cookie/src/nsCookieService.cpp | 97 ++++----------- netwerk/cookie/src/nsCookieService.h | 9 +- netwerk/test/TestCookie.cpp | 85 +------------- 39 files changed, 826 insertions(+), 172 deletions(-) create mode 100644 extensions/cookie/test/Makefile.in create mode 100644 extensions/cookie/test/browser_test_favicon.js create mode 100644 extensions/cookie/test/file_domain_inner.html create mode 100644 extensions/cookie/test/file_domain_inner_inner.html create mode 100644 extensions/cookie/test/file_image_inner.html create mode 100644 extensions/cookie/test/file_image_inner_inner.html create mode 100644 extensions/cookie/test/file_loadflags_inner.html create mode 100644 extensions/cookie/test/file_localhost_inner.html create mode 100644 extensions/cookie/test/file_loopback_inner.html create mode 100644 extensions/cookie/test/file_subdomain_inner.html create mode 100644 extensions/cookie/test/file_testcommon.js create mode 100644 extensions/cookie/test/file_testloadflags.js create mode 100644 extensions/cookie/test/image1.png create mode 100644 extensions/cookie/test/image1.png^headers^ create mode 100644 extensions/cookie/test/image2.png create mode 100644 extensions/cookie/test/image2.png^headers^ create mode 100644 extensions/cookie/test/test1.css create mode 100644 extensions/cookie/test/test1.css^headers^ create mode 100644 extensions/cookie/test/test2.css create mode 100644 extensions/cookie/test/test2.css^headers^ create mode 100644 extensions/cookie/test/test_differentdomain.html create mode 100644 extensions/cookie/test/test_image.html create mode 100644 extensions/cookie/test/test_loadflags.html create mode 100644 extensions/cookie/test/test_same_base_domain.html create mode 100644 extensions/cookie/test/test_same_base_domain_2.html create mode 100644 extensions/cookie/test/test_same_base_domain_3.html create mode 100644 extensions/cookie/test/test_same_base_domain_4.html create mode 100644 extensions/cookie/test/test_same_base_domain_5.html create mode 100644 extensions/cookie/test/test_same_base_domain_6.html create mode 100644 extensions/cookie/test/test_same_base_domain_7.html create mode 100644 extensions/cookie/test/test_samedomain.html create mode 100644 extensions/cookie/test/unit/test_cookies.js diff --git a/extensions/cookie/Makefile.in b/extensions/cookie/Makefile.in index e1ea6e6f16b..842166fca07 100644 --- a/extensions/cookie/Makefile.in +++ b/extensions/cookie/Makefile.in @@ -56,10 +56,13 @@ REQUIRES = xpcom \ string \ necko \ dom \ + content \ + widget \ pref \ windowwatcher \ docshell \ appshell \ + caps \ storage \ $(NULL) @@ -85,4 +88,8 @@ ifdef MOZ_MAIL_NEWS DEFINES += -DMOZ_MAIL_NEWS endif +ifdef ENABLE_TESTS +TOOL_DIRS += test +endif + include $(topsrcdir)/config/rules.mk diff --git a/extensions/cookie/makefiles.sh b/extensions/cookie/makefiles.sh index a4a5abea161..d7b6c690431 100755 --- a/extensions/cookie/makefiles.sh +++ b/extensions/cookie/makefiles.sh @@ -38,4 +38,5 @@ add_makefiles " extensions/cookie/Makefile + extensions/cookie/test/Makefile " diff --git a/extensions/cookie/nsCookiePermission.cpp b/extensions/cookie/nsCookiePermission.cpp index 4acad1689fb..0f8a64f02f7 100644 --- a/extensions/cookie/nsCookiePermission.cpp +++ b/extensions/cookie/nsCookiePermission.cpp @@ -21,6 +21,7 @@ * * Contributor(s): * Darin Fisher + * Daniel Witte * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or @@ -49,11 +50,12 @@ #include "nsIPrefBranch2.h" #include "nsIDocShell.h" #include "nsIDocShellTreeItem.h" -#include "nsIInterfaceRequestor.h" -#include "nsIInterfaceRequestorUtils.h" -#include "nsILoadGroup.h" +#include "nsIWebNavigation.h" +#include "nsINode.h" #include "nsIChannel.h" #include "nsIDOMWindow.h" +#include "nsIDOMDocument.h" +#include "nsIPrincipal.h" #include "nsString.h" #include "nsCRT.h" @@ -199,7 +201,6 @@ nsCookiePermission::SetAccess(nsIURI *aURI, NS_IMETHODIMP nsCookiePermission::CanAccess(nsIURI *aURI, - nsIURI *aFirstURI, nsIChannel *aChannel, nsCookieAccess *aResult) { @@ -235,7 +236,6 @@ nsCookiePermission::CanAccess(nsIURI *aURI, } } if ((appType == nsIDocShell::APP_TYPE_MAIL) || - (aFirstURI && IsFromMailNews(aFirstURI)) || IsFromMailNews(aURI)) { *aResult = ACCESS_DENY; return NS_OK; @@ -421,6 +421,94 @@ nsCookiePermission::CanSetCookie(nsIURI *aURI, return NS_OK; } +NS_IMETHODIMP +nsCookiePermission::GetOriginatingURI(nsIChannel *aChannel, + nsIURI **aURI) +{ + /* to find the originating URI, we use the loadgroup of the channel to obtain + * the docshell owning the load, and from there, we find the root content + * docshell and its URI. there are several possible cases: + * + * 1) no channel. this will occur for plugins using the nsICookieStorage + * interface, since they have none to provide. other consumers should + * have a channel. + * + * 2) a channel, but no docshell. this can occur when the consumer kicking + * off the load doesn't provide one to the channel, and should be limited + * to loads of certain types of resources (e.g. favicons). + * + * 3) a non-content docshell. this occurs for loads kicked off from chrome, + * where no content docshell exists (favicons can also fall into this + * category). + * + * 4) a content docshell equal to the root content docshell, with channel + * loadflags LOAD_DOCUMENT_URI. this covers the case of a freshly kicked- + * off load (e.g. the user typing something in the location bar, or + * clicking on a bookmark), where the currentURI hasn't yet been set, + * and will be bogus. we return the channel URI in this case. note that + * we could also allow non-content docshells here, but that goes against + * the philosophy of having an audit trail back to a URI the user typed + * or clicked on. + * + * 5) a root content docshell. this covers most cases for an ordinary page + * load from the location bar, and will catch nested frames within + * a page, image loads, etc. we return the URI of the docshell's principal + * in this case. + * + */ + + *aURI = nsnull; + + // case 1) + if (!aChannel) + return NS_ERROR_NULL_POINTER; + + // find the docshell and its root + nsCOMPtr docshell, root; + NS_QueryNotificationCallbacks(aChannel, docshell); + if (docshell) + docshell->GetSameTypeRootTreeItem(getter_AddRefs(root)); + + PRInt32 type; + if (root) + root->GetItemType(&type); + + // cases 2) and 3) + if (!root || type != nsIDocShellTreeItem::typeContent) + return NS_ERROR_INVALID_ARG; + + // case 4) + if (docshell == root) { + nsLoadFlags flags; + aChannel->GetLoadFlags(&flags); + + if (flags & nsIChannel::LOAD_DOCUMENT_URI) { + // get the channel URI - the docshell's will be bogus + aChannel->GetURI(aURI); + if (!*aURI) + return NS_ERROR_NULL_POINTER; + + return NS_OK; + } + } + + // case 5) - get the originating URI from the docshell's principal + nsCOMPtr webnav = do_QueryInterface(root); + if (webnav) { + nsCOMPtr doc; + webnav->GetDocument(getter_AddRefs(doc)); + nsCOMPtr node = do_QueryInterface(doc); + if (node) + node->NodePrincipal()->GetURI(aURI); + } + + if (!*aURI) + return NS_ERROR_NULL_POINTER; + + // all done! + return NS_OK; +} + NS_IMETHODIMP nsCookiePermission::Observe(nsISupports *aSubject, const char *aTopic, diff --git a/extensions/cookie/test/Makefile.in b/extensions/cookie/test/Makefile.in new file mode 100644 index 00000000000..e36a367cd9e --- /dev/null +++ b/extensions/cookie/test/Makefile.in @@ -0,0 +1,93 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# Mozilla Foundation. +# Portions created by the Initial Developer are Copyright (C) 2007 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +DEPTH = ../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ +relativesrcdir = extensions/cookie/test + +include $(DEPTH)/config/autoconf.mk + +MODULE = test_cookies + +_TEST_FILES = \ + test_samedomain.html \ + file_testcommon.js \ + file_domain_inner.html \ + file_domain_inner_inner.html \ + test_differentdomain.html \ + test_image.html \ + file_image_inner.html \ + file_image_inner_inner.html \ + image1.png \ + image1.png^headers^ \ + image2.png \ + image2.png^headers^ \ + test1.css \ + test1.css^headers^ \ + test2.css \ + test2.css^headers^ \ + test_loadflags.html \ + file_testloadflags.js \ + file_loadflags_inner.html \ + test_same_base_domain.html \ + file_subdomain_inner.html \ + test_same_base_domain_2.html \ + test_same_base_domain_3.html \ + test_same_base_domain_4.html \ + file_localhost_inner.html \ + test_same_base_domain_5.html \ + test_same_base_domain_6.html \ + file_loopback_inner.html \ + test_same_base_domain_7.html \ + $(NULL) + +_BROWSER_TEST_FILES = \ + browser_test_favicon.js \ + $(NULL) + +libs:: $(_TEST_FILES) + $(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir) + +libs:: $(_BROWSER_TEST_FILES) + $(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir) + +XPCSHELL_TESTS = unit + +include $(topsrcdir)/config/rules.mk + diff --git a/extensions/cookie/test/browser_test_favicon.js b/extensions/cookie/test/browser_test_favicon.js new file mode 100644 index 00000000000..4c1ae877c30 --- /dev/null +++ b/extensions/cookie/test/browser_test_favicon.js @@ -0,0 +1,44 @@ +// tests third party cookie blocking using a favicon load directly from chrome. +// in this case, the docshell of the channel is chrome, not content; thus +// the cookie should be considered third party. + +function test() { + waitForExplicitFinish(); + + var prefs = Components.classes["@mozilla.org/preferences-service;1"] + .getService(Components.interfaces.nsIPrefBranch); + prefs.setIntPref("network.cookie.cookieBehavior", 1); + + var o = new obs(); + + // kick off a favicon load + PageProxySetIcon("http://example.org/tests/extensions/cookie/test/image1.png"); +} + +function obs () { + this.os = Components.classes["@mozilla.org/observer-service;1"] + .getService(Components.interfaces.nsIObserverService); + this.os.addObserver(this, "cookie-rejected", false); +} + +obs.prototype = { + observe: function obs_observe (theSubject, theTopic, theData) + { + var uri = theSubject.QueryInterface(Components.interfaces.nsIURI); + var domain = uri.host; + + if (domain == "example.org") { + ok(true, "foreign favicon cookie was blocked"); + + var prefs = Components.classes["@mozilla.org/preferences-service;1"] + .getService(Components.interfaces.nsIPrefBranch); + prefs.setIntPref("network.cookie.cookieBehavior", 0); + + this.os.removeObserver(this, "cookie-rejected"); + this.os = null; + + finish(); + } + } +} + diff --git a/extensions/cookie/test/file_domain_inner.html b/extensions/cookie/test/file_domain_inner.html new file mode 100644 index 00000000000..b561c441705 --- /dev/null +++ b/extensions/cookie/test/file_domain_inner.html @@ -0,0 +1,14 @@ + + + + + + + + + diff --git a/extensions/cookie/test/file_domain_inner_inner.html b/extensions/cookie/test/file_domain_inner_inner.html new file mode 100644 index 00000000000..baa608e6a72 --- /dev/null +++ b/extensions/cookie/test/file_domain_inner_inner.html @@ -0,0 +1,14 @@ + + + + + + + + + diff --git a/extensions/cookie/test/file_image_inner.html b/extensions/cookie/test/file_image_inner.html new file mode 100644 index 00000000000..a4d98ee0599 --- /dev/null +++ b/extensions/cookie/test/file_image_inner.html @@ -0,0 +1,15 @@ + + + + + + + + + + diff --git a/extensions/cookie/test/file_image_inner_inner.html b/extensions/cookie/test/file_image_inner_inner.html new file mode 100644 index 00000000000..07f060940b8 --- /dev/null +++ b/extensions/cookie/test/file_image_inner_inner.html @@ -0,0 +1,20 @@ + + + + + + + + + + + + + diff --git a/extensions/cookie/test/file_loadflags_inner.html b/extensions/cookie/test/file_loadflags_inner.html new file mode 100644 index 00000000000..1dc7619cae9 --- /dev/null +++ b/extensions/cookie/test/file_loadflags_inner.html @@ -0,0 +1,17 @@ + + + + + + + + + + diff --git a/extensions/cookie/test/file_localhost_inner.html b/extensions/cookie/test/file_localhost_inner.html new file mode 100644 index 00000000000..49c75603877 --- /dev/null +++ b/extensions/cookie/test/file_localhost_inner.html @@ -0,0 +1,14 @@ + + + + + + + + + diff --git a/extensions/cookie/test/file_loopback_inner.html b/extensions/cookie/test/file_loopback_inner.html new file mode 100644 index 00000000000..156532dc338 --- /dev/null +++ b/extensions/cookie/test/file_loopback_inner.html @@ -0,0 +1,14 @@ + + + + + + + + + diff --git a/extensions/cookie/test/file_subdomain_inner.html b/extensions/cookie/test/file_subdomain_inner.html new file mode 100644 index 00000000000..ff1036edb47 --- /dev/null +++ b/extensions/cookie/test/file_subdomain_inner.html @@ -0,0 +1,14 @@ + + + + + + + + + diff --git a/extensions/cookie/test/file_testcommon.js b/extensions/cookie/test/file_testcommon.js new file mode 100644 index 00000000000..5adb7fbeaec --- /dev/null +++ b/extensions/cookie/test/file_testcommon.js @@ -0,0 +1,67 @@ +SimpleTest.waitForExplicitFinish(); + +var gPopup = null; + +var gExpectedCookies = 0; +var gExpectedLoads = 0; +var gLoads = 0; + +function setupTest(uri, cookies, loads) { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + + var prefs = Components.classes["@mozilla.org/preferences-service;1"] + .getService(Components.interfaces.nsIPrefBranch); + prefs.setIntPref("network.cookie.cookieBehavior", 1); + + var cs = Components.classes["@mozilla.org/cookiemanager;1"] + .getService(Components.interfaces.nsICookieManager2); + cs.removeAll(); + + gExpectedCookies = cookies; + gExpectedLoads = loads; + + // load a window which contains an iframe; each will attempt to set + // cookies from their respective domains. + gPopup = window.open(uri, 'hai', 'width=100,height=100'); +} + +/** Receives MessageEvents to this window. */ +function messageReceiver(evt) +{ + ok(evt instanceof MessageEvent, "wrong event type"); + + if (evt.data == "message") + gLoads++; + else { + ok(false, "wrong message"); + gPopup.close(); + SimpleTest.finish(); + } + + // only run the test when all our children are done loading & setting cookies + if (gLoads == gExpectedLoads) + runTest(); +} + +function runTest() { + // set a cookie from a domain of "localhost" + document.cookie = "oh=hai"; + + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + var cs = Components.classes["@mozilla.org/cookiemanager;1"] + .getService(Components.interfaces.nsICookieManager); + var list = cs.enumerator; + var count = 0; + while (list.hasMoreElements()) { + count++; + list.getNext(); + } + is(count, gExpectedCookies, "incorrect number of cookies"); + + gPopup.close(); + cs.removeAll(); + SimpleTest.finish(); +} + +document.addEventListener("message", messageReceiver, false); + diff --git a/extensions/cookie/test/file_testloadflags.js b/extensions/cookie/test/file_testloadflags.js new file mode 100644 index 00000000000..aa432c6dec8 --- /dev/null +++ b/extensions/cookie/test/file_testloadflags.js @@ -0,0 +1,111 @@ +SimpleTest.waitForExplicitFinish(); + +var gPopup = null; + +var gExpectedCookies = 0; +var gExpectedLoads = 0; +var gExpectedHeaders = 0; +var gLoads = 0; +var gHeaders = 0; + +var o = null; + +function setupTest(uri, domain, cookies, loads, headers) { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + + var prefs = Components.classes["@mozilla.org/preferences-service;1"] + .getService(Components.interfaces.nsIPrefBranch); + prefs.setIntPref("network.cookie.cookieBehavior", 1); + + var cs = Components.classes["@mozilla.org/cookiemanager;1"] + .getService(Components.interfaces.nsICookieManager2); + cs.removeAll(); + cs.add(domain, "", "oh", "hai", false, false, true, Math.pow(2, 62)); + is(cs.countCookiesFromHost(domain), 1, "cookie wasn't inited"); + + o = new obs(); + + gExpectedCookies = cookies; + gExpectedLoads = loads; + gExpectedHeaders = headers; + + // load a window which contains an iframe; each will attempt to set + // cookies from their respective domains. + gPopup = window.open(uri, 'hai', 'width=100,height=100'); +} + +function obs () { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + this.os = Components.classes["@mozilla.org/observer-service;1"] + .getService(Components.interfaces.nsIObserverService); + this.os.addObserver(this, "http-on-modify-request", false); + this.window = window; +} + +obs.prototype = { + observe: function obs_observe (theSubject, theTopic, theData) + { + this.window.netscape.security + .PrivilegeManager.enablePrivilege("UniversalXPConnect"); + var httpchannel = theSubject.QueryInterface(this.window.Components.interfaces + .nsIHttpChannel); + + var cookie = httpchannel.getRequestHeader("Cookie"); + + var got = cookie.indexOf("oh=hai"); + this.window.isnot(got, -1, "cookie wasn't sent"); + gHeaders++; + }, + + remove: function obs_remove() + { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + this.os.removeObserver(this, "http-on-modify-request"); + this.os = null; + this.window = null; + } +} + +/** Receives MessageEvents to this window. */ +function messageReceiver(evt) +{ + ok(evt instanceof MessageEvent, "wrong event type"); + + if (evt.data == "message") + gLoads++; + else { + ok(false, "wrong message"); + o.remove(); + gPopup.close(); + SimpleTest.finish(); + } + + // only run the test when all our children are done loading & setting cookies + if (gLoads == gExpectedLoads) + runTest(); +} + +function runTest() { + // set a cookie from a domain of "localhost" + document.cookie = "o=noes"; + + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + var cs = Components.classes["@mozilla.org/cookiemanager;1"] + .getService(Components.interfaces.nsICookieManager); + var list = cs.enumerator; + var count = 0; + while (list.hasMoreElements()) { + count++; + list.getNext(); + } + is(count, gExpectedCookies, "incorrect number of cookies"); + is(gHeaders, gExpectedHeaders, "incorrect number of request headers"); + + o.remove(); + gPopup.close(); + cs.removeAll(); + SimpleTest.finish(); +} + +document.addEventListener("message", messageReceiver, false); + diff --git a/extensions/cookie/test/image1.png b/extensions/cookie/test/image1.png new file mode 100644 index 0000000000000000000000000000000000000000..4b7c102840cab57d589b4380cb1d0675498fcda9 GIT binary patch literal 1242 zcmV<01SR{4P)4Tx0C=30k{)ols`Zz7ik<`+6&3Ip87oB zo_cEv5f^-H+-Di={FM z6ELfqlYm*#JPnvzN-7X}z;xDa7laF>!j(b}#2%2SYCZxI70s7GqTy5(h$fH@+*$zQ z1<1HwN%IszU0@Ua)i?;lVNAhax!z6Z`Ujx<{>*xR z0Mc+g538N9xC;kQFnR$!SCH?9l_`wO^LOZ50Wg@e{aPiomFHT8xvZ6|`}HuAw&VTl z?SD&o+X^68mpfstx~{BQDSa0GkgN=i*4c{6kO5(000SaNLh0L01FcU z01FcV0GgZ_0008*NklR(axBghhpis%YaSwDm*SW%g1$|O^3ZZj?II&IEfzwiCtw_nPP?EE`C z&pGg%=K%jf;S(z>Y{*>-00s4y4S5f;!hi4Z(WKaB&4}hqq@WS;;O=v!1|mwyG(yGy z8c+eQqK2HqV_XubKnZe*S2&sKR$M>`s`3N5XD2m~1nMJ%o&tdU`xYM~EQS)Q?acUH zu_(_HduHWvq^HfQUbEd;J*MF%-25W7<7C3alP#pjB_(l zsx86kH+5iyff5F;;E}~gz%OYkYjOjC^^Tb-pup~V<#7G#KqwM~2ql^aKjOD<1X*bd z(f^>`ZF}4^3jpMlvN%p6F6-T_+j5C7nWmhMb^3gK{AR~!cmzL#qad+~*ki7O$M47G z#w$=MY3FzbjT>7OQiQfpk!}%0lCs&b9FFhp@P)ki>Gwg9sZco8jJIwZ@#sq>7^Gj|3kLuK z$j1{5GbvF!1qwbML%|S2h(k`&0(A9u!+EV6`SxB|l>(mdTDWKG`c>_&+1_1-qvLOs z5x(~Ar&f%FfDnyCPRc^`4t3#Wy%TD?6FW!*J)kg)VOsO)vwn{{;niBxv4(Mjru}U- zoWQ@n@!}p<8CD`lMj=VS6qyE9ni#kwiZU<2jrw^zBV-$87TuAWMp<+ZzS(|U*A>lJ z*5Yc_PgU!nlxfjwcOc<|2TLTvK64x=0&pZ~_-4~$49EpCp-5wxe`wB4Ng$OHVZ5R* z8OB~O>KrcVI|pv3J}t0*alys+&Uf7K{)(sn(ocYSUzWXcQz>%->~>Nd%PU!SK6);n zOgM(N+E(N6)=crl>P!-NHh3v^T6#SIY%MBM22xYSKMhDxmS%e%O#lD@07*qoM6N<$ Eg369MXaE2J literal 0 HcmV?d00001 diff --git a/extensions/cookie/test/image1.png^headers^ b/extensions/cookie/test/image1.png^headers^ new file mode 100644 index 00000000000..6b75fe95939 --- /dev/null +++ b/extensions/cookie/test/image1.png^headers^ @@ -0,0 +1,3 @@ +Cache-Control: no-cache +Set-Cookie: foo=bar + diff --git a/extensions/cookie/test/image2.png b/extensions/cookie/test/image2.png new file mode 100644 index 0000000000000000000000000000000000000000..4b7c102840cab57d589b4380cb1d0675498fcda9 GIT binary patch literal 1242 zcmV<01SR{4P)4Tx0C=30k{)ols`Zz7ik<`+6&3Ip87oB zo_cEv5f^-H+-Di={FM z6ELfqlYm*#JPnvzN-7X}z;xDa7laF>!j(b}#2%2SYCZxI70s7GqTy5(h$fH@+*$zQ z1<1HwN%IszU0@Ua)i?;lVNAhax!z6Z`Ujx<{>*xR z0Mc+g538N9xC;kQFnR$!SCH?9l_`wO^LOZ50Wg@e{aPiomFHT8xvZ6|`}HuAw&VTl z?SD&o+X^68mpfstx~{BQDSa0GkgN=i*4c{6kO5(000SaNLh0L01FcU z01FcV0GgZ_0008*NklR(axBghhpis%YaSwDm*SW%g1$|O^3ZZj?II&IEfzwiCtw_nPP?EE`C z&pGg%=K%jf;S(z>Y{*>-00s4y4S5f;!hi4Z(WKaB&4}hqq@WS;;O=v!1|mwyG(yGy z8c+eQqK2HqV_XubKnZe*S2&sKR$M>`s`3N5XD2m~1nMJ%o&tdU`xYM~EQS)Q?acUH zu_(_HduHWvq^HfQUbEd;J*MF%-25W7<7C3alP#pjB_(l zsx86kH+5iyff5F;;E}~gz%OYkYjOjC^^Tb-pup~V<#7G#KqwM~2ql^aKjOD<1X*bd z(f^>`ZF}4^3jpMlvN%p6F6-T_+j5C7nWmhMb^3gK{AR~!cmzL#qad+~*ki7O$M47G z#w$=MY3FzbjT>7OQiQfpk!}%0lCs&b9FFhp@P)ki>Gwg9sZco8jJIwZ@#sq>7^Gj|3kLuK z$j1{5GbvF!1qwbML%|S2h(k`&0(A9u!+EV6`SxB|l>(mdTDWKG`c>_&+1_1-qvLOs z5x(~Ar&f%FfDnyCPRc^`4t3#Wy%TD?6FW!*J)kg)VOsO)vwn{{;niBxv4(Mjru}U- zoWQ@n@!}p<8CD`lMj=VS6qyE9ni#kwiZU<2jrw^zBV-$87TuAWMp<+ZzS(|U*A>lJ z*5Yc_PgU!nlxfjwcOc<|2TLTvK64x=0&pZ~_-4~$49EpCp-5wxe`wB4Ng$OHVZ5R* z8OB~O>KrcVI|pv3J}t0*alys+&Uf7K{)(sn(ocYSUzWXcQz>%->~>Nd%PU!SK6);n zOgM(N+E(N6)=crl>P!-NHh3v^T6#SIY%MBM22xYSKMhDxmS%e%O#lD@07*qoM6N<$ Eg369MXaE2J literal 0 HcmV?d00001 diff --git a/extensions/cookie/test/image2.png^headers^ b/extensions/cookie/test/image2.png^headers^ new file mode 100644 index 00000000000..16e3fce28e0 --- /dev/null +++ b/extensions/cookie/test/image2.png^headers^ @@ -0,0 +1,3 @@ +Cache-Control: no-cache +Set-Cookie: foo2=bar2 + diff --git a/extensions/cookie/test/test1.css b/extensions/cookie/test/test1.css new file mode 100644 index 00000000000..139597f9cb0 --- /dev/null +++ b/extensions/cookie/test/test1.css @@ -0,0 +1,2 @@ + + diff --git a/extensions/cookie/test/test1.css^headers^ b/extensions/cookie/test/test1.css^headers^ new file mode 100644 index 00000000000..729babb5a4c --- /dev/null +++ b/extensions/cookie/test/test1.css^headers^ @@ -0,0 +1,3 @@ +Cache-Control: no-cache +Set-Cookie: css=bar + diff --git a/extensions/cookie/test/test2.css b/extensions/cookie/test/test2.css new file mode 100644 index 00000000000..139597f9cb0 --- /dev/null +++ b/extensions/cookie/test/test2.css @@ -0,0 +1,2 @@ + + diff --git a/extensions/cookie/test/test2.css^headers^ b/extensions/cookie/test/test2.css^headers^ new file mode 100644 index 00000000000..b12d32c72bb --- /dev/null +++ b/extensions/cookie/test/test2.css^headers^ @@ -0,0 +1,3 @@ +Cache-Control: no-cache +Set-Cookie: css2=bar2 + diff --git a/extensions/cookie/test/test_differentdomain.html b/extensions/cookie/test/test_differentdomain.html new file mode 100644 index 00000000000..9fbaf6f7b96 --- /dev/null +++ b/extensions/cookie/test/test_differentdomain.html @@ -0,0 +1,16 @@ + + + + Test for Cross domain access to properties + + + + + +

+
+
+
+ + diff --git a/extensions/cookie/test/test_image.html b/extensions/cookie/test/test_image.html new file mode 100644 index 00000000000..681a0075ea2 --- /dev/null +++ b/extensions/cookie/test/test_image.html @@ -0,0 +1,15 @@ + + + + Test for Cross domain access to properties + + + + + +

+
+
+
+ + diff --git a/extensions/cookie/test/test_loadflags.html b/extensions/cookie/test/test_loadflags.html new file mode 100644 index 00000000000..1e50680d926 --- /dev/null +++ b/extensions/cookie/test/test_loadflags.html @@ -0,0 +1,16 @@ + + + + Test for Cross domain access to properties + + + + + +

+
+
+
+ + diff --git a/extensions/cookie/test/test_same_base_domain.html b/extensions/cookie/test/test_same_base_domain.html new file mode 100644 index 00000000000..ef2a5d4f429 --- /dev/null +++ b/extensions/cookie/test/test_same_base_domain.html @@ -0,0 +1,16 @@ + + + + Test for Cross domain access to properties + + + + + +

+
+
+
+ + diff --git a/extensions/cookie/test/test_same_base_domain_2.html b/extensions/cookie/test/test_same_base_domain_2.html new file mode 100644 index 00000000000..18cf5c15f56 --- /dev/null +++ b/extensions/cookie/test/test_same_base_domain_2.html @@ -0,0 +1,16 @@ + + + + Test for Cross domain access to properties + + + + + +

+
+
+
+ + diff --git a/extensions/cookie/test/test_same_base_domain_3.html b/extensions/cookie/test/test_same_base_domain_3.html new file mode 100644 index 00000000000..e768d8b84af --- /dev/null +++ b/extensions/cookie/test/test_same_base_domain_3.html @@ -0,0 +1,16 @@ + + + + Test for Cross domain access to properties + + + + + +

+
+
+
+ + diff --git a/extensions/cookie/test/test_same_base_domain_4.html b/extensions/cookie/test/test_same_base_domain_4.html new file mode 100644 index 00000000000..60706b5f31d --- /dev/null +++ b/extensions/cookie/test/test_same_base_domain_4.html @@ -0,0 +1,16 @@ + + + + Test for Cross domain access to properties + + + + + +

+
+
+
+ + diff --git a/extensions/cookie/test/test_same_base_domain_5.html b/extensions/cookie/test/test_same_base_domain_5.html new file mode 100644 index 00000000000..cf959e66190 --- /dev/null +++ b/extensions/cookie/test/test_same_base_domain_5.html @@ -0,0 +1,16 @@ + + + + Test for Cross domain access to properties + + + + + +

+
+
+
+ + diff --git a/extensions/cookie/test/test_same_base_domain_6.html b/extensions/cookie/test/test_same_base_domain_6.html new file mode 100644 index 00000000000..fbc5945fbd9 --- /dev/null +++ b/extensions/cookie/test/test_same_base_domain_6.html @@ -0,0 +1,16 @@ + + + + Test for Cross domain access to properties + + + + + +

+
+
+
+ + diff --git a/extensions/cookie/test/test_same_base_domain_7.html b/extensions/cookie/test/test_same_base_domain_7.html new file mode 100644 index 00000000000..06c7307d79d --- /dev/null +++ b/extensions/cookie/test/test_same_base_domain_7.html @@ -0,0 +1,16 @@ + + + + Test for Cross domain access to properties + + + + + +

+
+
+
+ + diff --git a/extensions/cookie/test/test_samedomain.html b/extensions/cookie/test/test_samedomain.html new file mode 100644 index 00000000000..51ed99b201b --- /dev/null +++ b/extensions/cookie/test/test_samedomain.html @@ -0,0 +1,16 @@ + + + + Test for Cross domain access to properties + + + + + +

+
+
+
+ + diff --git a/extensions/cookie/test/unit/test_cookies.js b/extensions/cookie/test/unit/test_cookies.js new file mode 100644 index 00000000000..ccda2a72bee --- /dev/null +++ b/extensions/cookie/test/unit/test_cookies.js @@ -0,0 +1,49 @@ +// test third party cookie blocking, for the cases: +// 1) with null channel +// 2) with channel, but with no docshell parent + +const Cc = Components.classes; +const Ci = Components.interfaces; + +function run_test() { + var cs = Cc["@mozilla.org/cookieService;1"].getService(Ci.nsICookieService); + var cm = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager2); + var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService); + var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch); + + var spec = "http://foo.com/dribble.html"; + var uri = ios.newURI(spec, null, null); + var channel = ios.newChannelFromURI(uri); + + // test with cookies enabled + prefs.setIntPref("network.cookie.cookieBehavior", 0); + // without channel + cs.setCookieString(uri, null, "oh=hai", null); + do_check_eq(cs.countCookiesFromHost("foo.com"), 1); + // with channel + cs.setCookieString(uri, null, "can=has", channel); + do_check_eq(cs.countCookiesFromHost("foo.com"), 2); + // without channel, from http + cs.setCookieStringFromHttp(uri, null, null, "cheez=burger", null, null); + do_check_eq(cs.countCookiesFromHost("foo.com"), 3); + // with channel, from http + cs.setCookieStringFromHttp(uri, null, null, "hot=dog", null, channel); + do_check_eq(cs.countCookiesFromHost("foo.com"), 4); + cs.removeAll(); + + // test with third party cookies blocked + prefs.setIntPref("network.cookie.cookieBehavior", 1); + // without channel + cs.setCookieString(uri, null, "oh=hai", null); + do_check_eq(cs.countCookiesFromHost("foo.com"), 0); + // with channel + cs.setCookieString(uri, null, "can=has", channel); + do_check_eq(cs.countCookiesFromHost("foo.com"), 0); + // without channel, from http + cs.setCookieStringFromHttp(uri, null, null, "cheez=burger", null, null); + do_check_eq(cs.countCookiesFromHost("foo.com"), 0); + // with channel, from http + cs.setCookieStringFromHttp(uri, null, null, "hot=dog", null, channel); + do_check_eq(cs.countCookiesFromHost("foo.com"), 0); +} + diff --git a/netwerk/cookie/public/nsICookiePermission.idl b/netwerk/cookie/public/nsICookiePermission.idl index 86aaf5200ea..511af410ffe 100644 --- a/netwerk/cookie/public/nsICookiePermission.idl +++ b/netwerk/cookie/public/nsICookiePermission.idl @@ -19,6 +19,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): + * Daniel Witte * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or @@ -45,7 +46,7 @@ typedef long nsCookieAccess; /** * An interface to test for cookie permissions */ -[scriptable, uuid(91f1c3ec-73a0-4bf0-bdc5-348a1f181b0e)] +[scriptable, uuid(4b1a775d-f6d3-4389-be2e-9dfbaf2ab47b)] interface nsICookiePermission : nsISupports { /** @@ -86,8 +87,6 @@ interface nsICookiePermission : nsISupports * * @param aURI * the URI trying to access cookies - * @param aFirstURI - * the URI initiated by the user that resulted in aURI being loaded * @param aChannel * the channel corresponding to aURI * @@ -95,7 +94,6 @@ interface nsICookiePermission : nsISupports * ACCESS_DEFAULT, ACCESS_ALLOW, or ACCESS_DENY */ nsCookieAccess canAccess(in nsIURI aURI, - in nsIURI aFirstURI, in nsIChannel aChannel); /** @@ -111,7 +109,7 @@ interface nsICookiePermission : nsISupports * @param aURI * the URI trying to set the cookie * @param aChannel - * the corresponding to aURI + * the channel corresponding to aURI * @param aCookie * the cookie being added to the cookie database * @param aIsSession @@ -130,6 +128,22 @@ interface nsICookiePermission : nsISupports in nsICookie2 aCookie, inout boolean aIsSession, inout PRInt64 aExpiry); + + /** + * getOriginatingURI + * + * determines the originating URI for a load given a channel, for third-party + * cookie blocking. this is done by leveraging the loadgroup of the channel to + * find the root content docshell, and the URI associated with its principal. + * if the root content docshell or its principal's URI cannot be obtained, + * this method will throw. + * + * @param aChannel + * the channel for the load trying to get or set cookies + * + * @return the originating URI. + */ + nsIURI getOriginatingURI(in nsIChannel aChannel); }; %{ C++ diff --git a/netwerk/cookie/src/nsCookieService.cpp b/netwerk/cookie/src/nsCookieService.cpp index 9933cfb165a..edb41cd4b72 100644 --- a/netwerk/cookie/src/nsCookieService.cpp +++ b/netwerk/cookie/src/nsCookieService.cpp @@ -48,9 +48,6 @@ #include "nsIURI.h" #include "nsIURL.h" #include "nsIChannel.h" -#include "nsIHttpChannel.h" -#include "nsIHttpChannelInternal.h" // evil hack! -#include "nsIPrompt.h" #include "nsIFile.h" #include "nsIObserverService.h" #include "nsILineInputStream.h" @@ -448,6 +445,8 @@ nsCookieService::Init() } mPermissionService = do_GetService(NS_COOKIEPERMISSION_CONTRACTID); + if (!mPermissionService) + NS_WARNING("nsICookiePermission implementation not available - some features won't work!"); return NS_OK; } @@ -647,15 +646,7 @@ nsCookieService::GetCookieString(nsIURI *aHostURI, nsIChannel *aChannel, char **aCookie) { - // try to determine first party URI - nsCOMPtr firstURI; - if (aChannel) { - nsCOMPtr httpInternal = do_QueryInterface(aChannel); - if (httpInternal) - httpInternal->GetDocumentURI(getter_AddRefs(firstURI)); - } - - GetCookieInternal(aHostURI, firstURI, aChannel, PR_FALSE, aCookie); + GetCookieInternal(aHostURI, aChannel, PR_FALSE, aCookie); return NS_OK; } @@ -666,7 +657,7 @@ nsCookieService::GetCookieStringFromHttp(nsIURI *aHostURI, nsIChannel *aChannel, char **aCookie) { - GetCookieInternal(aHostURI, aFirstURI, aChannel, PR_TRUE, aCookie); + GetCookieInternal(aHostURI, aChannel, PR_TRUE, aCookie); return NS_OK; } @@ -677,16 +668,7 @@ nsCookieService::SetCookieString(nsIURI *aHostURI, const char *aCookieHeader, nsIChannel *aChannel) { - // try to determine first party URI - nsCOMPtr firstURI; - - if (aChannel) { - nsCOMPtr httpInternal = do_QueryInterface(aChannel); - if (httpInternal) - httpInternal->GetDocumentURI(getter_AddRefs(firstURI)); - } - - return SetCookieStringInternal(aHostURI, firstURI, aPrompt, aCookieHeader, nsnull, aChannel, PR_FALSE); + return SetCookieStringInternal(aHostURI, aPrompt, aCookieHeader, nsnull, aChannel, PR_FALSE); } NS_IMETHODIMP @@ -697,12 +679,11 @@ nsCookieService::SetCookieStringFromHttp(nsIURI *aHostURI, const char *aServerTime, nsIChannel *aChannel) { - return SetCookieStringInternal(aHostURI, aFirstURI, aPrompt, aCookieHeader, aServerTime, aChannel, PR_TRUE); + return SetCookieStringInternal(aHostURI, aPrompt, aCookieHeader, aServerTime, aChannel, PR_TRUE); } nsresult nsCookieService::SetCookieStringInternal(nsIURI *aHostURI, - nsIURI *aFirstURI, nsIPrompt *aPrompt, const char *aCookieHeader, const char *aServerTime, @@ -715,7 +696,7 @@ nsCookieService::SetCookieStringInternal(nsIURI *aHostURI, } // check default prefs - PRUint32 cookieStatus = CheckPrefs(aHostURI, aFirstURI, aChannel, aCookieHeader); + PRUint32 cookieStatus = CheckPrefs(aHostURI, aChannel, aCookieHeader); // fire a notification if cookie was rejected (but not if there was an error) switch (cookieStatus) { case STATUS_REJECTED: @@ -1119,7 +1100,6 @@ static inline PRBool ispathdelimiter(char c) { return c == '/' || c == '?' || c void nsCookieService::GetCookieInternal(nsIURI *aHostURI, - nsIURI *aFirstURI, nsIChannel *aChannel, PRBool aHttpBound, char **aCookie) @@ -1132,7 +1112,7 @@ nsCookieService::GetCookieInternal(nsIURI *aHostURI, } // check default prefs - PRUint32 cookieStatus = CheckPrefs(aHostURI, aFirstURI, aChannel, nsnull); + PRUint32 cookieStatus = CheckPrefs(aHostURI, aChannel, nsnull); // for GetCookie(), we don't fire rejection notifications. switch (cookieStatus) { case STATUS_REJECTED: @@ -1729,15 +1709,11 @@ PRBool nsCookieService::IsForeign(nsIURI *aHostURI, nsIURI *aFirstURI) { - // if aFirstURI is null, default to not foreign - if (!aFirstURI) { - return PR_FALSE; - } - // Get hosts nsCAutoString currentHost, firstHost; if (NS_FAILED(aHostURI->GetAsciiHost(currentHost)) || NS_FAILED(aFirstURI->GetAsciiHost(firstHost))) { + // assume foreign return PR_TRUE; } // trim trailing dots @@ -1758,19 +1734,10 @@ nsCookieService::IsForeign(nsIURI *aHostURI, if (firstHost.Equals(currentHost)) return PR_FALSE; - // chrome URLs are never foreign (otherwise sidebar cookies won't work). - // eventually we want to have a protocol whitelist here, - // _or_ do something smart with nsIProtocolHandler::protocolFlags. - PRBool isChrome = PR_FALSE; - nsresult rv = aFirstURI->SchemeIs("chrome", &isChrome); - if (NS_SUCCEEDED(rv) && isChrome) { - return PR_FALSE; - } - // get the base domain for the originating URI. // e.g. for "images.bbc.co.uk", this would be "bbc.co.uk". nsCAutoString baseDomain; - rv = mTLDService->GetBaseDomain(aFirstURI, 0, baseDomain); + nsresult rv = mTLDService->GetBaseDomain(aFirstURI, 0, baseDomain); if (NS_FAILED(rv)) { // URI is an IP, eTLD, or something else went wrong - assume foreign return PR_TRUE; @@ -1787,35 +1754,14 @@ nsCookieService::IsForeign(nsIURI *aHostURI, PRUint32 nsCookieService::CheckPrefs(nsIURI *aHostURI, - nsIURI *aFirstURI, nsIChannel *aChannel, const char *aCookieHeader) { - // pref tree: - // 0) get the scheme strings from the two URI's - // 1) disallow ftp - // 2) disallow mailnews, if pref set - // 3) perform a permissionlist lookup to see if an entry exists for this host - // (a match here will override defaults in 4) - // 4) go through enumerated permissions to see which one we have: - // -> cookies disabled: return - // -> dontacceptforeign: check if cookie is foreign - - // first, get the URI scheme for further use - // if GetScheme fails on aHostURI, reject; aFirstURI is optional, so failing is ok - nsCAutoString currentURIScheme, firstURIScheme; - nsresult rv, rv2 = NS_OK; - rv = aHostURI->GetScheme(currentURIScheme); - if (aFirstURI) { - rv2 = aFirstURI->GetScheme(firstURIScheme); - } - if (NS_FAILED(rv) || NS_FAILED(rv2)) { - COOKIE_LOGFAILURE(aCookieHeader ? SET_COOKIE : GET_COOKIE, aHostURI, aCookieHeader, "couldn't get scheme of host URI"); - return STATUS_REJECTED_WITH_ERROR; - } + nsresult rv; // don't let ftp sites get/set cookies (could be a security issue) - if (currentURIScheme.EqualsLiteral("ftp")) { + PRBool ftp; + if (NS_SUCCEEDED(aHostURI->SchemeIs("ftp", &ftp)) && ftp) { COOKIE_LOGFAILURE(aCookieHeader ? SET_COOKIE : GET_COOKIE, aHostURI, aCookieHeader, "ftp sites cannot read cookies"); return STATUS_REJECTED_WITH_ERROR; } @@ -1824,7 +1770,7 @@ nsCookieService::CheckPrefs(nsIURI *aHostURI, // default prefs. see bug 184059. if (mPermissionService) { nsCookieAccess access; - rv = mPermissionService->CanAccess(aHostURI, aFirstURI, aChannel, &access); + rv = mPermissionService->CanAccess(aHostURI, aChannel, &access); // if we found an entry, use it if (NS_SUCCEEDED(rv)) { @@ -1839,19 +1785,20 @@ nsCookieService::CheckPrefs(nsIURI *aHostURI, } } - // check default prefs - go thru enumerated permissions + // check default prefs if (mCookiesPermissions == BEHAVIOR_REJECT) { COOKIE_LOGFAILURE(aCookieHeader ? SET_COOKIE : GET_COOKIE, aHostURI, aCookieHeader, "cookies are disabled"); return STATUS_REJECTED; } else if (mCookiesPermissions == BEHAVIOR_REJECTFOREIGN) { - // check if cookie is foreign. - // if aFirstURI is null, allow by default + // check if cookie is foreign + if (!mPermissionService) + return STATUS_REJECTED; - // note: this can be circumvented if we have http redirects within html, - // since the documentURI attribute isn't always correctly - // passed to the redirected channels. (or isn't correctly set in the first place) - if (IsForeign(aHostURI, aFirstURI)) { + nsCOMPtr firstURI; + rv = mPermissionService->GetOriginatingURI(aChannel, getter_AddRefs(firstURI)); + + if (NS_FAILED(rv) || IsForeign(aHostURI, firstURI)) { COOKIE_LOGFAILURE(aCookieHeader ? SET_COOKIE : GET_COOKIE, aHostURI, aCookieHeader, "originating server test failed"); return STATUS_REJECTED; } diff --git a/netwerk/cookie/src/nsCookieService.h b/netwerk/cookie/src/nsCookieService.h index 513b9145758..8a3f5473566 100644 --- a/netwerk/cookie/src/nsCookieService.h +++ b/netwerk/cookie/src/nsCookieService.h @@ -54,9 +54,6 @@ struct nsCookieAttributes; struct nsListIter; struct nsEnumerationData; -class nsAutoVoidArray; - -class nsIPrefBranch; class nsICookiePermission; class nsIEffectiveTLDService; class nsIPrefBranch; @@ -168,8 +165,8 @@ class nsCookieService : public nsICookieService nsresult InitDB(); nsresult CreateTable(); nsresult Read(); - void GetCookieInternal(nsIURI *aHostURI, nsIURI *aFirstURI, nsIChannel *aChannel, PRBool aHttpBound, char **aCookie); - nsresult SetCookieStringInternal(nsIURI *aHostURI, nsIURI *aFirstURI, nsIPrompt *aPrompt, const char *aCookieHeader, const char *aServerTime, nsIChannel *aChannel, PRBool aFromHttp); + void GetCookieInternal(nsIURI *aHostURI, nsIChannel *aChannel, PRBool aHttpBound, char **aCookie); + nsresult SetCookieStringInternal(nsIURI *aHostURI, nsIPrompt *aPrompt, const char *aCookieHeader, const char *aServerTime, nsIChannel *aChannel, PRBool aFromHttp); PRBool SetCookieInternal(nsIURI *aHostURI, nsIChannel *aChannel, nsDependentCString &aCookieHeader, PRInt64 aServerTime, PRBool aFromHttp); void AddInternal(nsCookie *aCookie, PRInt64 aCurrentTime, nsIURI *aHostURI, const char *aCookieHeader, PRBool aFromHttp); void RemoveCookieFromList(nsListIter &aIter); @@ -178,7 +175,7 @@ class nsCookieService : public nsICookieService static PRBool GetTokenValue(nsASingleFragmentCString::const_char_iterator &aIter, nsASingleFragmentCString::const_char_iterator &aEndIter, nsDependentCSubstring &aTokenString, nsDependentCSubstring &aTokenValue, PRBool &aEqualsFound); static PRBool ParseAttributes(nsDependentCString &aCookieHeader, nsCookieAttributes &aCookie); PRBool IsForeign(nsIURI *aHostURI, nsIURI *aFirstURI); - PRUint32 CheckPrefs(nsIURI *aHostURI, nsIURI *aFirstURI, nsIChannel *aChannel, const char *aCookieHeader); + PRUint32 CheckPrefs(nsIURI *aHostURI, nsIChannel *aChannel, const char *aCookieHeader); PRBool CheckDomain(nsCookieAttributes &aCookie, nsIURI *aHostURI); static PRBool CheckPath(nsCookieAttributes &aCookie, nsIURI *aHostURI); static PRBool GetExpiry(nsCookieAttributes &aCookie, PRInt64 aServerTime, PRInt64 aCurrentTime); diff --git a/netwerk/test/TestCookie.cpp b/netwerk/test/TestCookie.cpp index 8e64621928d..e8981e984e6 100644 --- a/netwerk/test/TestCookie.cpp +++ b/netwerk/test/TestCookie.cpp @@ -203,8 +203,9 @@ void InitPrefs(nsIPrefBranch *aPrefBranch) { // init some relevant prefs, so the tests don't go awry. - // we use the most restrictive set of prefs we can. - aPrefBranch->SetIntPref(kCookiesPermissions, 1); // 'reject foreign' + // we use the most restrictive set of prefs we can; + // however, we don't test third party blocking here. + aPrefBranch->SetIntPref(kCookiesPermissions, 0); // accept all aPrefBranch->SetBoolPref(kCookiesDisabledForMailNews, PR_TRUE); aPrefBranch->SetBoolPref(kCookiesLifetimeEnabled, PR_TRUE); aPrefBranch->SetIntPref(kCookiesLifetimeCurrentSession, 0); @@ -512,76 +513,6 @@ main(PRInt32 argc, char *argv[]) allTestsPassed = PrintResult(rv, 9) && allTestsPassed; - // *** foreign cookie tests - printf("*** Beginning foreign cookie tests...\n"); - - // test the blocking of foreign cookies, under various circumstances. - // order of URI arguments is hostURI, firstURI - SetACookie(cookieService, "http://yahoo.com/", "http://yahoo.com/", "test=foreign; domain=.yahoo.com", nsnull); - GetACookie(cookieService, "http://yahoo.com/", "http://yahoo.com/", getter_Copies(cookie)); - rv[0] = CheckResult(cookie.get(), MUST_EQUAL, "test=foreign"); - SetACookie(cookieService, "http://weather.yahoo.com/", "http://yahoo.com/", "test=foreign; domain=.yahoo.com", nsnull); - GetACookie(cookieService, "http://notweather.yahoo.com/", "http://sport.yahoo.com/", getter_Copies(cookie)); - rv[1] = CheckResult(cookie.get(), MUST_EQUAL, "test=foreign"); - SetACookie(cookieService, "http://moose.yahoo.com/", "http://canada.yahoo.com/", "test=foreign; domain=.yahoo.com", nsnull); - GetACookie(cookieService, "http://yahoo.com/", "http://sport.yahoo.com/", getter_Copies(cookie)); - rv[2] = CheckResult(cookie.get(), MUST_EQUAL, "test=foreign"); - GetACookie(cookieService, "http://sport.yahoo.com/", "http://yahoo.com/", getter_Copies(cookie)); - rv[3] = CheckResult(cookie.get(), MUST_EQUAL, "test=foreign"); - SetACookie(cookieService, "http://jack.yahoo.com/", "http://jill.yahoo.com/", "test=foreign; domain=.yahoo.com; max-age=0", nsnull); - GetACookie(cookieService, "http://jane.yahoo.com/", "http://yahoo.com/", getter_Copies(cookie)); - rv[4] = CheckResult(cookie.get(), MUST_BE_NULL); - - SetACookie(cookieService, "http://moose.yahoo.com/", "http://foo.moose.yahoo.com/", "test=foreign; domain=.yahoo.com", nsnull); - GetACookie(cookieService, "http://yahoo.com/", "http://yahoo.com/", getter_Copies(cookie)); - rv[5] = CheckResult(cookie.get(), MUST_EQUAL, "test=foreign"); - SetACookie(cookieService, "http://foo.bar.yahoo.com/", "http://yahoo.com/", "test=foreign; domain=.yahoo.com", nsnull); - GetACookie(cookieService, "http://yahoo.com/", "http://yahoo.com/", getter_Copies(cookie)); - rv[6] = CheckResult(cookie.get(), MUST_EQUAL, "test=foreign"); - SetACookie(cookieService, "http://foo.bar.yahoo.com/", "http://yahoo.com/", "test=foreign; domain=.yahoo.com; max-age=0", nsnull); - GetACookie(cookieService, "http://yahoo.com/", "http://yahoo.com/", getter_Copies(cookie)); - rv[7] = CheckResult(cookie.get(), MUST_BE_NULL); - - // test handling of IP addresses by the foreign blocking algo - SetACookie(cookieService, "http://192.168.54.33/", "http://192.168.54.33/", "test=foreign; domain=192.168.54.33", nsnull); - GetACookie(cookieService, "http://192.168.54.33/", "http://192.168.54.33/", getter_Copies(cookie)); - rv[8] = CheckResult(cookie.get(), MUST_EQUAL, "test=foreign"); - GetACookie(cookieService, "http://192.168.54.33./", "http://.192.168.54.33../", getter_Copies(cookie)); - rv[9] = CheckResult(cookie.get(), MUST_EQUAL, "test=foreign"); - GetACookie(cookieService, "http://192.168.54.33/", nsnull, getter_Copies(cookie)); - rv[10] = CheckResult(cookie.get(), MUST_EQUAL, "test=foreign"); - GetACookie(cookieService, "http://192.168.54.33/", "http://148.168.54.33", getter_Copies(cookie)); - rv[11] = CheckResult(cookie.get(), MUST_BE_NULL); - SetACookie(cookieService, "http://192.168.54.33/", "http://192.168.54.33/", "test=foreign; domain=192.168.54.33; max-age=0", nsnull); - GetACookie(cookieService, "http://192.168.54.33/", "http://192.168.54.33/", getter_Copies(cookie)); - rv[12] = CheckResult(cookie.get(), MUST_BE_NULL); - SetACookie(cookieService, "http://192.168.54.33/", "http://148.168.54.33/", "test=foreign; domain=192.168.54.33", nsnull); - GetACookie(cookieService, "http://192.168.54.33/", "http://192.168.54.33/", getter_Copies(cookie)); - rv[13] = CheckResult(cookie.get(), MUST_BE_NULL); - - // test the case where the host is an eTLD, e.g. http://co.tv/ (a legitimate site) - SetACookie(cookieService, "http://co.uk/", "http://co.uk/", "test=foreign; domain=.co.uk", nsnull); - GetACookie(cookieService, "http://co.uk/", "http://co.uk/", getter_Copies(cookie)); - // should be rejected, can't set a domain cookie for .co.uk - rv[14] = CheckResult(cookie.get(), MUST_BE_NULL); - SetACookie(cookieService, "http://co.uk/", "http://co.uk/", "test=foreign", nsnull); - GetACookie(cookieService, "http://co.uk/", "http://co.uk/", getter_Copies(cookie)); - // should be allowed, hostURI == firstURI and it's not a domain cookie - rv[15] = CheckResult(cookie.get(), MUST_EQUAL, "test=foreign"); - GetACookie(cookieService, "http://oblivious.co.uk/", nsnull, getter_Copies(cookie)); - rv[16] = CheckResult(cookie.get(), MUST_BE_NULL); - // remove cookie - SetACookie(cookieService, "http://co.uk/", "http://co.uk/", "test=foreign; max-age=0", nsnull); - GetACookie(cookieService, "http://co.uk/", "http://co.uk/", getter_Copies(cookie)); - rv[17] = CheckResult(cookie.get(), MUST_BE_NULL); - SetACookie(cookieService, "http://co.uk/", "http://evil.co.uk/", "test=foreign", nsnull); - GetACookie(cookieService, "http://co.uk/", "http://co.uk/", getter_Copies(cookie)); - // should be rejected, hostURI != firstURI and hostURI is an eTLD - rv[18] = CheckResult(cookie.get(), MUST_BE_NULL); - - allTestsPassed = PrintResult(rv, 19) && allTestsPassed; - - // *** parser tests printf("*** Beginning parser tests...\n"); @@ -639,15 +570,7 @@ main(PRInt32 argc, char *argv[]) GetACookie(cookieService, "http://mail.co.uk/", nsnull, getter_Copies(cookie)); rv[4] = CheckResult(cookie.get(), MUST_BE_NULL); - // test non-null firstURI's, i) from mailnews ii) not from mailnews - SetACookie(cookieService, "mailbox://mail.co.uk/", "http://mail.co.uk/", "test=mailnews", nsnull); - GetACookie(cookieService, "http://mail.co.uk/", nsnull, getter_Copies(cookie)); - rv[5] = CheckResult(cookie.get(), MUST_BE_NULL); - SetACookie(cookieService, "http://mail.co.uk/", "mailbox://mail.co.uk/", "test=mailnews", nsnull); - GetACookie(cookieService, "http://mail.co.uk/", nsnull, getter_Copies(cookie)); - rv[6] = CheckResult(cookie.get(), MUST_BE_NULL); - - allTestsPassed = PrintResult(rv, 7) && allTestsPassed; + allTestsPassed = PrintResult(rv, 5) && allTestsPassed; // *** path ordering tests From 479ae9823b5e09780610039dac0d207bd96769b4 Mon Sep 17 00:00:00 2001 From: "smontagu@smontagu.org" Date: Wed, 12 Mar 2008 00:56:38 -0700 Subject: [PATCH 30/65] Enable bidi processing if there are right-to-left characters in print headers or footers. Bug 421690, r+sr=roc, blocking1.9=damon --- intl/unicharutil/util/nsBidiUtils.cpp | 17 +++++++++++++++++ intl/unicharutil/util/nsBidiUtils.h | 6 ++++++ layout/generic/nsPageFrame.cpp | 3 ++- layout/xul/base/src/nsTextBoxFrame.cpp | 11 +---------- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/intl/unicharutil/util/nsBidiUtils.cpp b/intl/unicharutil/util/nsBidiUtils.cpp index 7aca02bd582..750b16f41db 100644 --- a/intl/unicharutil/util/nsBidiUtils.cpp +++ b/intl/unicharutil/util/nsBidiUtils.cpp @@ -42,6 +42,7 @@ #include "nsBidiUtils.h" #include "symmtable.h" #include "bidicattable.h" +#include "nsCharTraits.h" #define FE_TO_06_OFFSET 0xfe70 @@ -613,6 +614,22 @@ PRBool IsBidiControl(PRUint32 aChar) return (eBidiCat_CC == GetBidiCat(aChar) || ((aChar)&0xfffffe)==LRM_CHAR); } +PRBool HasRTLChars(nsAString& aString) +{ + PRInt32 length = aString.Length(); + for (PRInt32 i = 0; i < length; i++) { + if ((UCS2_CHAR_IS_BIDI(aString.CharAt(i)) ) || + ((NS_IS_HIGH_SURROGATE(aString.CharAt(i))) && + (++i < length) && + (NS_IS_LOW_SURROGATE(aString.CharAt(i))) && + (UTF32_CHAR_IS_BIDI(SURROGATE_TO_UCS4(aString.CharAt(i-1), + aString.CharAt(i)))))) { + return PR_TRUE; + } + } + return PR_FALSE; +} + nsCharType GetCharType(PRUint32 aChar) { nsCharType oResult; diff --git a/intl/unicharutil/util/nsBidiUtils.h b/intl/unicharutil/util/nsBidiUtils.h index 4efa77fccaa..9e69fda9928 100644 --- a/intl/unicharutil/util/nsBidiUtils.h +++ b/intl/unicharutil/util/nsBidiUtils.h @@ -203,6 +203,12 @@ typedef enum nsCharType nsCharType; */ PRBool IsBidiControl(PRUint32 aChar); + /** + * Give an nsString. + * @return PR_TRUE if the string contains right-to-left characters + */ + PRBool HasRTLChars(nsAString& aString); + // -------------------------------------------------- // IBMBIDI // -------------------------------------------------- diff --git a/layout/generic/nsPageFrame.cpp b/layout/generic/nsPageFrame.cpp index 75d33857a7c..7f4b003fce1 100644 --- a/layout/generic/nsPageFrame.cpp +++ b/layout/generic/nsPageFrame.cpp @@ -52,7 +52,6 @@ #include "nsTextFormatter.h" // for page number localization formatting #ifdef IBMBIDI #include "nsBidiUtils.h" -#include "nsBidiPresUtils.h" #endif #include "nsIFontMetrics.h" #include "nsIPrintSettings.h" @@ -369,6 +368,8 @@ nsPageFrame::DrawHeaderFooter(nsIRenderingContext& aRenderingContext, } else { return; // bail if couldn't find the correct length } + + PresContext()->SetBidiEnabled(HasRTLChars(str)); // cacl the x and y positions of the text nscoord x = GetXPosition(aRenderingContext, aRect, aJust, str); diff --git a/layout/xul/base/src/nsTextBoxFrame.cpp b/layout/xul/base/src/nsTextBoxFrame.cpp index 0adcff06111..e35158607da 100644 --- a/layout/xul/base/src/nsTextBoxFrame.cpp +++ b/layout/xul/base/src/nsTextBoxFrame.cpp @@ -609,17 +609,8 @@ nsTextBoxFrame::CalculateTitleForWidth(nsPresContext* aPresContext, if (mTitleWidth <= aWidth) { mCroppedTitle = mTitle; #ifdef IBMBIDI - PRInt32 length = mTitle.Length(); - for (PRInt32 i = 0; i < length; i++) { - if ((UCS2_CHAR_IS_BIDI(mTitle.CharAt(i)) ) || - ((NS_IS_HIGH_SURROGATE(mTitle.CharAt(i))) && - (++i < length) && - (NS_IS_LOW_SURROGATE(mTitle.CharAt(i))) && - (UTF32_CHAR_IS_BIDI(SURROGATE_TO_UCS4(mTitle.CharAt(i-1), - mTitle.CharAt(i)))))) { + if (HasRTLChars(mTitle)) { mState |= NS_FRAME_IS_BIDI; - break; - } } #endif // IBMBIDI return; // fits, done. From 5f6d1e5a427457fbe1fedf6ee7261f601b9d67e7 Mon Sep 17 00:00:00 2001 From: "timeless@mozdev.org" Date: Wed, 12 Mar 2008 01:15:55 -0700 Subject: [PATCH 31/65] Bug 3004 Remove debug robot from build r=mrbkap sr=jag a=dsicore So Long, and Thanks for All the Fish --- parser/htmlparser/Makefile.in | 4 ---- 1 file changed, 4 deletions(-) diff --git a/parser/htmlparser/Makefile.in b/parser/htmlparser/Makefile.in index 35001b0eca9..5af45b66314 100644 --- a/parser/htmlparser/Makefile.in +++ b/parser/htmlparser/Makefile.in @@ -47,10 +47,6 @@ DIRS = public src ifdef ENABLE_TESTS TOOL_DIRS += tests - -ifndef MOZ_ENABLE_LIBXUL -TOOL_DIRS += robot -endif endif include $(topsrcdir)/config/rules.mk From 112d5c202126e1e951269b5b1398987b33bd8184 Mon Sep 17 00:00:00 2001 From: "dwitte@stanford.edu" Date: Wed, 12 Mar 2008 01:35:57 -0700 Subject: [PATCH 32/65] disable failing test on mac. --- extensions/cookie/test/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/cookie/test/Makefile.in b/extensions/cookie/test/Makefile.in index e36a367cd9e..13a5711fafa 100644 --- a/extensions/cookie/test/Makefile.in +++ b/extensions/cookie/test/Makefile.in @@ -74,7 +74,7 @@ _TEST_FILES = \ test_same_base_domain_5.html \ test_same_base_domain_6.html \ file_loopback_inner.html \ - test_same_base_domain_7.html \ +# test_same_base_domain_7.html \ $(NULL) _BROWSER_TEST_FILES = \ From 81c71496dfb96048f87844a590a021d574216125 Mon Sep 17 00:00:00 2001 From: "Olli.Pettay@helsinki.fi" Date: Wed, 12 Mar 2008 03:26:12 -0700 Subject: [PATCH 33/65] Bug 421486, automatic unwanted scrolling, r+sr=sicking --- content/base/src/nsGenericElement.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/content/base/src/nsGenericElement.cpp b/content/base/src/nsGenericElement.cpp index d0feb33c29a..52bfaa1e22a 100644 --- a/content/base/src/nsGenericElement.cpp +++ b/content/base/src/nsGenericElement.cpp @@ -2233,6 +2233,15 @@ nsGenericElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor) return nsGenericElement::doPreHandleEvent(this, aVisitor); } +static nsIContent* +FindFirstNonNativeAnonymousAncestor(nsIContent* aContent) +{ + while (aContent && aContent->IsNativeAnonymous()) { + aContent = aContent->GetParent(); + } + return aContent; +} + nsresult nsGenericElement::doPreHandleEvent(nsIContent* aContent, nsEventChainPreVisitor& aVisitor) @@ -2260,10 +2269,10 @@ nsGenericElement::doPreHandleEvent(nsIContent* aContent, (aVisitor.mEvent->originalTarget == aContent && (aVisitor.mRelatedTargetIsInAnon = relatedTarget->IsInNativeAnonymousSubtree()))) { - nsIContent* nonAnon = aContent->FindFirstNonNativeAnonymous(); + nsIContent* nonAnon = FindFirstNonNativeAnonymousAncestor(aContent); if (nonAnon) { nsIContent* nonAnonRelated = - relatedTarget->FindFirstNonNativeAnonymous(); + FindFirstNonNativeAnonymousAncestor(relatedTarget); if (nonAnonRelated) { if (nonAnon == nonAnonRelated || nsContentUtils::ContentIsDescendantOf(nonAnonRelated, nonAnon)) { From f766af8913fd90cbf890afc875464d579fd7c6fb Mon Sep 17 00:00:00 2001 From: "mcsmurf@mcsmurf.de" Date: Wed, 12 Mar 2008 03:45:20 -0700 Subject: [PATCH 34/65] Bug 421787 - NSS portion of build uses continuation lines in variable definition that is used in an AC_SUBST, p=bill@wg9s.com, r=jag, sr=bsmedberg, a1.9=dsicore --- configure.in | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/configure.in b/configure.in index ee1289a08bf..a5b76ab2da3 100644 --- a/configure.in +++ b/configure.in @@ -3958,22 +3958,22 @@ if test -n "$MOZ_NATIVE_NSS"; then NSS_LIBS="$NSS_LIBS -lcrmf" else NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss' - NSS_DEP_LIBS='\\\ - $(LIBXUL_DIST)/lib/$(LIB_PREFIX)crmf.$(LIB_SUFFIX) \\\ - $(LIBXUL_DIST)/lib/$(DLL_PREFIX)smime'$NSS_VERSION'$(DLL_SUFFIX) \\\ - $(LIBXUL_DIST)/lib/$(DLL_PREFIX)ssl'$NSS_VERSION'$(DLL_SUFFIX) \\\ - $(LIBXUL_DIST)/lib/$(DLL_PREFIX)nss'$NSS_VERSION'$(DLL_SUFFIX) \\\ - $(LIBXUL_DIST)/lib/$(DLL_PREFIX)nssutil'$NSS_VERSION'$(DLL_SUFFIX) \\\ - $(LIBXUL_DIST)/lib/$(DLL_PREFIX)softokn'$NSS_VERSION'$(DLL_SUFFIX)' + NSS_DEP_LIBS="\ + \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \ + \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \ + \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \ + \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \ + \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX) \ + \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)softokn$NSS_VERSION\$(DLL_SUFFIX)" if test -z "$GNU_CC" && test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then - NSS_LIBS='\\\ - $(LIBXUL_DIST)/lib/$(LIB_PREFIX)crmf.$(LIB_SUFFIX) \\\ - $(LIBXUL_DIST)/lib/$(LIB_PREFIX)smime'$NSS_VERSION'.$(IMPORT_LIB_SUFFIX) \\\ - $(LIBXUL_DIST)/lib/$(LIB_PREFIX)ssl'$NSS_VERSION'.$(IMPORT_LIB_SUFFIX) \\\ - $(LIBXUL_DIST)/lib/$(LIB_PREFIX)nss'$NSS_VERSION'.$(IMPORT_LIB_SUFFIX) \\\ - $(LIBXUL_DIST)/lib/$(LIB_PREFIX)nssutil'$NSS_VERSION'.$(IMPORT_LIB_SUFFIX) \\\ - $(LIBXUL_DIST)/lib/$(LIB_PREFIX)softokn'$NSS_VERSION'.$(IMPORT_LIB_SUFFIX)' + NSS_LIBS="\ + \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \ + \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$IMPORT_LIB_SUFFIX) \ + \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \ + \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \ + \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \ + \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)softokn$NSS_VERSION.\$(IMPORT_LIB_SUFFIX)" else NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION -lsoftokn$NSS_VERSION" fi From 2f554a2cdb8968ba0207cb98cd85f7e98c468e1b Mon Sep 17 00:00:00 2001 From: "reed@reedloden.com" Date: Wed, 12 Mar 2008 03:46:41 -0700 Subject: [PATCH 35/65] Bug 405256 - "Compile error in nsNativeDragTarget.h with MingW GCC because of missing shobjidl.h" [p=bengt.erik.soderstrom@telia.com (Bengt-Erik Soderstrom) r=bsmedberg a1.9=damons] --- widget/src/windows/nsNativeDragTarget.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/widget/src/windows/nsNativeDragTarget.h b/widget/src/windows/nsNativeDragTarget.h index d5adbc01589..4d3eadd61f9 100644 --- a/widget/src/windows/nsNativeDragTarget.h +++ b/widget/src/windows/nsNativeDragTarget.h @@ -42,9 +42,12 @@ #include "nsIDragSession.h" #include #include -#ifndef WINCE + +#ifndef WINCE #ifndef IDropTargetHelper +#ifndef __MINGW32__ // MingW does not provide shobjidl.h. #include // Vista drag image interfaces +#endif // MingW #endif #endif // WINCE From 34a7cb2d4da7599300d784d87799e8615376b3ac Mon Sep 17 00:00:00 2001 From: "reed@reedloden.com" Date: Wed, 12 Mar 2008 03:52:02 -0700 Subject: [PATCH 36/65] Bug 421789 - "Trivial fix to a trivial warning in gtk2drawing.c" [p=frnchfrgg-mozbugs@altern.org (RIVAUD Julien [_FrnchFrgg_]) r+sr=roc a1.9=damons] --- widget/src/gtk2/gtk2drawing.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/widget/src/gtk2/gtk2drawing.c b/widget/src/gtk2/gtk2drawing.c index adbd8e4f532..55a4f3e2103 100644 --- a/widget/src/gtk2/gtk2drawing.c +++ b/widget/src/gtk2/gtk2drawing.c @@ -1137,7 +1137,8 @@ moz_gtk_scrollbar_thumb_paint(GtkThemeWidgetType widget, style = GTK_WIDGET(scrollbar)->style; - gtk_widget_style_get(scrollbar, "activate-slider", &activate_slider, NULL); + gtk_widget_style_get(GTK_WIDGET(scrollbar), "activate-slider", + &activate_slider, NULL); if (activate_slider && state->active) { shadow_type = GTK_SHADOW_IN; From 30f5471b69aafb09acd392e1078980a9c0c1ee91 Mon Sep 17 00:00:00 2001 From: "reed@reedloden.com" Date: Wed, 12 Mar 2008 03:52:58 -0700 Subject: [PATCH 37/65] Bug 385516 - "Console is spewed with WARNING: empty langgroup" (Add default constructor to gfxFontStyle and use it) [p=wasti.redl@gmx.net (Sebastian Redl) r=stuart a1.9=damons] --- gfx/src/thebes/nsSystemFontsBeOS.cpp | 11 ----------- gfx/src/thebes/nsSystemFontsGTK2.cpp | 14 -------------- gfx/src/thebes/nsThebesDeviceContext.cpp | 4 +--- gfx/thebes/public/gfxFont.h | 1 + gfx/thebes/src/gfxFont.cpp | 9 +++++++++ 5 files changed, 11 insertions(+), 28 deletions(-) diff --git a/gfx/src/thebes/nsSystemFontsBeOS.cpp b/gfx/src/thebes/nsSystemFontsBeOS.cpp index 2358956d468..258dee07280 100644 --- a/gfx/src/thebes/nsSystemFontsBeOS.cpp +++ b/gfx/src/thebes/nsSystemFontsBeOS.cpp @@ -45,21 +45,10 @@ #include "nsIDeviceContext.h" #include "nsSystemFontsBeOS.h" -#define DEFAULT_PIXEL_FONT_SIZE 16.0f - nsSystemFontsBeOS::nsSystemFontsBeOS() : mDefaultFontName(NS_LITERAL_STRING("sans-serif")) , mMenuFontName(NS_LITERAL_STRING("sans-serif")) , mCaptionFontName(NS_LITERAL_STRING("sans-serif")) - , mDefaultFontStyle(FONT_STYLE_NORMAL, FONT_WEIGHT_NORMAL, - DEFAULT_PIXEL_FONT_SIZE, NS_LITERAL_CSTRING(""), - 0.0f, PR_TRUE, PR_FALSE) - , mMenuFontStyle(FONT_STYLE_NORMAL, FONT_WEIGHT_NORMAL, - DEFAULT_PIXEL_FONT_SIZE, NS_LITERAL_CSTRING(""), - 0.0f, PR_TRUE, PR_FALSE) - , mCaptionFontStyle(FONT_STYLE_NORMAL, FONT_WEIGHT_NORMAL, - DEFAULT_PIXEL_FONT_SIZE, NS_LITERAL_CSTRING(""), - 0.0f, PR_TRUE, PR_FALSE) { menu_info info; get_menu_info(&info); diff --git a/gfx/src/thebes/nsSystemFontsGTK2.cpp b/gfx/src/thebes/nsSystemFontsGTK2.cpp index 01c5f0ab872..db8a73ab371 100644 --- a/gfx/src/thebes/nsSystemFontsGTK2.cpp +++ b/gfx/src/thebes/nsSystemFontsGTK2.cpp @@ -108,25 +108,11 @@ MOZ_pango_font_description_get_size_is_absolute(PangoFontDescription *desc) } #endif -#define DEFAULT_PIXEL_FONT_SIZE 16.0f - nsSystemFontsGTK2::nsSystemFontsGTK2() : mDefaultFontName(NS_LITERAL_STRING("sans-serif")) , mButtonFontName(NS_LITERAL_STRING("sans-serif")) , mFieldFontName(NS_LITERAL_STRING("sans-serif")) , mMenuFontName(NS_LITERAL_STRING("sans-serif")) - , mDefaultFontStyle(FONT_STYLE_NORMAL, FONT_WEIGHT_NORMAL, - DEFAULT_PIXEL_FONT_SIZE, NS_LITERAL_CSTRING(""), - 0.0f, PR_TRUE, PR_FALSE) - , mButtonFontStyle(FONT_STYLE_NORMAL, FONT_WEIGHT_NORMAL, - DEFAULT_PIXEL_FONT_SIZE, NS_LITERAL_CSTRING(""), - 0.0f, PR_TRUE, PR_FALSE) - , mFieldFontStyle(FONT_STYLE_NORMAL, FONT_WEIGHT_NORMAL, - DEFAULT_PIXEL_FONT_SIZE, NS_LITERAL_CSTRING(""), - 0.0f, PR_TRUE, PR_FALSE) - , mMenuFontStyle(FONT_STYLE_NORMAL, FONT_WEIGHT_NORMAL, - DEFAULT_PIXEL_FONT_SIZE, NS_LITERAL_CSTRING(""), - 0.0f, PR_TRUE, PR_FALSE) { InitPangoLib(); diff --git a/gfx/src/thebes/nsThebesDeviceContext.cpp b/gfx/src/thebes/nsThebesDeviceContext.cpp index cb7b76d5fdb..aa5a1a76fa3 100644 --- a/gfx/src/thebes/nsThebesDeviceContext.cpp +++ b/gfx/src/thebes/nsThebesDeviceContext.cpp @@ -394,9 +394,7 @@ nsThebesDeviceContext::GetSystemFont(nsSystemFontID aID, nsFont *aFont) const } nsString fontName; - gfxFontStyle fontStyle(NS_FONT_STYLE_NORMAL, FONT_WEIGHT_NORMAL, 16.0f, - NS_LITERAL_CSTRING(""), 0.0f, PR_TRUE, - PR_FALSE); + gfxFontStyle fontStyle; nsresult rv = gSystemFonts->GetSystemFont(aID, &fontName, &fontStyle); NS_ENSURE_SUCCESS(rv, rv); diff --git a/gfx/thebes/public/gfxFont.h b/gfx/thebes/public/gfxFont.h index a2a384af4fe..21c5ed8404a 100644 --- a/gfx/thebes/public/gfxFont.h +++ b/gfx/thebes/public/gfxFont.h @@ -72,6 +72,7 @@ class gfxFontGroup; #define FONT_MAX_SIZE 2000.0 struct THEBES_API gfxFontStyle { + gfxFontStyle(); gfxFontStyle(PRUint8 aStyle, PRUint16 aWeight, gfxFloat aSize, const nsACString& aLangGroup, float aSizeAdjust, PRPackedBool aSystemFont, diff --git a/gfx/thebes/src/gfxFont.cpp b/gfx/thebes/src/gfxFont.cpp index a38cef6fd95..41177e472d3 100644 --- a/gfx/thebes/src/gfxFont.cpp +++ b/gfx/thebes/src/gfxFont.cpp @@ -873,6 +873,15 @@ gfxFontGroup::MakeSpaceTextRun(const Parameters *aParams, PRUint32 aFlags) return textRun.forget(); } +#define DEFAULT_PIXEL_FONT_SIZE 16.0f + +gfxFontStyle::gfxFontStyle() : + style(FONT_STYLE_NORMAL), systemFont(PR_TRUE), familyNameQuirks(PR_FALSE), + weight(FONT_WEIGHT_NORMAL), size(DEFAULT_PIXEL_FONT_SIZE), + langGroup(NS_LITERAL_CSTRING("x-western")), sizeAdjust(0.0f) +{ +} + gfxFontStyle::gfxFontStyle(PRUint8 aStyle, PRUint16 aWeight, gfxFloat aSize, const nsACString& aLangGroup, float aSizeAdjust, PRPackedBool aSystemFont, From e35b6ef8187913f609e37d12e254128d770925bf Mon Sep 17 00:00:00 2001 From: "reed@reedloden.com" Date: Wed, 12 Mar 2008 03:54:22 -0700 Subject: [PATCH 38/65] Bug 416003 - "Use different arrow widgets for arrows in different context" [p=frnchfrgg-mozbugs@altern.org (RIVAUD Julien [_FrnchFrgg_]) r=Ventron r=twanno sr=roc a1.9=beltzner] --- widget/src/gtk2/gtk2drawing.c | 139 ++++++++++++++------------- widget/src/gtk2/gtkdrawing.h | 2 +- widget/src/gtk2/nsNativeThemeGTK.cpp | 3 +- 3 files changed, 77 insertions(+), 67 deletions(-) diff --git a/widget/src/gtk2/gtk2drawing.c b/widget/src/gtk2/gtk2drawing.c index 55a4f3e2103..36491db5532 100644 --- a/widget/src/gtk2/gtk2drawing.c +++ b/widget/src/gtk2/gtk2drawing.c @@ -58,6 +58,7 @@ static GtkWidget* gProtoWindow; static GtkWidget* gButtonWidget; static GtkWidget* gToggleButtonWidget; +static GtkWidget* gButtonArrowWidget; static GtkWidget* gCheckboxWidget; static GtkWidget* gRadiobuttonWidget; static GtkWidget* gHorizScrollbarWidget; @@ -66,11 +67,11 @@ static GtkWidget* gSpinWidget; static GtkWidget* gHScaleWidget; static GtkWidget* gVScaleWidget; static GtkWidget* gEntryWidget; -static GtkWidget* gArrowWidget; static GtkWidget* gOptionMenuWidget; static GtkWidget* gComboBoxEntryWidget; -static GtkWidget* gDropdownEntryWidget; -static GtkWidget* gDropdownButtonWidget; +static GtkWidget* gComboBoxEntryTextareaWidget; +static GtkWidget* gComboBoxEntryButtonWidget; +static GtkWidget* gComboBoxEntryArrowWidget; static GtkWidget* gHandleBoxWidget; static GtkWidget* gToolbarWidget; static GtkWidget* gFrameWidget; @@ -176,6 +177,19 @@ ensure_toggle_button_widget() return MOZ_GTK_SUCCESS; } +static gint +ensure_button_arrow_widget() +{ + if (!gButtonArrowWidget) { + ensure_toggle_button_widget(); + + gButtonArrowWidget = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_OUT); + gtk_container_add(GTK_CONTAINER(gToggleButtonWidget), gButtonArrowWidget); + gtk_widget_realize(gButtonArrowWidget); + } + return MOZ_GTK_SUCCESS; +} + static gint ensure_checkbox_widget() { @@ -270,13 +284,13 @@ moz_gtk_get_combo_box_entry_inner_widgets(GtkWidget *widget, gpointer client_data) { if (GTK_IS_TOGGLE_BUTTON(widget)) { - gDropdownButtonWidget = widget; + gComboBoxEntryButtonWidget = widget; g_object_add_weak_pointer(G_OBJECT(widget), - (gpointer) &gDropdownButtonWidget); + (gpointer) &gComboBoxEntryButtonWidget); } else if (GTK_IS_ENTRY(widget)) { - gDropdownEntryWidget = widget; + gComboBoxEntryTextareaWidget = widget; g_object_add_weak_pointer(G_OBJECT(widget), - (gpointer) &gDropdownEntryWidget); + (gpointer) &gComboBoxEntryTextareaWidget); } else return; gtk_widget_realize(widget); @@ -286,9 +300,9 @@ static void moz_gtk_get_combo_box_entry_arrow(GtkWidget *widget, gpointer client_data) { if (GTK_IS_ARROW(widget)) { - gArrowWidget = widget; + gComboBoxEntryArrowWidget = widget; g_object_add_weak_pointer(G_OBJECT(widget), - (gpointer) &gArrowWidget); + (gpointer) &gComboBoxEntryArrowWidget); gtk_widget_realize(widget); } } @@ -296,9 +310,9 @@ moz_gtk_get_combo_box_entry_arrow(GtkWidget *widget, gpointer client_data) static gint ensure_combo_box_entry_widgets() { - if (!gDropdownEntryWidget || - !gDropdownButtonWidget || - !gArrowWidget) { + if (!gComboBoxEntryTextareaWidget || + !gComboBoxEntryButtonWidget || + !gComboBoxEntryArrowWidget) { GtkWidget* buttonChild; /* Create a ComboBoxEntry if needed */ @@ -312,14 +326,14 @@ ensure_combo_box_entry_widgets() moz_gtk_get_combo_box_entry_inner_widgets, NULL); - if (!gDropdownEntryWidget) { + if (!gComboBoxEntryTextareaWidget) { ensure_entry_widget(); - gDropdownEntryWidget = gEntryWidget; + gComboBoxEntryTextareaWidget = gEntryWidget; } - if (gDropdownButtonWidget) { + if (gComboBoxEntryButtonWidget) { /* Get the Arrow inside the Button */ - buttonChild = GTK_BIN(gDropdownButtonWidget)->child; + buttonChild = GTK_BIN(gComboBoxEntryButtonWidget)->child; if (GTK_IS_HBOX(buttonChild)) { /* appears-as-list = FALSE, cell-view = TRUE; the button * contains an hbox. This hbox is there because ComboBoxEntry @@ -334,39 +348,30 @@ ensure_combo_box_entry_widgets() } else if(GTK_IS_ARROW(buttonChild)) { /* appears-as-list = TRUE, or cell-view = FALSE; * the button only contains an arrow */ - gArrowWidget = buttonChild; - g_object_add_weak_pointer(G_OBJECT(buttonChild), - (gpointer) &gArrowWidget); - gtk_widget_realize(gArrowWidget); + gComboBoxEntryArrowWidget = buttonChild; + g_object_add_weak_pointer(G_OBJECT(buttonChild), (gpointer) + &gComboBoxEntryArrowWidget); + gtk_widget_realize(gComboBoxEntryArrowWidget); } } else { /* Shouldn't be reached with current internal gtk implementation; * we use a generic toggle button as last resort fallback to avoid * crashing. */ ensure_toggle_button_widget(); - gDropdownButtonWidget = gToggleButtonWidget; + gComboBoxEntryButtonWidget = gToggleButtonWidget; } - if (!gArrowWidget) { + if (!gComboBoxEntryArrowWidget) { /* Shouldn't be reached with current internal gtk implementation; - * we use a generic down arrow as last resort fallback to avoid + * we gButtonArrowWidget as last resort fallback to avoid * crashing. */ - gArrowWidget = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE); - setup_widget_prototype(gArrowWidget); + ensure_button_arrow_widget(); + gComboBoxEntryArrowWidget = gButtonArrowWidget; } } return MOZ_GTK_SUCCESS; } -/* Will go away when bug 416003 lands (Use different arrow widgets for - * arrows in different context) */ -static gint -ensure_arrow_widget() -{ - if (!gArrowWidget) - ensure_combo_box_entry_widgets(); - return MOZ_GTK_SUCCESS; -} static gint ensure_handlebox_widget() @@ -923,18 +928,18 @@ moz_gtk_toggle_paint(GdkDrawable* drawable, GdkRectangle* rect, } static gint -calculate_arrow_dimensions(GdkRectangle* rect, GdkRectangle* arrow_rect, - GtkTextDirection direction) +calculate_arrow_rect(GtkWidget* arrow, GdkRectangle* rect, + GdkRectangle* arrow_rect, GtkTextDirection direction) { /* defined in gtkarrow.c */ gfloat arrow_scaling = 0.7; gfloat xalign, xpad; gint extent; - GtkMisc* misc = GTK_MISC(gArrowWidget); + GtkMisc* misc = GTK_MISC(arrow); if (have_arrow_scaling) - gtk_widget_style_get(gArrowWidget, - "arrow_scaling", &arrow_scaling, NULL); + gtk_widget_style_get(arrow, "arrow_scaling", &arrow_scaling, NULL); + extent = MIN((rect->width - misc->xpad * 2), (rect->height - misc->ypad * 2)) * arrow_scaling; @@ -1641,8 +1646,8 @@ moz_gtk_downarrow_paint(GdkDrawable* drawable, GdkRectangle* rect, GtkShadowType shadow_type = state->active ? GTK_SHADOW_IN : GTK_SHADOW_OUT; GdkRectangle arrow_rect; - ensure_arrow_widget(); - style = gArrowWidget->style; + ensure_button_arrow_widget(); + style = gButtonArrowWidget->style; arrow_rect.x = rect->x + 1 + XTHICKNESS(style); arrow_rect.y = rect->y + 1 + YTHICKNESS(style); @@ -1651,16 +1656,18 @@ moz_gtk_downarrow_paint(GdkDrawable* drawable, GdkRectangle* rect, TSOffsetStyleGCs(style, arrow_rect.x, arrow_rect.y); gtk_paint_arrow(style, drawable, state_type, shadow_type, cliprect, - gArrowWidget, "arrow", GTK_ARROW_DOWN, TRUE, + gButtonArrowWidget, "arrow", GTK_ARROW_DOWN, TRUE, arrow_rect.x, arrow_rect.y, arrow_rect.width, arrow_rect.height); return MOZ_GTK_SUCCESS; } static gint -moz_gtk_dropdown_arrow_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, - gboolean input_focus, GtkTextDirection direction) +moz_gtk_combo_box_entry_button_paint(GdkDrawable* drawable, GdkRectangle* rect, + GdkRectangle* cliprect, + GtkWidgetState* state, + gboolean input_focus, + GtkTextDirection direction) { GtkBorder inner_border; gboolean interior_focus; @@ -1676,20 +1683,20 @@ moz_gtk_dropdown_arrow_paint(GdkDrawable* drawable, GdkRectangle* rect, if (input_focus) { /* Some themes draw a complementary focus ring for the dropdown button * when the dropdown entry has focus */ - GTK_WIDGET_SET_FLAGS(gDropdownEntryWidget, GTK_HAS_FOCUS); + GTK_WIDGET_SET_FLAGS(gComboBoxEntryTextareaWidget, GTK_HAS_FOCUS); } moz_gtk_button_paint(drawable, rect, cliprect, state, GTK_RELIEF_NORMAL, - gDropdownButtonWidget, direction); + gComboBoxEntryButtonWidget, direction); if (input_focus) - GTK_WIDGET_UNSET_FLAGS(gDropdownEntryWidget, GTK_HAS_FOCUS); + GTK_WIDGET_UNSET_FLAGS(gComboBoxEntryTextareaWidget, GTK_HAS_FOCUS); /* This mirrors gtkbutton's child positioning */ - style = gDropdownButtonWidget->style; + style = gComboBoxEntryButtonWidget->style; - moz_gtk_button_get_inner_border(gDropdownButtonWidget, &inner_border); - moz_gtk_widget_get_focus(gDropdownButtonWidget, &interior_focus, + moz_gtk_button_get_inner_border(gComboBoxEntryButtonWidget, &inner_border); + moz_gtk_widget_get_focus(gComboBoxEntryButtonWidget, &interior_focus, &focus_width, &focus_pad); arrow_rect.x = rect->x + XTHICKNESS(style) + focus_width + focus_pad; @@ -1703,7 +1710,7 @@ moz_gtk_dropdown_arrow_paint(GdkDrawable* drawable, GdkRectangle* rect, inner_border.bottom - (YTHICKNESS(style) + focus_pad + focus_width) * 2); if (state_type == GTK_STATE_ACTIVE) { - gtk_widget_style_get(gDropdownButtonWidget, + gtk_widget_style_get(gComboBoxEntryButtonWidget, "child-displacement-x", &x_displacement, "child-displacement-y", &y_displacement, NULL); @@ -1711,13 +1718,14 @@ moz_gtk_dropdown_arrow_paint(GdkDrawable* drawable, GdkRectangle* rect, arrow_rect.y += y_displacement; } - calculate_arrow_dimensions(&arrow_rect, &real_arrow_rect, direction); + calculate_arrow_dimensions(gComboBoxEntryArrowWidget, + &arrow_rect, &real_arrow_rect, direction); - style = gArrowWidget->style; + style = gComboBoxEntryArrowWidget->style; TSOffsetStyleGCs(style, real_arrow_rect.x, real_arrow_rect.y); gtk_paint_arrow(style, drawable, state_type, shadow_type, cliprect, - gArrowWidget, "arrow", GTK_ARROW_DOWN, TRUE, + gComboBoxEntryArrowWidget, "arrow", GTK_ARROW_DOWN, TRUE, real_arrow_rect.x, real_arrow_rect.y, real_arrow_rect.width, real_arrow_rect.height); @@ -2500,11 +2508,11 @@ moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top, break; case MOZ_GTK_DROPDOWN_ENTRY: ensure_combo_box_entry_widgets(); - w = gDropdownEntryWidget; + w = gComboBoxEntryTextareaWidget; break; case MOZ_GTK_DROPDOWN_ARROW: ensure_combo_box_entry_widgets(); - w = gDropdownButtonWidget; + w = gComboBoxEntryButtonWidget; break; case MOZ_GTK_DROPDOWN: { @@ -2670,7 +2678,7 @@ moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top, } gint -moz_gtk_get_dropdown_arrow_size(gint* width, gint* height) +moz_gtk_get_combo_box_entry_button_size(gint* width, gint* height) { /* * We get the requisition of the drop down button, which includes @@ -2680,7 +2688,7 @@ moz_gtk_get_dropdown_arrow_size(gint* width, gint* height) GtkRequisition requisition; ensure_combo_box_entry_widgets(); - gtk_widget_size_request(gDropdownButtonWidget, &requisition); + gtk_widget_size_request(gComboBoxEntryButtonWidget, &requisition); *width = requisition.width; *height = requisition.height; @@ -2916,13 +2924,13 @@ moz_gtk_widget_paint(GtkThemeWidgetType widget, GdkDrawable* drawable, direction); break; case MOZ_GTK_DROPDOWN_ARROW: - return moz_gtk_dropdown_arrow_paint(drawable, rect, cliprect, state, - flags, direction); + return moz_gtk_combo_box_entry_button_paint(drawable, rect, cliprect, + state, flags, direction); break; case MOZ_GTK_DROPDOWN_ENTRY: ensure_combo_box_entry_widgets(); return moz_gtk_entry_paint(drawable, rect, cliprect, state, - gDropdownEntryWidget, direction); + gComboBoxEntryTextareaWidget, direction); break; case MOZ_GTK_CHECKBUTTON_CONTAINER: case MOZ_GTK_RADIOBUTTON_CONTAINER: @@ -3035,6 +3043,7 @@ moz_gtk_shutdown() gProtoWindow = NULL; gButtonWidget = NULL; gToggleButtonWidget = NULL; + gButtonArrowWidget = NULL; gCheckboxWidget = NULL; gRadiobuttonWidget = NULL; gHorizScrollbarWidget = NULL; @@ -3043,11 +3052,11 @@ moz_gtk_shutdown() gHScaleWidget = NULL; gVScaleWidget = NULL; gEntryWidget = NULL; - gArrowWidget = NULL; gOptionMenuWidget = NULL; - gDropdownButtonWidget = NULL; - gDropdownEntryWidget = NULL; gComboBoxEntryWidget = NULL; + gComboBoxEntryButtonWidget = NULL; + gComboBoxEntryArrowWidget = NULL; + gComboBoxEntryTextareaWidget = NULL; gHandleBoxWidget = NULL; gToolbarWidget = NULL; gStatusbarWidget = NULL; diff --git a/widget/src/gtk2/gtkdrawing.h b/widget/src/gtk2/gtkdrawing.h index 88ab8914d8e..71c3437ce7e 100644 --- a/widget/src/gtk2/gtkdrawing.h +++ b/widget/src/gtk2/gtkdrawing.h @@ -341,7 +341,7 @@ moz_gtk_get_scrollbar_metrics(MozGtkScrollbarMetrics* metrics); * * returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise */ -gint moz_gtk_get_dropdown_arrow_size(gint* width, gint* height); +gint moz_gtk_get_combo_box_entry_button_size(gint* width, gint* height); /** * Get the desired size of a scroll arrow widget diff --git a/widget/src/gtk2/nsNativeThemeGTK.cpp b/widget/src/gtk2/nsNativeThemeGTK.cpp index a8c423ee66b..f9663d2d8c3 100644 --- a/widget/src/gtk2/nsNativeThemeGTK.cpp +++ b/widget/src/gtk2/nsNativeThemeGTK.cpp @@ -1082,7 +1082,8 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsIRenderingContext* aContext, break; case NS_THEME_DROPDOWN_BUTTON: { - moz_gtk_get_dropdown_arrow_size(&aResult->width, &aResult->height); + moz_gtk_get_combo_box_entry_button_size(&aResult->width, + &aResult->height); *aIsOverridable = PR_FALSE; } break; From 4ad95a7fd6981df6b70e3b4a3ef7678af1f6bfbb Mon Sep 17 00:00:00 2001 From: "reed@reedloden.com" Date: Wed, 12 Mar 2008 03:57:05 -0700 Subject: [PATCH 39/65] Bug 421695 - "Toolbar and MenuBar shadows should not be saved" (Fix various uses of shadow-type) [p=ispence@gmail.com (Ian Spence) r+sr=roc a1.9=damons] --- widget/src/gtk2/gtk2drawing.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/widget/src/gtk2/gtk2drawing.c b/widget/src/gtk2/gtk2drawing.c index 36491db5532..bd8560414a4 100644 --- a/widget/src/gtk2/gtk2drawing.c +++ b/widget/src/gtk2/gtk2drawing.c @@ -95,11 +95,7 @@ static GtkWidget* gHPanedWidget; static GtkWidget* gVPanedWidget; static GtkWidget* gScrolledWindowWidget; -static GtkShadowType gMenuBarShadowType; -static GtkShadowType gToolbarShadowType; - static style_prop_t style_prop_func; -static gboolean have_menu_shadow_type; static gboolean have_arrow_scaling; static gboolean is_initialized; @@ -391,8 +387,6 @@ ensure_toolbar_widget() gToolbarWidget = gtk_toolbar_new(); gtk_container_add(GTK_CONTAINER(gHandleBoxWidget), gToolbarWidget); gtk_widget_realize(gToolbarWidget); - gtk_widget_style_get(gToolbarWidget, "shadow_type", &gToolbarShadowType, - NULL); } return MOZ_GTK_SUCCESS; } @@ -466,8 +460,6 @@ ensure_menu_bar_widget() if (!gMenuBarWidget) { gMenuBarWidget = gtk_menu_bar_new(); setup_widget_prototype(gMenuBarWidget); - gtk_widget_style_get(gMenuBarWidget, "shadow_type", &gMenuBarShadowType, - NULL); } return MOZ_GTK_SUCCESS; } @@ -744,9 +736,6 @@ gint moz_gtk_init() { is_initialized = TRUE; - have_menu_shadow_type = - (gtk_major_version > 2 || - (gtk_major_version == 2 && gtk_minor_version >= 1)); have_arrow_scaling = (gtk_major_version > 2 || (gtk_major_version == 2 && gtk_minor_version >= 12)); @@ -1839,7 +1828,9 @@ moz_gtk_toolbar_paint(GdkDrawable* drawable, GdkRectangle* rect, cliprect, rect->x, rect->y, rect->width, rect->height); - gtk_paint_box (style, drawable, GTK_STATE_NORMAL, gToolbarShadowType, + gtk_widget_style_get(gToolbarWidget, "shadow-type", &shadow_type, NULL); + + gtk_paint_box (style, drawable, GTK_STATE_NORMAL, shadow_type, cliprect, gToolbarWidget, "toolbar", rect->x, rect->y, rect->width, rect->height); @@ -2218,13 +2209,16 @@ moz_gtk_menu_bar_paint(GdkDrawable* drawable, GdkRectangle* rect, ensure_menu_bar_widget(); gtk_widget_set_direction(gMenuBarWidget, direction); + gtk_widget_style_get(gMenuBarWidget, "shadow-type", &shadow_type, NULL); + style = gMenuBarWidget->style; TSOffsetStyleGCs(style, rect->x, rect->y); gtk_style_apply_default_background(style, drawable, TRUE, GTK_STATE_NORMAL, cliprect, rect->x, rect->y, rect->width, rect->height); - gtk_paint_box(style, drawable, GTK_STATE_NORMAL, gMenuBarShadowType, + + gtk_paint_box(style, drawable, GTK_STATE_NORMAL, shadow_type, cliprect, gMenuBarWidget, "menubar", rect->x, rect->y, rect->width, rect->height); return MOZ_GTK_SUCCESS; @@ -2322,12 +2316,9 @@ moz_gtk_menu_item_paint(GdkDrawable* drawable, GdkRectangle* rect, style = item_widget->style; TSOffsetStyleGCs(style, rect->x, rect->y); - if (have_menu_shadow_type) { - gtk_widget_style_get(item_widget, "selected_shadow_type", - &shadow_type, NULL); - } else { - shadow_type = GTK_SHADOW_OUT; - } + + gtk_widget_style_get(item_widget, "selected-shadow-type", + &shadow_type, NULL); gtk_paint_box(style, drawable, GTK_STATE_PRELIGHT, shadow_type, cliprect, item_widget, "menuitem", rect->x, rect->y, From b544cb9223c04d4ddce643f9757417f23c2fbfc8 Mon Sep 17 00:00:00 2001 From: "reed@reedloden.com" Date: Wed, 12 Mar 2008 03:59:03 -0700 Subject: [PATCH 40/65] Bug 356011 - "kfreebsd support" (main configure.in and xpcom parts) [p=mh+mozilla@glandium.org (Mike Hommey) r=bsmedberg a1.9=damons] --- configure.in | 7 ++++--- xpcom/reflect/xptcall/src/md/unix/Makefile.in | 2 +- .../xptcall/src/md/unix/xptc_platforms_unixish_x86.h | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/configure.in b/configure.in index a5b76ab2da3..22b7745270b 100644 --- a/configure.in +++ b/configure.in @@ -948,6 +948,7 @@ if test -n "$CROSS_COMPILE"; then OS_RELEASE= case "${target_os}" in linux*) OS_ARCH=Linux OS_TARGET=Linux ;; + kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;; solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;; mingw*) OS_ARCH=WINNT ;; wince*) OS_ARCH=WINCE ;; @@ -1478,7 +1479,7 @@ case "$host" in LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL -lobjc' ;; -*-linux*) +*-linux*|*-kfreebsd*-gnu) HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX" HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"' HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}" @@ -2470,7 +2471,7 @@ dnl ======================================================== dnl = Flags to strip unused symbols from .so components dnl ======================================================== case "$target" in - *-linux*) + *-linux*|*-kfreebsd*-gnu) MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script' ;; *-solaris*) @@ -3144,7 +3145,7 @@ then fi ;; - *-*-linux*) + *-*-linux*|*-*-kfreebsd*-gnu) AC_DEFINE(_REENTRANT) ;; diff --git a/xpcom/reflect/xptcall/src/md/unix/Makefile.in b/xpcom/reflect/xptcall/src/md/unix/Makefile.in index f13e6809d72..abe5007df7c 100644 --- a/xpcom/reflect/xptcall/src/md/unix/Makefile.in +++ b/xpcom/reflect/xptcall/src/md/unix/Makefile.in @@ -76,7 +76,7 @@ endif # New code for Linux, et. al., with gcc # Migrate other platforms here after testing # -ifneq (,$(filter Linux,$(OS_ARCH))) +ifneq (,$(filter Linux GNU_%,$(OS_ARCH))) # Linux/x86-64 ifeq (x86_64,$(OS_TEST)) CPPSRCS := xptcinvoke_x86_64_linux.cpp xptcstubs_x86_64_linux.cpp diff --git a/xpcom/reflect/xptcall/src/md/unix/xptc_platforms_unixish_x86.h b/xpcom/reflect/xptcall/src/md/unix/xptc_platforms_unixish_x86.h index c61141554ee..dd6cb947154 100644 --- a/xpcom/reflect/xptcall/src/md/unix/xptc_platforms_unixish_x86.h +++ b/xpcom/reflect/xptcall/src/md/unix/xptc_platforms_unixish_x86.h @@ -67,7 +67,7 @@ * */ -#if defined(LINUX) +#if defined(LINUX) || (defined(__GLIBC__) && defined(__FreeBSD_kernel__)) #if (__GNUC__ == 2) && (__GNUC_MINOR__ <= 7) /* Old gcc 2.7.x.x. What does gcc 2.8.x do?? */ From 270d099f7689b15a27b0ff25ee7f14830097b362 Mon Sep 17 00:00:00 2001 From: "reed@reedloden.com" Date: Wed, 12 Mar 2008 04:00:24 -0700 Subject: [PATCH 41/65] Bug 414063 - "annotate xpidl-generated c++ headers with attributes for scriptable and deprecated methods" [p=Pidgeot18@gmail.com (Joshua Cranmer) r=dbradley a1.9=damons] --- xpcom/base/nscore.h | 20 ++++++ xpcom/tests/Makefile.in | 10 +++ xpcom/tests/TestScriptable.idl | 21 ++++++ xpcom/typelib/xpidl/xpidl.h | 3 + xpcom/typelib/xpidl/xpidl_header.c | 28 ++++++-- xpcom/typelib/xpidl/xpidl_java.c | 71 ++++++++++++++++++++ xpcom/typelib/xpidl/xpidl_util.c | 102 +++++++++++++++-------------- 7 files changed, 202 insertions(+), 53 deletions(-) create mode 100644 xpcom/tests/TestScriptable.idl diff --git a/xpcom/base/nscore.h b/xpcom/base/nscore.h index 7329fd11a70..3ed7024505e 100644 --- a/xpcom/base/nscore.h +++ b/xpcom/base/nscore.h @@ -244,6 +244,26 @@ ret (NS_STDCALL class::*name) args #endif +/** + * Deprecated declarations. + */ +#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) +# define NS_DEPRECATED __attribute__((deprecated)) +#elif defined(_MSC_VER) && (_MSC_VER >= 1300) +# define NS_DEPRECATED __declspec(deprecated) +#else +# define NS_DEPRECATED +#endif + +/** + * Attributes defined to help Dehydra GCC analysis. + */ +#ifdef DEHYDRA_GCC +# define NS_SCRIPTABLE __attribute__((user("script"))) +#else +# define NS_SCRIPTABLE +#endif + /** * Generic API modifiers which return the standard XPCOM nsresult type */ diff --git a/xpcom/tests/Makefile.in b/xpcom/tests/Makefile.in index 89c3a515f9f..1978d49dbf1 100644 --- a/xpcom/tests/Makefile.in +++ b/xpcom/tests/Makefile.in @@ -148,3 +148,13 @@ check:: for f in $(CPP_UNIT_TESTS); do \ XPCOM_DEBUG_BREAK=stack-and-abort $(RUN_TEST_PROGRAM) $(DIST)/bin/$$f; \ done + @echo "Running XPIDL tests" + $(XPIDL_COMPILE) -m header $(srcdir)/TestScriptable.idl + @if grep Notscriptable TestScriptable.h | grep -q NS_SCRIPTABLE ; then \ + echo "Nonscriptable object marked scriptable by xpidl"; \ + exit 1; \ + fi + @if test $$( grep 'NS_IMETHOD[^I].*Scriptable' TestScriptable.h | grep -v -c NS_SCRIPTABLE ) != 0 ; then \ + echo "Scriptable object marked nonscriptable by xpidl"; \ + exit 1; \ + fi diff --git a/xpcom/tests/TestScriptable.idl b/xpcom/tests/TestScriptable.idl new file mode 100644 index 00000000000..35da79f3244 --- /dev/null +++ b/xpcom/tests/TestScriptable.idl @@ -0,0 +1,21 @@ + +[scriptable, uuid(76d74662-0eae-404c-9d1f-697c0e321c0a)] +interface testScriptableInterface { + readonly attribute long scriptable_attr1; + attribute long scriptable_attr2; + [noscript] readonly attribute long notscriptable_attr1; + [noscript] attribute long notscriptable_attr2; + + void scriptable_method1(); + [noscript] void notscriptable_method1(); + [notxpcom] void notscriptable_method2(); + [noscript, notxpcom] void notscriptable_method3(); +}; + +[uuid(76d74662-0eae-404c-9d1f-697c0e321c0a)] +interface testNotscriptableInterface { + readonly attribute long notscriptable_attr1; + attribute long notscriptable_attr2; + + void notscriptable_method1(); +}; diff --git a/xpcom/typelib/xpidl/xpidl.h b/xpcom/typelib/xpidl/xpidl.h index bc8a9aa6e93..7a2f1322a33 100644 --- a/xpcom/typelib/xpidl/xpidl.h +++ b/xpcom/typelib/xpidl/xpidl.h @@ -275,4 +275,7 @@ check_native(TreeState *state); void printlist(FILE *outfile, GSList *slist); +gboolean +is_method_scriptable(IDL_tree method_tree, IDL_tree ident); + #endif /* __xpidl_h */ diff --git a/xpcom/typelib/xpidl/xpidl_header.c b/xpcom/typelib/xpidl/xpidl_header.c index 9d4247ec4c8..d9b8fdcc28a 100644 --- a/xpcom/typelib/xpidl/xpidl_header.c +++ b/xpcom/typelib/xpidl/xpidl_header.c @@ -146,7 +146,7 @@ interface(TreeState *state) char *classNameImpl = NULL; char *cp; gboolean ok = TRUE; - gboolean keepvtable; + gboolean keepvtable, scriptable, deprecated; const char *iid; const char *name_space; struct nsID id; @@ -233,11 +233,20 @@ interface(TreeState *state) if (IDL_NODE_TYPE(data) == IDLN_CODEFRAG) keepvtable = TRUE; } - + + scriptable = deprecated = FALSE; + if (IDL_tree_property_get(IDL_INTERFACE(iface).ident, "scriptable")) + scriptable = TRUE; + if (IDL_tree_property_get(IDL_INTERFACE(iface).ident, "deprecated")) + deprecated = TRUE; + /* The interface declaration itself. */ fprintf(state->file, - "class %s%s", - (keepvtable ? "" : "NS_NO_VTABLE "), className); + "class %s%s%s%s", + (keepvtable ? "" : "NS_NO_VTABLE "), + (scriptable ? "NS_SCRIPTABLE " : ""), + (deprecated ? "NS_DEPRECATED " : ""), + className); if ((iter = IDL_INTERFACE(iface).inheritance_spec)) { fputs(" : ", state->file); @@ -746,8 +755,14 @@ write_attr_accessor(IDL_tree attr_tree, FILE * outfile, { char *attrname = ATTR_IDENT(attr_tree).str; const char *binaryname; + IDL_tree ident = IDL_LIST(IDL_ATTR_DCL(attr_tree).simple_declarations).data; if (mode == AS_DECL) { + if (IDL_tree_property_get(ident, "deprecated")) + fputs("NS_DEPRECATED ", outfile); + if (is_method_scriptable(attr_tree, ident)) + fputs("NS_SCRIPTABLE ", outfile); + fputs("NS_IMETHOD ", outfile); } else if (mode == AS_IMPL) { fprintf(outfile, "NS_IMETHODIMP %s::", className); @@ -1023,6 +1038,11 @@ write_method_signature(IDL_tree method_tree, FILE *outfile, int mode, IDL_tree iter; if (mode == AS_DECL) { + if (IDL_tree_property_get(op->ident, "deprecated")) + fputs("NS_DEPRECATED ", outfile); + if (is_method_scriptable(method_tree, op->ident)) + fputs("NS_SCRIPTABLE ", outfile); + if (op_notxpcom) { fputs("NS_IMETHOD_(", outfile); if (!write_type(op->op_type_spec, FALSE, outfile)) diff --git a/xpcom/typelib/xpidl/xpidl_java.c b/xpcom/typelib/xpidl/xpidl_java.c index e36f53cea5d..68be7d29f13 100644 --- a/xpcom/typelib/xpidl/xpidl_java.c +++ b/xpcom/typelib/xpidl/xpidl_java.c @@ -144,6 +144,55 @@ write_indent(FILE *outfile) { fputs(" ", outfile); } +static GSList* +add_deprecated(GSList *comments) +{ + GSList *last; + char *buffer; + char *replaced; + const char deprecated[] = "* @deprecated */"; + + /* Handle the easy case: no documentation. */ + if (comments == NULL) { + buffer = malloc(sizeof(deprecated)+2); + buffer[0] = '/'; + buffer[1] = '*'; + strcpy(buffer+2, deprecated); + + return g_slist_append(comments, buffer); + } + + /* xpidl is so nice in that they give us the data as a single node. + * We are going to have to (very hackishly) strip out the the end of the + * documentation comment, add the tag, and then pop it back together. + */ + + /* Step 1: Move the comment into a larger buffer, so that we can have + * more space to work with. + */ + last = g_slist_last(comments); + buffer = last->data; + replaced = (char *)malloc(strlen(buffer) + sizeof(deprecated)); + strcpy(replaced, buffer); + last->data = replaced; + free(buffer); + + /* Now replaced has the comment, with a large enough buffer to put in the + * @deprecated tag. We search for the last / in hopes that the previous + * character is the * we're looking for... + */ + buffer = strrchr(replaced, '/'); + if (buffer == NULL || buffer == replaced || buffer[-1] == '*') { + /* We can't find a '/', so there's no comment, or this is not the end + * of a comment, so we'll ignore adding the deprecated tag. + */ + return comments; + } + /* buffer now points to '*' '/'. Overwrite both. */ + strcpy(buffer-1, deprecated); + return comments; +} + static gboolean write_classname_iid_define(FILE *file, const char *className) { @@ -330,6 +379,13 @@ interface_declaration(TreeState *state) return FALSE; } + /* + * Add deprecated tags if the interface is deprecated + */ + if (IDL_tree_property_get(IDL_INTERFACE(interface).ident, "deprecated")) { + doc_comments = add_deprecated(doc_comments); + } + /* * Write any interface comments */ @@ -776,6 +832,13 @@ method_declaration(TreeState *state) } #endif + /* + * Add deprecated tags if the interface is deprecated + */ + if (IDL_tree_property_get(method->ident, "deprecated")) { + doc_comments = add_deprecated(doc_comments); + } + if (doc_comments != NULL) { write_indent(state->file); printlist(state->file, doc_comments); @@ -1013,6 +1076,14 @@ attribute_declaration(TreeState *state) doc_comments = IDL_IDENT(IDL_LIST(IDL_ATTR_DCL (state->tree).simple_declarations).data).comments; + + /* + * Add deprecated tags if the interface is deprecated + */ + if (IDL_tree_property_get(ATTR_PROPS(state->tree), "deprecated")) { + doc_comments = add_deprecated(doc_comments); + } + if (doc_comments != NULL) { write_indent(state->file); printlist(state->file, doc_comments); diff --git a/xpcom/typelib/xpidl/xpidl_util.c b/xpcom/typelib/xpidl/xpidl_util.c index 0afed439929..65f8988636a 100644 --- a/xpcom/typelib/xpidl/xpidl_util.c +++ b/xpcom/typelib/xpidl/xpidl_util.c @@ -277,13 +277,59 @@ matches_nsIFoo(const char* attribute_name) return matches_IFoo(attribute_name + 3); } +/** + * Returns TRUE if the method is probably scriptable, FALSE otherwise. + * The first parameter may also be an attr_tree parameter, since these two are + * the same with respect to discovering the interface node. + */ +gboolean +is_method_scriptable(IDL_tree method_tree, IDL_tree ident) +{ + IDL_tree iface; + gboolean scriptable_interface; + + /* + * Look up the tree to find the interface. If we can't find the interface, + * then the caller is being called on an incorrect tree. If we find it, we + * see if it's [scriptable] and duly note it. + */ + if (IDL_NODE_UP(method_tree) && IDL_NODE_UP(IDL_NODE_UP(method_tree)) && + IDL_NODE_TYPE(iface = IDL_NODE_UP(IDL_NODE_UP(method_tree))) + == IDLN_INTERFACE) + { + scriptable_interface = + (IDL_tree_property_get(IDL_INTERFACE(iface).ident, "scriptable") + != NULL); + } else { + IDL_tree_error(method_tree, + "is_method_scriptable called on a non-interface?"); + return FALSE; + } + + /* If the interface isn't scriptable, the method sure can't be... */ + if (!scriptable_interface) + return FALSE; + + /* [notxpcom] implies [noscript] */ + if (IDL_tree_property_get(ident, "notxpcom") != NULL) + return FALSE; + + /* [noscript] methods obviously aren't scriptable */ + if (IDL_tree_property_get(ident, "noscript") != NULL) + return FALSE; + + /* The interface is scriptable, so therefore the method is, if the + * interfaces are accessible. That's good enough for this method. + */ + return TRUE; +} + gboolean verify_attribute_declaration(IDL_tree attr_tree) { IDL_tree iface; IDL_tree ident; IDL_tree attr_type; - gboolean scriptable_interface; /* We don't support attributes named IID, conflicts with static GetIID * member. The conflict is due to certain compilers (VC++) choosing a @@ -299,22 +345,6 @@ verify_attribute_declaration(IDL_tree attr_tree) "ordering problems"); return FALSE; } - /* - * Verify that we've been called on an interface, and decide if the - * interface was marked [scriptable]. - */ - if (IDL_NODE_UP(attr_tree) && IDL_NODE_UP(IDL_NODE_UP(attr_tree)) && - IDL_NODE_TYPE(iface = IDL_NODE_UP(IDL_NODE_UP(attr_tree))) - == IDLN_INTERFACE) - { - scriptable_interface = - (IDL_tree_property_get(IDL_INTERFACE(iface).ident, "scriptable") - != NULL); - } else { - IDL_tree_error(attr_tree, - "verify_attribute_declaration called on a non-interface?"); - return FALSE; - } /* * Grab the first of the list of idents and hope that it'll @@ -324,10 +354,10 @@ verify_attribute_declaration(IDL_tree attr_tree) /* * If the interface isn't scriptable, or the attribute is marked noscript, - * there's no need to check. + * there's no need to check. This also verifies that we've been called on + * an interface. */ - if (!scriptable_interface || - IDL_tree_property_get(ident, "noscript") != NULL) + if (!is_method_scriptable(attr_tree, ident)) return TRUE; /* @@ -533,7 +563,6 @@ check_param_attribute(IDL_tree method_tree, IDL_tree param, return TRUE; } - /* * Common method verification code, called by *op_dcl in the various backends. */ @@ -544,7 +573,6 @@ verify_method_declaration(IDL_tree method_tree) IDL_tree iface; IDL_tree iter; gboolean notxpcom; - gboolean scriptable_interface; gboolean scriptable_method; gboolean seen_retval = FALSE; gboolean hasoptional = PR_FALSE; @@ -568,36 +596,12 @@ verify_method_declaration(IDL_tree method_tree) } /* - * Verify that we've been called on an interface, and decide if the - * interface was marked [scriptable]. - */ - if (IDL_NODE_UP(method_tree) && IDL_NODE_UP(IDL_NODE_UP(method_tree)) && - IDL_NODE_TYPE(iface = IDL_NODE_UP(IDL_NODE_UP(method_tree))) - == IDLN_INTERFACE) - { - scriptable_interface = - (IDL_tree_property_get(IDL_INTERFACE(iface).ident, "scriptable") - != NULL); - } else { - IDL_tree_error(method_tree, - "verify_method_declaration called on a non-interface?"); - return FALSE; - } - - /* - * Require that any method in an interface marked as [scriptable], that - * *isn't* scriptable because it refers to some native type, be marked - * [noscript] or [notxpcom]. - * - * Also check that iid_is points to nsid, and length_is, size_is points - * to unsigned long. + * Decide if we are a scriptable method, or if we were are notxpcom. + * In doing so, we also verify that we've been called on an interface. */ + scriptable_method = is_method_scriptable(method_tree, op->ident); notxpcom = IDL_tree_property_get(op->ident, "notxpcom") != NULL; - scriptable_method = scriptable_interface && - !notxpcom && - IDL_tree_property_get(op->ident, "noscript") == NULL; - /* Loop through the parameters and check. */ for (iter = op->parameter_dcls; iter; iter = IDL_LIST(iter).next) { IDL_tree param = IDL_LIST(iter).data; From 2b0fe4031830e0a086936918c8c42d2c09c61a1f Mon Sep 17 00:00:00 2001 From: "reed@reedloden.com" Date: Wed, 12 Mar 2008 04:08:08 -0700 Subject: [PATCH 42/65] Bug 419544 - "places menupopups options ("open all in tabs", "open ") do not update correctly" [p=mak77@supereva.it (Marco Bonardo [mak77]) r=Mano a=blocking-firefox3+] --- browser/base/content/browser-places.js | 137 ++++++++++-------- browser/components/places/content/menu.xml | 67 +-------- browser/components/places/content/toolbar.xml | 27 ++-- browser/components/places/content/utils.js | 48 ++++++ 4 files changed, 150 insertions(+), 129 deletions(-) diff --git a/browser/base/content/browser-places.js b/browser/base/content/browser-places.js index f0fa2595d47..3fbd9e56d77 100644 --- a/browser/base/content/browser-places.js +++ b/browser/base/content/browser-places.js @@ -637,69 +637,86 @@ var BookmarksEventHandler = { */ onPopupShowing: function BM_onPopupShowing(event) { var target = event.originalTarget; - if (target.localName == "menupopup" && - target.id != "bookmarksMenuPopup" && - target.getAttribute("anonid") != "chevronPopup") { - // Add the "Open All in Tabs" menuitem if there are - // at least two menuitems with places result nodes. - // Add the "Open (Feed Name)" menuitem if it's a livemark with a siteURI. - var numNodes = 0; - var hasMultipleEntries = false; - var currentChild = target.firstChild; - while (currentChild) { - if (currentChild.localName == "menuitem" && currentChild.node) - numNodes++; + if (!target.hasAttribute("placespopup")) + return; - // If the menuitem already exists, do nothing. - if (currentChild.getAttribute("openInTabs") == "true") - return; - if (currentChild.hasAttribute("siteURI")) - return; - - currentChild = currentChild.nextSibling; - } - if (numNodes > 1) - hasMultipleEntries = true; - - var itemId = target._resultNode.itemId; - var siteURIString = ""; - if (itemId != -1 && PlacesUtils.livemarks.isLivemark(itemId)) { - var siteURI = PlacesUtils.livemarks.getSiteURI(itemId); - if (siteURI) - siteURIString = siteURI.spec; - } - - if (hasMultipleEntries || siteURIString) { - var separator = document.createElement("menuseparator"); - target.appendChild(separator); - - if (siteURIString) { - var openHomePage = document.createElement("menuitem"); - openHomePage.setAttribute("siteURI", siteURIString); - openHomePage.setAttribute("oncommand", - "openUILink(this.getAttribute('siteURI'), event);"); - // If a user middle-clicks this item we serve the oncommand event - // We are using checkForMiddleClick because of Bug 246720 - // Note: stopPropagation is needed to avoid serving middle-click - // with BT_onClick that would open all items in tabs - openHomePage.setAttribute("onclick", - "checkForMiddleClick(this, event); event.stopPropagation();"); - openHomePage.setAttribute("label", - PlacesUtils.getFormattedString("menuOpenLivemarkOrigin.label", - [target.parentNode.getAttribute("label")])); - target.appendChild(openHomePage); - } - - if (hasMultipleEntries) { - var openInTabs = document.createElement("menuitem"); - openInTabs.setAttribute("openInTabs", "true"); - openInTabs.setAttribute("oncommand", - "PlacesUtils.openContainerNodeInTabs(this.parentNode._resultNode, event);"); - openInTabs.setAttribute("label", - gNavigatorBundle.getString("menuOpenAllInTabs.label")); - target.appendChild(openInTabs); + // Check if the popup contains at least 2 menuitems with places nodes + var numNodes = 0; + var hasMultipleURIs = false; + var currentChild = target.firstChild; + while (currentChild) { + if (currentChild.localName == "menuitem" && currentChild.node) { + if (++numNodes == 2) { + hasMultipleURIs = true; + break; } } + currentChild = currentChild.nextSibling; + } + + var itemId = target._resultNode.itemId; + var siteURIString = ""; + if (itemId != -1 && PlacesUtils.livemarks.isLivemark(itemId)) { + var siteURI = PlacesUtils.livemarks.getSiteURI(itemId); + if (siteURI) + siteURIString = siteURI.spec; + } + + if (!siteURIString && target._endOptOpenSiteURI) { + target.removeChild(target._endOptOpenSiteURI); + target._endOptOpenSiteURI = null; + } + + if (!hasMultipleURIs && target._endOptOpenAllInTabs) { + target.removeChild(target._endOptOpenAllInTabs); + target._endOptOpenAllInTabs = null; + } + + if (!(hasMultipleURIs || siteURIString)) { + // we don't have to show any option + if (target._endOptSeparator) { + target.removeChild(target._endOptSeparator); + target._endOptSeparator = null; + target._endMarker = -1; + } + return; + } + + if (!target._endOptSeparator) { + // create a separator before options + target._endOptSeparator = document.createElement("menuseparator"); + target._endOptSeparator.setAttribute("builder", "end"); + target._endMarker = target.childNodes.length; + target.appendChild(target._endOptSeparator); + } + + if (siteURIString && !target._endOptOpenSiteURI) { + // Add "Open (Feed Name)" menuitem if it's a livemark with a siteURI + target._endOptOpenSiteURI = document.createElement("menuitem"); + target._endOptOpenSiteURI.setAttribute("siteURI", siteURIString); + target._endOptOpenSiteURI.setAttribute("oncommand", + "openUILink(this.getAttribute('siteURI'), event);"); + // If a user middle-clicks this item we serve the oncommand event + // We are using checkForMiddleClick because of Bug 246720 + // Note: stopPropagation is needed to avoid serving middle-click + // with BT_onClick that would open all items in tabs + target._endOptOpenSiteURI.setAttribute("onclick", + "checkForMiddleClick(this, event); event.stopPropagation();"); + target._endOptOpenSiteURI.setAttribute("label", + PlacesUtils.getFormattedString("menuOpenLivemarkOrigin.label", + [target.parentNode.getAttribute("label")])); + target.appendChild(target._endOptOpenSiteURI); + } + + if (hasMultipleURIs && !target._endOptOpenAllInTabs) { + // Add the "Open All in Tabs" menuitem if there are + // at least two menuitems with places result nodes. + target._endOptOpenAllInTabs = document.createElement("menuitem"); + target._endOptOpenAllInTabs.setAttribute("oncommand", + "PlacesUtils.openContainerNodeInTabs(this.parentNode._resultNode, event);"); + target._endOptOpenAllInTabs.setAttribute("label", + gNavigatorBundle.getString("menuOpenAllInTabs.label")); + target.appendChild(target._endOptOpenAllInTabs); } }, diff --git a/browser/components/places/content/menu.xml b/browser/components/places/content/menu.xml index 324e3cb4ec3..1257b8a6416 100755 --- a/browser/components/places/content/menu.xml +++ b/browser/components/places/content/menu.xml @@ -78,6 +78,8 @@ PlacesUtils.getViewForNode(this); + false + @@ -231,14 +233,14 @@ // draw the drop indicator outside of them var betweenMarkers = true; if (this._startMarker != -1 && - target.boxObject.y < this.childNodes[this._startMarker].boxObject.y) + target.boxObject.y <= this.childNodes[this._startMarker].boxObject.y) betweenMarkers = false; if (this._endMarker != -1 && - target.boxObject.y > this.childNodes[this._endMarker].boxObject.y) + target.boxObject.y >= this.childNodes[this._endMarker].boxObject.y) betweenMarkers = false; // hide the dropmarker if current node is not a places bookmark item - return !(target && betweenMarkers && this.canDrop()); + return !(target && target.node && betweenMarkers && this.canDrop()); ]]> @@ -494,14 +496,13 @@ readonly="true" onget="return this._controller;"/> - false - @@ -522,58 +523,6 @@ ]]> - - - 0) - --this._endMarker; - } - } - - // If no static items were found at the beginning, remove all items before - // the static items at the end. - if (aPopup._startMarker == -1) { - var end = aPopup._endMarker == -1 ? - aPopup.childNodes.length - 1 : aPopup._endMarker - 1; - for (var i = end; i >=0; i--) { - // skip the empty menu item - if (aPopup._emptyMenuItem != aPopup.childNodes[i]) { - aPopup.removeChild(aPopup.childNodes[i]); - if (aPopup._endMarker > 0) - --aPopup._endMarker; - } - } - } - ]]> - - 0) { diff --git a/browser/components/places/content/toolbar.xml b/browser/components/places/content/toolbar.xml index 94f04289ce7..0cb326a09bb 100755 --- a/browser/components/places/content/toolbar.xml +++ b/browser/components/places/content/toolbar.xml @@ -983,10 +983,20 @@ @@ -996,12 +1006,7 @@ if (aPopup._built) return; - // remove previous menu items - while (aPopup.hasChildNodes()) - aPopup.removeChild(aPopup.firstChild); - // restore the empty-menu item if has been created already - if (aPopup._emptyMenuItem) - aPopup.appendChild(aPopup._emptyMenuItem); + PlacesUtils.cleanPlacesPopup(aPopup); var resultNode = aPopup._resultNode; if (!resultNode.containerOpen) @@ -1018,8 +1023,10 @@ } } else { - // add element to show it is empty. - this._showEmptyMenuItem(aPopup); + // This menu is empty. If there is no static content, add + // an element to show it is empty. + if (aPopup._startMarker == -1 && aPopup._endMarker == -1) + this._showEmptyMenuItem(aPopup); } aPopup._built = true; ]]> diff --git a/browser/components/places/content/utils.js b/browser/components/places/content/utils.js index 703716ed6fb..0584fa7b636 100644 --- a/browser/components/places/content/utils.js +++ b/browser/components/places/content/utils.js @@ -1896,6 +1896,54 @@ var PlacesUtils = { return element; }, + cleanPlacesPopup: function PU_cleanPlacesPopup(aPopup) { + // Find static menuitems at the start and at the end of the menupopup, + // marked by builder="start" and builder="end" attributes, and set + // markers to keep track of their indices. + var items = []; + aPopup._startMarker = -1; + aPopup._endMarker = -1; + for (var i = 0; i < aPopup.childNodes.length; ++i) { + var item = aPopup.childNodes[i]; + if (item.getAttribute("builder") == "start") { + aPopup._startMarker = i; + continue; + } + if (item.getAttribute("builder") == "end") { + aPopup._endMarker = i; + continue; + } + if ((aPopup._startMarker != -1) && (aPopup._endMarker == -1)) + items.push(item); + } + + // If static items at the beginning were found, remove all items between + // them and the static content at the end. + for (var i = 0; i < items.length; ++i) { + // skip the empty menu item + if (aPopup._emptyMenuItem != items[i]) { + aPopup.removeChild(items[i]); + if (this._endMarker > 0) + --this._endMarker; + } + } + + // If no static items were found at the beginning, remove all items before + // the static items at the end. + if (aPopup._startMarker == -1) { + var end = aPopup._endMarker == -1 ? + aPopup.childNodes.length - 1 : aPopup._endMarker - 1; + for (var i = end; i >= 0; i--) { + // skip the empty menu item + if (aPopup._emptyMenuItem != aPopup.childNodes[i]) { + aPopup.removeChild(aPopup.childNodes[i]); + if (aPopup._endMarker > 0) + --aPopup._endMarker; + } + } + } + }, + getBestTitle: function PU_getBestTitle(aNode) { var title; if (!aNode.title && this.uriTypes.indexOf(aNode.type) != -1) { From 8f21b0240cd6b6e733d96bded4270dc774def057 Mon Sep 17 00:00:00 2001 From: "dtownsend@oxymoronical.com" Date: Wed, 12 Mar 2008 04:12:02 -0700 Subject: [PATCH 43/65] Bug 417606: See all search results always number 10 (config change). r=robstring. --- browser/app/profile/firefox.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index da37da6f98d..74531ed8577 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -73,9 +73,9 @@ pref("extensions.getAddons.showPane", true); pref("extensions.getAddons.browseAddons", "https://%LOCALE%.add-ons.mozilla.com/%LOCALE%/%APP%"); pref("extensions.getAddons.maxResults", 5); pref("extensions.getAddons.recommended.browseURL", "https://%LOCALE%.add-ons.mozilla.com/%LOCALE%/%APP%/recommended"); -pref("extensions.getAddons.recommended.url", "https://services.addons.mozilla.org/%LOCALE%/%APP%/api/list/featured/all/10"); +pref("extensions.getAddons.recommended.url", "https://services.addons.mozilla.org/%LOCALE%/%APP%/api/%API_VERSION%/list/featured/all/10/%OS%/%VERSION%"); pref("extensions.getAddons.search.browseURL", "https://%LOCALE%.add-ons.mozilla.com/%LOCALE%/%APP%/search?q=%TERMS%"); -pref("extensions.getAddons.search.url", "https://services.addons.mozilla.org/%LOCALE%/%APP%/api/search/%TERMS%"); +pref("extensions.getAddons.search.url", "https://services.addons.mozilla.org/%LOCALE%/%APP%/api/%API_VERSION%/search/%TERMS%/all/10/%OS%/%VERSION%"); // Blocklist preferences pref("extensions.blocklist.enabled", true); From dbd95b1964acb72b8cc6ad2fdd6d7a65557197b4 Mon Sep 17 00:00:00 2001 From: "reed@reedloden.com" Date: Wed, 12 Mar 2008 04:13:09 -0700 Subject: [PATCH 44/65] Bug 305782 - "Please allow to use system bzip2 library" [p=mh+mozilla@glandium.org (Mike Hommey) r=bsmedberg a1.9=beltzner] --- config/Makefile.in | 1 + config/autoconf.mk.in | 11 ++++++ config/system-headers | 3 ++ configure.in | 36 +++++++++++++++++++ extensions/metrics/build/Makefile.in | 4 +-- extensions/metrics/src/Makefile.in | 2 +- extensions/metrics/test/Makefile.in | 4 ++- other-licenses/bsdiff/Makefile.in | 4 ++- .../mozapps/update/src/updater/Makefile.in | 6 ++-- .../mozapps/update/src/updater/updater.cpp | 4 +++ toolkit/toolkit-makefiles.sh | 14 ++++---- toolkit/toolkit-tiers.mk | 2 ++ 12 files changed, 78 insertions(+), 13 deletions(-) diff --git a/config/Makefile.in b/config/Makefile.in index 8330678dc78..cf80cc10be3 100644 --- a/config/Makefile.in +++ b/config/Makefile.in @@ -122,6 +122,7 @@ export:: -DMOZ_TREE_CAIRO=$(MOZ_TREE_CAIRO) \ -DMOZ_ENABLE_LIBXUL=$(MOZ_ENABLE_LIBXUL) \ -DMOZ_NATIVE_HUNSPELL=$(MOZ_NATIVE_HUNSPELL) \ + -DMOZ_NATIVE_BZ2=$(MOZ_NATIVE_BZ2) \ -DMOZ_NATIVE_ZLIB=$(MOZ_NATIVE_ZLIB) \ -DMOZ_NATIVE_PNG=$(MOZ_NATIVE_PNG) \ -DMOZ_NATIVE_JPEG=$(MOZ_NATIVE_JPEG) \ diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in index 13b63cff53c..1ecdee60049 100644 --- a/config/autoconf.mk.in +++ b/config/autoconf.mk.in @@ -212,6 +212,7 @@ MOZ_HUNSPELL_LIBS = @MOZ_HUNSPELL_LIBS@ MOZ_HUNSPELL_CFLAGS = @MOZ_HUNSPELL_CFLAGS@ MOZ_NATIVE_ZLIB = @SYSTEM_ZLIB@ +MOZ_NATIVE_BZ2 = @SYSTEM_BZ2@ MOZ_NATIVE_JPEG = @SYSTEM_JPEG@ MOZ_NATIVE_PNG = @SYSTEM_PNG@ MOZ_TREE_CAIRO = @MOZ_TREE_CAIRO@ @@ -409,6 +410,16 @@ endif ZLIB_REQUIRES = zlib endif +ifdef MOZ_NATIVE_BZ2 +BZ2_CFLAGS = @BZ2_CFLAGS@ +BZ2_LIBS = @BZ2_LIBS@ +BZ2_REQUIRES = +else +BZ2_CFLAGS = @MOZ_BZ2_CFLAGS@ +BZ2_LIBS = @MOZ_BZ2_LIBS@ +BZ2_REQUIRES = libbz2 +endif + ifdef MOZ_NATIVE_PNG PNG_CFLAGS = @PNG_CFLAGS@ PNG_LIBS = @PNG_LIBS@ diff --git a/config/system-headers b/config/system-headers index e2439dfa864..dfd406182c6 100644 --- a/config/system-headers +++ b/config/system-headers @@ -971,3 +971,6 @@ libsn/sn-util.h #if MOZ_NATIVE_HUNSPELL==1 hunspell.hxx #endif +#if MOZ_NATIVE_BZ2==1 +bzlib.h +#endif diff --git a/configure.in b/configure.in index 22b7745270b..88f3446bda2 100644 --- a/configure.in +++ b/configure.in @@ -921,6 +921,8 @@ MOZ_JPEG_CFLAGS= MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)' MOZ_ZLIB_CFLAGS= MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)' +MOZ_BZ2_CFLAGS= +MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)' MOZ_PNG_CFLAGS= MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)' @@ -4061,6 +4063,35 @@ if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}" fi +dnl system BZIP2 Support +dnl ======================================================== +MOZ_ARG_WITH_STRING(system-bz2, +[ --with-system-bz2[=PFX] + Use system libbz2 [installed at prefix PFX]], + BZ2_DIR=$withval) + +_SAVE_CFLAGS=$CFLAGS +_SAVE_LDFLAGS=$LDFLAGS +_SAVE_LIBS=$LIBS +if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then + CFLAGS="-I${BZ2_DIR}/include $CFLAGS" + LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS" +fi +if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then + SYSTEM_BZ2= +else + AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"], + [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=], $BZ2_LIBS) +fi +CFLAGS=$_SAVE_CFLAGS +LDFLAGS=$_SAVE_LDFLAGS +LIBS=$_SAVE_LIBS + +if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then + BZ2_CFLAGS="-I${BZ2_DIR}/include" + BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}" +fi + dnl system PNG Support dnl ======================================================== MOZ_ARG_WITH_STRING(system-png, @@ -7685,11 +7716,14 @@ AC_SUBST(SYSTEM_MAKEDEPEND) AC_SUBST(SYSTEM_JPEG) AC_SUBST(SYSTEM_PNG) AC_SUBST(SYSTEM_ZLIB) +AC_SUBST(SYSTEM_BZ2) AC_SUBST(JPEG_CFLAGS) AC_SUBST(JPEG_LIBS) AC_SUBST(ZLIB_CFLAGS) AC_SUBST(ZLIB_LIBS) +AC_SUBST(BZ2_CFLAGS) +AC_SUBST(BZ2_LIBS) AC_SUBST(PNG_CFLAGS) AC_SUBST(PNG_LIBS) @@ -7697,6 +7731,8 @@ AC_SUBST(MOZ_JPEG_CFLAGS) AC_SUBST(MOZ_JPEG_LIBS) AC_SUBST(MOZ_ZLIB_CFLAGS) AC_SUBST(MOZ_ZLIB_LIBS) +AC_SUBST(MOZ_BZ2_CFLAGS) +AC_SUBST(MOZ_BZ2_LIBS) AC_SUBST(MOZ_PNG_CFLAGS) AC_SUBST(MOZ_PNG_LIBS) diff --git a/extensions/metrics/build/Makefile.in b/extensions/metrics/build/Makefile.in index fb97539fa6c..17596421049 100644 --- a/extensions/metrics/build/Makefile.in +++ b/extensions/metrics/build/Makefile.in @@ -61,11 +61,11 @@ CPPSRCS = \ SHARED_LIBRARY_LIBS = \ ../src/$(LIB_PREFIX)metrics_s.$(LIB_SUFFIX) \ - $(DEPTH)/modules/libbz2/src/$(LIB_PREFIX)bz2.$(LIB_SUFFIX) \ $(NULL) EXTRA_DSO_LDOPTS = $(XPCOM_GLUE_LDOPTS) \ $(NSPR_LIBS) \ + $(BZ2_LIBS) \ $(NULL) LOCAL_INCLUDES = \ @@ -80,4 +80,4 @@ ifeq ($(OS_ARCH)_$(GNU_CC), WINNT_) LDFLAGS += -NODEFAULTLIB:MSVCRT endif - +CXXFLAGS += $(BZ2_CFLAGS) diff --git a/extensions/metrics/src/Makefile.in b/extensions/metrics/src/Makefile.in index 6648c55c22b..3d7f59edaa8 100644 --- a/extensions/metrics/src/Makefile.in +++ b/extensions/metrics/src/Makefile.in @@ -57,7 +57,7 @@ REQUIRES = xpcom \ docshell \ layout \ widget \ - libbz2 \ + $(BZ2_REQUIRES) \ xulapp \ extensions \ rdf \ diff --git a/extensions/metrics/test/Makefile.in b/extensions/metrics/test/Makefile.in index 71865ab7d1e..308db03daa6 100644 --- a/extensions/metrics/test/Makefile.in +++ b/extensions/metrics/test/Makefile.in @@ -67,7 +67,7 @@ LOCAL_INCLUDES = \ LIBS = \ ../src/$(LIB_PREFIX)metrics_s.$(LIB_SUFFIX) \ - $(DEPTH)/modules/libbz2/src/$(LIB_PREFIX)bz2.$(LIB_SUFFIX) \ + $(BZ2_LIBS) \ $(XPCOM_GLUE_LDOPTS) \ $(NSPR_LIBS) \ $(NULL) @@ -76,6 +76,8 @@ XPCSHELL_TESTS = unit include $(topsrcdir)/config/rules.mk +CXXFLAGS += $(BZ2_CFLAGS) + # Give the unit tests absolute paths to the data and temp directories. # For cygwin, we need to convert the paths to native Windows paths. ifdef CYGWIN_WRAPPER diff --git a/other-licenses/bsdiff/Makefile.in b/other-licenses/bsdiff/Makefile.in index 622027e6a22..6e64a51fa0f 100644 --- a/other-licenses/bsdiff/Makefile.in +++ b/other-licenses/bsdiff/Makefile.in @@ -47,7 +47,7 @@ include $(DEPTH)/config/autoconf.mk # build system and is not intended to be included in Mozilla distributions. HOST_PROGRAM = mbsdiff$(BIN_SUFFIX) HOST_CSRCS = bsdiff.c -HOST_LIBS += $(DEPTH)/modules/libbz2/src/$(LIB_PREFIX)bz2.$(LIB_SUFFIX) +HOST_LIBS += $(BZ2_LIBS) ifeq (WINNT,$(OS_ARCH)) HOST_EXTRA_LIBS += $(call EXPAND_LIBNAME,Ws2_32) @@ -56,3 +56,5 @@ endif LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/mozapps/update/src/updater include $(topsrcdir)/config/rules.mk + +CXXFLAGS += $(BZ2_CFLAGS) diff --git a/toolkit/mozapps/update/src/updater/Makefile.in b/toolkit/mozapps/update/src/updater/Makefile.in index d020d6f4fe4..b5f06064c13 100644 --- a/toolkit/mozapps/update/src/updater/Makefile.in +++ b/toolkit/mozapps/update/src/updater/Makefile.in @@ -54,12 +54,12 @@ PROGRAM = updater$(BIN_SUFFIX) REQUIRES = \ libmar \ - libbz2 \ + $(BZ2_REQUIRES) \ $(NULL) LIBS += \ $(DEPTH)/modules/libmar/src/$(LIB_PREFIX)mar.$(LIB_SUFFIX) \ - $(DEPTH)/modules/libbz2/src/$(LIB_PREFIX)bz2.$(LIB_SUFFIX) \ + $(BZ2_LIBS) \ $(NULL) ifeq ($(OS_ARCH),WINNT) @@ -130,3 +130,5 @@ ifeq ($(OS_ARCH),WINNT) LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre REQUIRES += string endif + +CXXFLAGS += $(BZ2_CFLAGS) diff --git a/toolkit/mozapps/update/src/updater/updater.cpp b/toolkit/mozapps/update/src/updater/updater.cpp index 52027c9d0cc..b04446435ee 100644 --- a/toolkit/mozapps/update/src/updater/updater.cpp +++ b/toolkit/mozapps/update/src/updater/updater.cpp @@ -138,7 +138,11 @@ void LaunchChild(int argc, char **argv); // This variable lives in libbz2. It's declared in bzlib_private.h, so we just // declare it here to avoid including that entire header file. +#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) +extern "C" __attribute__((visibility("default"))) unsigned int BZ2_crc32Table[256]; +#else extern "C" unsigned int BZ2_crc32Table[256]; +#endif static unsigned int crc32(const unsigned char *buf, unsigned int len) diff --git a/toolkit/toolkit-makefiles.sh b/toolkit/toolkit-makefiles.sh index 1136132a96f..5d542a29ce5 100644 --- a/toolkit/toolkit-makefiles.sh +++ b/toolkit/toolkit-makefiles.sh @@ -748,15 +748,11 @@ MAKEFILES_accessible=" accessible/src/mac/Makefile accessible/build/Makefile " + MAKEFILES_zlib=" modules/zlib/standalone/Makefile " -MAKEFILES_libbz2=" - modules/libbz2/Makefile - modules/libbz2/src/Makefile -" - MAKEFILES_libmar=" modules/libmar/Makefile modules/libmar/src/Makefile @@ -805,7 +801,6 @@ add_makefiles " $MAKEFILES_libpr0n $MAKEFILES_accessible $MAKEFILES_zlib - $MAKEFILES_libbz2 $MAKEFILES_libmar " @@ -979,6 +974,13 @@ if [ ! "$SYSTEM_ZLIB" ]; then " fi +if [ ! "$SYSTEM_BZ2" ]; then + add_makefiles " + modules/libbz2/Makefile + modules/libbz2/src/Makefile + " +fi + if test -n "$MOZ_UPDATE_PACKAGING"; then add_makefiles " tools/update-packaging/Makefile diff --git a/toolkit/toolkit-tiers.mk b/toolkit/toolkit-tiers.mk index 5f3a98db8cb..48832585d23 100644 --- a/toolkit/toolkit-tiers.mk +++ b/toolkit/toolkit-tiers.mk @@ -64,7 +64,9 @@ tier_external_dirs += modules/zlib/standalone endif ifdef MOZ_UPDATER +ifndef MOZ_NATIVE_BZ2 tier_external_dirs += modules/libbz2 +endif tier_external_dirs += modules/libmar endif From 907124351a75fa2658e56ba1d27f29878f5f4903 Mon Sep 17 00:00:00 2001 From: "reed@reedloden.com" Date: Wed, 12 Mar 2008 04:34:34 -0700 Subject: [PATCH 45/65] Fix bustage from bug 416003. --- widget/src/gtk2/gtk2drawing.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/widget/src/gtk2/gtk2drawing.c b/widget/src/gtk2/gtk2drawing.c index bd8560414a4..8375bfbe0ac 100644 --- a/widget/src/gtk2/gtk2drawing.c +++ b/widget/src/gtk2/gtk2drawing.c @@ -1707,8 +1707,8 @@ moz_gtk_combo_box_entry_button_paint(GdkDrawable* drawable, GdkRectangle* rect, arrow_rect.y += y_displacement; } - calculate_arrow_dimensions(gComboBoxEntryArrowWidget, - &arrow_rect, &real_arrow_rect, direction); + calculate_arrow_rect(gComboBoxEntryArrowWidget, + &arrow_rect, &real_arrow_rect, direction); style = gComboBoxEntryArrowWidget->style; TSOffsetStyleGCs(style, real_arrow_rect.x, real_arrow_rect.y); From 90dd6b1b73363b9a52f2c69544fc65bf2dec7a46 Mon Sep 17 00:00:00 2001 From: "reed@reedloden.com" Date: Wed, 12 Mar 2008 04:42:32 -0700 Subject: [PATCH 46/65] Bug 409748 - "No statusbar-text for bookmarks toolbar sub-menu items" [p=dev@schonfeld.org (Michael Schonfeld) r=Mano a1.9=damons] --- browser/components/places/content/menu.xml | 30 ++++++++++++++++++++++ browser/components/places/content/utils.js | 1 - 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/browser/components/places/content/menu.xml b/browser/components/places/content/menu.xml index 1257b8a6416..f5d6939a04c 100755 --- a/browser/components/places/content/menu.xml +++ b/browser/components/places/content/menu.xml @@ -454,6 +454,36 @@ + + diff --git a/browser/components/places/content/utils.js b/browser/components/places/content/utils.js index 0584fa7b636..cc2d5fcb795 100644 --- a/browser/components/places/content/utils.js +++ b/browser/components/places/content/utils.js @@ -1853,7 +1853,6 @@ var PlacesUtils = { if (this.uriTypes.indexOf(type) != -1) { element = document.createElement("menuitem"); - element.setAttribute("statustext", aNode.uri); element.className = "menuitem-iconic bookmark-item"; } else if (this.containerTypes.indexOf(type) != -1) { From 1867381d21bb0b3584313aeb3e7d0a0910517be0 Mon Sep 17 00:00:00 2001 From: "mcsmurf@mcsmurf.de" Date: Wed, 12 Mar 2008 05:09:06 -0700 Subject: [PATCH 47/65] bustage fix for Bug 421787 --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 88f3446bda2..e6b96277392 100644 --- a/configure.in +++ b/configure.in @@ -3972,7 +3972,7 @@ else if test -z "$GNU_CC" && test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then NSS_LIBS="\ \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \ - \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$IMPORT_LIB_SUFFIX) \ + \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \ \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \ \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \ \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \ From 2d2dd3357b586b8d85fdb43115edd9e471ed067d Mon Sep 17 00:00:00 2001 From: "cbiesinger@gmail.com" Date: Wed, 12 Mar 2008 05:58:06 -0700 Subject: [PATCH 48/65] bug 395581 release and null out mTransaction when its Init method failed so that we don't try to do anything with this half-initialized object, in particular call Close on it. r+sr=bz a=shaver --- netwerk/protocol/http/src/nsHttpChannel.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/netwerk/protocol/http/src/nsHttpChannel.cpp b/netwerk/protocol/http/src/nsHttpChannel.cpp index 730bc5747c2..f57a8f3531d 100644 --- a/netwerk/protocol/http/src/nsHttpChannel.cpp +++ b/netwerk/protocol/http/src/nsHttpChannel.cpp @@ -600,7 +600,10 @@ nsHttpChannel::SetupTransaction() mUploadStream, mUploadStreamHasHeaders, NS_GetCurrentThread(), callbacks, this, getter_AddRefs(responseStream)); - if (NS_FAILED(rv)) return rv; + if (NS_FAILED(rv)) { + NS_RELEASE(mTransaction); + return rv; + } rv = nsInputStreamPump::Create(getter_AddRefs(mTransactionPump), responseStream); From 0a0bdf78b21d07bd5296bfec60cdbf852bb225e9 Mon Sep 17 00:00:00 2001 From: "reed@reedloden.com" Date: Wed, 12 Mar 2008 06:59:14 -0700 Subject: [PATCH 49/65] Bug 416868 - "Size of native style toolkit arrow" (Skin changes) [p=frnchfrgg-mozbugs@altern.org (RIVAUD Julien [_FrnchFrgg_]) r=Ryan a1.9=damons] --- toolkit/themes/gnomestripe/global/button.css | 7 +------ toolkit/themes/gnomestripe/global/dropmarker.css | 3 +++ toolkit/themes/gnomestripe/global/jar.mn | 1 + toolkit/themes/gnomestripe/global/toolbarbutton.css | 11 +---------- 4 files changed, 6 insertions(+), 16 deletions(-) create mode 100644 toolkit/themes/gnomestripe/global/dropmarker.css diff --git a/toolkit/themes/gnomestripe/global/button.css b/toolkit/themes/gnomestripe/global/button.css index 5a4fd1fa84c..9182488a9dd 100644 --- a/toolkit/themes/gnomestripe/global/button.css +++ b/toolkit/themes/gnomestripe/global/button.css @@ -154,12 +154,7 @@ button[type="menu-button"] { .button-menu-dropmarker, .button-menubutton-dropmarker { - -moz-appearance: none !important; - margin: 1px; - background-color: transparent !important; - border: none !important; - min-width:11px; - min-height:11px; + -moz-appearance: toolbarbutton-dropdown !important; } .button-menubutton-dropmarker[open="true"] { diff --git a/toolkit/themes/gnomestripe/global/dropmarker.css b/toolkit/themes/gnomestripe/global/dropmarker.css new file mode 100644 index 00000000000..061334ae19f --- /dev/null +++ b/toolkit/themes/gnomestripe/global/dropmarker.css @@ -0,0 +1,3 @@ +dropmarker { + -moz-appearance: menulist-button; +} diff --git a/toolkit/themes/gnomestripe/global/jar.mn b/toolkit/themes/gnomestripe/global/jar.mn index 17e88768954..7cb38c67ce5 100644 --- a/toolkit/themes/gnomestripe/global/jar.mn +++ b/toolkit/themes/gnomestripe/global/jar.mn @@ -7,6 +7,7 @@ classic.jar: + skin/classic/global/tabbox.css + skin/classic/global/toolbar.css + skin/classic/global/toolbarbutton.css ++ skin/classic/global/dropmarker.css + skin/classic/global/button.css + skin/classic/global/checkbox.css + skin/classic/global/splitter.css diff --git a/toolkit/themes/gnomestripe/global/toolbarbutton.css b/toolkit/themes/gnomestripe/global/toolbarbutton.css index 70c22510b95..1146d3700fc 100644 --- a/toolkit/themes/gnomestripe/global/toolbarbutton.css +++ b/toolkit/themes/gnomestripe/global/toolbarbutton.css @@ -116,12 +116,10 @@ toolbarbutton[checked="true"]:hover:active { .toolbarbutton-menu-dropmarker { -moz-appearance: toolbarbutton-dropdown !important; list-style-image: none; - width: 13px; - height: 13px; border: none !important; background-color: transparent !important; padding: 0; - margin: 2px; + margin: 0; } .toolbarbutton-menu-dropmarker[disabled="true"] { @@ -161,11 +159,4 @@ toolbarbutton[type="menu-button"][disabled="true"]:hover:active { padding: 3px; -moz-appearance: toolbarbutton-dropdown !important; list-style-image: none; - width: 12px; - height: 12px; } - -.toolbarbutton-menubutton-dropmarker[disabled="true"] { - padding: 3px !important; -} - From 25afe20eb6545024390a0cc547ab9c7cbb5bab63 Mon Sep 17 00:00:00 2001 From: "reed@reedloden.com" Date: Wed, 12 Mar 2008 07:00:35 -0700 Subject: [PATCH 50/65] Bug 416868 - "Size of native style toolkit arrow" (Correct arrow rect and make it advertise its size) [p=frnchfrgg-mozbugs@altern.org (RIVAUD Julien [_FrnchFrgg_]) r=Ventron sr=roc a1.9=damons] --- widget/src/gtk2/gtk2drawing.c | 19 +++++++++++++++---- widget/src/gtk2/gtkdrawing.h | 9 +++++++++ widget/src/gtk2/nsNativeThemeGTK.cpp | 7 ++++++- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/widget/src/gtk2/gtk2drawing.c b/widget/src/gtk2/gtk2drawing.c index 8375bfbe0ac..0a2757477f8 100644 --- a/widget/src/gtk2/gtk2drawing.c +++ b/widget/src/gtk2/gtk2drawing.c @@ -1638,10 +1638,8 @@ moz_gtk_downarrow_paint(GdkDrawable* drawable, GdkRectangle* rect, ensure_button_arrow_widget(); style = gButtonArrowWidget->style; - arrow_rect.x = rect->x + 1 + XTHICKNESS(style); - arrow_rect.y = rect->y + 1 + YTHICKNESS(style); - arrow_rect.width = MAX(1, rect->width - (arrow_rect.x - rect->x) * 2); - arrow_rect.height = MAX(1, rect->height - (arrow_rect.y - rect->y) * 2); + calculate_arrow_rect(gButtonArrowWidget, rect, &arrow_rect, + GTK_TEXT_DIR_LTR); TSOffsetStyleGCs(style, arrow_rect.x, arrow_rect.y); gtk_paint_arrow(style, drawable, state_type, shadow_type, cliprect, @@ -2701,6 +2699,19 @@ moz_gtk_get_tab_scroll_arrow_size(gint* width, gint* height) return MOZ_GTK_SUCCESS; } +gint +moz_gtk_get_downarrow_size(gint* width, gint* height) +{ + GtkRequisition requisition; + ensure_button_arrow_widget(); + + gtk_widget_size_request(gButtonArrowWidget, &requisition); + *width = requisition.width; + *height = requisition.height; + + return MOZ_GTK_SUCCESS; +} + gint moz_gtk_get_toolbar_separator_width(gint* size) { diff --git a/widget/src/gtk2/gtkdrawing.h b/widget/src/gtk2/gtkdrawing.h index 71c3437ce7e..4c9d89c4c8b 100644 --- a/widget/src/gtk2/gtkdrawing.h +++ b/widget/src/gtk2/gtkdrawing.h @@ -352,6 +352,15 @@ gint moz_gtk_get_combo_box_entry_button_size(gint* width, gint* height); */ gint moz_gtk_get_tab_scroll_arrow_size(gint* width, gint* height); +/** + * Get the desired size of a toolbar button dropdown arrow + * width: [OUT] the desired width + * height: [OUT] the desired height + * + * returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise + */ +gint moz_gtk_get_downarrow_size(gint* width, gint* height); + /** * Get the desired size of a toolbar separator * size: [OUT] the desired width diff --git a/widget/src/gtk2/nsNativeThemeGTK.cpp b/widget/src/gtk2/nsNativeThemeGTK.cpp index f9663d2d8c3..4e69efa2d15 100644 --- a/widget/src/gtk2/nsNativeThemeGTK.cpp +++ b/widget/src/gtk2/nsNativeThemeGTK.cpp @@ -1116,7 +1116,12 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsIRenderingContext* aContext, *aIsOverridable = PR_FALSE; } break; - + case NS_THEME_TOOLBAR_BUTTON_DROPDOWN: + { + moz_gtk_get_downarrow_size(&aResult->width, &aResult->height); + *aIsOverridable = PR_FALSE; + } + break; case NS_THEME_CHECKBOX_CONTAINER: case NS_THEME_RADIO_CONTAINER: case NS_THEME_CHECKBOX_LABEL: From 16bc7fe7dc33ba5ac6c0ec40b90cd9fa29ab6c56 Mon Sep 17 00:00:00 2001 From: "igor@mir2.org" Date: Wed, 12 Mar 2008 07:36:06 -0700 Subject: [PATCH 51/65] bug=420904 support for custom options for jsinterp.c in js shell build scripts. This is outside of tree. --- js/src/Makefile.ref | 1 + js/src/config.mk | 4 ++++ js/src/rules.mk | 7 +++++++ 3 files changed, 12 insertions(+) diff --git a/js/src/Makefile.ref b/js/src/Makefile.ref index 7a415b33165..658f2d5c3a4 100644 --- a/js/src/Makefile.ref +++ b/js/src/Makefile.ref @@ -84,6 +84,7 @@ endif # #CFLAGS += -DDEBUG -DDEBUG_brendan -DJS_ARENAMETER -DJS_HASHMETER -DJS_DUMP_PROPTREE_STATS -DJS_DUMP_SCOPE_METERS -DJS_SCOPE_DEPTH_METER -DJS_BASIC_STATS CFLAGS += $(OPTIMIZER) $(OS_CFLAGS) $(DEFINES) $(INCLUDES) $(XCFLAGS) +INTERP_CFLAGS += $(INTERP_OPTIMIZER) $(OS_CFLAGS) $(DEFINES) $(INCLUDES) $(XCFLAGS) $(INTERP_XCFLAGS) LDFLAGS = $(XLDFLAGS) diff --git a/js/src/config.mk b/js/src/config.mk index f0fd4ae3d2c..a0ce3619faf 100644 --- a/js/src/config.mk +++ b/js/src/config.mk @@ -119,17 +119,21 @@ endif ifdef BUILD_OPT ifdef USE_MSVC OPTIMIZER = -O2 -GL +INTERP_OPTIMIZER = -O2 -GL LDFLAGS += -LTCG else OPTIMIZER = -Os +INTERP_OPTIMIZER = -Os endif DEFINES += -UDEBUG -DNDEBUG -UDEBUG_$(USER) OBJDIR_TAG = _OPT else ifdef USE_MSVC OPTIMIZER = -Zi +INTERP_OPTIMIZER = -Zi else OPTIMIZER = -g3 +INTERP_OPTIMIZER = -g3 endif DEFINES += -DDEBUG -DDEBUG_$(USER) OBJDIR_TAG = _DBG diff --git a/js/src/rules.mk b/js/src/rules.mk index 9a7ace3f2d8..91b4c3f516e 100644 --- a/js/src/rules.mk +++ b/js/src/rules.mk @@ -77,6 +77,9 @@ $(OBJDIR)/%.o: %.c %.h @$(MAKE_OBJDIR) $(CC) -o $@ -c $(CFLAGS) $*.c +$(OBJDIR)/jsinterp.o: jsinterp.c jsinterp.h + @$(MAKE_OBJDIR) + $(CC) -o $@ -c $(INTERP_CFLAGS) jsinterp.c $(OBJDIR)/%.o: %.c @$(MAKE_OBJDIR) @@ -91,6 +94,10 @@ $(OBJDIR)/%.obj: %.c %.h @$(MAKE_OBJDIR) $(CC) -Fo$(OBJDIR)/ -c $(CFLAGS) $(JSDLL_CFLAGS) $*.c +$(OBJDIR)/jsinterp.obj: jsinterp.c jsinterp.h + @$(MAKE_OBJDIR) + $(CC) -Fo$(OBJDIR)/ -c $(INTERP_CFLAGS) $(JSDLL_CFLAGS) jsinterp.c + $(OBJDIR)/%.obj: %.c @$(MAKE_OBJDIR) $(CC) -Fo$(OBJDIR)/ -c $(CFLAGS) $(JSDLL_CFLAGS) $*.c From 2bb7ce1ef66ec4d9b0e346bc3b0600e58c3267d6 Mon Sep 17 00:00:00 2001 From: "reed@reedloden.com" Date: Wed, 12 Mar 2008 08:56:14 -0700 Subject: [PATCH 52/65] Back out patch from Julien Rivaud in bug 416868 due to reftest failure. --- toolkit/themes/gnomestripe/global/button.css | 7 ++++++- .../themes/gnomestripe/global/dropmarker.css | 3 --- toolkit/themes/gnomestripe/global/jar.mn | 1 - .../gnomestripe/global/toolbarbutton.css | 11 ++++++++++- widget/src/gtk2/gtk2drawing.c | 19 ++++--------------- widget/src/gtk2/gtkdrawing.h | 9 --------- widget/src/gtk2/nsNativeThemeGTK.cpp | 7 +------ 7 files changed, 21 insertions(+), 36 deletions(-) delete mode 100644 toolkit/themes/gnomestripe/global/dropmarker.css diff --git a/toolkit/themes/gnomestripe/global/button.css b/toolkit/themes/gnomestripe/global/button.css index 9182488a9dd..5a4fd1fa84c 100644 --- a/toolkit/themes/gnomestripe/global/button.css +++ b/toolkit/themes/gnomestripe/global/button.css @@ -154,7 +154,12 @@ button[type="menu-button"] { .button-menu-dropmarker, .button-menubutton-dropmarker { - -moz-appearance: toolbarbutton-dropdown !important; + -moz-appearance: none !important; + margin: 1px; + background-color: transparent !important; + border: none !important; + min-width:11px; + min-height:11px; } .button-menubutton-dropmarker[open="true"] { diff --git a/toolkit/themes/gnomestripe/global/dropmarker.css b/toolkit/themes/gnomestripe/global/dropmarker.css deleted file mode 100644 index 061334ae19f..00000000000 --- a/toolkit/themes/gnomestripe/global/dropmarker.css +++ /dev/null @@ -1,3 +0,0 @@ -dropmarker { - -moz-appearance: menulist-button; -} diff --git a/toolkit/themes/gnomestripe/global/jar.mn b/toolkit/themes/gnomestripe/global/jar.mn index 7cb38c67ce5..17e88768954 100644 --- a/toolkit/themes/gnomestripe/global/jar.mn +++ b/toolkit/themes/gnomestripe/global/jar.mn @@ -7,7 +7,6 @@ classic.jar: + skin/classic/global/tabbox.css + skin/classic/global/toolbar.css + skin/classic/global/toolbarbutton.css -+ skin/classic/global/dropmarker.css + skin/classic/global/button.css + skin/classic/global/checkbox.css + skin/classic/global/splitter.css diff --git a/toolkit/themes/gnomestripe/global/toolbarbutton.css b/toolkit/themes/gnomestripe/global/toolbarbutton.css index 1146d3700fc..70c22510b95 100644 --- a/toolkit/themes/gnomestripe/global/toolbarbutton.css +++ b/toolkit/themes/gnomestripe/global/toolbarbutton.css @@ -116,10 +116,12 @@ toolbarbutton[checked="true"]:hover:active { .toolbarbutton-menu-dropmarker { -moz-appearance: toolbarbutton-dropdown !important; list-style-image: none; + width: 13px; + height: 13px; border: none !important; background-color: transparent !important; padding: 0; - margin: 0; + margin: 2px; } .toolbarbutton-menu-dropmarker[disabled="true"] { @@ -159,4 +161,11 @@ toolbarbutton[type="menu-button"][disabled="true"]:hover:active { padding: 3px; -moz-appearance: toolbarbutton-dropdown !important; list-style-image: none; + width: 12px; + height: 12px; } + +.toolbarbutton-menubutton-dropmarker[disabled="true"] { + padding: 3px !important; +} + diff --git a/widget/src/gtk2/gtk2drawing.c b/widget/src/gtk2/gtk2drawing.c index 0a2757477f8..8375bfbe0ac 100644 --- a/widget/src/gtk2/gtk2drawing.c +++ b/widget/src/gtk2/gtk2drawing.c @@ -1638,8 +1638,10 @@ moz_gtk_downarrow_paint(GdkDrawable* drawable, GdkRectangle* rect, ensure_button_arrow_widget(); style = gButtonArrowWidget->style; - calculate_arrow_rect(gButtonArrowWidget, rect, &arrow_rect, - GTK_TEXT_DIR_LTR); + arrow_rect.x = rect->x + 1 + XTHICKNESS(style); + arrow_rect.y = rect->y + 1 + YTHICKNESS(style); + arrow_rect.width = MAX(1, rect->width - (arrow_rect.x - rect->x) * 2); + arrow_rect.height = MAX(1, rect->height - (arrow_rect.y - rect->y) * 2); TSOffsetStyleGCs(style, arrow_rect.x, arrow_rect.y); gtk_paint_arrow(style, drawable, state_type, shadow_type, cliprect, @@ -2699,19 +2701,6 @@ moz_gtk_get_tab_scroll_arrow_size(gint* width, gint* height) return MOZ_GTK_SUCCESS; } -gint -moz_gtk_get_downarrow_size(gint* width, gint* height) -{ - GtkRequisition requisition; - ensure_button_arrow_widget(); - - gtk_widget_size_request(gButtonArrowWidget, &requisition); - *width = requisition.width; - *height = requisition.height; - - return MOZ_GTK_SUCCESS; -} - gint moz_gtk_get_toolbar_separator_width(gint* size) { diff --git a/widget/src/gtk2/gtkdrawing.h b/widget/src/gtk2/gtkdrawing.h index 4c9d89c4c8b..71c3437ce7e 100644 --- a/widget/src/gtk2/gtkdrawing.h +++ b/widget/src/gtk2/gtkdrawing.h @@ -352,15 +352,6 @@ gint moz_gtk_get_combo_box_entry_button_size(gint* width, gint* height); */ gint moz_gtk_get_tab_scroll_arrow_size(gint* width, gint* height); -/** - * Get the desired size of a toolbar button dropdown arrow - * width: [OUT] the desired width - * height: [OUT] the desired height - * - * returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise - */ -gint moz_gtk_get_downarrow_size(gint* width, gint* height); - /** * Get the desired size of a toolbar separator * size: [OUT] the desired width diff --git a/widget/src/gtk2/nsNativeThemeGTK.cpp b/widget/src/gtk2/nsNativeThemeGTK.cpp index 4e69efa2d15..f9663d2d8c3 100644 --- a/widget/src/gtk2/nsNativeThemeGTK.cpp +++ b/widget/src/gtk2/nsNativeThemeGTK.cpp @@ -1116,12 +1116,7 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsIRenderingContext* aContext, *aIsOverridable = PR_FALSE; } break; - case NS_THEME_TOOLBAR_BUTTON_DROPDOWN: - { - moz_gtk_get_downarrow_size(&aResult->width, &aResult->height); - *aIsOverridable = PR_FALSE; - } - break; + case NS_THEME_CHECKBOX_CONTAINER: case NS_THEME_RADIO_CONTAINER: case NS_THEME_CHECKBOX_LABEL: From 2066bfc46984fc77e0d2fbb020f09f195f7b6750 Mon Sep 17 00:00:00 2001 From: "bhearsum@mozilla.com" Date: Wed, 12 Mar 2008 09:17:25 -0700 Subject: [PATCH 53/65] bug 422122: switch bootstrap.cfg for 200013 release back to stage.m.o. r=nrthomas, patch=me --- tools/release/configs/fx-moz18-bootstrap.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/release/configs/fx-moz18-bootstrap.cfg b/tools/release/configs/fx-moz18-bootstrap.cfg index 78236bc2374..0d320774db5 100644 --- a/tools/release/configs/fx-moz18-bootstrap.cfg +++ b/tools/release/configs/fx-moz18-bootstrap.cfg @@ -65,7 +65,7 @@ buildTree = MozillaRelease stagingUser = cltbld stagingServer = production-1.8-master.build.mozilla.org externalStagingUser = cltbld -externalStagingServer = stage-old.mozilla.org +externalStagingServer = stage.mozilla.org # where beta updates/builds go ftpServer = ftp.mozilla.org # where release updates/builds go @@ -75,7 +75,7 @@ sshUser = cltbld sshServer = production-1.8-master.build.mozilla.org # force 1.8 specific behavior useTalkback = 0 -symbolServer = stage-old.mozilla.org +symbolServer = stage.mozilla.org symbolServerUser = ffxbld symbolServerPath = /mnt/netapp/breakpad/symbols_ffx symbolServerKey = /home/cltbld/.ssh/ffxbld_dsa From fcb8ab3a861d47cefd70352046dddd2f1b2e6c7d Mon Sep 17 00:00:00 2001 From: "dietrich@mozilla.com" Date: Wed, 12 Mar 2008 09:28:45 -0700 Subject: [PATCH 54/65] Bug 421943 ? "redundant multiplexed document" should be a warning not assertion (r=sayre, sr+a=shaver) --- xpcom/io/nsFastLoadFile.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xpcom/io/nsFastLoadFile.cpp b/xpcom/io/nsFastLoadFile.cpp index b50881cffc7..323b198ebad 100644 --- a/xpcom/io/nsFastLoadFile.cpp +++ b/xpcom/io/nsFastLoadFile.cpp @@ -1400,8 +1400,8 @@ nsFastLoadFileWriter::StartMuxedDocument(nsISupports* aURI, saveGeneration = mDocumentMap.generation; } - NS_ASSERTION(docMapEntry->mString == nsnull, - "redundant multiplexed document?"); + NS_WARN_IF_FALSE(docMapEntry->mString == nsnull, + "redundant multiplexed document?"); if (docMapEntry->mString) return NS_ERROR_UNEXPECTED; From dfc4e7fcb2d0a740cdbfc58a2c676190baa94612 Mon Sep 17 00:00:00 2001 From: "gavin@gavinsharp.com" Date: Wed, 12 Mar 2008 09:29:30 -0700 Subject: [PATCH 55/65] Bug 421196: fix xul.css binding rule to make rich autocomplete popup usable for toolkit users, r=enndeakin --- toolkit/content/xul.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/content/xul.css b/toolkit/content/xul.css index 3c11367bb24..f880aa5e1b8 100644 --- a/toolkit/content/xul.css +++ b/toolkit/content/xul.css @@ -745,7 +745,7 @@ panel[type="autocomplete"] { -moz-binding: url("chrome://global/content/bindings/autocomplete.xml#autocomplete-result-popup"); } -panel[type="rich-autocomplete"] { +panel[type="autocomplete-richlistbox"] { -moz-binding: url("chrome://global/content/bindings/autocomplete.xml#autocomplete-rich-result-popup"); } From f6bc031b9e839ed54b0f6b59e30dcf490b58da63 Mon Sep 17 00:00:00 2001 From: "mattwillis@gmail.com" Date: Wed, 12 Mar 2008 09:45:14 -0700 Subject: [PATCH 56/65] Bug 422147 - Add IDs to some menubar elements where they're missing. r=gavin, a1.9+=damons --- browser/base/content/browser-menubar.inc | 30 +++++++++++++++++------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/browser/base/content/browser-menubar.inc b/browser/base/content/browser-menubar.inc index 6db07928ffe..decbc0532f4 100644 --- a/browser/base/content/browser-menubar.inc +++ b/browser/base/content/browser-menubar.inc @@ -41,14 +41,26 @@ - - - - + + +