зеркало из https://github.com/mozilla/gecko-dev.git
Fix window title encoding when getting it via AppleScript. b=448087 r=josh sr=roc
This commit is contained in:
Родитель
814bebc25e
Коммит
62bf95e767
|
@ -426,8 +426,9 @@ void nsWindowUtils::GetCleanedWindowName(WindowPtr wind, char* outName, long max
|
||||||
baseWindow->GetTitle(getter_Copies(title));
|
baseWindow->GetTitle(getter_Copies(title));
|
||||||
ThrowErrIfNil(title, paramErr);
|
ThrowErrIfNil(title, paramErr);
|
||||||
|
|
||||||
// convert to MacRoman, which is what AppleEvents expects
|
// Convert window title to MacRoman, which is what AppleEvents expects
|
||||||
CFStringRef windowTitleCFString = ::CFStringCreateWithCharacters(kCFAllocatorDefault, title.get(), kCFStringEncodingUTF16);
|
const char* cTitle = NS_ConvertUTF16toUTF8(title).get();
|
||||||
|
CFStringRef windowTitleCFString = ::CFStringCreateWithCString(kCFAllocatorDefault, (char *)cTitle, kCFStringEncodingUTF8);
|
||||||
if (windowTitleCFString) {
|
if (windowTitleCFString) {
|
||||||
::CFStringGetCString(windowTitleCFString, outName, maxLen, kCFStringEncodingMacRoman);
|
::CFStringGetCString(windowTitleCFString, outName, maxLen, kCFStringEncodingMacRoman);
|
||||||
outName[maxLen - 1] = '\0'; // in case it didn't get null terminated
|
outName[maxLen - 1] = '\0'; // in case it didn't get null terminated
|
||||||
|
|
Загрузка…
Ссылка в новой задаче