зеркало из https://github.com/mozilla/gecko-dev.git
landing patch for bug 262218 "libxpcom.so should only export frozen symbols" r=bsmedberg sr=bryner
This commit is contained in:
Родитель
c12b3d3c63
Коммит
52ac61d678
|
@ -39,6 +39,7 @@ bin\js3250.dll
|
|||
bin\plc4.dll
|
||||
bin\plds4.dll
|
||||
bin\xpcom.dll
|
||||
bin\xpcom_core.dll
|
||||
bin\xpistub.dll
|
||||
bin\nspr4.dll
|
||||
bin\components\xpinstal.dll
|
||||
|
|
|
@ -11,3 +11,4 @@
|
|||
0x0d000000 @executable_path/libmozcomps.dylib
|
||||
0x0e000000 @executable_path/libprldap50.dylib
|
||||
0x0f000000 @executable_path/libldap50.dylib
|
||||
0x10000000 @executable_path/libxpcom_core.dylib
|
||||
|
|
|
@ -574,7 +574,7 @@ MOZ_PNG_CFLAGS=
|
|||
MOZ_PNG_LIBS='-L$(DIST)/lib -lmozpng'
|
||||
|
||||
MOZ_JS_LIBS='-L$(DIST)/bin -lmozjs'
|
||||
XPCOM_LIBS='-L$(DIST)/bin -lxpcom'
|
||||
XPCOM_LIBS='-L$(DIST)/bin -lxpcom -lxpcom_core'
|
||||
|
||||
MOZ_COMPONENT_NSPR_LIBS='-L$(DIST)/bin $(NSPR_LIBS)'
|
||||
MOZ_COMPONENT_XPCOM_LIBS='$(XPCOM_LIBS)'
|
||||
|
@ -1145,7 +1145,7 @@ case "$target" in
|
|||
MOZ_ZLIB_LIBS='-L$(DIST)/lib -lmozz'
|
||||
MOZ_PNG_LIBS='-L$(DIST)/lib -lpng'
|
||||
MOZ_JS_LIBS='-L$(DIST)/lib -ljs$(MOZ_BITS)$(VERSION_NUMBER)'
|
||||
XPCOM_LIBS='-L$(DIST)/lib -lxpcom'
|
||||
XPCOM_LIBS='-L$(DIST)/lib -lxpcom -lxpcom_core'
|
||||
DLL_PREFIX=
|
||||
IMPORT_LIB_SUFFIX=dll.a
|
||||
else
|
||||
|
@ -1181,7 +1181,7 @@ case "$target" in
|
|||
MOZ_ZLIB_LIBS='$(DIST)/lib/mozz.lib'
|
||||
MOZ_PNG_LIBS='$(DIST)/lib/png.lib'
|
||||
MOZ_JS_LIBS='$(DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
|
||||
XPCOM_LIBS='$(DIST)/lib/xpcom.lib'
|
||||
XPCOM_LIBS='$(DIST)/lib/xpcom.lib $(DIST)/lib/xpcom_core.lib'
|
||||
MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
|
||||
MOZ_COMPONENT_XPCOM_LIBS='$(XPCOM_LIBS)'
|
||||
MOZ_XPCOM_OBSOLETE_LIBS='$(DIST)/lib/xpcom_compat.lib'
|
||||
|
@ -1426,6 +1426,7 @@ case "$target" in
|
|||
MOZ_WIDGET_TOOLKIT_LDFLAGS='-lwdgt$(MOZ_WIDGET_TOOLKIT)'
|
||||
MOZ_GFX_TOOLKIT_LDFLAGS='-lgfx_$(MOZ_GFX_TOOLKIT)'
|
||||
MOZ_XPCOM_OBSOLETE_LIBS='-L$(DIST)/lib $(DIST)/lib/xpcomct.lib'
|
||||
XPCOM_LIBS='-L$(DIST)/lib $(DIST)/lib/xpcom.lib $(DIST)/lib/xpcomcor.lib'
|
||||
|
||||
# GCC for OS/2 currently predefines these, but we don't want them
|
||||
_DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
|
||||
|
@ -1469,7 +1470,7 @@ case "$target" in
|
|||
MOZ_JS_LIBS='$(DIST)/lib/mozjs.lib'
|
||||
MOZ_COMPONENT_XPCOM_LIBS='$(DIST)/lib/xpcom.lib'
|
||||
MOZ_XPCOM_OBSOLETE_LIBS='$(DIST)/lib/xpcomct.lib'
|
||||
XPCOM_LIBS='$(DIST)/lib/xpcom.lib'
|
||||
XPCOM_LIBS='$(DIST)/lib/xpcom.lib $(DIST)/lib/xpcomcor.lib'
|
||||
MOZ_JPEG_LIBS='$(DIST)/lib/mozjpeg.$(LIB_SUFFIX)'
|
||||
MOZ_ZLIB_LIBS='$(DIST)/lib/mozz.$(LIB_SUFFIX)'
|
||||
MOZ_PNG_LIBS='$(DIST)/lib/mozpng.$(LIB_SUFFIX)'
|
||||
|
|
|
@ -53,9 +53,6 @@ interface nsIEditorObserver;
|
|||
interface nsIEditActionListener;
|
||||
|
||||
%{C++
|
||||
|
||||
#include "nsAString.h"
|
||||
|
||||
class nsIPresShell;
|
||||
class nsIContent;
|
||||
typedef short EDirection;
|
||||
|
|
|
@ -52,6 +52,8 @@ REQUIRES = xpcom \
|
|||
embedcomponents \
|
||||
$(NULL)
|
||||
|
||||
DEFINES += -DMOZILLA_STRICT_API
|
||||
|
||||
SDK_HEADERS = \
|
||||
nsEmbedAPI.h \
|
||||
$(NULL)
|
||||
|
|
|
@ -44,8 +44,11 @@
|
|||
#include "nsIDirectoryService.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsEmbedAPI.h"
|
||||
#include "nsLiteralString.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
|
||||
static nsIServiceManager *sServiceManager = nsnull;
|
||||
static PRBool sRegistryInitializedFlag = PR_FALSE;
|
||||
|
|
|
@ -74,8 +74,6 @@
|
|||
and release them.
|
||||
*/
|
||||
|
||||
#include "nsString.h"
|
||||
|
||||
#define NS_APPSTARTUPNOTIFIER_CONTRACTID "@mozilla.org/embedcomp/appstartup-notifier;1"
|
||||
#define NS_APPSTARTUPNOTIFIER_CLASSNAME "AppStartup Notifier"
|
||||
|
||||
|
@ -92,4 +90,3 @@
|
|||
*/
|
||||
|
||||
#endif /* nsIAppStartupNotifier_h___ */
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ libmozjs.dylib
|
|||
; XPCOM:
|
||||
;
|
||||
libxpcom.dylib
|
||||
libxpcom_core.dylib
|
||||
libxpcom_compat.dylib
|
||||
components/libxpcom_compat_c.dylib
|
||||
components/xpcom_obsolete.xpt
|
||||
|
|
|
@ -27,6 +27,7 @@ libmozjs.so
|
|||
; XPCOM:
|
||||
;
|
||||
libxpcom.so
|
||||
libxpcom_core.so
|
||||
components/xpcom_base.xpt
|
||||
components/xpcom_components.xpt
|
||||
components/xpcom_ds.xpt
|
||||
|
|
|
@ -27,6 +27,7 @@ libmozjs.so
|
|||
; XPCOM:
|
||||
;
|
||||
libxpcom.so
|
||||
libxpcom_core.so
|
||||
components/xpcom_base.xpt
|
||||
components/xpcom_components.xpt
|
||||
components/xpcom_ds.xpt
|
||||
|
|
|
@ -45,6 +45,7 @@ js3250.dll
|
|||
; XPCOM:
|
||||
;
|
||||
xpcom.dll
|
||||
xpcom_core.dll
|
||||
xpcom_compat.dll
|
||||
components\xpcom_compat_c.dll
|
||||
components\xpcom_base.xpt
|
||||
|
|
|
@ -22,6 +22,7 @@ libmozjs.so
|
|||
; XPCOM:
|
||||
;
|
||||
libxpcom.so
|
||||
libxpcom_core.so
|
||||
components/xpcom_base.xpt
|
||||
components/xpcom_components.xpt
|
||||
components/xpcom_ds.xpt
|
||||
|
|
|
@ -22,6 +22,7 @@ libmozjs.so
|
|||
; XPCOM:
|
||||
;
|
||||
libxpcom.so
|
||||
libxpcom_core.so
|
||||
components/xpcom_base.xpt
|
||||
components/xpcom_components.xpt
|
||||
components/xpcom_ds.xpt
|
||||
|
|
|
@ -56,7 +56,6 @@
|
|||
#include "MfcEmbed.h"
|
||||
#include "BrowserFrm.h"
|
||||
#include "Dialogs.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// IBrowserFrameGlue implementation
|
||||
|
@ -99,7 +98,7 @@ void CBrowserFrame::BrowserFrameGlueObj::UpdateCurrentURI(nsIURI *aLocation)
|
|||
if(aLocation)
|
||||
{
|
||||
USES_CONVERSION;
|
||||
nsCAutoString uriString;
|
||||
nsEmbedCString uriString;
|
||||
aLocation->GetSpec(uriString);
|
||||
pThis->m_wndUrlBar.SetCurrentURL(A2CT(uriString.get()));
|
||||
}
|
||||
|
@ -115,9 +114,9 @@ void CBrowserFrame::BrowserFrameGlueObj::GetBrowserFrameTitle(PRUnichar **aTitle
|
|||
if(!title.IsEmpty())
|
||||
{
|
||||
USES_CONVERSION;
|
||||
nsString nsTitle;
|
||||
nsEmbedString nsTitle;
|
||||
nsTitle.Assign(T2CW(title.GetBuffer(0)));
|
||||
*aTitle = ToNewUnicode(nsTitle);
|
||||
*aTitle = NS_StringCloneData(nsTitle);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -327,7 +326,7 @@ void CBrowserFrame::BrowserFrameGlueObj::ShowContextMenu(PRUint32 aContextFlags,
|
|||
|
||||
// Reset the values from the last invocation
|
||||
// Clear image src & link url
|
||||
nsAutoString empty;
|
||||
nsEmbedString empty;
|
||||
pThis->m_wndBrowserView.SetCtxMenuImageSrc(empty);
|
||||
pThis->m_wndBrowserView.SetCtxMenuLinkUrl(empty);
|
||||
pThis->m_wndBrowserView.SetCurrentFrameURL(empty);
|
||||
|
@ -354,10 +353,13 @@ void CBrowserFrame::BrowserFrameGlueObj::ShowContextMenu(PRUint32 aContextFlags,
|
|||
aInfo->GetBackgroundImageSrc(getter_AddRefs(imgURI));
|
||||
if (!imgURI)
|
||||
return;
|
||||
nsCAutoString uri;
|
||||
nsEmbedCString uri;
|
||||
imgURI->GetSpec(uri);
|
||||
|
||||
pThis->m_wndBrowserView.SetCtxMenuImageSrc(NS_ConvertUTF8toUCS2(uri)); // Set the new Img Src
|
||||
nsEmbedString uri2;
|
||||
NS_CStringToUTF16(uri, NS_CSTRING_ENCODING_UTF8, uri2);
|
||||
|
||||
pThis->m_wndBrowserView.SetCtxMenuImageSrc(uri2); // Set the new Img Src
|
||||
}
|
||||
}
|
||||
else if(aContextFlags & nsIContextMenuListener2::CONTEXT_TEXT)
|
||||
|
@ -373,7 +375,7 @@ void CBrowserFrame::BrowserFrameGlueObj::ShowContextMenu(PRUint32 aContextFlags,
|
|||
// BrowserView will be invoked and the value of the URL
|
||||
// will be accesible in the view
|
||||
|
||||
nsAutoString strUrlUcs2;
|
||||
nsEmbedString strUrlUcs2;
|
||||
nsresult rv = aInfo->GetAssociatedLink(strUrlUcs2);
|
||||
if(NS_FAILED(rv))
|
||||
return;
|
||||
|
@ -387,12 +389,14 @@ void CBrowserFrame::BrowserFrameGlueObj::ShowContextMenu(PRUint32 aContextFlags,
|
|||
aInfo->GetImageSrc(getter_AddRefs(imgURI));
|
||||
if(imgURI)
|
||||
{
|
||||
nsCAutoString strImgSrcUtf8;
|
||||
nsEmbedCString strImgSrcUtf8;
|
||||
imgURI->GetSpec(strImgSrcUtf8);
|
||||
if(!strImgSrcUtf8.IsEmpty())
|
||||
if(strImgSrcUtf8.Length() != 0)
|
||||
{
|
||||
// Set the new Img Src
|
||||
pThis->m_wndBrowserView.SetCtxMenuImageSrc(NS_ConvertUTF8toUCS2(strImgSrcUtf8));
|
||||
nsEmbedString strImgSrc;
|
||||
NS_CStringToUTF16(strImgSrcUtf8, NS_CSTRING_ENCODING_UTF8, strImgSrc);
|
||||
pThis->m_wndBrowserView.SetCtxMenuImageSrc(strImgSrc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -405,13 +409,15 @@ void CBrowserFrame::BrowserFrameGlueObj::ShowContextMenu(PRUint32 aContextFlags,
|
|||
aInfo->GetImageSrc(getter_AddRefs(imgURI));
|
||||
if(!imgURI)
|
||||
return;
|
||||
nsCAutoString strImgSrcUtf8;
|
||||
nsEmbedCString strImgSrcUtf8;
|
||||
imgURI->GetSpec(strImgSrcUtf8);
|
||||
if(strImgSrcUtf8.IsEmpty())
|
||||
if(strImgSrcUtf8.Length() == 0)
|
||||
return;
|
||||
|
||||
// Set the new Img Src
|
||||
pThis->m_wndBrowserView.SetCtxMenuImageSrc(NS_ConvertUTF8toUCS2(strImgSrcUtf8));
|
||||
nsEmbedString strImgSrc;
|
||||
NS_CStringToUTF16(strImgSrcUtf8, NS_CSTRING_ENCODING_UTF8, strImgSrc);
|
||||
pThis->m_wndBrowserView.SetCtxMenuImageSrc(strImgSrc);
|
||||
}
|
||||
|
||||
// Determine if we need to add the Frame related context menu items
|
||||
|
@ -438,7 +444,7 @@ void CBrowserFrame::BrowserFrameGlueObj::ShowContextMenu(PRUint32 aContextFlags,
|
|||
if(NS_FAILED(rv))
|
||||
GOTO_BUILD_CTX_MENU;
|
||||
|
||||
nsAutoString strFrameURL;
|
||||
nsEmbedString strFrameURL;
|
||||
rv = htmlDoc->GetURL(strFrameURL);
|
||||
if(NS_FAILED(rv))
|
||||
GOTO_BUILD_CTX_MENU;
|
||||
|
|
|
@ -63,7 +63,117 @@
|
|||
#include "CPageSetupPropSheet.h"
|
||||
|
||||
// Mozilla Includes
|
||||
#include "nsIIOService.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsMemory.h"
|
||||
#include "nsXPCOM.h"
|
||||
|
||||
static nsresult
|
||||
NewURI(nsIURI **result, const nsAString &spec)
|
||||
{
|
||||
nsEmbedCString specUtf8;
|
||||
NS_UTF16ToCString(spec, NS_CSTRING_ENCODING_UTF8, specUtf8);
|
||||
|
||||
nsCOMPtr<nsIIOService> ios = do_GetService("@mozilla.org/network/io-service;1");
|
||||
NS_ENSURE_TRUE(ios, NS_ERROR_UNEXPECTED);
|
||||
|
||||
return ios->NewURI(specUtf8, nsnull, nsnull, result);
|
||||
}
|
||||
|
||||
static void
|
||||
ReplaceChar(nsAString &str, char oldChar, char newChar)
|
||||
{
|
||||
// XXX this could be much more efficient
|
||||
|
||||
PRUnichar *data = NS_StringCloneData(str);
|
||||
for (; *data; ++data)
|
||||
{
|
||||
if ((char ) *data == oldChar)
|
||||
*data = (PRUnichar) newChar;
|
||||
}
|
||||
NS_StringSetData(str, data);
|
||||
nsMemory::Free(data);
|
||||
}
|
||||
|
||||
static void
|
||||
StripChars(nsAString &str, const char *chars)
|
||||
{
|
||||
// XXX this could be much more efficient
|
||||
|
||||
PRUint32 len = str.Length();
|
||||
|
||||
PRUnichar *data = NS_StringCloneData(str);
|
||||
PRUnichar *dataEnd = data + len;
|
||||
for (; *data; ++data)
|
||||
{
|
||||
if (strchr(chars, (char ) *data))
|
||||
{
|
||||
// include trailing null terminator in the memmove
|
||||
memmove(data, data + 1, (dataEnd - data) * sizeof(PRUnichar));
|
||||
--dataEnd;
|
||||
}
|
||||
}
|
||||
NS_StringSetData(str, data);
|
||||
nsMemory::Free(data);
|
||||
}
|
||||
|
||||
static void
|
||||
StripChars(nsACString &str, const char *chars)
|
||||
{
|
||||
// XXX this could be much more efficient
|
||||
|
||||
PRUint32 len = str.Length();
|
||||
|
||||
char *data = NS_CStringCloneData(str);
|
||||
char *dataEnd = data + len;
|
||||
for (; *data; ++data)
|
||||
{
|
||||
if (strchr(chars, *data))
|
||||
{
|
||||
// include trailing null terminator in the memmove
|
||||
memmove(data, data + 1, dataEnd - data);
|
||||
--dataEnd;
|
||||
}
|
||||
}
|
||||
NS_CStringSetData(str, data);
|
||||
nsMemory::Free(data);
|
||||
}
|
||||
|
||||
static const char* kWhitespace="\b\t\r\n ";
|
||||
|
||||
static void
|
||||
CompressWhitespace(nsAString &str)
|
||||
{
|
||||
const PRUnichar *p;
|
||||
PRInt32 i, len = (PRInt32) NS_StringGetData(str, &p);
|
||||
|
||||
// trim leading whitespace
|
||||
|
||||
for (i=0; i<len; ++i)
|
||||
{
|
||||
if (!strchr(kWhitespace, (char) p[i]))
|
||||
break;
|
||||
}
|
||||
|
||||
if (i>0)
|
||||
{
|
||||
NS_StringCutData(str, 0, i);
|
||||
len = (PRInt32) NS_StringGetData(str, &p);
|
||||
}
|
||||
|
||||
// trim trailing whitespace
|
||||
|
||||
for (i=len-1; i>=0; --i)
|
||||
{
|
||||
if (!strchr(kWhitespace, (char) p[i]))
|
||||
break;
|
||||
}
|
||||
|
||||
if (++i < len)
|
||||
NS_StringCutData(str, i, len - i);
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
|
@ -355,7 +465,9 @@ BOOL CBrowserView::IsViewSourceUrl(CString& strUrl)
|
|||
|
||||
BOOL CBrowserView::OpenViewSourceWindow(const char* pUrl)
|
||||
{
|
||||
return OpenViewSourceWindow(NS_ConvertASCIItoUCS2(pUrl).get());
|
||||
nsEmbedString str;
|
||||
NS_CStringToUTF16(nsEmbedCString(pUrl), NS_CSTRING_ENCODING_ASCII, str);
|
||||
return OpenViewSourceWindow(str.get());
|
||||
}
|
||||
|
||||
BOOL CBrowserView::OpenViewSourceWindow(const PRUnichar* pUrl)
|
||||
|
@ -391,14 +503,14 @@ void CBrowserView::OnViewSource()
|
|||
return;
|
||||
|
||||
// Get the uri string associated with the nsIURI object
|
||||
nsCAutoString uriString;
|
||||
nsEmbedCString uriString;
|
||||
rv = currentURI->GetSpec(uriString);
|
||||
if(NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
// Build the view-source: url
|
||||
nsAutoString viewSrcUrl(L"view-source:");
|
||||
viewSrcUrl.AppendWithConversion(uriString.get());
|
||||
nsEmbedCString viewSrcUrl("view-source:");
|
||||
viewSrcUrl.Append(uriString);
|
||||
|
||||
OpenViewSourceWindow(viewSrcUrl.get());
|
||||
}
|
||||
|
@ -626,26 +738,27 @@ void CBrowserView::OnFileOpen()
|
|||
|
||||
void CBrowserView::GetBrowserWindowTitle(nsAString& title)
|
||||
{
|
||||
nsXPIDLString idlStrTitle;
|
||||
PRUnichar *idlStrTitle = nsnull;
|
||||
if(mBaseWindow)
|
||||
mBaseWindow->GetTitle(getter_Copies(idlStrTitle));
|
||||
mBaseWindow->GetTitle(&idlStrTitle);
|
||||
|
||||
title = idlStrTitle;
|
||||
nsMemory::Free(idlStrTitle);
|
||||
}
|
||||
|
||||
void CBrowserView::OnFileSaveAs()
|
||||
{
|
||||
nsAutoString fileName;
|
||||
nsEmbedString fileName;
|
||||
|
||||
GetBrowserWindowTitle(fileName); // Suggest the window title as the filename
|
||||
|
||||
// Sanitize the file name of all illegal characters
|
||||
|
||||
USES_CONVERSION;
|
||||
fileName.CompressWhitespace(); // Remove whitespace from the ends
|
||||
fileName.StripChars("\\*|:\"><?"); // Strip illegal characters
|
||||
fileName.ReplaceChar('.', L'_'); // Dots become underscores
|
||||
fileName.ReplaceChar('/', L'-'); // Forward slashes become hyphens
|
||||
CompressWhitespace(fileName); // Remove whitespace from the ends
|
||||
StripChars(fileName, "\\*|:\"><?"); // Strip illegal characters
|
||||
ReplaceChar(fileName, '.', L'_'); // Dots become underscores
|
||||
ReplaceChar(fileName, '/', L'-'); // Forward slashes become hyphens
|
||||
|
||||
TCHAR *lpszFilter =
|
||||
_T("Web Page, HTML Only (*.htm;*.html)|*.htm;*.html|")
|
||||
|
@ -688,14 +801,14 @@ void CBrowserView::OnFileSaveAs()
|
|||
nsCOMPtr<nsIWebBrowserPersist> persist(do_QueryInterface(mWebBrowser));
|
||||
if(persist)
|
||||
{
|
||||
nsCAutoString fullPath(T2CA(pStrFullPath));
|
||||
nsEmbedCString fullPath(T2CA(pStrFullPath));
|
||||
nsCOMPtr<nsILocalFile> file;
|
||||
NS_NewNativeLocalFile(fullPath, TRUE, getter_AddRefs(file));
|
||||
|
||||
nsCOMPtr<nsILocalFile> data;
|
||||
if (pStrDataPath)
|
||||
{
|
||||
nsCAutoString dataPath(T2CA(pStrDataPath));
|
||||
nsEmbedCString dataPath(T2CA(pStrDataPath));
|
||||
NS_NewNativeLocalFile(dataPath, TRUE, getter_AddRefs(data));
|
||||
}
|
||||
|
||||
|
@ -709,7 +822,9 @@ void CBrowserView::OnFileSaveAs()
|
|||
|
||||
void CBrowserView::OpenURL(const char* pUrl)
|
||||
{
|
||||
OpenURL(NS_ConvertASCIItoUCS2(pUrl).get());
|
||||
nsEmbedString str;
|
||||
NS_CStringToUTF16(nsEmbedCString(pUrl), NS_CSTRING_ENCODING_ASCII, str);
|
||||
OpenURL(str.get());
|
||||
}
|
||||
|
||||
void CBrowserView::OpenURL(const PRUnichar* pUrl)
|
||||
|
@ -765,7 +880,9 @@ void CBrowserView::OnCopyLinkLocation()
|
|||
if (! OpenClipboard())
|
||||
return;
|
||||
|
||||
HGLOBAL hClipData = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, mCtxMenuLinkUrl.Length() + 1);
|
||||
PRUint32 size = mCtxMenuLinkUrl.Length() + 1;
|
||||
|
||||
HGLOBAL hClipData = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, size);
|
||||
if(! hClipData)
|
||||
return;
|
||||
|
||||
|
@ -773,7 +890,7 @@ void CBrowserView::OnCopyLinkLocation()
|
|||
if(!pszClipData)
|
||||
return;
|
||||
|
||||
mCtxMenuLinkUrl.ToCString(pszClipData, mCtxMenuLinkUrl.Length() + 1);
|
||||
memcpy(pszClipData, mCtxMenuLinkUrl.get(), size);
|
||||
|
||||
GlobalUnlock(hClipData);
|
||||
|
||||
|
@ -811,17 +928,17 @@ void CBrowserView::OnSaveLinkAs()
|
|||
// use it while saving this link to a file
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsIURI> linkURI;
|
||||
rv = NS_NewURI(getter_AddRefs(linkURI), mCtxMenuLinkUrl);
|
||||
rv = NewURI(getter_AddRefs(linkURI), mCtxMenuLinkUrl);
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
// Get the "path" portion (see nsIURI.h for more info
|
||||
// on various parts of a URI)
|
||||
nsCAutoString fileName;
|
||||
nsEmbedCString fileName;
|
||||
linkURI->GetPath(fileName);
|
||||
|
||||
// The path may have the "/" char in it - strip those
|
||||
fileName.StripChars("\\/");
|
||||
StripChars(fileName, "\\/");
|
||||
|
||||
// Now, use this file name in a File Save As dlg...
|
||||
|
||||
|
@ -837,7 +954,7 @@ void CBrowserView::OnSaveLinkAs()
|
|||
if(cf.DoModal() == IDOK)
|
||||
{
|
||||
USES_CONVERSION;
|
||||
nsCAutoString fullPath; fullPath.Assign(T2CA(cf.GetPathName()));
|
||||
nsEmbedCString fullPath; fullPath.Assign(T2CA(cf.GetPathName()));
|
||||
nsCOMPtr<nsIWebBrowserPersist> persist(do_QueryInterface(mWebBrowser));
|
||||
if(persist)
|
||||
{
|
||||
|
@ -860,18 +977,18 @@ void CBrowserView::OnSaveImageAs()
|
|||
// use it while saving this link to a file
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsIURI> linkURI;
|
||||
rv = NS_NewURI(getter_AddRefs(linkURI), mCtxMenuImgSrc);
|
||||
rv = NewURI(getter_AddRefs(linkURI), mCtxMenuImgSrc);
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
// Get the "path" portion (see nsIURI.h for more info
|
||||
// on various parts of a URI)
|
||||
nsCAutoString path;
|
||||
nsEmbedCString path;
|
||||
linkURI->GetPath(path);
|
||||
|
||||
// The path may have the "/" char in it - strip those
|
||||
nsCAutoString fileName(path);
|
||||
fileName.StripChars("\\/");
|
||||
nsEmbedCString fileName(path);
|
||||
StripChars(fileName, "\\/");
|
||||
|
||||
// Now, use this file name in a File Save As dlg...
|
||||
|
||||
|
@ -883,7 +1000,7 @@ void CBrowserView::OnSaveImageAs()
|
|||
if(cf.DoModal() == IDOK)
|
||||
{
|
||||
USES_CONVERSION;
|
||||
nsCAutoString fullPath; fullPath.Assign(T2CA(cf.GetPathName()));
|
||||
nsEmbedCString fullPath; fullPath.Assign(T2CA(cf.GetPathName()));
|
||||
|
||||
nsCOMPtr<nsIWebBrowserPersist> persist(do_QueryInterface(mWebBrowser));
|
||||
if(persist)
|
||||
|
@ -918,9 +1035,10 @@ void CBrowserView::OnShowFindDlg()
|
|||
nsCOMPtr<nsIWebBrowserFind> finder(do_GetInterface(mWebBrowser));
|
||||
if(finder)
|
||||
{
|
||||
nsXPIDLString stringBuf;
|
||||
finder->GetSearchString(getter_Copies(stringBuf));
|
||||
csSearchStr = stringBuf.get();
|
||||
PRUnichar *stringBuf = nsnull;
|
||||
finder->GetSearchString(&stringBuf);
|
||||
csSearchStr = stringBuf;
|
||||
nsMemory::Free(stringBuf);
|
||||
|
||||
finder->GetMatchCase(&bMatchCase);
|
||||
finder->GetEntireWord(&bMatchWholeWord);
|
||||
|
@ -1113,17 +1231,17 @@ void CBrowserView::UpdateBusyState(PRBool aBusy)
|
|||
mbDocumentLoading = aBusy;
|
||||
}
|
||||
|
||||
void CBrowserView::SetCtxMenuLinkUrl(nsAutoString& strLinkUrl)
|
||||
void CBrowserView::SetCtxMenuLinkUrl(nsEmbedString& strLinkUrl)
|
||||
{
|
||||
mCtxMenuLinkUrl = strLinkUrl;
|
||||
}
|
||||
|
||||
void CBrowserView::SetCtxMenuImageSrc(nsAutoString& strImgSrc)
|
||||
void CBrowserView::SetCtxMenuImageSrc(nsEmbedString& strImgSrc)
|
||||
{
|
||||
mCtxMenuImgSrc = strImgSrc;
|
||||
}
|
||||
|
||||
void CBrowserView::SetCurrentFrameURL(nsAutoString& strCurrentFrameURL)
|
||||
void CBrowserView::SetCurrentFrameURL(nsEmbedString& strCurrentFrameURL)
|
||||
{
|
||||
mCtxMenuCurrentFrameURL = strCurrentFrameURL;
|
||||
}
|
||||
|
@ -1198,7 +1316,7 @@ void CBrowserView::OnViewFrameSource()
|
|||
{
|
||||
// Build the view-source: url
|
||||
//
|
||||
nsAutoString viewSrcUrl;
|
||||
nsEmbedString viewSrcUrl;
|
||||
viewSrcUrl.Append(L"view-source:");
|
||||
viewSrcUrl.Append(mCtxMenuCurrentFrameURL);
|
||||
|
||||
|
|
|
@ -97,14 +97,14 @@ public:
|
|||
void UpdateBusyState(PRBool aBusy);
|
||||
PRBool mbDocumentLoading;
|
||||
|
||||
void SetCtxMenuLinkUrl(nsAutoString& strLinkUrl);
|
||||
nsAutoString mCtxMenuLinkUrl;
|
||||
void SetCtxMenuLinkUrl(nsEmbedString& strLinkUrl);
|
||||
nsEmbedString mCtxMenuLinkUrl;
|
||||
|
||||
void SetCtxMenuImageSrc(nsAutoString& strImgSrc);
|
||||
nsAutoString mCtxMenuImgSrc;
|
||||
void SetCtxMenuImageSrc(nsEmbedString& strImgSrc);
|
||||
nsEmbedString mCtxMenuImgSrc;
|
||||
|
||||
void SetCurrentFrameURL(nsAutoString& strCurrentFrameURL);
|
||||
nsString mCtxMenuCurrentFrameURL;
|
||||
void SetCurrentFrameURL(nsEmbedString& strCurrentFrameURL);
|
||||
nsEmbedString mCtxMenuCurrentFrameURL;
|
||||
|
||||
inline void ClearFindDialog() { m_pFindDlg = NULL; }
|
||||
CFindDialog* m_pFindDlg;
|
||||
|
@ -202,4 +202,4 @@ protected:
|
|||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
#endif //_BROWSERVIEW_H
|
||||
#endif //_BROWSERVIEW_H
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "stdafx.h"
|
||||
#include "resource.h"
|
||||
#include "CPageSetupPropSheet.h"
|
||||
#include "nsMemory.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
|
@ -100,11 +101,12 @@ static float GetFloatFromStr(const TCHAR * aStr, float aMaxVal = 1.0)
|
|||
static PRUnichar* GetUnicodeFromCString(const CString& aStr)
|
||||
{
|
||||
#ifdef _UNICODE
|
||||
nsString str(aStr);
|
||||
nsEmbedString str(aStr);
|
||||
#else
|
||||
nsString str; str.AssignWithConversion(aStr);
|
||||
nsEmbedString str;
|
||||
NS_CStringToUTF16(nsEmbedCString(aStr), NS_CSTRING_ENCODING_ASCII, str);
|
||||
#endif
|
||||
return ToNewUnicode(str);
|
||||
return NS_StringCloneData(str);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -146,27 +148,27 @@ void CPageSetupPropSheet::SetPrintSettingsValues(nsIPrintSettings* aPrintSetting
|
|||
|
||||
PRUnichar* uStr;
|
||||
aPrintSettings->GetHeaderStrLeft(&uStr);
|
||||
m_MarginHeaderFooterTab.m_HeaderLeftText = NS_LossyConvertUCS2toASCII(uStr).get();
|
||||
m_MarginHeaderFooterTab.m_HeaderLeftText = uStr;
|
||||
if (uStr != nsnull) nsMemory::Free(uStr);
|
||||
|
||||
aPrintSettings->GetHeaderStrCenter(&uStr);
|
||||
m_MarginHeaderFooterTab.m_HeaderCenterText = NS_LossyConvertUCS2toASCII(uStr).get();
|
||||
m_MarginHeaderFooterTab.m_HeaderCenterText = uStr;
|
||||
if (uStr != nsnull) nsMemory::Free(uStr);
|
||||
|
||||
aPrintSettings->GetHeaderStrRight(&uStr);
|
||||
m_MarginHeaderFooterTab.m_HeaderRightText = NS_LossyConvertUCS2toASCII(uStr).get();
|
||||
m_MarginHeaderFooterTab.m_HeaderRightText = uStr;
|
||||
if (uStr != nsnull) nsMemory::Free(uStr);
|
||||
|
||||
aPrintSettings->GetFooterStrLeft(&uStr);
|
||||
m_MarginHeaderFooterTab.m_FooterLeftText = NS_LossyConvertUCS2toASCII(uStr).get();
|
||||
m_MarginHeaderFooterTab.m_FooterLeftText = uStr;
|
||||
if (uStr != nsnull) nsMemory::Free(uStr);
|
||||
|
||||
aPrintSettings->GetFooterStrCenter(&uStr);
|
||||
m_MarginHeaderFooterTab.m_FooterCenterText = NS_LossyConvertUCS2toASCII(uStr).get();
|
||||
m_MarginHeaderFooterTab.m_FooterCenterText = uStr;
|
||||
if (uStr != nsnull) nsMemory::Free(uStr);
|
||||
|
||||
aPrintSettings->GetFooterStrRight(&uStr);
|
||||
m_MarginHeaderFooterTab.m_FooterRightText = NS_LossyConvertUCS2toASCII(uStr).get();
|
||||
m_MarginHeaderFooterTab.m_FooterRightText = uStr;
|
||||
if (uStr != nsnull) nsMemory::Free(uStr);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,10 @@
|
|||
#include "BrowserFrm.h"
|
||||
#include "EditorFrm.h"
|
||||
#include "Dialogs.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsMemory.h"
|
||||
#include "nsIEditor.h"
|
||||
#include "nsIHTMLEditor.h"
|
||||
|
||||
//------------------------------------------------------------
|
||||
// Editor Command/Parameter Names
|
||||
|
@ -325,7 +329,7 @@ CEditorFrame::ExecuteAttribParam(const char *aCommand, const char *aAttribute)
|
|||
}
|
||||
|
||||
NS_METHOD
|
||||
CEditorFrame::GetAttributeParamValue(const char *aCommand, nsCString &aValue)
|
||||
CEditorFrame::GetAttributeParamValue(const char *aCommand, nsEmbedCString &aValue)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsICommandParams> params;
|
||||
|
@ -339,7 +343,8 @@ CEditorFrame::GetAttributeParamValue(const char *aCommand, nsCString &aValue)
|
|||
{
|
||||
char *tchar;
|
||||
rv = params->GetCStringValue(STATE_ATTRIBUTE,&tchar);
|
||||
aValue.Adopt(tchar);
|
||||
aValue.Assign(tchar);
|
||||
nsMemory::Free(tchar);
|
||||
return rv;
|
||||
}
|
||||
return rv;
|
||||
|
@ -419,12 +424,12 @@ void CEditorFrame::OnAlignleft()
|
|||
|
||||
void CEditorFrame::OnUpdateAlignleft(CCmdUI* pCmdUI)
|
||||
{
|
||||
nsCAutoString tValue;
|
||||
nsEmbedCString tValue;
|
||||
|
||||
nsresult rv = GetAttributeParamValue(ALIGN_COMMAND,tValue);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
if (tValue.Equals(ALIGN_LEFT))
|
||||
if (strcmp(tValue.get(), ALIGN_LEFT) == 0)
|
||||
pCmdUI->SetCheck(1);
|
||||
else
|
||||
pCmdUI->SetCheck(0);
|
||||
|
@ -438,11 +443,11 @@ void CEditorFrame::OnAlignright()
|
|||
|
||||
void CEditorFrame::OnUpdateAlignright(CCmdUI* pCmdUI)
|
||||
{
|
||||
nsCAutoString tValue;
|
||||
nsEmbedCString tValue;
|
||||
nsresult rv = GetAttributeParamValue(ALIGN_COMMAND,tValue);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
if (tValue.Equals(ALIGN_RIGHT))
|
||||
if (strcmp(tValue.get(), ALIGN_RIGHT) == 0)
|
||||
pCmdUI->SetCheck(1);
|
||||
else
|
||||
pCmdUI->SetCheck(0);
|
||||
|
@ -456,11 +461,11 @@ void CEditorFrame::OnAligncenter()
|
|||
|
||||
void CEditorFrame::OnUpdateAligncenter(CCmdUI* pCmdUI)
|
||||
{
|
||||
nsCAutoString tValue;
|
||||
nsEmbedCString tValue;
|
||||
nsresult rv = GetAttributeParamValue(ALIGN_COMMAND,tValue);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
if (tValue.Equals(ALIGN_CENTER))
|
||||
if (strcmp(tValue.get(), ALIGN_CENTER) == 0)
|
||||
pCmdUI->SetCheck(1);
|
||||
else
|
||||
pCmdUI->SetCheck(0);
|
||||
|
@ -494,11 +499,13 @@ void CEditorFrame::InsertLink(CString& linkText, CString& linkLocation)
|
|||
|
||||
void CEditorFrame::InsertHTML(CString& str)
|
||||
{
|
||||
nsString htmlToInsert;
|
||||
nsEmbedString htmlToInsert;
|
||||
#ifdef _UNICODE
|
||||
htmlToInsert.Assign(str.GetBuffer(0));
|
||||
#else
|
||||
htmlToInsert.AssignWithConversion(str.GetBuffer(0));
|
||||
NS_CStringToUTF16(nsEmbedCString(str.GetBuffer(0)),
|
||||
NS_CSTRING_ENCODING_ASCII,
|
||||
htmlToInsert);
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIHTMLEditor> htmlEditor;
|
||||
|
@ -539,13 +546,13 @@ BOOL CEditorFrame::GetCurrentLinkInfo(CString& strLinkText, CString& strLinkLoca
|
|||
return FALSE;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> domElement;
|
||||
htmlEditor->GetElementOrParentByTagName(NS_LITERAL_STRING("href"),
|
||||
htmlEditor->GetElementOrParentByTagName(nsEmbedString(L"href"),
|
||||
nsnull,
|
||||
getter_AddRefs(domElement));
|
||||
if (!domElement)
|
||||
return FALSE;
|
||||
|
||||
nsAutoString linkLocation, linkText;
|
||||
nsEmbedString linkLocation, linkText;
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
// Determine linkLocation
|
||||
|
@ -657,7 +664,7 @@ BOOL CEditorFrame::InLink()
|
|||
if (htmlEditor)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> domElememt;
|
||||
htmlEditor->GetElementOrParentByTagName(NS_LITERAL_STRING("href"),
|
||||
htmlEditor->GetElementOrParentByTagName(nsEmbedString(L"href"),
|
||||
nsnull,
|
||||
getter_AddRefs(domElememt));
|
||||
return domElememt ? TRUE : FALSE;
|
||||
|
|
|
@ -33,13 +33,12 @@
|
|||
#ifndef _EDITORFRM_H_
|
||||
#define _EDITORFRM_H_
|
||||
|
||||
#include "nsICommandParams.h"
|
||||
class nsICommandParams;
|
||||
class nsIEditor;
|
||||
class nsIHTMLEditor;
|
||||
|
||||
#include "nsIEditingSession.h"
|
||||
#include "nsICommandManager.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
#include "nsIEditor.h"
|
||||
#include "nsIHTMLEditor.h"
|
||||
|
||||
class CEditorFrame : public CBrowserFrame
|
||||
{
|
||||
|
@ -112,7 +111,7 @@ private:
|
|||
NS_METHOD ExecuteNoParam(const char *aCommand);
|
||||
NS_METHOD MakeCommandParams(const char *aCommand,nsICommandParams **aParams);
|
||||
NS_METHOD ExecuteAttribParam(const char *aCommand, const char *aAttribute);
|
||||
NS_METHOD GetAttributeParamValue(const char *aCommand, nsCString &aValue);
|
||||
NS_METHOD GetAttributeParamValue(const char *aCommand, nsEmbedCString &aValue);
|
||||
|
||||
void UpdateStyleToolBarBtn(const char *aCommand, CCmdUI* pCmdUI);
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ GRE_BUILD = 1
|
|||
endif
|
||||
|
||||
ifdef GRE_BUILD
|
||||
DEFINES += -DXPCOM_GLUE
|
||||
DEFINES += -DXPCOM_GLUE -DMOZILLA_STRICT_API
|
||||
endif
|
||||
|
||||
REQUIRES = \
|
||||
|
@ -109,7 +109,7 @@ CPPSRCS = \
|
|||
StdAfx.cpp \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DSO_LIBS = embed_base_s profdirserviceprovider_s
|
||||
EXTRA_DSO_LIBS = embed_base_s profdirserviceprovidersa_s
|
||||
|
||||
ifdef NS_TRACE_MALLOC
|
||||
EXTRA_DSO_LIBS += tracemalloc
|
||||
|
@ -123,7 +123,6 @@ LIBS = \
|
|||
ifdef GRE_BUILD
|
||||
LIBS += \
|
||||
$(DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)string_s.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
else
|
||||
LIBS += $(XPCOM_LIBS)
|
||||
|
|
|
@ -47,8 +47,12 @@
|
|||
// Local Includes
|
||||
#include "stdafx.h"
|
||||
#include "MfcEmbed.h"
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsXPCOMGlue.h"
|
||||
#include "nsMemory.h"
|
||||
#include "nsIComponentRegistrar.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "BrowserFrm.h"
|
||||
#include "EditorFrm.h"
|
||||
#include "winEmbedFileLocProvider.h"
|
||||
|
@ -127,7 +131,7 @@ public:
|
|||
szParam++;
|
||||
|
||||
// previous argument was a flag too, so process that first
|
||||
if (!mLastFlag.IsEmpty())
|
||||
if (mLastFlag.Length() != 0)
|
||||
HandleFlag(mLastFlag);
|
||||
|
||||
mLastFlag = szParam;
|
||||
|
@ -137,10 +141,10 @@ public:
|
|||
HandleFlag(mLastFlag);
|
||||
|
||||
} else {
|
||||
if (!mLastFlag.IsEmpty())
|
||||
if (mLastFlag.Length() != 0)
|
||||
HandleFlag(mLastFlag, szParam);
|
||||
|
||||
mLastFlag.Truncate();
|
||||
mLastFlag.Cut(0, PR_UINT32_MAX);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -151,12 +155,12 @@ public:
|
|||
void HandleFlag(const nsACString& flag, const TCHAR * param = nsnull)
|
||||
#endif
|
||||
{
|
||||
if (flag.Equals(_T("console")))
|
||||
if (_tcscmp(flag.BeginReading(), _T("console")) == 0)
|
||||
DoConsole();
|
||||
else if (flag.Equals(_T("chrome")))
|
||||
else if (_tcscmp(flag.BeginReading(), _T("chrome")) == 0)
|
||||
DoChrome();
|
||||
#ifdef NS_TRACE_MALLOC
|
||||
else if (flag.Equals(_T("trace-malloc")))
|
||||
else if (_tcscmp(flag.BeginReading(), _T("trace-malloc")) == 0)
|
||||
{
|
||||
USES_CONVERSION;
|
||||
DoTraceMalloc(flag, T2CA(param));
|
||||
|
@ -197,9 +201,9 @@ public:
|
|||
private:
|
||||
// autostring is fine, this is a stack based object anyway
|
||||
#ifdef _UNICODE
|
||||
nsAutoString mLastFlag;
|
||||
nsEmbedString mLastFlag;
|
||||
#else
|
||||
nsCAutoString mLastFlag;
|
||||
nsEmbedCString mLastFlag;
|
||||
#endif
|
||||
|
||||
CMfcEmbedApp& mApp;
|
||||
|
@ -383,11 +387,6 @@ BOOL CMfcEmbedApp::InitInstance()
|
|||
NSGetStaticModuleInfo = app_getModuleInfo;
|
||||
#endif
|
||||
|
||||
CMfcEmbedCommandLine cmdLine(*this);
|
||||
ParseCommandLine(cmdLine);
|
||||
|
||||
Enable3dControls();
|
||||
|
||||
#ifdef XPCOM_GLUE
|
||||
if (NS_FAILED(XPCOMGlueStartup(GRE_GetXPCOMPath()))) {
|
||||
MessageBox(NULL, "Could not initialize XPCOM. Perhaps the GRE\nis not installed or could not be found?", "MFCEmbed", MB_OK | MB_ICONERROR);
|
||||
|
@ -395,6 +394,11 @@ BOOL CMfcEmbedApp::InitInstance()
|
|||
}
|
||||
#endif
|
||||
|
||||
CMfcEmbedCommandLine cmdLine(*this);
|
||||
ParseCommandLine(cmdLine);
|
||||
|
||||
Enable3dControls();
|
||||
|
||||
//
|
||||
// 1. Determine the name of the dir from which the GRE based app is being run
|
||||
// from [It's OK to do this even if you're not running in an GRE env]
|
||||
|
@ -416,7 +420,7 @@ BOOL CMfcEmbedApp::InitInstance()
|
|||
USES_CONVERSION;
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsILocalFile> mreAppDir;
|
||||
rv = NS_NewNativeLocalFile(nsDependentCString(T2A(path)), TRUE, getter_AddRefs(mreAppDir));
|
||||
rv = NS_NewNativeLocalFile(nsEmbedCString(T2A(path)), TRUE, getter_AddRefs(mreAppDir));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to create mreAppDir localfile");
|
||||
|
||||
// Take a look at
|
||||
|
@ -425,7 +429,7 @@ BOOL CMfcEmbedApp::InitInstance()
|
|||
|
||||
CString strRes;
|
||||
strRes.LoadString(IDS_PROFILES_FOLDER_NAME);
|
||||
winEmbedFileLocProvider *provider = new winEmbedFileLocProvider(nsDependentCString(strRes));
|
||||
winEmbedFileLocProvider *provider = new winEmbedFileLocProvider(nsEmbedCString(strRes));
|
||||
if(!provider)
|
||||
{
|
||||
ASSERT(FALSE);
|
||||
|
@ -665,7 +669,7 @@ BOOL CMfcEmbedApp::InitializeProfiles()
|
|||
USES_CONVERSION;
|
||||
CString strRes;
|
||||
strRes.LoadString(IDS_PROFILES_NONSHARED_NAME);
|
||||
nsDependentString nonSharedName(T2W(strRes));
|
||||
nsEmbedString nonSharedName(T2W(strRes));
|
||||
sharingSetup->EnableSharing(nonSharedName);
|
||||
}
|
||||
#endif
|
||||
|
@ -760,17 +764,18 @@ nsresult CMfcEmbedApp::InitializePrefs()
|
|||
|
||||
prefs->GetIntPref("browser.startup.page", &m_iStartupPage);
|
||||
|
||||
nsXPIDLCString str;
|
||||
prefs->GetCharPref("browser.startup.homepage", getter_Copies(str));
|
||||
if (!str.IsEmpty())
|
||||
char* str = nsnull;
|
||||
prefs->GetCharPref("browser.startup.homepage", &str);
|
||||
if (str)
|
||||
{
|
||||
USES_CONVERSION;
|
||||
m_strHomePage = A2CT(str.get());
|
||||
m_strHomePage = A2CT(str);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_strHomePage.Empty();
|
||||
}
|
||||
nsMemory::Free(str);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -856,7 +861,7 @@ NS_IMETHODIMP CMfcEmbedApp::Observe(nsISupports *aSubject, const char *aTopic, c
|
|||
|
||||
// Only make a new browser window on a switch. This also gets
|
||||
// called at start up and we already make a window then.
|
||||
if (!wcscmp(someData, NS_LITERAL_STRING("switch").get()))
|
||||
if (!wcscmp(someData, L"switch"))
|
||||
OnNewBrowser();
|
||||
}
|
||||
return rv;
|
||||
|
|
|
@ -41,7 +41,9 @@
|
|||
#include "StdAfx.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsDirectoryServiceUtils.h"
|
||||
#include "MostRecentUrls.h"
|
||||
|
||||
//--------------------------------------------------------
|
||||
|
@ -75,7 +77,7 @@ FILE * CMostRecentUrls::GetFD(const char * aMode)
|
|||
nsresult rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(file));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsILocalFile> local_file(do_QueryInterface(file));
|
||||
local_file->AppendNative(NS_LITERAL_CSTRING("urls.txt"));
|
||||
local_file->AppendNative(nsEmbedCString("urls.txt"));
|
||||
local_file->OpenANSIFileDesc(aMode, &fd);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,13 +35,16 @@
|
|||
#include "ProfilesDlg.h"
|
||||
|
||||
// Mozilla Includes
|
||||
#include "nsString.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsEmbedString.h"
|
||||
#include "nsIRegistry.h"
|
||||
#include "nsIProfile.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsMemory.h"
|
||||
|
||||
// Constants
|
||||
#define kRegistryGlobalPrefsSubtreeString (NS_LITERAL_STRING("global-prefs"))
|
||||
#define kRegistryGlobalPrefsSubtreeString (nsEmbedString(L"global-prefs"))
|
||||
#define kRegistryShowProfilesAtStartup "start-show-dialog"
|
||||
|
||||
//*****************************************************************************
|
||||
|
@ -75,7 +78,7 @@ nsresult CProfileMgr::StartUp()
|
|||
if (profileCount == 0)
|
||||
{
|
||||
// Make a new default profile
|
||||
NS_NAMED_LITERAL_STRING(newProfileName, "default");
|
||||
nsEmbedString newProfileName(L"default");
|
||||
|
||||
rv = profileService->CreateNewProfile(newProfileName.get(), nsnull, nsnull, PR_FALSE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -99,10 +102,11 @@ nsresult CProfileMgr::StartUp()
|
|||
// GetCurrentProfile returns the profile which was last used but is not nescesarily
|
||||
// active. Call SetCurrentProfile to make it installed and active.
|
||||
|
||||
nsXPIDLString currProfileName;
|
||||
rv = profileService->GetCurrentProfile(getter_Copies(currProfileName));
|
||||
PRUnichar *currProfileName = nsnull;
|
||||
rv = profileService->GetCurrentProfile(&currProfileName);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = profileService->SetCurrentProfile(currProfileName);
|
||||
nsMemory::Free(currProfileName);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
// Mozilla
|
||||
#include "nsIProfile.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsMemory.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
|
@ -208,14 +210,13 @@ BOOL CProfilesDlg::OnInitDialog()
|
|||
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
nsCAutoString cStr;
|
||||
nsXPIDLString curProfileName;
|
||||
PRUnichar *curProfileName = nsnull;
|
||||
|
||||
// Fill the list of profiles
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIProfile> profileService =
|
||||
do_GetService(NS_PROFILE_CONTRACTID, &rv);
|
||||
profileService->GetCurrentProfile(getter_Copies(curProfileName));
|
||||
profileService->GetCurrentProfile(&curProfileName);
|
||||
|
||||
PRInt32 selectedRow = 0;
|
||||
PRUint32 listLen;
|
||||
|
@ -226,9 +227,10 @@ BOOL CProfilesDlg::OnInitDialog()
|
|||
{
|
||||
CString tmpStr(W2T(profileList[index]));
|
||||
m_ProfileList.AddString(tmpStr);
|
||||
if (wcscmp(profileList[index], curProfileName.get()) == 0)
|
||||
if (wcscmp(profileList[index], curProfileName) == 0)
|
||||
selectedRow = index;
|
||||
}
|
||||
nsMemory::Free(curProfileName);
|
||||
|
||||
m_ProfileList.SetCurSel(selectedRow);
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ public:
|
|||
BOOL m_bAskAtStartUp;
|
||||
//}}AFX_DATA
|
||||
|
||||
nsAutoString m_SelectedProfile;
|
||||
nsEmbedString m_SelectedProfile;
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
|
|
|
@ -72,11 +72,8 @@
|
|||
#endif
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsString.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsEmbedString.h"
|
||||
#include "nsCWebBrowser.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIWebBrowser.h"
|
||||
|
@ -100,7 +97,6 @@
|
|||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMHTMLDocument.h"
|
||||
#include "nsIDOMHTMLFrameSetElement.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIPrompt.h"
|
||||
#include "nsEmbedAPI.h"
|
||||
#include "nsISHistory.h"
|
||||
|
|
|
@ -31,13 +31,13 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "winEmbedFileLocProvider.h"
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsXPCOMGlue.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "nsString.h"
|
||||
#include "nsXPIDLString.h"
|
||||
|
||||
#include "nsIProperties.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <shlobj.h>
|
||||
|
@ -45,17 +45,17 @@
|
|||
|
||||
// WARNING: These hard coded names need to go away. They need to
|
||||
// come from localizable resources
|
||||
#define APP_REGISTRY_NAME NS_LITERAL_CSTRING("registry.dat")
|
||||
#define APP_REGISTRY_NAME nsEmbedCString("registry.dat")
|
||||
|
||||
#define PROFILE_ROOT_DIR_NAME NS_LITERAL_CSTRING("Profiles")
|
||||
#define DEFAULTS_DIR_NAME NS_LITERAL_CSTRING("defaults")
|
||||
#define DEFAULTS_PREF_DIR_NAME NS_LITERAL_CSTRING("pref")
|
||||
#define DEFAULTS_PROFILE_DIR_NAME NS_LITERAL_CSTRING("profile")
|
||||
#define RES_DIR_NAME NS_LITERAL_CSTRING("res")
|
||||
#define CHROME_DIR_NAME NS_LITERAL_CSTRING("chrome")
|
||||
#define PLUGINS_DIR_NAME NS_LITERAL_CSTRING("plugins")
|
||||
#define SEARCH_DIR_NAME NS_LITERAL_CSTRING("searchplugins")
|
||||
#define COMPONENTS_DIR_NAME NS_LITERAL_CSTRING("components")
|
||||
#define PROFILE_ROOT_DIR_NAME nsEmbedCString("Profiles")
|
||||
#define DEFAULTS_DIR_NAME nsEmbedCString("defaults")
|
||||
#define DEFAULTS_PREF_DIR_NAME nsEmbedCString("pref")
|
||||
#define DEFAULTS_PROFILE_DIR_NAME nsEmbedCString("profile")
|
||||
#define RES_DIR_NAME nsEmbedCString("res")
|
||||
#define CHROME_DIR_NAME nsEmbedCString("chrome")
|
||||
#define PLUGINS_DIR_NAME nsEmbedCString("plugins")
|
||||
#define SEARCH_DIR_NAME nsEmbedCString("searchplugins")
|
||||
#define COMPONENTS_DIR_NAME nsEmbedCString("components")
|
||||
|
||||
//*****************************************************************************
|
||||
// winEmbedFileLocProvider::Constructor/Destructor
|
||||
|
|
|
@ -31,9 +31,10 @@
|
|||
|
||||
#include "nsIDirectoryService.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "nsString.h"
|
||||
#include "nsEmbedString.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsIFile;
|
||||
class nsILocalFile;
|
||||
|
||||
//*****************************************************************************
|
||||
// class winEmbedFileLocProvider
|
||||
|
@ -57,6 +58,6 @@ protected:
|
|||
NS_METHOD GetDefaultUserProfileRoot(nsILocalFile **aLocalFile);
|
||||
|
||||
|
||||
nsCString mProductDirName;
|
||||
nsEmbedCString mProductDirName;
|
||||
nsCOMPtr<nsILocalFile> mMozBinDirectory;
|
||||
};
|
||||
|
|
|
@ -121,6 +121,7 @@ components\jsurl.xpt
|
|||
|
||||
; XPCOM:
|
||||
xpcom.dll
|
||||
xpcomcor.dll
|
||||
xpcomct.dll
|
||||
xpistub.dll
|
||||
xpicleanup.exe
|
||||
|
|
|
@ -137,6 +137,7 @@ libmozjs.so
|
|||
; XPCOM:
|
||||
;
|
||||
libxpcom.so
|
||||
libxpcom_core.so
|
||||
libxpistub.so
|
||||
libxpcom_compat.so
|
||||
components/xpcom_base.xpt
|
||||
|
|
|
@ -20,6 +20,7 @@ bin\defaults\profile\extensions\{972ce4c6-7e08-4474-a285-3208198ce6fd}\install.r
|
|||
|
||||
[xpcom]
|
||||
bin\xpcom.dll
|
||||
bin\xpcom_core.dll
|
||||
bin\xpcom_compat.dll
|
||||
bin\xpistub.dll
|
||||
bin\components\jar50.dll
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#define __nsILookAndFeel
|
||||
#include "nsISupports.h"
|
||||
#include "nsColor.h"
|
||||
#include "nsFont.h"
|
||||
|
||||
// for |#ifdef NS_DEBUG|
|
||||
struct nsSize;
|
||||
|
|
|
@ -43,6 +43,7 @@ static int PR_CALLBACK colorPrefChanged(const char* aPref, void* aData);
|
|||
#include "nsIServiceManager.h"
|
||||
#include "nsIPref.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsFont.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#include "nsSize.h"
|
||||
|
|
|
@ -58,6 +58,7 @@ DIRS = \
|
|||
reflect \
|
||||
proxy \
|
||||
build \
|
||||
stub \
|
||||
tools \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -73,8 +73,5 @@ interface nsISupports {
|
|||
|
||||
%{C++
|
||||
#include "nsISupportsBase.h"
|
||||
|
||||
#ifndef MOZILLA_STRICT_API
|
||||
#include "nsISupportsUtils.h"
|
||||
#endif
|
||||
%}
|
||||
|
|
|
@ -43,7 +43,10 @@ VPATH = @srcdir@
|
|||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = xpcom
|
||||
LIBRARY_NAME = xpcom
|
||||
LIBRARY_NAME = xpcom_core
|
||||
ifneq ($(OS_ARCH),WINNT)
|
||||
SHORT_LIBNAME = xpcomcor
|
||||
endif
|
||||
|
||||
PACKAGE_FILE = xpcom.pkg
|
||||
PACKAGE_VARS += USE_SHORT_LIBNAME
|
||||
|
@ -64,9 +67,7 @@ ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
|
|||
REQUIRES += macmorefiles
|
||||
endif
|
||||
|
||||
CPPSRCS = nsXPComInit.cpp \
|
||||
nsStringAPI.cpp \
|
||||
$(NULL)
|
||||
CPPSRCS = nsXPComInit.cpp
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
CPPSRCS += dlldeps.cpp
|
||||
|
@ -116,9 +117,6 @@ SDK_HEADERS = \
|
|||
nsXPCOMCID.h \
|
||||
$(NULL)
|
||||
|
||||
SDK_LIBRARY = $(IMPORT_LIBRARY)
|
||||
SDK_BINARY = $(SHARED_LIBRARY)
|
||||
|
||||
# pull in MoreFiles for MacOSX
|
||||
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
|
||||
EXTRA_DSO_LIBS = macmorefiles_s
|
||||
|
|
|
@ -88,9 +88,7 @@
|
|||
#include "nsVariant.h"
|
||||
#include "nsEscape.h"
|
||||
#include "nsStreamUtils.h"
|
||||
|
||||
#define NS_STRINGAPI_IMPL
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsNativeCharsetUtils.h"
|
||||
|
||||
void XXXNeverCalled()
|
||||
{
|
||||
|
@ -175,20 +173,6 @@ void XXXNeverCalled()
|
|||
NS_NewUTF8StringEnumerator(nsnull, &carray);
|
||||
NS_NewAdoptingUTF8StringEnumerator(nsnull, &carray);
|
||||
nsVoidableString str3;
|
||||
nsCStringContainer sc1;
|
||||
NS_CStringContainerInit(sc1);
|
||||
NS_CStringContainerFinish(sc1);
|
||||
NS_CStringGetData(str2, nsnull, nsnull);
|
||||
NS_CStringSetData(str2, nsnull, 0);
|
||||
NS_CStringSetDataRange(str2, 0, 0, nsnull, 0);
|
||||
NS_CStringCopy(str2, str2);
|
||||
nsStringContainer sc2;
|
||||
NS_StringContainerInit(sc2);
|
||||
NS_StringContainerFinish(sc2);
|
||||
NS_StringGetData(str1, nsnull, nsnull);
|
||||
NS_StringSetData(str1, nsnull, 0);
|
||||
NS_StringSetDataRange(str1, 0, 0, nsnull, 0);
|
||||
NS_StringCopy(str1, str1);
|
||||
{
|
||||
nsAdoptingCString foo, bar;
|
||||
foo = bar;
|
||||
|
@ -197,6 +181,6 @@ void XXXNeverCalled()
|
|||
nsAdoptingString foo, bar;
|
||||
foo = bar;
|
||||
}
|
||||
NS_UTF16ToCString(str1, NS_CSTRING_ENCODING_ASCII, str2);
|
||||
NS_CStringToUTF16(str2, NS_CSTRING_ENCODING_ASCII, str1);
|
||||
NS_CopyNativeToUnicode(str2, str1);
|
||||
NS_CopyUnicodeToNative(str1, str2);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#include "nsString.h"
|
||||
#include "nsCharTraits.h"
|
||||
|
||||
#define NS_STRINGAPI_IMPL
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsNativeCharsetUtils.h"
|
||||
|
||||
|
|
|
@ -38,6 +38,20 @@
|
|||
#ifndef nsXPCOM_h__
|
||||
#define nsXPCOM_h__
|
||||
|
||||
// Map frozen functions to private symbol names if not using strict API.
|
||||
#ifndef MOZILLA_STRICT_API
|
||||
# define NS_InitXPCOM2 NS_InitXPCOM2_P
|
||||
# define NS_ShutdownXPCOM NS_ShutdownXPCOM_P
|
||||
# define NS_GetServiceManager NS_GetServiceManager_P
|
||||
# define NS_GetComponentManager NS_GetComponentManager_P
|
||||
# define NS_GetComponentRegistrar NS_GetComponentRegistrar_P
|
||||
# define NS_GetMemoryManager NS_GetMemoryManager_P
|
||||
# define NS_NewLocalFile NS_NewLocalFile_P
|
||||
# define NS_NewNativeLocalFile NS_NewNativeLocalFile_P
|
||||
# define NS_GetDebug NS_GetDebug_P
|
||||
# define NS_GetTraceRefcnt NS_GetTraceRefcnt_P
|
||||
#endif
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsXPCOMCID.h"
|
||||
|
||||
|
|
|
@ -39,6 +39,13 @@
|
|||
#ifndef nsXPComPrivate_h__
|
||||
#define nsXPComPrivate_h__
|
||||
|
||||
// Map frozen functions to private symbol names if not using strict API.
|
||||
#ifndef MOZILLA_STRICT_API
|
||||
# define NS_RegisterXPCOMExitRoutine NS_RegisterXPCOMExitRoutine_P
|
||||
# define NS_UnregisterXPCOMExitRoutine NS_UnregisterXPCOMExitRoutine_P
|
||||
# define NS_GetFrozenFunctions NS_GetFrozenFunctions_P
|
||||
#endif
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsXPCOM.h"
|
||||
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
#include "nsXPCOM.h"
|
||||
#include "nsMemory.h"
|
||||
#include "nsXPCOMPrivate.h"
|
||||
#include "nsDebug.h"
|
||||
#include "nsISupportsUtils.h"
|
||||
|
||||
static nsIMemory* gMemory = nsnull;
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
// nsWeakReference.h
|
||||
|
||||
#include "nsIWeakReference.h"
|
||||
#include "nsIWeakReferenceUtils.h"
|
||||
|
||||
class nsWeakReference;
|
||||
|
||||
|
|
|
@ -85,4 +85,4 @@ include $(topsrcdir)/config/rules.mk
|
|||
export:: $(XPCOM_GLUE_SRC_CSRCS)
|
||||
$(INSTALL) $^ .
|
||||
|
||||
DEFINES += -DXPCOM_GLUE
|
||||
DEFINES += -DXPCOM_GLUE -DMOZILLA_STRICT_API
|
||||
|
|
|
@ -40,8 +40,11 @@
|
|||
|
||||
#include "nspr.h"
|
||||
#include "nsMemory.h"
|
||||
#include "nsDebug.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsGREDirServiceProvider.h"
|
||||
#include "nsXPCOMPrivate.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#if XP_WIN32
|
||||
|
|
|
@ -52,7 +52,7 @@ MODULE_NAME = nsSampleModule
|
|||
|
||||
# Ensure that the xpcom classes that we build
|
||||
# do not export themselves
|
||||
DEFINES += -DXPCOM_GLUE
|
||||
DEFINES += -DMOZILLA_STRICT_API -DXPCOM_GLUE
|
||||
|
||||
|
||||
REQUIRES = string \
|
||||
|
|
|
@ -44,8 +44,11 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsISample.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIComponentRegistrar.h"
|
||||
|
||||
#ifdef XPCOM_GLUE
|
||||
|
|
|
@ -48,7 +48,13 @@
|
|||
|
||||
#include "nscore.h"
|
||||
|
||||
#define NS_STRINGAPI(x) extern "C" NS_COM x
|
||||
#if defined( XPCOM_GLUE )
|
||||
#define NS_STRINGAPI(type) extern "C" type
|
||||
#elif defined( _IMPL_NS_STRINGAPI )
|
||||
#define NS_STRINGAPI(type) extern "C" NS_EXPORT type
|
||||
#else
|
||||
#define NS_STRINGAPI(type) extern "C" NS_IMPORT type
|
||||
#endif
|
||||
|
||||
/* The base string types */
|
||||
class nsAString;
|
||||
|
@ -631,14 +637,14 @@ NS_UTF16ToCString(const nsAString &aSource, nsCStringEncoding aDestEncoding,
|
|||
* internal definition of these classes from nsAString.h in the Mozilla tree.
|
||||
*/
|
||||
|
||||
#ifndef NS_STRINGAPI_IMPL
|
||||
#ifndef _IMPL_NS_STRINGAPI
|
||||
#define nsAString_external nsAString
|
||||
#define nsACString_external nsACString
|
||||
#endif
|
||||
|
||||
class nsAString_external
|
||||
{
|
||||
#ifndef NS_STRINGAPI_IMPL
|
||||
#ifndef _IMPL_NS_STRINGAPI
|
||||
|
||||
public:
|
||||
typedef PRUnichar char_type;
|
||||
|
@ -712,7 +718,7 @@ public:
|
|||
|
||||
NS_HIDDEN_(void) Cut( index_type cutStart, size_type cutLength ) { Replace(cutStart, cutLength, nsnull, 0); }
|
||||
|
||||
#endif // NS_STRINGAPI_IMPL
|
||||
#endif // _IMPL_NS_STRINGAPI
|
||||
|
||||
private:
|
||||
void *v;
|
||||
|
@ -720,7 +726,7 @@ private:
|
|||
|
||||
class nsACString_external
|
||||
{
|
||||
#ifndef NS_STRINGAPI_IMPL
|
||||
#ifndef _IMPL_NS_STRINGAPI
|
||||
|
||||
public:
|
||||
typedef char char_type;
|
||||
|
@ -794,7 +800,7 @@ public:
|
|||
|
||||
NS_HIDDEN_(void) Cut( index_type cutStart, size_type cutLength ) { Replace(cutStart, cutLength, nsnull, 0); }
|
||||
|
||||
#endif // NS_STRINGAPI_IMPL
|
||||
#endif // _IMPL_NS_STRINGAPI
|
||||
|
||||
private:
|
||||
void *v;
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
# vim:set ts=8 sw=8 sts=8 noet:
|
||||
# ***** 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 IBM Corporation.
|
||||
# Portions created by IBM Corporation are Copyright (C) 2004
|
||||
# IBM Corporation. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Darin Fisher <darin@meer.net>
|
||||
#
|
||||
# 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@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = xpcom
|
||||
LIBRARY_NAME = xpcom
|
||||
|
||||
PACKAGE_FILE = xpcom.pkg
|
||||
PACKAGE_VARS += USE_SHORT_LIBNAME
|
||||
|
||||
ifdef ENABLE_TESTS
|
||||
PACKAGE_FILE += xpcom-tests.pkg
|
||||
endif
|
||||
|
||||
# Do not set EXPORT_LIBRARY as we do not want xpcom in the static libs list
|
||||
#EXPORT_LIBRARY = 1
|
||||
GRE_MODULE = 1
|
||||
|
||||
REQUIRES = string \
|
||||
$(NULL)
|
||||
|
||||
DEFINES = -D_IMPL_NS_STRINGAPI
|
||||
LOCAL_INCLUDES = -I$(srcdir)/../build
|
||||
|
||||
CPPSRCS = nsXPComStub.cpp ../build/nsStringAPI.cpp
|
||||
|
||||
SDK_LIBRARY = $(IMPORT_LIBRARY)
|
||||
SDK_BINARY = $(SHARED_LIBRARY)
|
||||
|
||||
# Force use of PIC
|
||||
FORCE_USE_PIC = 1
|
||||
|
||||
FORCE_SHARED_LIB = 1
|
||||
|
||||
ifeq ($(OS_TARGET),OS2)
|
||||
EXTRA_DSO_LIBS = xpcomcor
|
||||
else
|
||||
EXTRA_DSO_LIBS = xpcom_core
|
||||
endif
|
||||
EXTRA_DSO_LDOPTS = $(LIBS_DIR) $(EXTRA_DSO_LIBS) $(NSPR_LIBS)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
|
@ -38,7 +38,6 @@
|
|||
#include "nsString.h"
|
||||
#include "nsCharTraits.h"
|
||||
|
||||
#define NS_STRINGAPI_IMPL
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsNativeCharsetUtils.h"
|
||||
|
||||
|
|
|
@ -0,0 +1,144 @@
|
|||
/* ***** 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.
|
||||
*
|
||||
* The Initial Developer of the Original Code is IBM Corporation.
|
||||
* Portions created by IBM Corporation are Copyright (C) 2004
|
||||
* IBM Corporation. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Darin Fisher <darin@meer.net>
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsXPCOMPrivate.h"
|
||||
#include "nsStringAPI.h"
|
||||
|
||||
/*
|
||||
* Stubs for nsXPCOM.h
|
||||
*/
|
||||
|
||||
#undef NS_InitXPCOM2
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NS_InitXPCOM2(nsIServiceManager **result,
|
||||
nsIFile *binDirectory,
|
||||
nsIDirectoryServiceProvider *dirProvider)
|
||||
{
|
||||
return NS_InitXPCOM2_P(result, binDirectory, dirProvider);
|
||||
}
|
||||
|
||||
#undef NS_ShutdownXPCOM
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NS_ShutdownXPCOM(nsIServiceManager *svcMgr)
|
||||
{
|
||||
return NS_ShutdownXPCOM_P(svcMgr);
|
||||
}
|
||||
|
||||
#undef NS_GetServiceManager
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NS_GetServiceManager(nsIServiceManager* *result)
|
||||
{
|
||||
return NS_GetServiceManager_P(result);
|
||||
}
|
||||
|
||||
#undef NS_GetComponentManager
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NS_GetComponentManager(nsIComponentManager* *result)
|
||||
{
|
||||
return NS_GetComponentManager_P(result);
|
||||
}
|
||||
|
||||
#undef NS_GetComponentRegistrar
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NS_GetComponentRegistrar(nsIComponentRegistrar* *result)
|
||||
{
|
||||
return NS_GetComponentRegistrar_P(result);
|
||||
}
|
||||
|
||||
#undef NS_GetMemoryManager
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NS_GetMemoryManager(nsIMemory* *result)
|
||||
{
|
||||
return NS_GetMemoryManager_P(result);
|
||||
}
|
||||
|
||||
#undef NS_NewLocalFile
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NS_NewLocalFile(const nsAString &path,
|
||||
PRBool followLinks,
|
||||
nsILocalFile **result)
|
||||
{
|
||||
return NS_NewLocalFile_P(path, followLinks, result);
|
||||
}
|
||||
|
||||
#undef NS_NewNativeLocalFile
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NS_NewNativeLocalFile(const nsACString &path,
|
||||
PRBool followLinks,
|
||||
nsILocalFile **result)
|
||||
{
|
||||
return NS_NewNativeLocalFile_P(path, followLinks, result);
|
||||
}
|
||||
|
||||
#undef NS_GetDebug
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NS_GetDebug(nsIDebug **result)
|
||||
{
|
||||
return NS_GetDebug_P(result);
|
||||
}
|
||||
|
||||
#undef NS_GetTraceRefcnt
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NS_GetTraceRefcnt(nsITraceRefcnt **result)
|
||||
{
|
||||
return NS_GetTraceRefcnt_P(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* Stubs for nsXPCOMPrivate.h
|
||||
*/
|
||||
|
||||
#undef NS_RegisterXPCOMExitRoutine
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NS_RegisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine, PRUint32 priority)
|
||||
{
|
||||
return NS_RegisterXPCOMExitRoutine_P(exitRoutine, priority);
|
||||
}
|
||||
|
||||
#undef NS_UnregisterXPCOMExitRoutine
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NS_UnregisterXPCOMExitRoutine(XPCOMExitRoutine exitRoutine)
|
||||
{
|
||||
return NS_UnregisterXPCOMExitRoutine_P(exitRoutine);
|
||||
}
|
||||
|
||||
#undef NS_GetFrozenFunctions
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NS_GetFrozenFunctions(XPCOMFunctions *entryPoints, const char* libraryPath)
|
||||
{
|
||||
return NS_GetFrozenFunctions_P(entryPoints, libraryPath);
|
||||
}
|
|
@ -294,6 +294,55 @@ static PRBool test_replace()
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
static const char* kWhitespace="\b\t\r\n ";
|
||||
|
||||
static void
|
||||
CompressWhitespace(nsACString &str)
|
||||
{
|
||||
const char *p;
|
||||
PRInt32 i, len = (PRInt32) NS_CStringGetData(str, &p);
|
||||
|
||||
// trim leading whitespace
|
||||
|
||||
for (i=0; i<len; ++i)
|
||||
{
|
||||
if (!strchr(kWhitespace, (char) p[i]))
|
||||
break;
|
||||
}
|
||||
|
||||
if (i>0)
|
||||
{
|
||||
NS_CStringCutData(str, 0, i);
|
||||
len = (PRInt32) NS_CStringGetData(str, &p);
|
||||
}
|
||||
|
||||
// trim trailing whitespace
|
||||
|
||||
for (i=len-1; i>=0; --i)
|
||||
{
|
||||
if (!strchr(kWhitespace, (char) p[i]))
|
||||
break;
|
||||
}
|
||||
|
||||
if (++i < len)
|
||||
NS_CStringCutData(str, i, len - i);
|
||||
}
|
||||
|
||||
static PRBool test_compress_ws()
|
||||
{
|
||||
nsCStringContainer s;
|
||||
NS_CStringContainerInit(s);
|
||||
NS_CStringSetData(s, " \thello world\r \n");
|
||||
CompressWhitespace(s);
|
||||
const char *d;
|
||||
NS_CStringGetData(s, &d);
|
||||
PRBool rv = !strcmp(d, "hello world");
|
||||
if (!rv)
|
||||
printf("=> \"%s\"\n", d);
|
||||
NS_CStringContainerFinish(s);
|
||||
return rv;
|
||||
}
|
||||
|
||||
//----
|
||||
|
||||
typedef PRBool (*TestFunc)();
|
||||
|
@ -310,6 +359,7 @@ tests[] =
|
|||
{ "test_convert", test_convert },
|
||||
{ "test_append", test_append },
|
||||
{ "test_replace", test_replace },
|
||||
{ "test_compress_ws", test_compress_ws },
|
||||
{ nsnull, nsnull }
|
||||
};
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ include $(DEPTH)/config/autoconf.mk
|
|||
MODULE = xpcom
|
||||
CPPSRCS = regxpcom.cpp
|
||||
|
||||
DEFINES += -DXPCOM_GLUE
|
||||
DEFINES += -DXPCOM_GLUE -DMOZILLA_STRICT_API
|
||||
|
||||
REQUIRES = \
|
||||
string \
|
||||
|
|
|
@ -48,8 +48,6 @@
|
|||
#include "nsIComponentManager.h"
|
||||
#include "nsICategoryManager.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
struct nsModuleComponentInfo; // forward declaration
|
||||
|
|
|
@ -65,7 +65,7 @@ endif
|
|||
endif
|
||||
|
||||
ifdef GRE_BUILD
|
||||
DEFINES += -DXPCOM_GLUE
|
||||
DEFINES += -DXPCOM_GLUE -DMOZILLA_STRICT_API
|
||||
endif
|
||||
|
||||
MODULE = apprunner
|
||||
|
@ -176,7 +176,6 @@ endif
|
|||
# If you change anything that mozilla links to, please talk to dougt@netscape.com
|
||||
ifdef GRE_BUILD
|
||||
LIBS += \
|
||||
$(DIST)/lib/$(LIB_PREFIX)string_s.$(LIB_SUFFIX) \
|
||||
$(DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
else
|
||||
|
@ -375,7 +374,7 @@ endif
|
|||
|
||||
CXXFLAGS += $(MOZ_TOOLKIT_REGISTRY_CFLAGS)
|
||||
|
||||
LOCAL_INCLUDES = -I$(srcdir) -I.
|
||||
LOCAL_INCLUDES = -I$(srcdir) -I.
|
||||
|
||||
ifneq (,$(filter-out OS2 WINNT,$(OS_ARCH)))
|
||||
$(MOZ_APP_NAME).1: mozilla.man.in Makefile.in Makefile $(DEPTH)/config/autoconf.mk
|
||||
|
|
|
@ -39,10 +39,15 @@
|
|||
|
||||
#ifdef XPCOM_GLUE
|
||||
#include "nsXPCOMGlue.h"
|
||||
#include "nsStringSupport.h"
|
||||
#else
|
||||
#include "nsString.h"
|
||||
#endif
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
#include "nsIComponentRegistrar.h"
|
||||
|
||||
|
@ -67,6 +72,7 @@
|
|||
#include "prprf.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIDirectoryService.h"
|
||||
#include "nsDirectoryServiceUtils.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsIWindowMediator.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
|
@ -74,7 +80,6 @@
|
|||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsICmdLineHandler.h"
|
||||
#include "nsICategoryManager.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsIXULWindow.h"
|
||||
#include "nsIChromeRegistrySea.h"
|
||||
#include "nsIEventQueueService.h"
|
||||
|
@ -82,9 +87,9 @@
|
|||
#include "nsBuildID.h"
|
||||
#include "nsWindowCreator.h"
|
||||
#include "nsIWindowWatcher.h"
|
||||
#include "nsProcess.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "nsILookAndFeel.h"
|
||||
#include "nsIProcess.h"
|
||||
|
||||
#ifdef MOZ_XPINSTALL
|
||||
#include "InstallCleanupDefines.h"
|
||||
|
@ -124,7 +129,6 @@
|
|||
#define DEBUG_CMD_LINE
|
||||
#endif
|
||||
|
||||
static NS_DEFINE_CID(kIProcessCID, NS_PROCESS_CID);
|
||||
#include "nsWidgetsCID.h"
|
||||
static NS_DEFINE_CID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
|
||||
|
||||
|
@ -464,26 +468,26 @@ PrintUsage(void)
|
|||
fprintf(stderr, "\t<url>: a fully defined url string like http:// etc..\n");
|
||||
}
|
||||
|
||||
static nsresult OpenWindow(const nsAFlatCString& aChromeURL,
|
||||
const nsAFlatString& aAppArgs,
|
||||
static nsresult OpenWindow(const nsCString& aChromeURL,
|
||||
const nsString& aAppArgs,
|
||||
PRInt32 aWidth, PRInt32 aHeight);
|
||||
|
||||
static nsresult OpenWindow(const nsAFlatCString& aChromeURL,
|
||||
const nsAFlatString& aAppArgs)
|
||||
static nsresult OpenWindow(const nsCString& aChromeURL,
|
||||
const nsString& aAppArgs)
|
||||
{
|
||||
return OpenWindow(aChromeURL, aAppArgs,
|
||||
nsIAppShellService::SIZE_TO_CONTENT,
|
||||
nsIAppShellService::SIZE_TO_CONTENT);
|
||||
}
|
||||
|
||||
static nsresult OpenWindow(const nsAFlatCString& aChromeURL,
|
||||
static nsresult OpenWindow(const nsCString& aChromeURL,
|
||||
PRInt32 aWidth, PRInt32 aHeight)
|
||||
{
|
||||
return OpenWindow(aChromeURL, EmptyString(), aWidth, aHeight);
|
||||
}
|
||||
|
||||
static nsresult OpenWindow(const nsAFlatCString& aChromeURL,
|
||||
const nsAFlatString& aAppArgs,
|
||||
static nsresult OpenWindow(const nsCString& aChromeURL,
|
||||
const nsString& aAppArgs,
|
||||
PRInt32 aWidth, PRInt32 aHeight)
|
||||
{
|
||||
|
||||
|
@ -817,16 +821,26 @@ static char kMatchOSLocalePref[] = "intl.locale.matchOS";
|
|||
nsresult
|
||||
getCountry(const nsAString& lc_name, nsAString& aCountry)
|
||||
{
|
||||
#ifdef XPCOM_GLUE
|
||||
const PRUnichar *begin = lc_name.BeginReading();
|
||||
const PRUnichar *end = lc_name.EndReading();
|
||||
while (begin != end) {
|
||||
if (*begin == '-')
|
||||
break;
|
||||
++begin;
|
||||
}
|
||||
|
||||
nsresult result = NS_OK;
|
||||
if (begin == end)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRInt32 dash = lc_name.FindChar('-');
|
||||
if (dash > 0)
|
||||
aCountry = Substring(lc_name, dash+1, lc_name.Length()-dash);
|
||||
else
|
||||
result = NS_ERROR_FAILURE;
|
||||
|
||||
return result;
|
||||
aCountry.Assign(begin + 1, end - begin);
|
||||
#else
|
||||
PRInt32 i = lc_name.FindChar('-');
|
||||
if (i == kNotFound)
|
||||
return NS_ERROR_FAILURE;
|
||||
aCountry = Substring(lc_name, i + 1, PR_UINT32_MAX);
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult
|
||||
|
@ -1035,7 +1049,7 @@ static nsresult VerifyInstallation(int argc, char **argv)
|
|||
cleanupUtility->SetNativeLeafName(CLEANUP_UTIL);
|
||||
|
||||
//Create the process framework to run the cleanup utility
|
||||
nsCOMPtr<nsIProcess> cleanupProcess = do_CreateInstance(kIProcessCID);
|
||||
nsCOMPtr<nsIProcess> cleanupProcess = do_CreateInstance(NS_PROCESS_CONTRACTID);
|
||||
rv = cleanupProcess->Init(cleanupUtility);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = cleanupProcess->Run(PR_FALSE,nsnull, 0, nsnull);
|
||||
|
|
|
@ -35,8 +35,14 @@
|
|||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "nsNativeAppSupportBase.h"
|
||||
|
||||
#ifdef XPCOM_GLUE
|
||||
#include "nsStringSupport.h"
|
||||
#else
|
||||
#include "nsString.h"
|
||||
#endif
|
||||
|
||||
#include "nsNativeAppSupportBase.h"
|
||||
#include "nsIObserver.h"
|
||||
|
||||
#include <Application.h>
|
||||
|
|
|
@ -39,10 +39,15 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifdef XPCOM_GLUE
|
||||
#include "nsStringSupport.h"
|
||||
#else
|
||||
#include "nsString.h"
|
||||
#endif
|
||||
|
||||
#include "nsNativeAppSupportBase.h"
|
||||
#include "gdk/gdk.h"
|
||||
#include "prenv.h"
|
||||
#include "nsString.h"
|
||||
#ifdef MOZ_XUL_APP
|
||||
extern char* splash_xpm[];
|
||||
#else
|
||||
|
|
|
@ -44,12 +44,16 @@
|
|||
#define INCL_DOSERRORS
|
||||
#include <os2.h>
|
||||
|
||||
#ifdef XPCOM_GLUE
|
||||
#include "nsStringSupport.h"
|
||||
#else
|
||||
#include "nsString.h"
|
||||
#endif
|
||||
|
||||
#include "nsNativeAppSupportBase.h"
|
||||
#include "nsNativeAppSupportOS2.h"
|
||||
#include "nsString.h"
|
||||
#include "nsICmdLineService.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsICmdLineHandler.h"
|
||||
|
|
|
@ -41,12 +41,12 @@
|
|||
|
||||
#include "nsNativeAppSupportBase.h"
|
||||
#include "nsNativeAppSupportWin.h"
|
||||
#include "nsString.h"
|
||||
#include "nsICmdLineService.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsICmdLineHandler.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsXPCOM.h"
|
||||
|
@ -70,6 +70,12 @@
|
|||
#include "nsIObserverService.h"
|
||||
#include "nsXPCOM.h"
|
||||
|
||||
#ifdef XPCOM_GLUE
|
||||
#include "nsStringSupport.h"
|
||||
#else
|
||||
#include "nsString.h"
|
||||
#endif
|
||||
|
||||
// These are needed to load a URL in a browser window.
|
||||
#include "nsIDOMLocation.h"
|
||||
#include "nsIJSContextStack.h"
|
||||
|
@ -1349,7 +1355,7 @@ static nsCString hszValue( DWORD, HSZ ) {
|
|||
|
||||
|
||||
// Utility function to escape double-quotes within a string.
|
||||
static void escapeQuotes( nsAString &aString ) {
|
||||
static void escapeQuotes( nsString &aString ) {
|
||||
PRInt32 offset = -1;
|
||||
while( 1 ) {
|
||||
// Find next '"'.
|
||||
|
@ -1509,7 +1515,7 @@ nsNativeAppSupportWin::HandleDDENotification( UINT uType, // transaction t
|
|||
// title
|
||||
outpt.Append( NS_LITERAL_CSTRING("\",\"") );
|
||||
// Now copy the current page title to the return string
|
||||
outpt.Append( NS_LossyConvertUCS2toASCII( title.get() ));
|
||||
outpt.Append( NS_LossyConvertUCS2toASCII( title ));
|
||||
// Fill out the return string with the remainin ",""
|
||||
outpt.Append( NS_LITERAL_CSTRING( "\",\"\"" ));
|
||||
|
||||
|
@ -1682,14 +1688,14 @@ void nsNativeAppSupportWin::ParseDDEArg( HSZ args, int index, nsCString& aString
|
|||
DWORD argLen = DdeQueryString( mInstance, args, NULL, NULL, CP_WINANSI );
|
||||
// there wasn't any string, so return empty string
|
||||
if ( !argLen ) return;
|
||||
nsCAutoString temp;
|
||||
// Ensure result's buffer is sufficiently big.
|
||||
temp.SetLength( argLen );
|
||||
char *temp = (char *) malloc(argLen + 1);
|
||||
if ( !temp ) return;
|
||||
// Now get the string contents.
|
||||
DdeQueryString( mInstance, args, temp.BeginWriting(), argLen + 1, CP_WINANSI );
|
||||
DdeQueryString( mInstance, args, temp, argLen + 1, CP_WINANSI );
|
||||
// Parse out the given arg.
|
||||
ParseDDEArg(temp.get(), index, aString);
|
||||
return;
|
||||
ParseDDEArg(temp, index, aString);
|
||||
free(temp);
|
||||
}
|
||||
|
||||
void nsNativeAppSupportWin::ActivateLastWindow() {
|
||||
|
@ -1872,8 +1878,7 @@ nsNativeAppSupportWin::HandleRequest( LPBYTE request, PRBool newWindow ) {
|
|||
if (NS_FAILED(rv) || !defaultArgs) return;
|
||||
|
||||
if (defaultArgs) {
|
||||
nsCAutoString url;
|
||||
url.AssignWithConversion( defaultArgs );
|
||||
NS_LossyConvertUCS2toASCII url( defaultArgs );
|
||||
OpenBrowserWindow(url.get());
|
||||
} else {
|
||||
OpenBrowserWindow("about:blank");
|
||||
|
|
|
@ -0,0 +1,345 @@
|
|||
/* ***** 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.
|
||||
*
|
||||
* The Initial Developer of the Original Code is IBM Corporation.
|
||||
* Portions created by IBM Corporation are Copyright (C) 2004
|
||||
* IBM Corporation. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Darin Fisher <darin@meer.net>
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
#ifndef nsStringSupport_h__
|
||||
#define nsStringSupport_h__
|
||||
|
||||
/**
|
||||
* This file attempts to implement the subset of string classes and methods
|
||||
* used by xpfe/bootstrap in terms of the frozen string API.
|
||||
*
|
||||
* This code exists to allow xpfe/bootstrap to be optionally compiled as a
|
||||
* standalone embedder of the GRE. However, since the module can also be built
|
||||
* statically or as a non-GRE application, it is necessary to support compiling
|
||||
* it directly against the internal xpcom string classes. Hence, this layer of
|
||||
* indirection ;-)
|
||||
*/
|
||||
|
||||
#include "nsEmbedString.h"
|
||||
#include "nsMemory.h"
|
||||
#include "prprf.h"
|
||||
#include "plstr.h"
|
||||
|
||||
// rename class names that are redefined here
|
||||
#define nsCString nsCString_local
|
||||
#define nsCAutoString nsCAutoString_local
|
||||
#define nsDependentCString nsDependentCString_local
|
||||
#define nsXPIDLCString nsXPIDLCString_local
|
||||
#define nsCGetterCopies nsCGetterCopies_local
|
||||
#define nsString nsString_local
|
||||
#define nsAutoString nsAutoString_local
|
||||
#define nsDependentString nsDependentString_local
|
||||
#define nsXPIDLString nsXPIDLString_local
|
||||
#define nsGetterCopies nsGetterCopies_local
|
||||
#define NS_ConvertUCS2toUTF8 NS_ConvertUCS2toUTF8_local
|
||||
#define NS_LossyConvertUCS2toASCII NS_LossyConvertUCS2toASCII_local
|
||||
#define getter_Copies getter_Copies_local
|
||||
|
||||
#define kNotFound -1
|
||||
|
||||
class nsCString : public nsEmbedCString
|
||||
{
|
||||
public:
|
||||
nsCString() {}
|
||||
nsCString(const char *s)
|
||||
{
|
||||
Assign(s);
|
||||
}
|
||||
void AppendInt(PRInt32 value)
|
||||
{
|
||||
char buf[32];
|
||||
PR_snprintf(buf, sizeof(buf), "%d", value);
|
||||
Append(buf);
|
||||
}
|
||||
PRBool IsEmpty()
|
||||
{
|
||||
return Length() == 0;
|
||||
}
|
||||
PRInt32 FindChar(char c, PRUint32 offset = 0)
|
||||
{
|
||||
NS_ASSERTION(offset <= Length(), "invalid offset");
|
||||
const char *data = get() + offset;
|
||||
for (const char *p = data; *p; ++p)
|
||||
if (*p == c)
|
||||
return p - data;
|
||||
return kNotFound;
|
||||
}
|
||||
PRInt32 Find(const char *needle, PRBool ignoreCase = PR_FALSE)
|
||||
{
|
||||
const char *data = get(), *p;
|
||||
if (ignoreCase)
|
||||
p = PL_strcasestr(data, needle);
|
||||
else
|
||||
p = PL_strstr(data, needle);
|
||||
return p ? p - data : kNotFound;
|
||||
}
|
||||
PRBool Equals(const char *s)
|
||||
{
|
||||
return strcmp(get(), s) == 0;
|
||||
}
|
||||
};
|
||||
|
||||
class nsDependentCString : public nsCString
|
||||
{
|
||||
public:
|
||||
nsDependentCString(const char *data)
|
||||
{
|
||||
Assign(data); // XXX forced to copy
|
||||
}
|
||||
nsDependentCString(const char *data, PRUint32 len)
|
||||
{
|
||||
Assign(data, len); // XXX forced to copy
|
||||
}
|
||||
};
|
||||
|
||||
class nsCAutoString : public nsCString
|
||||
{
|
||||
public:
|
||||
nsCAutoString() {}
|
||||
nsCAutoString(const char *data)
|
||||
{
|
||||
Assign(data);
|
||||
}
|
||||
nsCAutoString(const nsCString &s)
|
||||
{
|
||||
Assign(s);
|
||||
}
|
||||
};
|
||||
|
||||
class nsString : public nsEmbedString
|
||||
{
|
||||
public:
|
||||
nsString() {}
|
||||
PRBool IsEmpty()
|
||||
{
|
||||
return Length() == 0;
|
||||
}
|
||||
PRInt32 FindChar(PRUnichar c, PRUint32 offset = 0)
|
||||
{
|
||||
NS_ASSERTION(offset <= Length(), "invalid offset");
|
||||
const PRUnichar *data = get() + offset;
|
||||
for (const PRUnichar *p = data; *p; ++p)
|
||||
if (*p == c)
|
||||
return p - data;
|
||||
return kNotFound;
|
||||
}
|
||||
};
|
||||
|
||||
class nsDependentString : public nsString
|
||||
{
|
||||
public:
|
||||
nsDependentString(const PRUnichar *data)
|
||||
{
|
||||
Assign(data); // XXX forced to copy
|
||||
}
|
||||
};
|
||||
|
||||
class nsAutoString : public nsString
|
||||
{
|
||||
public:
|
||||
void AssignWithConversion(const char *data)
|
||||
{
|
||||
AssignLiteral(data);
|
||||
}
|
||||
void AssignLiteral(const char *data)
|
||||
{
|
||||
NS_CStringToUTF16(nsEmbedCString(data), NS_CSTRING_ENCODING_ASCII, *this);
|
||||
}
|
||||
nsAutoString &operator=(const PRUnichar *s)
|
||||
{
|
||||
Assign(s);
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
class nsXPIDLCString : public nsCString
|
||||
{
|
||||
public:
|
||||
nsXPIDLCString() : mVoided(PR_TRUE) {}
|
||||
|
||||
const char *get() const
|
||||
{
|
||||
return mVoided ? nsnull : nsEmbedCString::get();
|
||||
}
|
||||
operator const char*() const
|
||||
{
|
||||
return get();
|
||||
}
|
||||
|
||||
void Adopt(char *data)
|
||||
{
|
||||
if (data)
|
||||
{
|
||||
// XXX unfortunately, we don't have a better way to do this.
|
||||
Assign(data);
|
||||
nsMemory::Free(data);
|
||||
mVoided = PR_FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
Cut(0, PR_UINT32_MAX);
|
||||
mVoided = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
PRBool mVoided;
|
||||
};
|
||||
|
||||
class nsCGetterCopies
|
||||
{
|
||||
public:
|
||||
typedef char char_type;
|
||||
|
||||
nsCGetterCopies(nsXPIDLCString& str)
|
||||
: mString(str), mData(nsnull) {}
|
||||
|
||||
~nsCGetterCopies()
|
||||
{
|
||||
mString.Adopt(mData); // OK if mData is null
|
||||
}
|
||||
|
||||
operator char_type**()
|
||||
{
|
||||
return &mData;
|
||||
}
|
||||
|
||||
private:
|
||||
nsXPIDLCString& mString;
|
||||
char_type* mData;
|
||||
};
|
||||
|
||||
inline
|
||||
nsCGetterCopies
|
||||
getter_Copies( nsXPIDLCString& aString )
|
||||
{
|
||||
return nsCGetterCopies(aString);
|
||||
}
|
||||
|
||||
class nsXPIDLString : public nsString
|
||||
{
|
||||
public:
|
||||
nsXPIDLString() : mVoided(PR_TRUE) {}
|
||||
|
||||
const PRUnichar *get() const
|
||||
{
|
||||
return mVoided ? nsnull : nsEmbedString::get();
|
||||
}
|
||||
operator const PRUnichar*() const
|
||||
{
|
||||
return get();
|
||||
}
|
||||
|
||||
void Adopt(PRUnichar *data)
|
||||
{
|
||||
if (data)
|
||||
{
|
||||
// XXX unfortunately, we don't have a better way to do this.
|
||||
Assign(data);
|
||||
nsMemory::Free(data);
|
||||
mVoided = PR_FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
Cut(0, PR_UINT32_MAX);
|
||||
mVoided = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
PRBool mVoided;
|
||||
};
|
||||
|
||||
class nsGetterCopies
|
||||
{
|
||||
public:
|
||||
typedef PRUnichar char_type;
|
||||
|
||||
nsGetterCopies(nsXPIDLString& str)
|
||||
: mString(str), mData(nsnull) {}
|
||||
|
||||
~nsGetterCopies()
|
||||
{
|
||||
mString.Adopt(mData); // OK if mData is null
|
||||
}
|
||||
|
||||
operator char_type**()
|
||||
{
|
||||
return &mData;
|
||||
}
|
||||
|
||||
private:
|
||||
nsXPIDLString& mString;
|
||||
char_type* mData;
|
||||
};
|
||||
|
||||
inline
|
||||
nsGetterCopies
|
||||
getter_Copies( nsXPIDLString& aString )
|
||||
{
|
||||
return nsGetterCopies(aString);
|
||||
}
|
||||
|
||||
class NS_ConvertUCS2toUTF8 : public nsCString
|
||||
{
|
||||
public:
|
||||
NS_ConvertUCS2toUTF8(const nsAString &str)
|
||||
{
|
||||
NS_UTF16ToCString(str, NS_CSTRING_ENCODING_UTF8, *this);
|
||||
}
|
||||
};
|
||||
|
||||
class NS_LossyConvertUCS2toASCII : public nsCString
|
||||
{
|
||||
public:
|
||||
NS_LossyConvertUCS2toASCII(const nsAString &str)
|
||||
{
|
||||
NS_UTF16ToCString(str, NS_CSTRING_ENCODING_ASCII, *this);
|
||||
}
|
||||
};
|
||||
|
||||
#define NS_LITERAL_CSTRING(s) nsDependentCString(s)
|
||||
|
||||
#ifdef HAVE_CPP_2BYTE_WCHAR_T
|
||||
#define NS_LITERAL_STRING(s) nsDependentString(L##s)
|
||||
#else
|
||||
#error "need implementation of NS_LITERAL_STRING"
|
||||
#endif
|
||||
|
||||
#define EmptyCString() nsCString()
|
||||
#define EmptyString() nsString()
|
||||
|
||||
#endif // !nsStringSupport_h__
|
|
@ -74,6 +74,7 @@
|
|||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIServiceManagerUtils.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIXULWindow.h"
|
||||
#include "nsIWebBrowserChrome.h"
|
||||
|
|
|
@ -75,6 +75,7 @@ char *bindir[] = {
|
|||
"PLC4.DLL",
|
||||
"PLDS4.DLL",
|
||||
"XPCOM.DLL",
|
||||
"XPCOMCOR.DLL",
|
||||
"XPCOMCT.DLL",
|
||||
0
|
||||
};
|
||||
|
|
|
@ -48,8 +48,6 @@
|
|||
#include "nsIComponentManager.h"
|
||||
#include "nsICategoryManager.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
struct nsModuleComponentInfo; // forward declaration
|
||||
|
|
|
@ -51,6 +51,7 @@ bin/nspr4.dll
|
|||
bin/plc4.dll
|
||||
bin/plds4.dll
|
||||
bin/xpcom.dll
|
||||
bin/xpcomcor.dll
|
||||
bin/xpistub.dll
|
||||
;bin/zlib.dll
|
||||
bin/mozz.dll
|
||||
|
|
|
@ -48,6 +48,7 @@ bin/libplc4.so
|
|||
bin/libplds4.so
|
||||
bin/cpu/sparcv8plus/libnspr_flt4.so
|
||||
bin/libxpcom.so
|
||||
bin/libxpcom_core.so
|
||||
bin/libxpistub.so
|
||||
bin/components/libxpinstall.so
|
||||
bin/components/libjar50.so
|
||||
|
|
|
@ -50,6 +50,7 @@ bin/libplc4.so
|
|||
bin/libplds4.so
|
||||
bin/cpu/sparcv8plus/libnspr_flt4.so
|
||||
bin/libxpcom.so
|
||||
bin/libxpcom_core.so
|
||||
bin/libxpistub.so
|
||||
bin/libmozz.so
|
||||
bin/components/libxpinstall.so
|
||||
|
|
|
@ -473,6 +473,7 @@ function upgradeCleanup()
|
|||
deleteThisFile("Program", "softokn3.dll");
|
||||
deleteThisFile("Program", "ssl3.dll");
|
||||
deleteThisFile("Program", "xpcom.dll");
|
||||
deleteThisFile("Program", "xpcom_core.dll");
|
||||
deleteThisFile("Program", "xpistub.dll");
|
||||
deleteThisFile("Program", "zlib.dll");
|
||||
deleteThisFile("Program", "mozz.dll");
|
||||
|
|
|
@ -16,6 +16,7 @@ bin\nspr4.dll
|
|||
bin\plc4.dll
|
||||
bin\plds4.dll
|
||||
bin\xpcom.dll
|
||||
bin\xpcom_core.dll
|
||||
bin\xpistub.dll
|
||||
bin\mozz.dll
|
||||
bin\components\jar50.dll
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#include "nsIXPINotifier.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
|
Загрузка…
Ссылка в новой задаче