Bug 1402255 - Change nsIBaseWindow::title from wstring to AString. r=janv.

Because nsAString is nicer to work with than char16_t*. The patch relatedly
changes nsIEmbeddingSiteWindow::title and nsIWindowMediator::updateWindowTitle
as well.

--HG--
extra : rebase_source : 0bf332dec3e09af6c39c676f8795b368768a6046
This commit is contained in:
Nicholas Nethercote 2017-09-25 13:10:51 +10:00
Родитель 1b29ddae7a
Коммит 3aa25724fe
16 изменённых файлов: 31 добавлений и 39 удалений

Просмотреть файл

@ -6632,16 +6632,14 @@ nsDocShell::GetMainWidget(nsIWidget** aMainWidget)
}
NS_IMETHODIMP
nsDocShell::GetTitle(char16_t** aTitle)
nsDocShell::GetTitle(nsAString& aTitle)
{
NS_ENSURE_ARG_POINTER(aTitle);
*aTitle = ToNewUnicode(mTitle);
aTitle = mTitle;
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::SetTitle(const char16_t* aTitle)
nsDocShell::SetTitle(const nsAString& aTitle)
{
// Store local title
mTitle = aTitle;

Просмотреть файл

@ -720,7 +720,7 @@ nsDocShellTreeOwner::SetFocus()
}
NS_IMETHODIMP
nsDocShellTreeOwner::GetTitle(char16_t** aTitle)
nsDocShellTreeOwner::GetTitle(nsAString& aTitle)
{
nsCOMPtr<nsIEmbeddingSiteWindow> ownerWin = GetOwnerWin();
if (ownerWin) {
@ -730,7 +730,7 @@ nsDocShellTreeOwner::GetTitle(char16_t** aTitle)
}
NS_IMETHODIMP
nsDocShellTreeOwner::SetTitle(const char16_t* aTitle)
nsDocShellTreeOwner::SetTitle(const nsAString& aTitle)
{
nsCOMPtr<nsIEmbeddingSiteWindow> ownerWin = GetOwnerWin();
if (ownerWin) {

Просмотреть файл

@ -7341,7 +7341,7 @@ nsDocument::DoNotifyPossibleTitleChange()
if (container) {
nsCOMPtr<nsIBaseWindow> docShellWin = do_QueryInterface(container);
if (docShellWin) {
docShellWin->SetTitle(title.get());
docShellWin->SetTitle(title);
}
}
}

Просмотреть файл

@ -941,7 +941,7 @@ TabChild::SetVisibility(bool aVisibility)
}
NS_IMETHODIMP
TabChild::GetTitle(char16_t** aTitle)
TabChild::GetTitle(nsAString& aTitle)
{
NS_WARNING("TabChild::GetTitle not supported in TabChild");
@ -949,7 +949,7 @@ TabChild::GetTitle(char16_t** aTitle)
}
NS_IMETHODIMP
TabChild::SetTitle(const char16_t* aTitle)
TabChild::SetTitle(const nsAString& aTitle)
{
// JavaScript sends the "DOMTitleChanged" event to the parent
// via the message manager.

Просмотреть файл

@ -134,7 +134,7 @@ interface nsIEmbeddingSiteWindow : nsISupports
/**
* Title of the window.
*/
attribute wstring title;
attribute AString title;
/**
* Native window for the site's window. The implementor should copy the

Просмотреть файл

@ -1582,9 +1582,8 @@ nsWebBrowser::SetFocus()
}
NS_IMETHODIMP
nsWebBrowser::GetTitle(char16_t** aTitle)
nsWebBrowser::GetTitle(nsAString& aTitle)
{
NS_ENSURE_ARG_POINTER(aTitle);
NS_ENSURE_STATE(mDocShell);
NS_ENSURE_SUCCESS(mDocShellAsWin->GetTitle(aTitle), NS_ERROR_FAILURE);
@ -1593,7 +1592,7 @@ nsWebBrowser::GetTitle(char16_t** aTitle)
}
NS_IMETHODIMP
nsWebBrowser::SetTitle(const char16_t* aTitle)
nsWebBrowser::SetTitle(const nsAString& aTitle)
{
NS_ENSURE_STATE(mDocShell);

Просмотреть файл

@ -993,7 +993,7 @@ nsNativeAppSupportWin::HandleDDENotification( UINT uType, // transaction t
if(!baseWindow) {
break;
}
baseWindow->GetTitle(getter_Copies(title));
baseWindow->GetTitle(title);
// Escape any double-quotes in the title.
escapeQuotes( title );

Просмотреть файл

@ -226,5 +226,5 @@ interface nsIBaseWindow : nsISupports
/*
Title of the window.
*/
attribute wstring title;
attribute AString title;
};

Просмотреть файл

@ -380,12 +380,12 @@ WebBrowserChrome2Stub::SetVisibility(bool aVisibility)
}
NS_IMETHODIMP
WebBrowserChrome2Stub::GetTitle(char16_t** aTitle)
WebBrowserChrome2Stub::GetTitle(nsAString& aTitle)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
WebBrowserChrome2Stub::SetTitle(const char16_t* aTitle)
WebBrowserChrome2Stub::SetTitle(const nsAString& aTitle)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -430,13 +430,13 @@ NS_IMETHODIMP nsChromeTreeOwner::SetFocus()
return mXULWindow->SetFocus();
}
NS_IMETHODIMP nsChromeTreeOwner::GetTitle(char16_t** aTitle)
NS_IMETHODIMP nsChromeTreeOwner::GetTitle(nsAString& aTitle)
{
NS_ENSURE_STATE(mXULWindow);
return mXULWindow->GetTitle(aTitle);
}
NS_IMETHODIMP nsChromeTreeOwner::SetTitle(const char16_t* aTitle)
NS_IMETHODIMP nsChromeTreeOwner::SetTitle(const nsAString& aTitle)
{
NS_ENSURE_STATE(mXULWindow);
return mXULWindow->SetTitle(aTitle);

Просмотреть файл

@ -713,15 +713,14 @@ NS_IMETHODIMP nsContentTreeOwner::SetFocus()
return mXULWindow->SetFocus();
}
NS_IMETHODIMP nsContentTreeOwner::GetTitle(char16_t** aTitle)
NS_IMETHODIMP nsContentTreeOwner::GetTitle(nsAString& aTitle)
{
NS_ENSURE_ARG_POINTER(aTitle);
NS_ENSURE_STATE(mXULWindow);
return mXULWindow->GetTitle(aTitle);
}
NS_IMETHODIMP nsContentTreeOwner::SetTitle(const char16_t* aTitle)
NS_IMETHODIMP nsContentTreeOwner::SetTitle(const nsAString& aTitle)
{
// We only allow the title to be set from the primary content shell
if(!mPrimary || !mContentTitleSetting)
@ -810,7 +809,7 @@ NS_IMETHODIMP nsContentTreeOwner::SetTitle(const char16_t* aTitle)
return rv.StealNSResult();
}
return mXULWindow->SetTitle(title.get());
return mXULWindow->SetTitle(title);
}
//*****************************************************************************
@ -1148,13 +1147,13 @@ nsSiteWindow::SetVisibility(bool aVisibility)
}
NS_IMETHODIMP
nsSiteWindow::GetTitle(char16_t * *aTitle)
nsSiteWindow::GetTitle(nsAString& aTitle)
{
return mAggregator->GetTitle(aTitle);
}
NS_IMETHODIMP
nsSiteWindow::SetTitle(const char16_t * aTitle)
nsSiteWindow::SetTitle(const nsAString& aTitle)
{
return mAggregator->SetTitle(aTitle);
}

Просмотреть файл

@ -109,7 +109,7 @@ interface nsIWindowMediator: nsISupports
* @param inTitle the window's new title
*/
[noscript] void updateWindowTitle(in nsIXULWindow aWindow,
in wstring inTitle );
in AString inTitle);
/* z-ordering: */

Просмотреть файл

@ -10,8 +10,7 @@ interface nsIXULWindow;
[scriptable, uuid(2F276982-0D60-4377-A595-D350BA516395)]
interface nsIWindowMediatorListener : nsISupports
{
void onWindowTitleChange(in nsIXULWindow window,
in wstring newTitle);
void onWindowTitleChange(in nsIXULWindow window, in AString newTitle);
void onOpenWindow(in nsIXULWindow window);
void onCloseWindow(in nsIXULWindow window);

Просмотреть файл

@ -396,7 +396,7 @@ nsWindowMediator::UpdateWindowTimeStamp(nsIXULWindow* inWindow)
NS_IMETHODIMP
nsWindowMediator::UpdateWindowTitle(nsIXULWindow* inWindow,
const char16_t* inTitle)
const nsAString& inTitle)
{
MOZ_RELEASE_ASSERT(NS_IsMainThread());
NS_ENSURE_STATE(mReady);

Просмотреть файл

@ -890,17 +890,13 @@ NS_IMETHODIMP nsXULWindow::SetFocus()
return NS_OK;
}
NS_IMETHODIMP nsXULWindow::GetTitle(char16_t** aTitle)
NS_IMETHODIMP nsXULWindow::GetTitle(nsAString& aTitle)
{
NS_ENSURE_ARG_POINTER(aTitle);
*aTitle = ToNewUnicode(mTitle);
if (!*aTitle)
return NS_ERROR_OUT_OF_MEMORY;
aTitle = mTitle;
return NS_OK;
}
NS_IMETHODIMP nsXULWindow::SetTitle(const char16_t* aTitle)
NS_IMETHODIMP nsXULWindow::SetTitle(const nsAString& aTitle)
{
NS_ENSURE_STATE(mWindow);
mTitle.Assign(aTitle);

Просмотреть файл

@ -121,7 +121,7 @@ NS_INTERFACE_MAP_END
NS_IMETHODIMP
nsWindowDataSource::OnWindowTitleChange(nsIXULWindow *window,
const char16_t *newTitle)
const nsAString& newTitle)
{
nsresult rv;
@ -137,7 +137,8 @@ nsWindowDataSource::OnWindowTitleChange(nsIXULWindow *window,
NS_ENSURE_TRUE(windowResource, NS_ERROR_UNEXPECTED);
nsCOMPtr<nsIRDFLiteral> newTitleLiteral;
rv = gRDFService->GetLiteral(newTitle, getter_AddRefs(newTitleLiteral));
rv = gRDFService->GetLiteral(PromiseFlatString(newTitle).get(),
getter_AddRefs(newTitleLiteral));
NS_ENSURE_SUCCESS(rv, rv);
// get the old title