# HG changeset patch
# User t_mrc-ct@users.sourceforge.jp
# Date 1375620327 -32400
# Branch GECKO17011esr_2013111808_RELBRANCH
# Node ID 6999b9d33dfd6ccf235d399f9504c117972a3bbc
# Parent  3684fe1785c2406f880dcc42adf1f8f06c9ad820
patch for xpcshell-tests

diff --git a/build/Makefile.in b/build/Makefile.in
--- a/build/Makefile.in
+++ b/build/Makefile.in
@@ -170,41 +170,41 @@
 ifeq ($(OS_ARCH),Darwin)
 libs:: $(topsrcdir)/tools/rb/fix-macosx-stack.pl
 	$(INSTALL) $< $(DIST)/bin
 libs:: $(topsrcdir)/tools/rb/fix_macosx_stack.py
 	$(INSTALL) $< $(DIST)/bin
 
 # Basic unit tests for some stuff in the unify script
 check::
-# build x64/i386 binaries, and unify them
-	rm -f unify-test-x64 unify-test-i386 unify-test-universal
-	$(HOST_CC) -arch x86_64 $(srcdir)/unify-test.c -o unify-test-x64
-	$(HOST_CC) -arch i386 $(srcdir)/unify-test.c -o unify-test-i386
-	@if ! $(srcdir)/macosx/universal/unify ./unify-test-x64 ./unify-test-i386 \
+# build ppc64/32 binaries, and unify them
+	rm -f unify-test-ppc64 unify-test-ppc32 unify-test-universal
+	$(HOST_CC) -m64 $(srcdir)/unify-test.c -o unify-test-ppc64
+	$(HOST_CC) -m32 $(srcdir)/unify-test.c -o unify-test-ppc32
+	@if ! $(srcdir)/macosx/universal/unify ./unify-test-ppc64 ./unify-test-ppc32 \
           ./unify-test-universal; then \
           echo "TEST-UNEXPECTED-FAIL | build/ | unify failed to produce a universal binary!"; \
           false; \
         fi
 	@if test ! -f ./unify-test-universal; then \
           echo "TEST-UNEXPECTED-FAIL | build/ | unify failed to produce a universal binary!"; \
           false; \
         fi
 	@if ! file -b ./unify-test-universal | head -n1 | grep -q "^Mach-O universal binary"; then \
           echo "TEST-UNEXPECTED-FAIL | build/ | unify failed to produce a universal binary!"; \
           false; \
         else \
           echo "TEST-PASS | build/ | unify produced a universal binary!"; \
         fi
 # try building an x86-64 binary. if that succeeds, try unifying it
 # with an i386 binary
-	rm -f unify-test-x86_64 unify-test-universal-64
-	-$(HOST_CC) -arch x86_64 $(srcdir)/unify-test.c -o unify-test-x86_64
-	@if test -f ./unify-test-x86_64; then \
-          if ! $(srcdir)/macosx/universal/unify ./unify-test-x86_64 ./unify-test-i386 \
+	rm -f unify-test-ppc64 unify-test-universal-64
+	-$(HOST_CC) -m64 $(srcdir)/unify-test.c -o unify-test-ppc64
+	@if test -f ./unify-test-ppc64; then \
+          if ! $(srcdir)/macosx/universal/unify ./unify-test-ppc64 ./unify-test-ppc32 \
             ./unify-test-universal-64; then \
             echo "TEST-UNEXPECTED-FAIL | build/ | unify failed to produce a universal binary with a 64-bit input!"; \
             false; \
           fi; \
           if test ! -f ./unify-test-universal-64; then \
             echo "TEST-UNEXPECTED-FAIL | build/ | unify failed to produce a universal binary with a 64-bit input!"; \
             false; \
           fi; \
diff --git a/build/automationutils.py b/build/automationutils.py
--- a/build/automationutils.py
+++ b/build/automationutils.py
@@ -412,12 +412,13 @@
 def wrapCommand(cmd):
   """
   If running on OS X 10.5 or older, wrap |cmd| so that it will
   be executed as an i386 binary, in case it's a 32-bit/64-bit universal
   binary.
   """
   if platform.system() == "Darwin" and \
      hasattr(platform, 'mac_ver') and \
+     platform.processor() != 'powerpc' and \
      platform.mac_ver()[0][:4] < '10.6':
     return ["arch", "-arch", "i386"] + cmd
   # otherwise just execute the command normally
   return cmd
diff --git a/dom/plugins/test/testplugin/nptest_macosx.mm b/dom/plugins/test/testplugin/nptest_macosx.mm
--- a/dom/plugins/test/testplugin/nptest_macosx.mm
+++ b/dom/plugins/test/testplugin/nptest_macosx.mm
@@ -230,17 +230,17 @@
       CTFrameDraw(frame, cgContext);
       CFRelease(frame);
     }
 #else
     CGContextSetGrayFillColor(cgContext, 0.0, 1.0);
     ATSUStyle atsuStyle;
     ATSUCreateStyle(&atsuStyle);
     CFIndex stringLength = CFStringGetLength(uaCFString);
-    UniChar* unicharBuffer = (UniChar*)malloc((stringLength + 1) * sizeof(UniChar));
+    UniChar* unicharBuffer = (UniChar*)NPN_MemAlloc((stringLength + 1) * sizeof(UniChar));
     CFStringGetCharacters(uaCFString, CFRangeMake(0, stringLength), unicharBuffer);
     UniCharCount runLengths = kATSUToTextEnd;
     ATSUTextLayout atsuLayout;
     ATSUCreateTextLayoutWithTextPtr(unicharBuffer,
                                     kATSUFromTextBeginning,
                                     kATSUToTextEnd,
                                     stringLength,
                                     1,
@@ -270,33 +270,33 @@
                         kATSUFromTextBeginning,
                         stringLength,
                         FloatToFixed(windowWidth - 10.0),
                         &softBreakCount);
     ATSUGetSoftLineBreaks(atsuLayout,
                           kATSUFromTextBeginning,
                           kATSUToTextEnd,
                           0, NULL, &softBreakCount);
-    UniCharArrayOffset* softBreaks = (UniCharArrayOffset*)malloc(softBreakCount * sizeof(UniCharArrayOffset));
+    UniCharArrayOffset* softBreaks = (UniCharArrayOffset*)NPN_MemAlloc(softBreakCount * sizeof(UniCharArrayOffset));
     ATSUGetSoftLineBreaks(atsuLayout,
                           kATSUFromTextBeginning,
                           kATSUToTextEnd,
                           softBreakCount, softBreaks, &softBreakCount);
     UniCharArrayOffset currentDrawOffset = kATSUFromTextBeginning;
     unsigned int i = 0;
     while (i < softBreakCount) {
       ATSUDrawText(atsuLayout, currentDrawOffset, softBreaks[i], FloatToFixed(5.0),
                    FloatToFixed(windowHeight - 5.0 - (lineHeight * (i + 1.0))));
       currentDrawOffset = softBreaks[i];
       i++;
     }
     ATSUDrawText(atsuLayout, currentDrawOffset, kATSUToTextEnd, FloatToFixed(5.0),
                  FloatToFixed(windowHeight - 5.0 - (lineHeight * (i + 1.0))));
-    free(unicharBuffer);
-    free(softBreaks);
+    NPN_MemFree(unicharBuffer);
+    NPN_MemFree(softBreaks);
 #endif
 
     // restore the cgcontext gstate
     CGContextRestoreGState(cgContext);
     break;
   }
   case DM_SOLID_COLOR: {
     // save the cgcontext gstate
diff --git a/testing/mozbase/mozrunner/mozrunner/runner.py b/testing/mozbase/mozrunner/mozrunner/runner.py
--- a/testing/mozbase/mozrunner/mozrunner/runner.py
+++ b/testing/mozbase/mozrunner/mozrunner/runner.py
@@ -225,16 +225,17 @@
 
     def _wrap_command(self, cmd):
         """
         If running on OS X 10.5 or older, wrap |cmd| so that it will
         be executed as an i386 binary, in case it's a 32-bit/64-bit universal
         binary.
         """
         if mozinfo.isMac and hasattr(platform, 'mac_ver') and \
+                               platform.processor() != 'powerpc' and \
                                platform.mac_ver()[0][:4] < '10.6':
             return ["arch", "-arch", "i386"] + cmd
         return cmd
 
     __del__ = cleanup
 
 
 class FirefoxRunner(Runner):
