Copy'n'paste (340071) and drag'n'drop (340890) between Mozilla app running natively and Mozilla app running under Rosetta translation does not work [properly]. Byte-swap UTF-16 text in private flavors when running under Rosetta. r=josh sr=pink a/1.8.1=me
git-svn-id: svn://10.0.0.236/trunk@199998 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -41,7 +41,7 @@
|
||||
* nsIMacUtils: Generic globally-available Mac-specific utilities.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(59BE3453-873B-450D-8DB8-2643E08A00BE)]
|
||||
[scriptable, uuid(F6FC107C-5CBA-4C5C-A35E-B69D580D1DB6)]
|
||||
interface nsIMacUtils : nsISupports
|
||||
{
|
||||
/**
|
||||
@@ -49,4 +49,9 @@ interface nsIMacUtils : nsISupports
|
||||
* ppc and x86 (universal binary).
|
||||
*/
|
||||
readonly attribute boolean isUniversalBinary;
|
||||
|
||||
/**
|
||||
* True when running under binary translation (Rosetta).
|
||||
*/
|
||||
readonly attribute boolean isTranslated;
|
||||
};
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <mach-o/fat.h>
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsMacUtilsImpl, nsIMacUtils)
|
||||
@@ -123,3 +124,31 @@ done:
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute boolean isTranslated; */
|
||||
// True when running under binary translation (Rosetta).
|
||||
NS_IMETHODIMP nsMacUtilsImpl::GetIsTranslated(PRBool *aIsTranslated)
|
||||
{
|
||||
#ifdef __ppc__
|
||||
static PRBool sInitialized = PR_FALSE;
|
||||
|
||||
// Initialize sIsNative to 1. If the sysctl fails because it doesn't
|
||||
// exist, then translation is not possible, so the process must not be
|
||||
// running translated.
|
||||
static PRInt32 sIsNative = 1;
|
||||
|
||||
if (!sInitialized) {
|
||||
size_t sz = sizeof(sIsNative);
|
||||
sysctlbyname("sysctl.proc_native", &sIsNative, &sz, NULL, 0);
|
||||
sInitialized = PR_TRUE;
|
||||
}
|
||||
|
||||
*aIsTranslated = !sIsNative;
|
||||
#else
|
||||
// Translation only exists for ppc code. Other architectures aren't
|
||||
// translated.
|
||||
*aIsTranslated = PR_FALSE;
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user