Bug 786533 - Replace NS_MIN/NS_MAX with std::min/std::max and #include <algorithm> where needed.  r=ehsan
Bug 786533 - Replace NS_MIN/NS_MAX in xpcom/ with XPCOM_MIN/XPCOM_MAX to prevent accidental use.  r=ehsan
Bug 786533 - On OSX, one of the system header files (exception_defines.h) defines 'try' and 'catch' as macros which breaks @try/@catch.  We need to #undef those before using nsObjCExceptions.h.  r=ehsan
Bug 786533 - On Windows, one of the system header files (windef.h) defines 'min' and 'max' as macros which breaks any use of std::min/std::max.  Define NOMINMAX before including system header files where needed to avoid defining those macros.  r=ehsan
Bug 786533 - X11/Xlibint.h defines 'min' and 'max' as macros which breaks any use of std::min/std::max.  r=ehsan