Bug 969757 - Remove the dead code in our tree which pretends to support OS/2; r=roc,mcmanus,gps,jorendorf,bsmedberg sr=bsmedberg
authorEhsan Akhgari <ehsan@mozilla.com>
Mon, 10 Feb 2014 17:57:01 -0500
changeset 167937 58fe9dc85fa4c4eec3407b3a2c7b137a1f7c7ff4
parent 167936 6d101392c66f2b474c32c314619b2c3ed67b0b0f
child 167938 1559cb15be5ae81eb591771607aad2d8777b5be4
push id39602
push usereakhgari@mozilla.com
push dateMon, 10 Feb 2014 22:57:19 +0000
treeherdermozilla-inbound@58fe9dc85fa4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, mcmanus, gps, jorendorf, bsmedberg, bsmedberg
bugs969757
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 969757 - Remove the dead code in our tree which pretends to support OS/2; r=roc,mcmanus,gps,jorendorf,bsmedberg sr=bsmedberg
b2g/app/nsBrowserApp.cpp
b2g/installer/package-manifest.in
browser/app/Makefile.in
browser/app/nsBrowserApp.cpp
browser/app/splashos2.rc
browser/branding/aurora/Makefile.in
browser/branding/aurora/document-os2.ico
browser/branding/aurora/firefox-os2.ico
browser/branding/nightly/Makefile.in
browser/branding/nightly/document-os2.ico
browser/branding/nightly/firefox-os2.ico
browser/branding/official/Makefile.in
browser/branding/official/document-os2.ico
browser/branding/official/firefox-os2.ico
browser/branding/unofficial/Makefile.in
browser/branding/unofficial/document-os2.ico
browser/branding/unofficial/firefox-os2.ico
browser/components/preferences/in-content/preferences.xul
browser/components/preferences/preferences.xul
browser/installer/package-manifest.in
build/binary-location.mk
build/moz.build
build/os2/test_os2.cmd
chrome/src/nsChromeRegistry.cpp
config/Makefile.in
config/config.mk
config/makefiles/target_binaries.mk
config/nspr/Makefile.in
config/rules.mk
config/system-headers
configure.in
content/base/public/nsContentUtils.h
content/xul/content/src/nsXULPopupListener.cpp
db/sqlite3/src/Makefile.in
db/sqlite3/src/moz.build
docshell/base/nsDefaultURIFixup.cpp
dom/base/Navigator.cpp
dom/base/nsFocusManager.cpp
dom/events/nsEventStateManager.cpp
dom/moz.build
dom/plugins/base/PluginPRLibrary.cpp
dom/plugins/base/PluginPRLibrary.h
dom/plugins/base/moz.build
dom/plugins/base/npapi.h
dom/plugins/base/npfunctions.h
dom/plugins/base/nptypes.h
dom/plugins/base/nsNPAPIPlugin.cpp
dom/plugins/base/nsNPAPIPlugin.h
dom/plugins/base/nsNPAPIPluginInstance.cpp
dom/plugins/base/nsNPAPIPluginStreamListener.cpp
dom/plugins/base/nsPluginInstanceOwner.cpp
dom/plugins/base/nsPluginInstanceOwner.h
dom/plugins/base/nsPluginNativeWindowOS2.cpp
dom/plugins/base/nsPluginsDirOS2.cpp
dom/plugins/ipc/PluginLibrary.h
dom/plugins/ipc/PluginMessageUtils.h
dom/plugins/ipc/PluginModuleChild.cpp
dom/plugins/ipc/PluginModuleChild.h
dom/plugins/ipc/PluginModuleParent.cpp
dom/plugins/ipc/PluginModuleParent.h
dom/plugins/test/testplugin/nptest.cpp
dom/plugins/test/testplugin/nptest_os2.cpp
dom/plugins/test/testplugin/testplugin.mozbuild
dom/xbl/builtin/moz.build
dom/xslt/xslt/txXPathResultComparator.cpp
editor/libeditor/html/nsHTMLEditorEventListener.cpp
embedding/browser/webBrowser/nsIPrintingPrompt.idl
embedding/browser/webBrowser/nsIPrintingPromptService.idl
embedding/components/build/moz.build
embedding/components/printingui/src/moz.build
embedding/components/printingui/src/os2/moz.build
embedding/components/printingui/src/os2/nsPrintProgress.cpp
embedding/components/printingui/src/os2/nsPrintProgress.h
embedding/components/printingui/src/os2/nsPrintProgressParams.cpp
embedding/components/printingui/src/os2/nsPrintProgressParams.h
embedding/components/printingui/src/os2/nsPrintingPromptService.cpp
embedding/components/printingui/src/os2/nsPrintingPromptService.h
embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp
extensions/pref/autoconfig/src/Makefile.in
extensions/pref/autoconfig/src/os2/platform.js
gfx/cairo/cairo/src/moz.build
gfx/cairo/libpixman/src/Makefile.in
gfx/src/Makefile.in
gfx/src/nsDeviceContext.cpp
gfx/thebes/Makefile.in
gfx/thebes/gfxOS2Fonts.cpp
gfx/thebes/gfxOS2Fonts.h
gfx/thebes/gfxOS2Platform.cpp
gfx/thebes/gfxOS2Platform.h
gfx/thebes/gfxOS2Surface.cpp
gfx/thebes/gfxOS2Surface.h
gfx/thebes/gfxPlatform.cpp
gfx/thebes/gfxPlatform.h
gfx/thebes/moz.build
image/decoders/icon/moz.build
image/decoders/icon/os2/moz.build
image/decoders/icon/os2/nsIconChannel.cpp
image/decoders/icon/os2/nsIconChannel.h
image/decoders/moz.build
intl/build/nsI18nModule.cpp
intl/chardet/tools/GenCyrillicClass.cpp
intl/locale/idl/nsIScriptableDateFormat.idl
intl/locale/public/moz.build
intl/locale/public/nsIOS2Locale.h
intl/locale/public/nsLocaleCID.h
intl/locale/src/mac/nsDateTimeFormatMac.cpp
intl/locale/src/mac/nsMacCharset.cpp
intl/locale/src/moz.build
intl/locale/src/nsLocaleConstructors.h
intl/locale/src/nsLocaleService.cpp
intl/locale/src/os2/Makefile.in
intl/locale/src/os2/moz.build
intl/locale/src/os2/nsCollationOS2.cpp
intl/locale/src/os2/nsCollationOS2.h
intl/locale/src/os2/nsDateTimeFormatOS2.cpp
intl/locale/src/os2/nsDateTimeFormatOS2.h
intl/locale/src/os2/nsOS2Charset.cpp
intl/locale/src/os2/nsOS2Locale.cpp
intl/locale/src/os2/nsOS2Locale.h
intl/locale/src/os2/os2charset.properties
intl/locale/src/windows/nsCollationWin.cpp
intl/locale/src/windows/nsDateTimeFormatWin.cpp
intl/locale/src/windows/nsWin32Locale.cpp
intl/locale/src/windows/nsWinCharset.cpp
intl/locale/tests/unit/xpcshell.ini
intl/uconv/src/moz.build
intl/uconv/src/nsUConvModule.cpp
intl/uconv/tests/plattest.cpp
intl/uconv/ucvibm/nsCP1125ToUnicode.cpp
intl/uconv/ucvibm/nsCP1125ToUnicode.h
intl/uconv/ucvibm/nsCP1131ToUnicode.cpp
intl/uconv/ucvibm/nsCP1131ToUnicode.h
intl/uconv/ucvibm/nsCP869ToUnicode.cpp
intl/uconv/ucvibm/nsCP869ToUnicode.h
intl/uconv/ucvibm/nsUnicodeToCP1125.cpp
intl/uconv/ucvibm/nsUnicodeToCP1125.h
intl/uconv/ucvibm/nsUnicodeToCP1131.cpp
intl/uconv/ucvibm/nsUnicodeToCP1131.h
intl/uconv/ucvibm/nsUnicodeToCP869.cpp
intl/uconv/ucvibm/nsUnicodeToCP869.h
intl/uconv/ucvja/nsJapaneseToUnicode.cpp
js/src/Makefile.in
js/src/assembler/jit/ExecutableAllocatorOS2.cpp
js/src/configure.in
js/src/ctypes/CTypes.cpp
js/src/gc/Memory.cpp
js/src/jscpucfg.h
js/src/jsdtoa.cpp
js/src/jsnativestack.cpp
js/src/jsnum.cpp
js/src/moz.build
js/src/prmjtime.cpp
js/src/shell/js.cpp
js/src/vm/ForkJoin.cpp
js/src/yarr/OSAllocatorOS2.cpp
js/xpconnect/loader/mozJSComponentLoader.cpp
js/xpconnect/src/XPCShellImpl.cpp
layout/forms/nsListControlFrame.cpp
layout/generic/nsObjectFrame.cpp
layout/printing/nsPrintEngine.cpp
layout/style/forms.css
layout/xul/nsMenuFrame.cpp
layout/xul/nsMenuPopupFrame.cpp
memory/mozalloc/Makefile.in
memory/mozalloc/moz.build
memory/mozalloc/mozalloc.cpp
memory/mozalloc/mozalloc.h
memory/mozalloc/mozalloc_abort.cpp
memory/mozalloc/mozalloc_abort.h
memory/mozalloc/mozalloc_oom.cpp
memory/mozalloc/mozalloc_oom.h
memory/mozalloc/msvc_raise_wrappers.cpp
memory/mozalloc/msvc_throw_wrapper.cpp
mfbt/Types.h
mfbt/tests/TestPoisonArea.cpp
modules/libjar/nsJAR.cpp
modules/libjar/nsZipArchive.cpp
modules/libmar/sign/nss_secutil.c
modules/libpref/src/Makefile.in
modules/libpref/src/Preferences.cpp
modules/libpref/src/init/all.js
modules/libpref/src/prefapi.cpp
mozglue/build/Makefile.in
netwerk/base/src/moz.build
netwerk/base/src/nsFileStreams.cpp
netwerk/base/src/nsNetAddr.cpp
netwerk/base/src/nsServerSocket.cpp
netwerk/base/src/nsSocketTransport2.cpp
netwerk/base/src/nsURLHelper.cpp
netwerk/base/src/nsURLHelper.h
netwerk/base/src/nsURLHelperOS2.cpp
netwerk/base/src/nsURLParsers.cpp
netwerk/base/src/nsURLParsers.h
netwerk/cache/nsDiskCacheDevice.cpp
netwerk/cache2/CacheFileIOManager.cpp
netwerk/dns/DNS.cpp
netwerk/dns/DNS.h
netwerk/ipc/NeckoMessageUtils.h
netwerk/protocol/file/nsFileProtocolHandler.cpp
netwerk/protocol/http/nsHttpHandler.cpp
netwerk/streamconv/test/TestStreamConv.cpp
netwerk/test/TestOverlappedIO.cpp
netwerk/test/TestSocketIO.cpp
netwerk/test/TestSocketInput.cpp
profile/dirserviceprovider/src/nsProfileLock.cpp
profile/dirserviceprovider/src/nsProfileLock.h
python/mozbuild/mozpack/executables.py
rdf/datasource/src/nsFileSystemDataSource.cpp
rdf/datasource/src/nsFileSystemDataSource.h
security/build/Makefile.in
toolkit/components/commandlines/nsCommandLine.cpp
toolkit/components/ctypes/tests/unit/test_jsctypes.js.in
toolkit/components/downloads/SQLFunctions.cpp
toolkit/components/filepicker/moz.build
toolkit/components/help/content/help.js
toolkit/components/help/content/platformClasses.css
toolkit/components/intl/nsCharsetMenu.cpp
toolkit/components/places/BookmarkHTMLUtils.jsm
toolkit/components/places/Helpers.cpp
toolkit/components/places/SQLFunctions.cpp
toolkit/components/startup/moz.build
toolkit/components/startup/nsUserInfoOS2.cpp
toolkit/library/Makefile.in
toolkit/library/moz.build
toolkit/library/nsStaticXULComponents.cpp
toolkit/library/xulrunos2.rc
toolkit/mozapps/installer/package-name.mk
toolkit/mozapps/installer/packager.mk
toolkit/mozapps/update/tests/TestAUSReadStrings.cpp
toolkit/mozapps/update/tests/unit_aus_update/head_update.js
toolkit/mozapps/update/updater/updater.cpp
toolkit/profile/nsToolkitProfileService.cpp
toolkit/themes/moz.build
toolkit/themes/os2/global/arrow/arrow-dn-dis.gif
toolkit/themes/os2/global/arrow/arrow-dn.gif
toolkit/themes/os2/global/arrow/arrow-lft-dis.gif
toolkit/themes/os2/global/arrow/arrow-lft.gif
toolkit/themes/os2/global/arrow/arrow-rit-dis.gif
toolkit/themes/os2/global/arrow/arrow-rit.gif
toolkit/themes/os2/global/arrow/arrow-up-dis.gif
toolkit/themes/os2/global/arrow/arrow-up.gif
toolkit/themes/os2/global/arrow/thumb-hrz.gif
toolkit/themes/os2/global/arrow/thumb-vrt.gif
toolkit/themes/os2/global/jar.mn
toolkit/themes/os2/global/menu.css
toolkit/themes/os2/global/menu/Menu-arrow.png
toolkit/themes/os2/global/menu/menu-check.gif
toolkit/themes/os2/global/moz.build
toolkit/themes/os2/global/popup.css
toolkit/themes/os2/global/toolbar.css
toolkit/themes/os2/global/xulscrollbars.css
toolkit/xre/moz.build
toolkit/xre/nsAppRunner.cpp
toolkit/xre/nsNativeAppSupportOS2.cpp
toolkit/xre/nsNativeAppSupportOS2.h
toolkit/xre/nsSigHandlers.cpp
toolkit/xre/nsUpdateDriver.cpp
toolkit/xre/nsXREDirProvider.cpp
tools/trace-malloc/Makefile.in
uriloader/exthandler/moz.build
uriloader/exthandler/nsExternalHelperAppService.cpp
uriloader/exthandler/os2/nsMIMEInfoOS2.cpp
uriloader/exthandler/os2/nsMIMEInfoOS2.h
uriloader/exthandler/os2/nsOSHelperAppService.cpp
uriloader/exthandler/os2/nsOSHelperAppService.h
widget/moz.build
widget/nsIDragSessionOS2.h
widget/nsIRwsService.idl
widget/os2/Makefile.in
widget/os2/MozSounds.cmd
widget/os2/README.firefox
widget/os2/README.seamonkey
widget/os2/README.thunderbird
widget/os2/moz.build
widget/os2/nsAppShell.cpp
widget/os2/nsAppShell.h
widget/os2/nsBidiKeyboard.cpp
widget/os2/nsBidiKeyboard.h
widget/os2/nsClipboard.cpp
widget/os2/nsClipboard.h
widget/os2/nsDeviceContextSpecOS2.cpp
widget/os2/nsDeviceContextSpecOS2.h
widget/os2/nsDragService.cpp
widget/os2/nsDragService.h
widget/os2/nsFilePicker.cpp
widget/os2/nsFilePicker.h
widget/os2/nsGfxDefs.h
widget/os2/nsIdleServiceOS2.cpp
widget/os2/nsIdleServiceOS2.h
widget/os2/nsLookAndFeel.cpp
widget/os2/nsLookAndFeel.h
widget/os2/nsOS2Uni.cpp
widget/os2/nsOS2Uni.h
widget/os2/nsPrintOS2.cpp
widget/os2/nsPrintOS2.h
widget/os2/nsPrintOptionsOS2.cpp
widget/os2/nsPrintOptionsOS2.h
widget/os2/nsPrintdOS2.h
widget/os2/nsRwsService.cpp
widget/os2/nsRwsService.h
widget/os2/nsScreenManagerOS2.cpp
widget/os2/nsScreenManagerOS2.h
widget/os2/nsScreenOS2.cpp
widget/os2/nsScreenOS2.h
widget/os2/nsSound.cpp
widget/os2/nsSound.h
widget/os2/nsWidgetFactory.cpp
widget/os2/nsWindow.cpp
widget/os2/nsWindow.h
widget/os2/os2FrameWindow.cpp
widget/os2/os2FrameWindow.h
widget/os2/res/aliasb.ptr
widget/os2/res/arrow_wait.ptr
widget/os2/res/cell.ptr
widget/os2/res/col_resize.ptr
widget/os2/res/copy.ptr
widget/os2/res/crosshair.ptr
widget/os2/res/dndtext.ico
widget/os2/res/dndurl.ico
widget/os2/res/grab.ptr
widget/os2/res/grabbing.ptr
widget/os2/res/help.ptr
widget/os2/res/none.ptr
widget/os2/res/row_resize.ptr
widget/os2/res/select.ptr
widget/os2/res/vertical_text.ptr
widget/os2/res/zoom_in.ptr
widget/os2/res/zoom_out.ptr
widget/os2/rws.h
widget/os2/rwserr.h
widget/os2/wdgtos2rc.h
widget/os2/widget.rc
widget/tests/TestAppShellSteadyState.cpp
widget/xpwidgets/moz.build
xpcom/base/nsCycleCollector.cpp
xpcom/base/nsDebugImpl.cpp
xpcom/base/nsIProgrammingLanguage.idl
xpcom/base/nscore.h
xpcom/build/BinaryPath.h
xpcom/build/FileLocation.cpp
xpcom/build/XPCOM.h
xpcom/build/nsXPCOMPrivate.h
xpcom/build/nsXPComInit.cpp
xpcom/ds/nsCRT.h
xpcom/glue/FileUtils.cpp
xpcom/glue/FileUtils.h
xpcom/glue/nsCRTGlue.h
xpcom/glue/nsINIParser.cpp
xpcom/glue/pldhash.h
xpcom/glue/standalone/nsXPCOMGlue.cpp
xpcom/io/SpecialSystemDirectory.cpp
xpcom/io/moz.build
xpcom/io/nsAppFileLocationProvider.cpp
xpcom/io/nsDirectoryService.cpp
xpcom/io/nsDirectoryServiceAtomList.h
xpcom/io/nsDirectoryServiceDefs.h
xpcom/io/nsILocalFileOS2.idl
xpcom/io/nsLocalFile.h
xpcom/io/nsLocalFileCommon.cpp
xpcom/io/nsLocalFileOS2.cpp
xpcom/io/nsLocalFileOS2.h
xpcom/io/nsNativeCharsetUtils.cpp
xpcom/reflect/xptcall/src/md/moz.build
xpcom/reflect/xptcall/src/md/os2/Makefile.in
xpcom/reflect/xptcall/src/md/os2/moz.build
xpcom/reflect/xptcall/src/md/os2/xptcstubs_gcc_x86_os2.cpp
xpcom/tests/Makefile.in
xpcom/tests/TestFile.cpp
xpcom/tests/unit/test_hidden_files.js
xpcom/tests/unit/test_symlinks.js
xpfe/appshell/src/nsXULWindow.cpp
xulrunner/app/Makefile.in
xulrunner/app/nsXULRunnerApp.cpp
xulrunner/app/splashos2.rc
xulrunner/app/xulrunner-os2.ico
xulrunner/stub/nsXULStub.cpp
--- a/b2g/app/nsBrowserApp.cpp
+++ b/b2g/app/nsBrowserApp.cpp
@@ -67,17 +67,17 @@ static bool IsArg(const char* arg, const
 {
   if (*arg == '-')
   {
     if (*++arg == '-')
       ++arg;
     return !strcasecmp(arg, s);
   }
 
-#if defined(XP_WIN) || defined(XP_OS2)
+#if defined(XP_WIN)
   if (*arg == '/')
     return !strcasecmp(++arg, s);
 #endif
 
   return false;
 }
 
 /**
--- a/b2g/installer/package-manifest.in
+++ b/b2g/installer/package-manifest.in
@@ -99,23 +99,19 @@
 #ifndef XP_UNIX
 @BINPATH@/@MOZ_APP_NAME@.exe
 #else
 @BINPATH@/@MOZ_APP_NAME@-bin
 @BINPATH@/@MOZ_APP_NAME@
 #endif
 @BINPATH@/application.ini
 @BINPATH@/platform.ini
-#ifndef XP_OS2
 #ifndef MOZ_FOLD_LIBS
 @BINPATH@/@DLL_PREFIX@mozsqlite3@DLL_SUFFIX@
 #endif
-#else
-@BINPATH@/mozsqlt3@DLL_SUFFIX@
-#endif
 @BINPATH@/blocklist.xml
 @BINPATH@/ua-update.json
 #ifdef XP_UNIX
 #ifndef XP_MACOSX
 @BINPATH@/run-mozilla.sh
 @BINPATH@/mozilla-xremote-client
 #endif
 #endif
@@ -448,21 +444,17 @@
 @BINPATH@/components/nsUpdateTimerManager.manifest
 @BINPATH@/components/nsUpdateTimerManager.js
 @BINPATH@/components/pluginGlue.manifest
 @BINPATH@/components/nsSessionStore.manifest
 @BINPATH@/components/nsSessionStartup.js
 @BINPATH@/components/nsSessionStore.js
 @BINPATH@/components/nsURLFormatter.manifest
 @BINPATH@/components/nsURLFormatter.js
-#ifndef XP_OS2
 @BINPATH@/components/@DLL_PREFIX@browsercomps@DLL_SUFFIX@
-#else
-@BINPATH@/components/brwsrcmp@DLL_SUFFIX@
-#endif
 @BINPATH@/components/txEXSLTRegExFunctions.manifest
 @BINPATH@/components/txEXSLTRegExFunctions.js
 @BINPATH@/components/toolkitplaces.manifest
 @BINPATH@/components/nsLivemarkService.js
 @BINPATH@/components/nsTaggingService.js
 @BINPATH@/components/nsPlacesDBFlush.js
 @BINPATH@/components/nsPlacesAutoComplete.manifest
 @BINPATH@/components/nsPlacesAutoComplete.js
@@ -744,21 +736,16 @@ bin/libfreebl_32int64_3.so
 #endif
 
 ; [Extensions]
 ;
 #ifdef MOZ_ENABLE_GNOMEVFS
 bin/components/@DLL_PREFIX@nkgnomevfs@DLL_SUFFIX@
 #endif
 
-; [OS/2]
-#ifdef XP_OS2
-@BINPATH@/MozSounds.cmd
-#endif
-
 [b2g]
 #ifndef MOZ_WIDGET_GONK
 #ifdef XP_WIN32
 @BINPATH@/xpcshell.exe
 #else
 @BINPATH@/xpcshell
 #endif
 #endif
--- a/browser/app/Makefile.in
+++ b/browser/app/Makefile.in
@@ -69,21 +69,16 @@ RCINCLUDE = splash.rc
 EXTRA_DEPS += firefox.exe.manifest
 ifndef GNU_CC
 RCFLAGS += -DMOZ_PHOENIX -I$(srcdir)
 else
 RCFLAGS += -DMOZ_PHOENIX --include-dir $(srcdir)
 endif
 endif
 
-ifeq ($(OS_ARCH),OS2)
-RCFLAGS += -DMOZ_PHOENIX
-RCFLAGS += -DFIREFOX_ICO='"$(DIST)/branding/firefox-os2.ico"' -DDOCUMENT_ICO='"$(DIST)/branding/document-os2.ico"'
-endif
-
 PROGRAMS_DEST = $(DIST)/bin
 
 include $(topsrcdir)/config/rules.mk
 
 ifeq ($(OS_ARCH),WINNT) #{
 #
 # Control the default heap size.
 # This is the heap returned by GetProcessHeap().
@@ -94,17 +89,17 @@ ifeq ($(OS_ARCH),WINNT) #{
 #
 # Set it to 256k.  See bug 127069.
 #
 ifndef GNU_CC #{
 LDFLAGS += /HEAP:0x40000
 endif #}
 endif #}
 
-ifneq (,$(filter-out OS2 WINNT,$(OS_ARCH)))
+ifneq (,$(filter-out WINNT,$(OS_ARCH)))
 
 ifdef COMPILE_ENVIRONMENT
 libs:: 
 	cp -p $(MOZ_APP_NAME)$(BIN_SUFFIX) $(DIST)/bin/$(MOZ_APP_NAME)-bin$(BIN_SUFFIX)
 endif
 
 GARBAGE += $(addprefix $(FINAL_TARGET)/defaults/pref/, firefox.js)
 
--- a/browser/app/nsBrowserApp.cpp
+++ b/browser/app/nsBrowserApp.cpp
@@ -105,17 +105,17 @@ static bool IsArg(const char* arg, const
 {
   if (*arg == '-')
   {
     if (*++arg == '-')
       ++arg;
     return !strcasecmp(arg, s);
   }
 
-#if defined(XP_WIN) || defined(XP_OS2)
+#if defined(XP_WIN)
   if (*arg == '/')
     return !strcasecmp(++arg, s);
 #endif
 
   return false;
 }
 
 #ifdef XP_WIN
deleted file mode 100644
--- a/browser/app/splashos2.rc
+++ /dev/null
@@ -1,24 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include <os2.h>
-
-// Splash screen dialog ID.
-#define IDD_SPLASH  100
-
-// Splash screen bitmap ID.
-#define IDB_SPLASH  101
-
-ICON 1 FIREFOX_ICO
-
-DLGTEMPLATE IDD_SPLASH DISCARDABLE 
-BEGIN
-    DIALOG "", IDD_SPLASH, 0, 0, 390, 261, , FCF_BORDER
-    BEGIN
-    END
-END
-
-//BITMAP IDB_SPLASH "splash.bmp"
--- a/browser/branding/aurora/Makefile.in
+++ b/browser/branding/aurora/Makefile.in
@@ -42,23 +42,16 @@ ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
 BRANDING_FILES := \
 	default16.png \
 	default32.png \
 	default48.png \
 	mozicon128.png \
 	$(NULL)
 endif
 
-ifeq ($(OS_ARCH),OS2)
-BRANDING_FILES := \
-	firefox-os2.ico \
-	document-os2.ico \
-	$(NULL)
-endif
-
 BRANDING_DEST := $(DIST)/branding
 BRANDING_TARGET := export
 INSTALL_TARGETS += BRANDING
 
 ifeq ($(MOZ_WIDGET_TOOLKIT) $(DIST_SUBDIR),windows metro)
 VISUALMANIFEST := VisualElementsManifest.xml
 VISUALMANIFEST_FLAGS := -Fsubstitution -DMOZ_APP_DISPLAYNAME=${MOZ_APP_DISPLAYNAME}
 VISUALMANIFEST_PATH := $(DIST)/bin
deleted file mode 100644
index 214e92cef45cc11f13a54015977afbc0d8321f29..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 560d198b3265eb104dae65b1da46ae0e8dfb0aa1..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
--- a/browser/branding/nightly/Makefile.in
+++ b/browser/branding/nightly/Makefile.in
@@ -42,23 +42,16 @@ ifdef MOZ_WIDGET_GTK
 BRANDING_FILES := \
 	default16.png \
 	default32.png \
 	default48.png \
 	mozicon128.png \
 	$(NULL)
 endif
 
-ifeq ($(OS_ARCH),OS2)
-BRANDING_FILES := \
-	firefox-os2.ico \
-	document-os2.ico \
-	$(NULL)
-endif
-
 BRANDING_DEST := $(DIST)/branding
 BRANDING_TARGET := export
 INSTALL_TARGETS += BRANDING
 
 ifeq ($(MOZ_WIDGET_TOOLKIT) $(DIST_SUBDIR),windows metro)
 VISUALMANIFEST := VisualElementsManifest.xml
 VISUALMANIFEST_FLAGS := -Fsubstitution -DMOZ_APP_DISPLAYNAME=${MOZ_APP_DISPLAYNAME}
 VISUALMANIFEST_PATH := $(DIST)/bin
deleted file mode 100644
index 214e92cef45cc11f13a54015977afbc0d8321f29..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 560d198b3265eb104dae65b1da46ae0e8dfb0aa1..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
--- a/browser/branding/official/Makefile.in
+++ b/browser/branding/official/Makefile.in
@@ -42,23 +42,16 @@ ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
 BRANDING_FILES := \
 	default16.png \
 	default32.png \
 	default48.png \
 	mozicon128.png \
 	$(NULL)
 endif
 
-ifeq ($(OS_ARCH),OS2)
-BRANDING_FILES := \
-	firefox-os2.ico \
-	document-os2.ico \
-	$(NULL)
-endif
-
 BRANDING_DEST := $(DIST)/branding
 BRANDING_TARGET := export
 INSTALL_TARGETS += BRANDING
 
 ifeq ($(MOZ_WIDGET_TOOLKIT) $(DIST_SUBDIR),windows metro)
 VISUALMANIFEST := VisualElementsManifest.xml
 VISUALMANIFEST_FLAGS := -Fsubstitution -DMOZ_APP_DISPLAYNAME=${MOZ_APP_DISPLAYNAME}
 VISUALMANIFEST_PATH := $(DIST)/bin
deleted file mode 100644
index 9772a69f0cb26176ea0712fd5463de3aa87f82a1..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index c566aac9d10ee28ec713f6c4f05cc4488295809a..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
--- a/browser/branding/unofficial/Makefile.in
+++ b/browser/branding/unofficial/Makefile.in
@@ -42,23 +42,16 @@ ifdef MOZ_WIDGET_GTK
 BRANDING_FILES := \
 	default16.png \
 	default32.png \
 	default48.png \
 	mozicon128.png \
 	$(NULL)
 endif
 
-ifeq ($(OS_ARCH),OS2)
-BRANDING_FILES := \
-	firefox-os2.ico \
-	document-os2.ico \
-	$(NULL)
-endif
-
 BRANDING_DEST := $(DIST)/branding
 BRANDING_TARGET := export
 INSTALL_TARGETS += BRANDING
 
 ifeq ($(MOZ_WIDGET_TOOLKIT) $(DIST_SUBDIR),windows metro)
 VISUALMANIFEST := VisualElementsManifest.xml
 VISUALMANIFEST_FLAGS := -Fsubstitution -DMOZ_APP_DISPLAYNAME=${MOZ_APP_DISPLAYNAME}
 VISUALMANIFEST_PATH := $(DIST)/bin
deleted file mode 100644
index 214e92cef45cc11f13a54015977afbc0d8321f29..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 560d198b3265eb104dae65b1da46ae0e8dfb0aa1..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
--- a/browser/components/preferences/in-content/preferences.xul
+++ b/browser/components/preferences/in-content/preferences.xul
@@ -45,19 +45,16 @@
 %contentDTD;
 %applicationsDTD;
 %advancedDTD;
 ]>
 
 #ifdef XP_WIN
 #define USE_WIN_TITLE_STYLE
 #endif
-#ifdef XP_OS2
-#define USE_WIN_TITLE_STYLE
-#endif
 
 <page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
       xmlns:html="http://www.w3.org/1999/xhtml"
 #ifdef USE_WIN_TITLE_STYLE
       title="&prefWindow.titleWin;">
 #else
       title="&prefWindow.titleGNOME;">
 #endif
--- a/browser/components/preferences/preferences.xul
+++ b/browser/components/preferences/preferences.xul
@@ -22,19 +22,16 @@
 <!ENTITY % preferencesDTD SYSTEM "chrome://browser/locale/preferences/preferences.dtd">
 %brandDTD;
 %preferencesDTD;
 ]>
 
 #ifdef XP_WIN
 #define USE_WIN_TITLE_STYLE
 #endif
-#ifdef XP_OS2
-#define USE_WIN_TITLE_STYLE
-#endif
 
 #ifdef XP_MACOSX
 <?xul-overlay href="chrome://browser/content/macBrowserOverlay.xul"?>
 #endif
 
 <prefwindow type="prefwindow"
             id="BrowserPreferences"
             windowtype="Browser:Preferences"
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -136,25 +136,21 @@
 @BINPATH@/@MOZ_APP_NAME@-bin
 @BINPATH@/@MOZ_APP_NAME@
 #endif
 @BINPATH@/application.ini
 #ifdef MOZ_UPDATER
 @BINPATH@/update-settings.ini
 #endif
 @BINPATH@/platform.ini
-#ifndef XP_OS2
 #ifndef MOZ_NATIVE_SQLITE
 #ifndef MOZ_FOLD_LIBS
 @BINPATH@/@DLL_PREFIX@mozsqlite3@DLL_SUFFIX@
 #endif
 #endif
-#else
-@BINPATH@/mozsqlt3@DLL_SUFFIX@
-#endif
 @BINPATH@/browser/blocklist.xml
 #ifdef XP_UNIX
 #ifndef XP_MACOSX
 @BINPATH@/run-mozilla.sh
 @BINPATH@/mozilla-xremote-client
 #endif
 #endif
 
@@ -425,21 +421,17 @@
 @BINPATH@/components/nsUpdateTimerManager.manifest
 @BINPATH@/components/nsUpdateTimerManager.js
 @BINPATH@/components/pluginGlue.manifest
 @BINPATH@/browser/components/nsSessionStore.manifest
 @BINPATH@/browser/components/nsSessionStartup.js
 @BINPATH@/browser/components/nsSessionStore.js
 @BINPATH@/components/nsURLFormatter.manifest
 @BINPATH@/components/nsURLFormatter.js
-#ifndef XP_OS2
 @BINPATH@/browser/components/@DLL_PREFIX@browsercomps@DLL_SUFFIX@
-#else
-@BINPATH@/browser/components/brwsrcmp@DLL_SUFFIX@
-#endif
 @BINPATH@/components/txEXSLTRegExFunctions.manifest
 @BINPATH@/components/txEXSLTRegExFunctions.js
 @BINPATH@/components/toolkitplaces.manifest
 @BINPATH@/components/nsLivemarkService.js
 @BINPATH@/components/nsTaggingService.js
 @BINPATH@/components/nsPlacesAutoComplete.manifest
 @BINPATH@/components/nsPlacesAutoComplete.js
 @BINPATH@/components/nsPlacesExpiration.js
@@ -787,23 +779,16 @@ bin/libfreebl_32int64_3.so
 #endif
 #endif
 @BINPATH@/browser/crashreporter-override.ini
 #ifdef MOZ_CRASHREPORTER_INJECTOR
 @BINPATH@/breakpadinjector.dll
 #endif
 #endif
 
-; [OS/2]
-#ifdef XP_OS2
-@BINPATH@/MozSounds.cmd
-@BINPATH@/*.xqs
-@BINPATH@/components/*.xqs
-#endif
-
 #ifdef MOZ_WEBAPP_RUNTIME
 [WebappRuntime]
 #ifdef XP_WIN
 @BINPATH@/webapp-uninstaller@BIN_SUFFIX@
 #endif
 @BINPATH@/webapprt-stub@BIN_SUFFIX@
 @BINPATH@/webapprt/webapprt.ini
 @BINPATH@/webapprt/chrome.manifest
--- a/build/binary-location.mk
+++ b/build/binary-location.mk
@@ -1,15 +1,15 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 # finds the location of the browser and puts it in the variable $(browser_path)
 
-ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
+ifneq (,$(filter WINNT,$(OS_ARCH)))
 program = $(MOZ_APP_NAME)$(BIN_SUFFIX)
 else
 program = $(MOZ_APP_NAME)-bin$(BIN_SUFFIX)
 endif
 
 TARGET_DIST = $(TARGET_DEPTH)/dist
 
 ifeq ($(MOZ_BUILD_APP),camino)
--- a/build/moz.build
+++ b/build/moz.build
@@ -2,20 +2,20 @@
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 # This cannot be named "build" because of bug 922191.
 SPHINX_TREES['buildsystem'] = 'docs'
 
-if CONFIG['OS_ARCH'] not in ('WINNT', 'OS2'):
+if CONFIG['OS_ARCH'] == 'WINNT':
+    DIRS += ['win32']
+else:
     DIRS += ['unix']
-elif CONFIG['OS_ARCH'] == 'WINNT':
-    DIRS += ['win32']
 
 if CONFIG['OS_TARGET'] == 'Android' and not CONFIG['MOZ_ANDROID_LIBSTDCXX']:
     DIRS += ['stlport']
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
     DIRS += ['annotationProcessors']
     TEST_DIRS += [
         'mobile/sutagent/android',
deleted file mode 100644
--- a/build/os2/test_os2.cmd
+++ /dev/null
@@ -1,21 +0,0 @@
-REM This Source Code Form is subject to the terms of the Mozilla Public
-REM License, v. 2.0. If a copy of the MPL was not distributed with this
-REM file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-/* Invoke unit tests on OS/2 */
-PARSE ARG dist prog parm
-dist=forwardtoback(dist);
-prog=forwardtoback(prog);
-'set BEGINLIBPATH='dist'\bin;%BEGINLIBPATH%'
-'set LIBPATHSTRICT=T'
-prog parm
-exit
-
-forwardtoback: procedure
-  arg pathname
-  parse var pathname pathname'/'rest
-  do while (rest <> "")
-    pathname = pathname'\'rest
-    parse var pathname pathname'/'rest
-  end
-  return pathname
--- a/chrome/src/nsChromeRegistry.cpp
+++ b/chrome/src/nsChromeRegistry.cpp
@@ -277,17 +277,17 @@ nsChromeRegistry::ConvertChromeURL(nsIUR
   nsIURI* baseURI = GetBaseURIFromPackage(package, provider, path);
 
   uint32_t flags;
   rv = GetFlagsFromPackage(package, &flags);
   if (NS_FAILED(rv))
     return rv;
 
   if (flags & PLATFORM_PACKAGE) {
-#if defined(XP_WIN) || defined(XP_OS2)
+#if defined(XP_WIN)
     path.Insert("win/", 0);
 #elif defined(XP_MACOSX)
     path.Insert("mac/", 0);
 #else
     path.Insert("unix/", 0);
 #endif
   }
 
--- a/config/Makefile.in
+++ b/config/Makefile.in
@@ -118,14 +118,14 @@ endif
 check-preqs += check-makefiles
 
 check:: $(check-preqs)
 
 check-jar-mn::
 	$(MAKE) -C tests/src-simple check-jar
 	$(MAKE) -C tests/src-simple check-flat
 	$(MAKE) -C tests/src-simple check-flat USE_EXTENSION_MANIFEST=1
-ifneq (,$(filter-out WINNT OS2,$(OS_ARCH)))
+ifneq (,$(filter-out WINNT,$(OS_ARCH)))
 	$(MAKE) -C tests/src-simple check-symlink
 endif
 
 check-makefiles:
 	$(MAKE) -C tests/makefiles/autodeps check
--- a/config/config.mk
+++ b/config/config.mk
@@ -442,20 +442,16 @@ MAKE_JARS_FLAGS = \
 	$(NULL)
 
 ifdef USE_EXTENSION_MANIFEST
 MAKE_JARS_FLAGS += -e
 endif
 
 TAR_CREATE_FLAGS = -chf
 
-ifeq ($(OS_ARCH),OS2)
-TAR_CREATE_FLAGS = -cf
-endif
-
 #
 # Personal makefile customizations go in these optional make include files.
 #
 MY_CONFIG	:= $(DEPTH)/config/myconfig.mk
 MY_RULES	:= $(DEPTH)/config/myrules.mk
 
 #
 # Default command macros; can be overridden in <arch>.mk.
@@ -641,30 +637,24 @@ ifdef MOZ_USING_CCACHE
 ifdef CLANG_CXX
 export CCACHE_CPP2=1
 endif
 endif
 
 # Set link flags according to whether we want a console.
 ifdef MOZ_WINCONSOLE
 ifeq ($(MOZ_WINCONSOLE),1)
-ifeq ($(OS_ARCH),OS2)
-BIN_FLAGS	+= -Zlinker -PM:VIO
-endif
 ifeq ($(OS_ARCH),WINNT)
 ifdef GNU_CC
 WIN32_EXE_LDFLAGS	+= -mconsole
 else
 WIN32_EXE_LDFLAGS	+= -SUBSYSTEM:CONSOLE
 endif
 endif
 else # MOZ_WINCONSOLE
-ifeq ($(OS_ARCH),OS2)
-BIN_FLAGS	+= -Zlinker -PM:PM
-endif
 ifeq ($(OS_ARCH),WINNT)
 ifdef GNU_CC
 WIN32_EXE_LDFLAGS	+= -mwindows
 else
 WIN32_EXE_LDFLAGS	+= -SUBSYSTEM:WINDOWS
 endif
 endif
 endif
@@ -709,41 +699,37 @@ NSINSTALL_PY := $(PYTHON) $(abspath $(to
 # a native command where possible. Since native commands can't be used outside
 # of single-line commands, we continue to provide INSTALL for general use.
 # Single-line commands should be switched over to install_cmd.
 NSINSTALL_NATIVECMD := %nsinstall nsinstall
 
 ifdef NSINSTALL_BIN
 NSINSTALL = $(NSINSTALL_BIN)
 else
-ifeq (OS2,$(CROSS_COMPILE)$(OS_ARCH))
-NSINSTALL = $(MOZ_TOOLS_DIR)/nsinstall
-else
 ifeq ($(HOST_OS_ARCH),WINNT)
 NSINSTALL = $(NSINSTALL_PY)
 else
 NSINSTALL = $(DIST)/bin/nsinstall$(HOST_BIN_SUFFIX)
 endif # WINNT
-endif # OS2
 endif # NSINSTALL_BIN
 
 
-ifeq (,$(CROSS_COMPILE)$(filter-out WINNT OS2, $(OS_ARCH)))
+ifeq (,$(CROSS_COMPILE)$(filter-out WINNT, $(OS_ARCH)))
 INSTALL = $(NSINSTALL) -t
 ifdef .PYMAKE
 install_cmd = $(NSINSTALL_NATIVECMD) -t $(1)
 endif # .PYMAKE
 
 else
 
 # This isn't laid out as conditional directives so that NSDISTMODE can be
 # target-specific.
 INSTALL         = $(if $(filter copy, $(NSDISTMODE)), $(NSINSTALL) -t, $(if $(filter absolute_symlink, $(NSDISTMODE)), $(NSINSTALL) -L $(PWD), $(NSINSTALL) -R))
 
-endif # WINNT/OS2
+endif # WINNT
 
 # The default for install_cmd is simply INSTALL
 install_cmd ?= $(INSTALL) $(1)
 
 # Use nsinstall in copy mode to install files on the system
 SYSINSTALL	= $(NSINSTALL) -t
 # This isn't necessarily true, just here
 sysinstall_cmd = install_cmd
@@ -790,23 +776,19 @@ MERGE_FILE = $(firstword \
   $(wildcard $(LOCALE_MERGEDIR)/$(subst /locales,,$(relativesrcdir))/$(1)) \
   $(wildcard $(LOCALE_SRCDIR)/$(1)) \
   $(srcdir)/en-US/$(1) )
 else
 MERGE_FILE = $(LOCALE_SRCDIR)/$(1)
 endif
 MERGE_FILES = $(foreach f,$(1),$(call MERGE_FILE,$(f)))
 
-ifeq (OS2,$(OS_ARCH))
-RUN_TEST_PROGRAM = $(topsrcdir)/build/os2/test_os2.cmd '$(LIBXUL_DIST)'
-else
 ifneq (WINNT,$(OS_ARCH))
 RUN_TEST_PROGRAM = $(LIBXUL_DIST)/bin/run-mozilla.sh
 endif # ! WINNT
-endif # ! OS2
 
 #
 # Java macros
 #
 
 # Make sure any compiled classes work with at least JVM 1.4
 JAVAC_FLAGS += -source 1.4
 
@@ -839,17 +821,17 @@ endif
 ifdef MOZ_LIBSTDCXX_TARGET_VERSION
 EXTRA_LIBS += $(call EXPAND_LIBNAME_PATH,stdc++compat,$(DEPTH)/build/unix/stdc++compat)
 endif
 ifdef MOZ_LIBSTDCXX_HOST_VERSION
 HOST_EXTRA_LIBS += $(call EXPAND_LIBNAME_PATH,host_stdc++compat,$(DEPTH)/build/unix/stdc++compat)
 endif
 endif
 
-ifeq (,$(filter $(OS_TARGET),WINNT Darwin OS2))
+ifeq (,$(filter $(OS_TARGET),WINNT Darwin))
 CHECK_TEXTREL = @$(TOOLCHAIN_PREFIX)readelf -d $(1) | grep TEXTREL > /dev/null && echo 'TEST-UNEXPECTED-FAIL | check_textrel | We do not want text relocations in libraries and programs' || true
 endif
 
 define CHECK_BINARY
 $(call CHECK_STDCXX,$(1))
 $(call CHECK_TEXTREL,$(1))
 endef
 
--- a/config/makefiles/target_binaries.mk
+++ b/config/makefiles/target_binaries.mk
@@ -62,17 +62,17 @@ endif # LIBRARY
 
 ifdef SHARED_LIBRARY
 ifndef IS_COMPONENT
 SHARED_LIBRARY_FILES = $(SHARED_LIBRARY)
 SHARED_LIBRARY_DEST ?= $(FINAL_TARGET)
 SHARED_LIBRARY_TARGET = binaries libs
 INSTALL_TARGETS += SHARED_LIBRARY
 
-ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
+ifneq (,$(filter WINNT,$(OS_ARCH)))
 ifndef NO_INSTALL_IMPORT_LIBRARY
 IMPORT_LIB_FILES = $(IMPORT_LIBRARY)
 endif # NO_INSTALL_IMPORT_LIBRARY
 else
 IMPORT_LIB_FILES = $(SHARED_LIBRARY)
 endif
 
 IMPORT_LIB_DEST ?= $(DIST)/lib
--- a/config/nspr/Makefile.in
+++ b/config/nspr/Makefile.in
@@ -31,14 +31,14 @@ endif
 
 libs export clean distclean::
 	$(MAKE) -C $(DEPTH)/nsprpub $@ $(EXTRA_MAKE_FLAGS)
 
 libs::
 	$(MAKE) -C $(DEPTH)/nsprpub install prefix=$(ABS_DIST)/sdk exec_prefix=$(ABS_DIST)/sdk bindir=$(ABS_DIST)/sdk/dummy includedir=$(ABS_DIST)/include/nspr libdir=$(ABS_DIST)/sdk/lib datadir=$(ABS_DIST)/sdk/dummy DESTDIR= $(EXTRA_MAKE_FLAGS)
 	$(INSTALL) $(DEPTH)/nsprpub/config/nspr-config $(DIST)/sdk/bin
 	$(RM) -rf $(DIST)/sdk/dummy
-ifneq (,$(filter OS2 WINNT,$(OS_ARCH))) # {
+ifneq (,$(filter WINNT,$(OS_ARCH))) # {
 	$(RM) -f $(DIST)/sdk/lib/$(DLL_PREFIX)nspr4$(DLL_SUFFIX) $(DIST)/sdk/lib/$(DLL_PREFIX)plc4$(DLL_SUFFIX) $(DIST)/sdk/lib/$(DLL_PREFIX)plds4$(DLL_SUFFIX)
 	$(RM) -f $(DIST)/sdk/lib/$(LIB_PREFIX)nspr4_s.$(LIB_SUFFIX) $(DIST)/sdk/lib/$(LIB_PREFIX)plc4_s.$(LIB_SUFFIX) $(DIST)/sdk/lib/$(LIB_PREFIX)plds4_s.$(LIB_SUFFIX)
 else # } {
 	$(RM) -f $(DIST)/sdk/lib/$(LIB_PREFIX)nspr4.$(LIB_SUFFIX) $(DIST)/sdk/lib/$(LIB_PREFIX)plc4.$(LIB_SUFFIX) $(DIST)/sdk/lib/$(LIB_PREFIX)plds4.$(LIB_SUFFIX)
 endif # }
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -51,21 +51,17 @@ ifdef .PYMAKE
 REPORT_BUILD = @%rebuild_check rebuild_check $@ $^
 else
 REPORT_BUILD = $(info $(shell $(PYTHON) $(MOZILLA_DIR)/config/rebuild_check.py $@ $^))
 endif
 else
 REPORT_BUILD = $(info $(notdir $@))
 endif
 
-ifeq ($(OS_ARCH),OS2)
-EXEC			=
-else
 EXEC			= exec
-endif
 
 # Don't copy xulrunner files at install time, when using system xulrunner
 ifdef SYSTEM_LIBXUL
   SKIP_COPY_XULRUNNER=1
 endif
 
 # ELOG prints out failed command when building silently (gmake -s). Pymake
 # prints out failed commands anyway, so ELOG just makes things worse by
@@ -186,30 +182,26 @@ endif
 ifdef LIBRARY
 ifdef FORCE_SHARED_LIB
 ifdef MKSHLIB
 
 ifdef LIB_IS_C_ONLY
 MKSHLIB			= $(MKCSHLIB)
 endif
 
-ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
+ifneq (,$(filter WINNT,$(OS_ARCH)))
 IMPORT_LIBRARY		:= $(LIB_PREFIX)$(SHARED_LIBRARY_NAME).$(IMPORT_LIB_SUFFIX)
 endif
 
 ifdef MAKE_FRAMEWORK
 SHARED_LIBRARY		:= $(SHARED_LIBRARY_NAME)
 else
 SHARED_LIBRARY		:= $(DLL_PREFIX)$(SHARED_LIBRARY_NAME)$(DLL_SUFFIX)
 endif
 
-ifeq ($(OS_ARCH),OS2)
-DEF_FILE		:= $(SHARED_LIBRARY:.dll=.def)
-endif
-
 EMBED_MANIFEST_AT=2
 
 endif # MKSHLIB
 endif # FORCE_SHARED_LIB
 endif # LIBRARY
 
 ifdef FORCE_STATIC_LIB
 ifndef FORCE_SHARED_LIB
@@ -724,19 +716,16 @@ endif
 
 distclean::
 	-$(RM) -r $(ALL_TRASH_DIRS)
 	-$(RM) $(ALL_TRASH)  \
 	Makefile .HSancillary \
 	$(wildcard *.$(OBJ_SUFFIX)) $(wildcard *.ho) $(wildcard host_*.o*) \
 	$(wildcard *.$(LIB_SUFFIX)) $(wildcard *$(DLL_SUFFIX)) \
 	$(wildcard *.$(IMPORT_LIB_SUFFIX))
-ifeq ($(OS_ARCH),OS2)
-	-$(RM) $(PROGRAM:.exe=.map)
-endif
 
 alltags:
 	$(RM) TAGS
 	find $(topsrcdir) -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' -o -name '*.idl' \) -print | $(TAG_PROGRAM)
 
 #
 # PROGRAM = Foo
 # creates OBJS, links with LIBS to create Foo
@@ -867,33 +856,16 @@ ifeq ($(OS_ARCH),WINNT)
 # but make will happily consider the import library before it is refreshed
 # when rebuilding the corresponding shared library. Defining an empty recipe
 # for import libraries forces make to wait for the shared library recipe to
 # have run before considering other targets that depend on the import library.
 # See bug 795204.
 $(IMPORT_LIBRARY): $(SHARED_LIBRARY) ;
 endif
 
-ifeq ($(OS_ARCH),OS2)
-$(DEF_FILE): $(OBJS) $(SHARED_LIBRARY_LIBS)
-	$(RM) $@
-	echo LIBRARY $(SHARED_LIBRARY_NAME) INITINSTANCE TERMINSTANCE > $@
-	echo PROTMODE >> $@
-	echo CODE    LOADONCALL MOVEABLE DISCARDABLE >> $@
-	echo DATA    PRELOAD MOVEABLE MULTIPLE NONSHARED >> $@
-	echo EXPORTS >> $@
-
-	$(ADD_TO_DEF_FILE)
-
-$(IMPORT_LIBRARY): $(SHARED_LIBRARY)
-	$(REPORT_BUILD)
-	$(RM) $@
-	$(IMPLIB) $@ $^
-endif # OS/2
-
 $(HOST_LIBRARY): $(HOST_OBJS) Makefile
 	$(REPORT_BUILD)
 	$(RM) $@
 	$(EXPAND_LIBS_EXEC) --extract -- $(HOST_AR) $(HOST_AR_FLAGS) $(HOST_OBJS)
 
 ifdef HAVE_DTRACE
 ifndef XP_MACOSX
 ifdef DTRACE_PROBE_OBJ
@@ -1071,32 +1043,28 @@ endif
 
 $(filter %.i,$(CMMSRCS:%.mm=%.i)): %.i: %.mm $(call mkdir_deps,$(MDDEPDIR))
 	$(REPORT_BUILD)
 	$(CCC) -C $(PREPROCESS_OPTION)$@ $(COMPILE_CXXFLAGS) $(COMPILE_CMMFLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
 
 $(RESFILE): %.res: %.rc
 	$(REPORT_BUILD)
 	@echo Creating Resource file: $@
-ifeq ($(OS_ARCH),OS2)
-	$(RC) $(RCFLAGS:-D%=-d %) -i $(subst /,\,$(srcdir)) -r $< $@
-else
 ifdef GNU_CC
 	$(RC) $(RCFLAGS) $(filter-out -U%,$(DEFINES)) $(INCLUDES:-I%=--include-dir %) $(OUTOPTION)$@ $(_VPATH_SRCS)
 else
 	$(RC) $(RCFLAGS) -r $(DEFINES) $(INCLUDES) $(OUTOPTION)$@ $(_VPATH_SRCS)
 endif
-endif
 
 # Cancel GNU make built-in implicit rules
 ifndef .PYMAKE
 MAKEFLAGS += -r
 endif
 
-ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
+ifneq (,$(filter WINNT,$(OS_ARCH)))
 SEP := ;
 else
 SEP := :
 endif
 
 EMPTY :=
 SPACE := $(EMPTY) $(EMPTY)
 
--- a/config/system-headers
+++ b/config/system-headers
@@ -216,17 +216,16 @@ byteswap.h
 #endif
 #ifdef WRAP_CAIRO_HEADERS
 pixman.h
 cairo.h
 cairo-atsui.h
 cairo-beos.h
 cairo-ft.h
 cairo-glitz.h
-cairo-os2.h
 cairo-pdf.h
 cairo-ps.h
 cairo-tee.h
 cairo-quartz.h
 cairo-win32.h
 cairo-xlib.h
 cairo-xlib-xrender.h
 cairo-directfb.h
@@ -685,17 +684,16 @@ objbase.h
 objidl.h
 Objsafe.h
 ojiapitests.h
 ole2.h
 oleidl.h
 OpenGL/OpenGL.h
 OpenTptInternet.h
 OpenTransport.h
-os2.h
 OS.h
 osreldate.h
 ostream
 OSUtils.h
 Packages.h
 Palettes.h
 PALM_CMN.H
 pango/pango-modules.h
--- a/configure.in
+++ b/configure.in
@@ -1041,19 +1041,16 @@ solaris*)
     if test -z "$GNU_CXX"; then
        if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
            SOLARIS_SUNPRO_CXX=1
        fi
     fi
     AC_SUBST(SOLARIS_SUNPRO_CC)
     AC_SUBST(SOLARIS_SUNPRO_CXX)
     ;;
-OS_2)
-    HOST_OS_ARCH=OS2
-    ;;
 esac
 
 case "$OS_ARCH" in
 WINNT)
     if test -z "$CROSS_COMPILE" ; then
         OS_TEST=`uname -p`
     fi
     ;;
@@ -1082,21 +1079,16 @@ MINGW*_NT*)
     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
     OS_ARCH=WINNT
     OS_TARGET=WINNT
     ;;
 AIX)
     OS_RELEASE=`uname -v`.`uname -r`
     OS_TEST=${target_cpu}
     ;;
-OS_2)
-    OS_ARCH=OS2
-    OS_TARGET=OS2
-    OS_RELEASE=`uname -v`
-    ;;
 Darwin)
     case "${target_cpu}" in
     powerpc*)
         OS_TEST=ppc
         ;;
     i*86*)
         OS_TEST=i386
         ;;
@@ -1538,26 +1530,16 @@ if test "$result" = "yes"; then
     AC_DEFINE(HAVE_64BIT_OS)
     HAVE_64BIT_OS=1
 fi
 AC_SUBST(HAVE_64BIT_OS)
 AC_LANG_RESTORE
 fi # COMPILE_ENVIRONMENT
 
 dnl ========================================================
-dnl Enable high-memory support on OS/2 by default.
-dnl ========================================================
-MOZ_OS2_HIGH_MEMORY=1
-MOZ_ARG_DISABLE_BOOL(os2-high-mem,
-[  --disable-os2-high-mem  Disable high-memory support on OS/2],
-    MOZ_OS2_HIGH_MEMORY=,
-    MOZ_OS2_HIGH_MEMORY=1 )
-AC_SUBST(MOZ_OS2_HIGH_MEMORY)
-
-dnl ========================================================
 dnl = Use profiling compile flags
 dnl ========================================================
 MOZ_ARG_ENABLE_BOOL(profiling,
 [  --enable-profiling      Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
     MOZ_PROFILING=1,
     MOZ_PROFILING= )
 
 dnl ========================================================
@@ -1737,24 +1719,16 @@ case "$host" in
     ;;
 
 *-linux*|*-kfreebsd*-gnu|*-gnu*)
     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
     ;;
 
-*os2*)
-    HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
-    HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
-    HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
-    HOST_BIN_SUFFIX=.exe
-    MOZ_FIX_LINK_PATHS=
-    ;;
-
 *)
     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
     ;;
 esac
 
 dnl Check for using a custom <inttypes.h> implementation
 dnl ========================================================
@@ -2252,81 +2226,16 @@ ia64*-hpux*)
     DSO_CFLAGS=''
     DSO_PIC_CFLAGS='-fPIC'
     DSO_LDOPTS='-shared -fPIC'
     if test "$LIBRUNPATH"; then
 	DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
     fi
     ;;
 
-*-os2*)
-    MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
-    MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
-    AC_DEFINE(OS2)
-    AC_DEFINE(XP_OS2)
-    AC_DEFINE(OS2EMX_PLAIN_CHAR)
-    AC_DEFINE(TCPV40HDRS)
-    DLL_PREFIX=
-    LIB_PREFIX=
-    LIB_SUFFIX=lib
-    BIN_SUFFIX=".exe"
-    DLL_SUFFIX=".dll"
-    IMPORT_LIB_SUFFIX=lib
-    DSO_PIC_CFLAGS=
-    AR=emxomfar
-    AR_FLAGS='r $@'
-    CFLAGS="$CFLAGS -Zomf"
-    CXXFLAGS="$CXXFLAGS -Zomf"
-    DSO_LDOPTS='-Zdll'
-    BIN_FLAGS='-Zlinker /ST:0x100000'
-    IMPLIB='emximp -o'
-    FILTER='true'
-    LDFLAGS='-Zmap'
-    WARNINGS_AS_ERRORS='-Werror'
-    MOZ_DEBUG_FLAGS="-g -fno-inline"
-    MOZ_OPTIMIZE_FLAGS="-O2"
-    MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
-    LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
-    TARGET_MD_ARCH=os2
-    _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
-    RC=rc.exe
-    MC=mc.exe
-    RCFLAGS='-n'
-    MOZ_USER_DIR="Mozilla"
-    ZIP="$ZIP -X"
-    STRIP=lxlite
-    STRIP_FLAGS="/yua /ydd /yxd /ynl /anp /b- /cs+ /d /i- /ml1 /mr2 /mf2 /r+ /u+ /x- /zs:0 /zx /zd"
-
-    if test "$MOZTOOLS"; then
-        MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
-    else
-        AC_MSG_ERROR([MOZTOOLS is not set])
-    fi
-    if test -n "$MOZ_OS2_HIGH_MEMORY"; then
-        DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
-        LDFLAGS="$LDFLAGS -Zhigh-mem"
-        MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
-        AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
-    fi
-
-    # GCC for OS/2 currently predefines these, but we don't want them
-    _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
-    _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
-
-    AC_CACHE_CHECK(for __declspec(dllexport),
-        ac_os2_declspec,
-        [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
-                        [return 0;],
-                        ac_os2_declspec="yes",
-                        ac_os2_declspec="no")])
-    if test "$ac_os2_declspec" != "yes"; then
-        AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
-    fi
-    ;;
-
 *-solaris*)
     AC_DEFINE(SOLARIS)
     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
     MOZ_FIX_LINK_PATHS=
     # $ORIGIN/.. is for shared libraries under components/ to locate shared
     # libraries one level up (e.g. libnspr4.so)
     if test "$SOLARIS_SUNPRO_CC"; then
        LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
@@ -2412,20 +2321,16 @@ ia64*-hpux*)
     AC_DEFINE(SPRINTF_RETURNS_STRING)
     case "$(target_os)" in
     sunos4.1*)
         DLL_SUFFIX='.so.1.0'
         ;;
     esac
     ;;
 
-*-os2*)
-    HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
-    ;;
-
 esac
 
 case "$target" in
 *-*linux*)
     # Includes linux-android
     AC_DEFINE(XP_LINUX)
     ;;
 esac
@@ -2448,19 +2353,16 @@ dnl So, by defining NO_LD_ARCHIVE_FLAGS 
 dnl they can link in the static libs that provide the missing
 dnl symbols.
 dnl ========================================================
 NO_LD_ARCHIVE_FLAGS=
 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
     NO_LD_ARCHIVE_FLAGS=1
 fi
 case "$target" in
-*-os2*)
-    NO_LD_ARCHIVE_FLAGS=
-    ;;
 *-aix4.3*|*-aix5*)
     NO_LD_ARCHIVE_FLAGS=
     ;;
 *-mingw*)
     if test -z "$GNU_CC"; then
         NO_LD_ARCHIVE_FLAGS=
     fi
     ;;
@@ -2806,18 +2708,16 @@ dnl We don't want to link with libdl eve
 dnl it's not used and not part of the default installation. OS/2 has dlfcn
 dnl in libc.
 dnl We don't want to link against libm or libpthread on Darwin since
 dnl they both are just symlinks to libSystem and explicitly linking
 dnl against libSystem causes issues when debugging (see bug 299601).
 case $target in
 *-darwin*)
     ;;
-*-os2*)
-    ;;
 *)
     AC_SEARCH_LIBS(dlopen, dl,
         MOZ_CHECK_HEADER(dlfcn.h,
         AC_DEFINE(HAVE_DLOPEN)))
     ;;
 esac
 
 _SAVE_CFLAGS="$CFLAGS"
@@ -2832,23 +2732,17 @@ if test ! "$GNU_CXX"; then
 	AC_CHECK_LIB(C_r, demangle)
 	;;
      *)
 	AC_CHECK_LIB(C, demangle)
 	;;
      esac
 fi
 
-dnl OS/2 has socket in libc.
-case $target in
-*-os2*)
-    ;;
-*)
-    AC_CHECK_LIB(socket, socket)
-esac
+AC_CHECK_LIB(socket, socket)
 
 XLDFLAGS="$X_LIBS"
 XLIBS="$X_EXTRA_LIBS"
 
 dnl ========================================================
 dnl Checks for X libraries.
 dnl Ordering is important.
 dnl Xt is dependent upon SM as of X11R6
@@ -3117,17 +3011,17 @@ dnl must add the link line we do somethi
 dnl else
 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
 fi
 
 AC_LANG_CPLUSPLUS
 
 case $target_os in
-    darwin*|mingw*|os2*)
+    darwin*|mingw*)
         ;;
     *)
 
 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
 _SAVE_LIBS=$LIBS
 LIBS="$LIBS $_ICONV_LIBS"
@@ -3692,17 +3586,17 @@ if test -n "$_USE_SYSTEM_NSS"; then
     AM_PATH_NSS(3.16, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
 fi
 
 if test -n "$MOZ_NATIVE_NSS"; then
    NSS_LIBS="$NSS_LIBS -lcrmf"
 else
    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
 
-   if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2"; then
+   if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT"; then
        NSS_LIBS="\
         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
    else
        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
@@ -4277,30 +4171,28 @@ MOZ_ARG_HEADER(Toolkit Options)
     dnl ========================================================
     dnl = Select the default toolkit
     dnl ========================================================
 	MOZ_ARG_ENABLE_STRING(default-toolkit,
 	[  --enable-default-toolkit=TK
                           Select default toolkit
                           Platform specific defaults:
                             Mac OS X - cairo-cocoa
-                            OS/2 - cairo-os2
                             Win32 - cairo-windows
                             * - cairo-gtk2
                             * - cairo-gtk3
                             * - cairo-qt],
     [ _DEFAULT_TOOLKIT=$enableval ],
     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
 
     if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk3" \
         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
-        -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
         -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
         -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
         -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
     then
         dnl nglayout only supports building with one toolkit,
         dnl so ignore everything after the first comma (",").
         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
@@ -4386,24 +4278,16 @@ cairo-qt)
     USE_FC_FREETYPE=1
     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
     TK_LIBS='$(MOZ_QT_LIBS)'
     AC_DEFINE(MOZ_WIDGET_QT)
     MOZ_PDF_PRINTING=1
     AC_DEFINE(QT_NO_KEYWORDS)
     ;;
 
-cairo-os2)
-    MOZ_WIDGET_TOOLKIT=os2
-    USE_FC_FREETYPE=1
-    TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
-    TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
-    MOZ_PDF_PRINTING=1
-    ;;
-
 cairo-cocoa)
     MOZ_WIDGET_TOOLKIT=cocoa
     AC_DEFINE(MOZ_WIDGET_COCOA)
     LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
     TK_LIBS='-framework CoreLocation -framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
     TK_CFLAGS="-DNO_X11"
     CFLAGS="$CFLAGS $TK_CFLAGS"
     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
@@ -6845,18 +6729,18 @@ MOZ_ARG_ENABLE_BOOL(jemalloc,
 
 if test "$NS_TRACE_MALLOC"; then
     MOZ_MEMORY=
 fi
 
 if test "${OS_TARGET}" = "Android"; then
   dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
   :
-elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "OS2"; then
-  dnl On Windows, OSX and OS2, we want to link all our binaries against mozglue
+elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin"; then
+  dnl On Windows and OSX, we want to link all our binaries against mozglue
   if test -z "$GNU_CC"; then
     MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
   else
     MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
   fi
 else
   dnl On other Unix systems, we only want to link executables against mozglue
   MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
@@ -7558,17 +7442,17 @@ dnl things were flat packaged. After pac
 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
 dnl is set to flat since putting files into jars is only
 dnl done during packaging with omnijar.
 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
     MOZ_OMNIJAR=1
     AC_DEFINE(MOZ_OMNIJAR)
 fi
 MOZ_PACKAGER_FORMAT="$MOZ_CHROME_FILE_FORMAT"
-if test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2" -o "$MOZ_WIDGET_TOOLKIT" = "android"; then
+if test "$OS_ARCH" = "WINNT" -o "$MOZ_WIDGET_TOOLKIT" = "android"; then
     MOZ_CHROME_FILE_FORMAT=flat
 else
     MOZ_CHROME_FILE_FORMAT=symlink
 fi
 
 if test "$MOZ_WIDGET_TOOLKIT" = "android"; then
     dnl Fennec's static resources live in the assets/ folder of the
     dnl APK.  Adding a path to the name here works because we only
@@ -8038,23 +7922,16 @@ if test "$MOZ_TREE_CAIRO"; then
 
         MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
 
         dnl D3D10 Layers depend on D2D Surfaces.
         if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
           MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
         fi
         ;;
-      os2)
-        OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
-        FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
-        MOZ_ENABLE_CAIRO_FT=1
-        CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
-        CAIRO_FT_OSLIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
-        ;;
     esac
     if test "$USE_FC_FREETYPE"; then
         FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
     fi
     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
     AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
     AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
     AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
@@ -8420,17 +8297,16 @@ AC_SUBST(XPCOM_FROZEN_LDOPTS)
 AC_SUBST(XPCOM_GLUE_LDOPTS)
 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
 AC_SUBST(XPCOM_STATICRUNTIME_GLUE_LDOPTS)
 AC_SUBST(XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS)
 
 AC_SUBST(USE_DEPENDENT_LIBS)
 
 AC_SUBST(MOZ_BUILD_ROOT)
-AC_SUBST(MOZ_OS2_TOOLS)
 
 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
 AC_SUBST(MOZ_LINKER_EXTRACT)
 
 AC_SUBST(MOZ_JSDOWNLOADS)
 if test -n "$MOZ_JSDOWNLOADS"; then
   AC_DEFINE(MOZ_JSDOWNLOADS)
@@ -8792,17 +8668,17 @@ fi # MOZ_X11
 
 fi # COMPILE_ENVIRONMENT
 
 dnl Set various defines and substitutions
 dnl ========================================================
 
 if test "$OS_ARCH" = "Darwin"; then
   AC_DEFINE(XP_UNIX)
-elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then
+elif test "$OS_ARCH" != "WINNT"; then
   AC_DEFINE(XP_UNIX)
 fi
 
 if test "$MOZ_DEBUG"; then
     AC_DEFINE(MOZ_REFLOW_PERF)
     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
 fi
 
--- a/content/base/public/nsContentUtils.h
+++ b/content/base/public/nsContentUtils.h
@@ -4,17 +4,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* A namespace class for static content utilities. */
 
 #ifndef nsContentUtils_h___
 #define nsContentUtils_h___
 
-#if defined(XP_WIN) || defined(XP_OS2)
+#if defined(XP_WIN)
 #include <float.h>
 #endif
 
 #if defined(SOLARIS)
 #include <ieeefp.h>
 #endif
 
 #include "js/TypeDecls.h"
--- a/content/xul/content/src/nsXULPopupListener.cpp
+++ b/content/xul/content/src/nsXULPopupListener.cpp
@@ -45,17 +45,17 @@
 #include "nsMenuFrame.h"
 #include "nsDOMEvent.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 // on win32 and os/2, context menus come up on mouse up. On other platforms,
 // they appear on mouse down. Certain bits of code care about this difference.
-#if defined(XP_WIN) || defined(XP_OS2)
+#if defined(XP_WIN)
 #define NS_CONTEXT_MENU_IS_MOUSEUP 1
 #endif
 
 nsXULPopupListener::nsXULPopupListener(mozilla::dom::Element* aElement,
                                        bool aIsContext)
   : mElement(aElement), mPopupContent(nullptr), mIsContext(aIsContext)
 {
 }
--- a/db/sqlite3/src/Makefile.in
+++ b/db/sqlite3/src/Makefile.in
@@ -43,14 +43,8 @@ endif
 ifeq ($(OS_ARCH),WINNT)
 MODULE_OPTIMIZE_FLAGS = -O2
 endif
 
 include $(topsrcdir)/config/rules.mk
 
 # next line allows use of MOZ_OBJDIR in .mozconfig with older gcc on BeOS, maybe others
 LOCAL_INCLUDES += -I$(srcdir)
-
-ifeq ($(OS_ARCH),OS2)
-ADD_TO_DEF_FILE = $(PYTHON) -m mozbuild.action.preprocessor $(DEFINES) \
-       $(srcdir)/sqlite.def | sed -e '1,/^EXPORTS$$/ d' -e 's,sqlite3,_\0,' \
-       -e 's,\ DATA.*$$,,' >> $(DEF_FILE)
-endif
--- a/db/sqlite3/src/moz.build
+++ b/db/sqlite3/src/moz.build
@@ -45,19 +45,16 @@ DEFINES['SQLITE_MAX_SCHEMA_RETRY'] = 25
 # -DSQLITE_ENABLE_LOCKING_STYLE=1 to help with AFP folders
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
     DEFINES['SQLITE_ENABLE_LOCKING_STYLE'] = 1
 
 # Turn on SQLite's assertions in debug builds.
 if CONFIG['MOZ_DEBUG']:
     DEFINES['SQLITE_DEBUG'] = 1
 
-if CONFIG['OS_ARCH'] == 'OS2' and CONFIG['MOZ_OS2_HIGH_MEMORY']:
-    DEFINES['OS2_HIGH_MEMORY'] = True
-
 if CONFIG['OS_TARGET'] == 'Android':
     # default to user readable only to fit Android security model
     DEFINES['SQLITE_DEFAULT_FILE_PERMISSIONS'] = '0600'
 
 # Force using malloc_usable_size when building with jemalloc because _msize
 # causes assertions on Win64. See bug 719579.
 if CONFIG['OS_ARCH'] == 'WINNT' and CONFIG['MOZ_MEMORY']:
     DEFINES['HAVE_MALLOC_USABLE_SIZE'] = True
--- a/docshell/base/nsDefaultURIFixup.cpp
+++ b/docshell/base/nsDefaultURIFixup.cpp
@@ -158,17 +158,17 @@ nsDefaultURIFixup::CreateFixupURI(const 
         uriString.Assign(NS_LITERAL_CSTRING("view-source:") + spec);
     }
     else {
         // Check for if it is a file URL
         FileURIFixup(uriString, aURI);
         if(*aURI)
             return NS_OK;
 
-#if defined(XP_WIN) || defined(XP_OS2)
+#if defined(XP_WIN)
         // Not a file URL, so translate '\' to '/' for convenience in the common protocols
         // e.g. catch
         //
         //   http:\\broken.com\address
         //   http:\\broken.com/blah
         //   broken.com\blah
         //
         // Code will also do partial fix up the following urls
@@ -597,17 +597,17 @@ nsresult nsDefaultURIFixup::FileURIFixup
     return NS_ERROR_FAILURE;
 }
 
 nsresult nsDefaultURIFixup::ConvertFileToStringURI(const nsACString& aIn,
                                                    nsCString& aOut)
 {
     bool attemptFixup = false;
 
-#if defined(XP_WIN) || defined(XP_OS2)
+#if defined(XP_WIN)
     // Check for \ in the url-string or just a drive (PC)
     if(kNotFound != aIn.FindChar('\\') ||
        (aIn.Length() == 2 && (aIn.Last() == ':' || aIn.Last() == '|')))
     {
         attemptFixup = true;
     }
 #elif defined(XP_UNIX)
     // Check if it starts with / (UNIX)
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -2022,18 +2022,16 @@ NS_GetNavigatorPlatform(nsAString& aPlat
 #elif defined(WIN32)
   aPlatform.AssignLiteral("Win32");
 #elif defined(XP_MACOSX) && defined(__ppc__)
   aPlatform.AssignLiteral("MacPPC");
 #elif defined(XP_MACOSX) && defined(__i386__)
   aPlatform.AssignLiteral("MacIntel");
 #elif defined(XP_MACOSX) && defined(__x86_64__)
   aPlatform.AssignLiteral("MacIntel");
-#elif defined(XP_OS2)
-  aPlatform.AssignLiteral("OS/2");
 #else
   // XXX Communicator uses compiled-in build-time string defines
   // to indicate the platform it was compiled *for*, not what it is
   // currently running *on* which is what this does.
   nsAutoCString plat;
   rv = service->GetOscpu(plat);
   CopyASCIItoUTF16(plat, aPlatform);
 #endif
--- a/dom/base/nsFocusManager.cpp
+++ b/dom/base/nsFocusManager.cpp
@@ -1972,17 +1972,17 @@ nsFocusManager::RaiseWindow(nsPIDOMWindo
     // In test mode, emulate the existing window being lowered and the new
     // window being raised.
     if (mActiveWindow)
       WindowLowered(mActiveWindow);
     WindowRaised(aWindow);
     return;
   }
 
-#if defined(XP_WIN) || defined(XP_OS2)
+#if defined(XP_WIN)
   // Windows would rather we focus the child widget, otherwise, the toplevel
   // widget will always end up being focused. Fortunately, focusing the child
   // widget will also have the effect of raising the window this widget is in.
   // But on other platforms, we can just focus the toplevel widget to raise
   // the window.
   nsCOMPtr<nsPIDOMWindow> childWindow;
   GetFocusedDescendant(aWindow, true, getter_AddRefs(childWindow));
   if (!childWindow)
--- a/dom/events/nsEventStateManager.cpp
+++ b/dom/events/nsEventStateManager.cpp
@@ -1042,53 +1042,42 @@ nsEventStateManager::PreHandleEvent(nsPr
   *aStatus = nsEventStatus_eIgnore;
 
   nsMouseWheelTransaction::OnEvent(aEvent);
 
   switch (aEvent->message) {
   case NS_MOUSE_BUTTON_DOWN: {
     switch (mouseEvent->button) {
     case WidgetMouseEvent::eLeftButton:
-#ifndef XP_OS2
       BeginTrackingDragGesture(aPresContext, mouseEvent, aTargetFrame);
-#endif
       mLClickCount = mouseEvent->clickCount;
       SetClickCount(aPresContext, mouseEvent, aStatus);
       sNormalLMouseEventInProcess = true;
       break;
     case WidgetMouseEvent::eMiddleButton:
       mMClickCount = mouseEvent->clickCount;
       SetClickCount(aPresContext, mouseEvent, aStatus);
       break;
     case WidgetMouseEvent::eRightButton:
-#ifdef XP_OS2
-      BeginTrackingDragGesture(aPresContext, mouseEvent, aTargetFrame);
-#endif
       mRClickCount = mouseEvent->clickCount;
       SetClickCount(aPresContext, mouseEvent, aStatus);
       break;
     }
     break;
   }
   case NS_MOUSE_BUTTON_UP: {
     switch (mouseEvent->button) {
       case WidgetMouseEvent::eLeftButton:
         if (Prefs::ClickHoldContextMenu()) {
           KillClickHoldTimer();
         }
-#ifndef XP_OS2
         StopTrackingDragGesture();
-#endif
         sNormalLMouseEventInProcess = false;
         // then fall through...
       case WidgetMouseEvent::eRightButton:
-#ifdef XP_OS2
-        StopTrackingDragGesture();
-#endif
-        // then fall through...
       case WidgetMouseEvent::eMiddleButton:
         SetClickCount(aPresContext, mouseEvent, aStatus);
         break;
     }
     break;
   }
   case NS_MOUSE_EXIT:
     // If the event is not a top-level window exit, then it's not
--- a/dom/moz.build
+++ b/dom/moz.build
@@ -112,11 +112,11 @@ if CONFIG['MOZ_NFC']:
 if CONFIG['MOZ_B2G']:
     PARALLEL_DIRS += ['downloads']
 
 TEST_DIRS += [
     'tests',
     'imptests',
 ]
 
-if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'cocoa', 'windows', 'android', 'qt', 'os2'):
+if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'cocoa', 'windows', 'android', 'qt'):
     TEST_DIRS += ['plugins/test']
 
--- a/dom/plugins/base/PluginPRLibrary.cpp
+++ b/dom/plugins/base/PluginPRLibrary.cpp
@@ -159,17 +159,17 @@ PluginPRLibrary::NP_GetValue(void *futur
     *error = pfNP_GetValue(future, aVariable, aValue);
   }
   return NS_OK;
 #else
   return NS_ERROR_NOT_IMPLEMENTED;
 #endif
 }
 
-#if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_OS2)
+#if defined(XP_WIN) || defined(XP_MACOSX)
 nsresult
 PluginPRLibrary::NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error)
 {
   CALLING_CONVENTION_HACK
 
   if (mNP_GetEntryPoints) {
     *error = mNP_GetEntryPoints(pFuncs);
   } else {
--- a/dom/plugins/base/PluginPRLibrary.h
+++ b/dom/plugins/base/PluginPRLibrary.h
@@ -22,17 +22,17 @@ public:
 #else
         mNP_Initialize(nullptr),
 #endif
         mNP_Shutdown(nullptr),
         mNP_GetMIMEDescription(nullptr),
 #if defined(XP_UNIX) && !defined(XP_MACOSX)
         mNP_GetValue(nullptr),
 #endif
-#if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_OS2)
+#if defined(XP_WIN) || defined(XP_MACOSX)
         mNP_GetEntryPoints(nullptr),
 #endif
         mNPP_New(nullptr),
         mNPP_ClearSiteData(nullptr),
         mNPP_GetSitesWithData(nullptr),
         mLibrary(aLibrary),
         mFilePath(aFilePath)
     {
@@ -67,17 +67,17 @@ public:
 
 #if defined(XP_UNIX) && !defined(XP_MACOSX)
         mNP_GetValue = (NP_GetValueFunc)
             PR_FindFunctionSymbol(mLibrary, "NP_GetValue");
         if (!mNP_GetValue)
             return false;
 #endif
 
-#if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_OS2)
+#if defined(XP_WIN) || defined(XP_MACOSX)
         mNP_GetEntryPoints = (NP_GetEntryPointsFunc)
             PR_FindFunctionSymbol(mLibrary, "NP_GetEntryPoints");
         if (!mNP_GetEntryPoints)
             return false;
 #endif
         return true;
     }
 
@@ -90,17 +90,17 @@ public:
 #endif
 
     virtual nsresult NP_Shutdown(NPError* error);
     virtual nsresult NP_GetMIMEDescription(const char** mimeDesc);
 
     virtual nsresult NP_GetValue(void *future, NPPVariable aVariable,
                                  void *aValue, NPError* error);
 
-#if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_OS2)
+#if defined(XP_WIN) || defined(XP_MACOSX)
     virtual nsresult NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error);
 #endif
 
     virtual nsresult NPP_New(NPMIMEType pluginType, NPP instance,
                              uint16_t mode, int16_t argc, char* argn[],
                              char* argv[], NPSavedData* saved,
                              NPError* error);
 
@@ -125,17 +125,17 @@ public:
 
 private:
     NP_InitializeFunc mNP_Initialize;
     NP_ShutdownFunc mNP_Shutdown;
     NP_GetMIMEDescriptionFunc mNP_GetMIMEDescription;
 #if defined(XP_UNIX) && !defined(XP_MACOSX)
     NP_GetValueFunc mNP_GetValue;
 #endif
-#if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_OS2)
+#if defined(XP_WIN) || defined(XP_MACOSX)
     NP_GetEntryPointsFunc mNP_GetEntryPoints;
 #endif
     NPP_NewProcPtr mNPP_New;
     NPP_ClearSiteDataPtr mNPP_ClearSiteData;
     NPP_GetSitesWithDataPtr mNPP_GetSitesWithData;
     PRLibrary* mLibrary;
     nsCString mFilePath;
 };
--- a/dom/plugins/base/moz.build
+++ b/dom/plugins/base/moz.build
@@ -60,21 +60,16 @@ SOURCES += [
 ]
 
 if CONFIG['OS_ARCH'] == 'WINNT':
     UNIFIED_SOURCES += [
         'nsPluginDirServiceProvider.cpp',
         'nsPluginNativeWindowWin.cpp',
         'nsPluginsDirWin.cpp',
     ]
-elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'os2':
-    UNIFIED_SOURCES += [
-        'nsPluginNativeWindowOS2.cpp',
-        'nsPluginsDirOS2.cpp',
-    ]
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
     UNIFIED_SOURCES += [
         'nsPluginNativeWindow.cpp',
         'nsPluginsDirDarwin.cpp',
     ]
 else:
     UNIFIED_SOURCES += [
         'nsPluginsDirUnix.cpp',
--- a/dom/plugins/base/npapi.h
+++ b/dom/plugins/base/npapi.h
@@ -1,28 +1,18 @@
 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef npapi_h_
 #define npapi_h_
 
-#if defined(__OS2__)
-#pragma pack(1)
-#endif
-
 #include "nptypes.h"
 
-#if defined(__OS2__) || defined(OS2)
-#ifndef XP_OS2
-#define XP_OS2 1
-#endif
-#endif
-
 #if defined(_WIN32) && !defined(__SYMBIAN32__)
 #include <windef.h>
 #ifndef XP_WIN
 #define XP_WIN 1
 #endif
 #endif
 
 #if defined(__SYMBIAN32__)
@@ -532,23 +522,16 @@ typedef EventRecord NPEvent;
 typedef QEvent NPEvent;
 #elif defined(XP_WIN)
 typedef struct _NPEvent
 {
   uint16_t event;
   uintptr_t wParam;
   uintptr_t lParam;
 } NPEvent;
-#elif defined(XP_OS2)
-typedef struct _NPEvent
-{
-  uint32_t event;
-  uint32_t wParam;
-  uint32_t lParam;
-} NPEvent;
 #elif defined(XP_UNIX) && defined(MOZ_X11)
 typedef XEvent NPEvent;
 #else
 typedef void*  NPEvent;
 #endif
 
 #if defined(XP_MACOSX)
 typedef void* NPRegion;
@@ -780,129 +763,120 @@ enum NPEventType {
 #define NPVERS_HAS_ADVANCED_KEY_HANDLING    25
 #define NPVERS_HAS_URL_REDIRECT_HANDLING    26
 #define NPVERS_HAS_CLEAR_SITE_DATA          27
 
 /*----------------------------------------------------------------------*/
 /*                        Function Prototypes                           */
 /*----------------------------------------------------------------------*/
 
-#if defined(__OS2__)
-#define NP_LOADDS _System
-#else
-#define NP_LOADDS
-#endif
-
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 /* NPP_* functions are provided by the plugin and called by the navigator. */
 
 #if defined(XP_UNIX)
 const char* NPP_GetMIMEDescription(void);
 #endif
 
-NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance,
-                          uint16_t mode, int16_t argc, char* argn[],
-                          char* argv[], NPSavedData* saved);
-NPError NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save);
-NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window);
-NPError NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type,
-                                NPStream* stream, NPBool seekable,
-                                uint16_t* stype);
-NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream,
-                                    NPReason reason);
-int32_t NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream);
-int32_t NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32_t offset,
-                            int32_t len, void* buffer);
-void    NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream,
-                                   const char* fname);
-void    NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint);
-int16_t NP_LOADDS NPP_HandleEvent(NPP instance, void* event);
-void    NP_LOADDS NPP_URLNotify(NPP instance, const char* url,
-                                NPReason reason, void* notifyData);
-NPError NP_LOADDS NPP_GetValue(NPP instance, NPPVariable variable, void *value);
-NPError NP_LOADDS NPP_SetValue(NPP instance, NPNVariable variable, void *value);
-NPBool  NP_LOADDS NPP_GotFocus(NPP instance, NPFocusDirection direction);
-void    NP_LOADDS NPP_LostFocus(NPP instance);
-void    NP_LOADDS NPP_URLRedirectNotify(NPP instance, const char* url, int32_t status, void* notifyData);
-NPError NP_LOADDS NPP_ClearSiteData(const char* site, uint64_t flags, uint64_t maxAge);
-char**  NP_LOADDS NPP_GetSitesWithData(void);
-void    NP_LOADDS NPP_DidComposite(NPP instance);
+NPError NPP_New(NPMIMEType pluginType, NPP instance,
+                uint16_t mode, int16_t argc, char* argn[],
+                char* argv[], NPSavedData* saved);
+NPError NPP_Destroy(NPP instance, NPSavedData** save);
+NPError NPP_SetWindow(NPP instance, NPWindow* window);
+NPError NPP_NewStream(NPP instance, NPMIMEType type,
+                      NPStream* stream, NPBool seekable,
+                      uint16_t* stype);
+NPError NPP_DestroyStream(NPP instance, NPStream* stream,
+                          NPReason reason);
+int32_t NPP_WriteReady(NPP instance, NPStream* stream);
+int32_t NPP_Write(NPP instance, NPStream* stream, int32_t offset,
+                  int32_t len, void* buffer);
+void    NPP_StreamAsFile(NPP instance, NPStream* stream,
+                         const char* fname);
+void    NPP_Print(NPP instance, NPPrint* platformPrint);
+int16_t NPP_HandleEvent(NPP instance, void* event);
+void    NPP_URLNotify(NPP instance, const char* url,
+                      NPReason reason, void* notifyData);
+NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value);
+NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value);
+NPBool  NPP_GotFocus(NPP instance, NPFocusDirection direction);
+void    NPP_LostFocus(NPP instance);
+void    NPP_URLRedirectNotify(NPP instance, const char* url, int32_t status, void* notifyData);
+NPError NPP_ClearSiteData(const char* site, uint64_t flags, uint64_t maxAge);
+char**  NPP_GetSitesWithData(void);
+void    NPP_DidComposite(NPP instance);
 
 /* NPN_* functions are provided by the navigator and called by the plugin. */
-void        NP_LOADDS NPN_Version(int* plugin_major, int* plugin_minor,
-                                  int* netscape_major, int* netscape_minor);
-NPError     NP_LOADDS NPN_GetURLNotify(NPP instance, const char* url,
-                                       const char* target, void* notifyData);
-NPError     NP_LOADDS NPN_GetURL(NPP instance, const char* url,
-                                 const char* target);
-NPError     NP_LOADDS NPN_PostURLNotify(NPP instance, const char* url,
-                                        const char* target, uint32_t len,
-                                        const char* buf, NPBool file,
-                                        void* notifyData);
-NPError     NP_LOADDS NPN_PostURL(NPP instance, const char* url,
-                                  const char* target, uint32_t len,
-                                  const char* buf, NPBool file);
-NPError     NP_LOADDS NPN_RequestRead(NPStream* stream, NPByteRange* rangeList);
-NPError     NP_LOADDS NPN_NewStream(NPP instance, NPMIMEType type,
-                                    const char* target, NPStream** stream);
-int32_t     NP_LOADDS NPN_Write(NPP instance, NPStream* stream, int32_t len,
-                                void* buffer);
-NPError     NP_LOADDS NPN_DestroyStream(NPP instance, NPStream* stream,
-                                        NPReason reason);
-void        NP_LOADDS NPN_Status(NPP instance, const char* message);
-const char* NP_LOADDS NPN_UserAgent(NPP instance);
-void*       NP_LOADDS NPN_MemAlloc(uint32_t size);
-void        NP_LOADDS NPN_MemFree(void* ptr);
-uint32_t    NP_LOADDS NPN_MemFlush(uint32_t size);
-void        NP_LOADDS NPN_ReloadPlugins(NPBool reloadPages);
-NPError     NP_LOADDS NPN_GetValue(NPP instance, NPNVariable variable,
-                                   void *value);
-NPError     NP_LOADDS NPN_SetValue(NPP instance, NPPVariable variable,
-                                   void *value);
-void        NP_LOADDS NPN_InvalidateRect(NPP instance, NPRect *invalidRect);
-void        NP_LOADDS NPN_InvalidateRegion(NPP instance,
-                                           NPRegion invalidRegion);
-void        NP_LOADDS NPN_ForceRedraw(NPP instance);
-void        NP_LOADDS NPN_PushPopupsEnabledState(NPP instance, NPBool enabled);
-void        NP_LOADDS NPN_PopPopupsEnabledState(NPP instance);
-void        NP_LOADDS NPN_PluginThreadAsyncCall(NPP instance,
-                                                void (*func) (void *),
-                                                void *userData);
-NPError     NP_LOADDS NPN_GetValueForURL(NPP instance, NPNURLVariable variable,
-                                         const char *url, char **value,
-                                         uint32_t *len);
-NPError     NP_LOADDS NPN_SetValueForURL(NPP instance, NPNURLVariable variable,
-                                         const char *url, const char *value,
-                                         uint32_t len);
-NPError     NP_LOADDS NPN_GetAuthenticationInfo(NPP instance,
-                                                const char *protocol,
-                                                const char *host, int32_t port,
-                                                const char *scheme,
-                                                const char *realm,
-                                                char **username, uint32_t *ulen,
-                                                char **password,
-                                                uint32_t *plen);
-uint32_t    NP_LOADDS NPN_ScheduleTimer(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID));
-void        NP_LOADDS NPN_UnscheduleTimer(NPP instance, uint32_t timerID);
-NPError     NP_LOADDS NPN_PopUpContextMenu(NPP instance, NPMenu* menu);
-NPBool      NP_LOADDS NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace);
-NPBool      NP_LOADDS NPN_HandleEvent(NPP instance, void *event, NPBool handled);
-NPBool      NP_LOADDS NPN_UnfocusInstance(NPP instance, NPFocusDirection direction);
-void        NP_LOADDS NPN_URLRedirectResponse(NPP instance, void* notifyData, NPBool allow);
-NPError     NP_LOADDS NPN_InitAsyncSurface(NPP instance, NPSize *size,
-                                           NPImageFormat format, void *initData,
-                                           NPAsyncSurface *surface);
-NPError     NP_LOADDS NPN_FinalizeAsyncSurface(NPP instance, NPAsyncSurface *surface);
-void        NP_LOADDS NPN_SetCurrentAsyncSurface(NPP instance, NPAsyncSurface *surface, NPRect *changed);
+void        NPN_Version(int* plugin_major, int* plugin_minor,
+                        int* netscape_major, int* netscape_minor);
+NPError     NPN_GetURLNotify(NPP instance, const char* url,
+                             const char* target, void* notifyData);
+NPError     NPN_GetURL(NPP instance, const char* url,
+                       const char* target);
+NPError     NPN_PostURLNotify(NPP instance, const char* url,
+                              const char* target, uint32_t len,
+                              const char* buf, NPBool file,
+                              void* notifyData);
+NPError     NPN_PostURL(NPP instance, const char* url,
+                        const char* target, uint32_t len,
+                        const char* buf, NPBool file);
+NPError     NPN_RequestRead(NPStream* stream, NPByteRange* rangeList);
+NPError     NPN_NewStream(NPP instance, NPMIMEType type,
+                          const char* target, NPStream** stream);
+int32_t     NPN_Write(NPP instance, NPStream* stream, int32_t len,
+                      void* buffer);
+NPError     NPN_DestroyStream(NPP instance, NPStream* stream,
+                              NPReason reason);
+void        NPN_Status(NPP instance, const char* message);
+const char* NPN_UserAgent(NPP instance);
+void*       NPN_MemAlloc(uint32_t size);
+void        NPN_MemFree(void* ptr);
+uint32_t    NPN_MemFlush(uint32_t size);
+void        NPN_ReloadPlugins(NPBool reloadPages);
+NPError     NPN_GetValue(NPP instance, NPNVariable variable,
+                         void *value);
+NPError     NPN_SetValue(NPP instance, NPPVariable variable,
+                         void *value);
+void        NPN_InvalidateRect(NPP instance, NPRect *invalidRect);
+void        NPN_InvalidateRegion(NPP instance,
+                                 NPRegion invalidRegion);
+void        NPN_ForceRedraw(NPP instance);
+void        NPN_PushPopupsEnabledState(NPP instance, NPBool enabled);
+void        NPN_PopPopupsEnabledState(NPP instance);
+void        NPN_PluginThreadAsyncCall(NPP instance,
+                                      void (*func) (void *),
+                                      void *userData);
+NPError     NPN_GetValueForURL(NPP instance, NPNURLVariable variable,
+                               const char *url, char **value,
+                               uint32_t *len);
+NPError     NPN_SetValueForURL(NPP instance, NPNURLVariable variable,
+                               const char *url, const char *value,
+                               uint32_t len);
+NPError     NPN_GetAuthenticationInfo(NPP instance,
+                                      const char *protocol,
+                                      const char *host, int32_t port,
+                                      const char *scheme,
+                                      const char *realm,
+                                      char **username, uint32_t *ulen,
+                                      char **password,
+                                      uint32_t *plen);
+uint32_t    NPN_ScheduleTimer(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID));
+void        NPN_UnscheduleTimer(NPP instance, uint32_t timerID);
+NPError     NPN_PopUpContextMenu(NPP instance, NPMenu* menu);
+NPBool      NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace);
+NPBool      NPN_HandleEvent(NPP instance, void *event, NPBool handled);
+NPBool      NPN_UnfocusInstance(NPP instance, NPFocusDirection direction);
+void        NPN_URLRedirectResponse(NPP instance, void* notifyData, NPBool allow);
+NPError     NPN_InitAsyncSurface(NPP instance, NPSize *size,
+                                 NPImageFormat format, void *initData,
+                                 NPAsyncSurface *surface);
+NPError     NPN_FinalizeAsyncSurface(NPP instance, NPAsyncSurface *surface);
+void        NPN_SetCurrentAsyncSurface(NPP instance, NPAsyncSurface *surface, NPRect *changed);
 
 #ifdef __cplusplus
 }  /* end extern "C" */
 #endif
 
 #endif /* RC_INVOKED */
-#if defined(__OS2__)
-#pragma pack()
-#endif
 
 #endif /* npapi_h_ */
--- a/dom/plugins/base/npfunctions.h
+++ b/dom/plugins/base/npfunctions.h
@@ -1,51 +1,44 @@
 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef npfunctions_h_
 #define npfunctions_h_
 
-#ifdef __OS2__
-#pragma pack(1)
-#define NP_LOADDS _System
-#else
-#define NP_LOADDS
-#endif
-
 #include "npapi.h"
 #include "npruntime.h"
 
 #ifdef MOZ_WIDGET_ANDROID
 #include <jni.h>
 #endif
 
-typedef NPError      (* NP_LOADDS NPP_NewProcPtr)(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved);
-typedef NPError      (* NP_LOADDS NPP_DestroyProcPtr)(NPP instance, NPSavedData** save);
-typedef NPError      (* NP_LOADDS NPP_SetWindowProcPtr)(NPP instance, NPWindow* window);
-typedef NPError      (* NP_LOADDS NPP_NewStreamProcPtr)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype);
-typedef NPError      (* NP_LOADDS NPP_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason);
-typedef int32_t      (* NP_LOADDS NPP_WriteReadyProcPtr)(NPP instance, NPStream* stream);
-typedef int32_t      (* NP_LOADDS NPP_WriteProcPtr)(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer);
-typedef void         (* NP_LOADDS NPP_StreamAsFileProcPtr)(NPP instance, NPStream* stream, const char* fname);
-typedef void         (* NP_LOADDS NPP_PrintProcPtr)(NPP instance, NPPrint* platformPrint);
-typedef int16_t      (* NP_LOADDS NPP_HandleEventProcPtr)(NPP instance, void* event);
-typedef void         (* NP_LOADDS NPP_URLNotifyProcPtr)(NPP instance, const char* url, NPReason reason, void* notifyData);
+typedef NPError      (* NPP_NewProcPtr)(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved);
+typedef NPError      (* NPP_DestroyProcPtr)(NPP instance, NPSavedData** save);
+typedef NPError      (* NPP_SetWindowProcPtr)(NPP instance, NPWindow* window);
+typedef NPError      (* NPP_NewStreamProcPtr)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype);
+typedef NPError      (* NPP_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason);
+typedef int32_t      (* NPP_WriteReadyProcPtr)(NPP instance, NPStream* stream);
+typedef int32_t      (* NPP_WriteProcPtr)(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer);
+typedef void         (* NPP_StreamAsFileProcPtr)(NPP instance, NPStream* stream, const char* fname);
+typedef void         (* NPP_PrintProcPtr)(NPP instance, NPPrint* platformPrint);
+typedef int16_t      (* NPP_HandleEventProcPtr)(NPP instance, void* event);
+typedef void         (* NPP_URLNotifyProcPtr)(NPP instance, const char* url, NPReason reason, void* notifyData);
 /* Any NPObjects returned to the browser via NPP_GetValue should be retained
    by the plugin on the way out. The browser is responsible for releasing. */
-typedef NPError      (* NP_LOADDS NPP_GetValueProcPtr)(NPP instance, NPPVariable variable, void *ret_value);
-typedef NPError      (* NP_LOADDS NPP_SetValueProcPtr)(NPP instance, NPNVariable variable, void *value);
-typedef NPBool       (* NP_LOADDS NPP_GotFocusPtr)(NPP instance, NPFocusDirection direction);
-typedef void         (* NP_LOADDS NPP_LostFocusPtr)(NPP instance);
-typedef void         (* NP_LOADDS NPP_URLRedirectNotifyPtr)(NPP instance, const char* url, int32_t status, void* notifyData);
-typedef NPError      (* NP_LOADDS NPP_ClearSiteDataPtr)(const char* site, uint64_t flags, uint64_t maxAge);
-typedef char**       (* NP_LOADDS NPP_GetSitesWithDataPtr)(void);
-typedef void         (* NP_LOADDS NPP_DidCompositePtr)(NPP instance);
+typedef NPError      (* NPP_GetValueProcPtr)(NPP instance, NPPVariable variable, void *ret_value);
+typedef NPError      (* NPP_SetValueProcPtr)(NPP instance, NPNVariable variable, void *value);
+typedef NPBool       (* NPP_GotFocusPtr)(NPP instance, NPFocusDirection direction);
+typedef void         (* NPP_LostFocusPtr)(NPP instance);
+typedef void         (* NPP_URLRedirectNotifyPtr)(NPP instance, const char* url, int32_t status, void* notifyData);
+typedef NPError      (* NPP_ClearSiteDataPtr)(const char* site, uint64_t flags, uint64_t maxAge);
+typedef char**       (* NPP_GetSitesWithDataPtr)(void);
+typedef void         (* NPP_DidCompositePtr)(NPP instance);
 
 typedef NPError      (*NPN_GetValueProcPtr)(NPP instance, NPNVariable variable, void *ret_value);
 typedef NPError      (*NPN_SetValueProcPtr)(NPP instance, NPPVariable variable, void *value);
 typedef NPError      (*NPN_GetURLNotifyProcPtr)(NPP instance, const char* url, const char* window, void* notifyData);
 typedef NPError      (*NPN_PostURLNotifyProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData);
 typedef NPError      (*NPN_GetURLProcPtr)(NPP instance, const char* url, const char* window);
 typedef NPError      (*NPN_PostURLProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file);
 typedef NPError      (*NPN_RequestReadProcPtr)(NPStream* stream, NPByteRange* rangeList);
@@ -214,70 +207,49 @@ OSErr BP_GetSupportedMIMETypes(BPSupport
 #define NP_GETMIMEDESCRIPTION_NAME "NP_GetMIMEDescription"
 typedef const char* (*NP_GetMIMEDescriptionProcPtr)(void);
 typedef OSErr (*BP_GetSupportedMIMETypesProcPtr)(BPSupportedMIMETypes*, UInt32);
 #endif
 
 #if defined(_WIN32)
 #define OSCALL WINAPI
 #else
-#if defined(__OS2__)
-#define OSCALL _System
-#else
 #define OSCALL
 #endif
-#endif
 
 #if defined(XP_UNIX)
 /* GCC 3.3 and later support the visibility attribute. */
 #if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
 #define NP_VISIBILITY_DEFAULT __attribute__((visibility("default")))
 #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
 #define NP_VISIBILITY_DEFAULT __global
 #else
 #define NP_VISIBILITY_DEFAULT
 #endif
 #define NP_EXPORT(__type) NP_VISIBILITY_DEFAULT __type
 #endif
 
-#if defined(_WIN32) || defined (__OS2__)
+#if defined(_WIN32)
 #ifdef __cplusplus
 extern "C" {
 #endif
 /* plugin meta member functions */
-#if defined(__OS2__)
-typedef struct _NPPluginData {   /* Alternate OS2 Plugin interface */
-  char *pMimeTypes;
-  char *pFileExtents;
-  char *pFileOpenTemplate;
-  char *pProductName;
-  char *pProductDescription;
-  unsigned long dwProductVersionMS;
-  unsigned long dwProductVersionLS;
-} NPPluginData;
-typedef NPError     (OSCALL *NP_GetPluginDataFunc)(NPPluginData*);
-NPError OSCALL      NP_GetPluginData(NPPluginData * pPluginData);
-#endif
 typedef NPError     (OSCALL *NP_GetEntryPointsFunc)(NPPluginFuncs*);
 NPError OSCALL      NP_GetEntryPoints(NPPluginFuncs* pFuncs);
 typedef NPError     (OSCALL *NP_InitializeFunc)(NPNetscapeFuncs*);
 NPError OSCALL      NP_Initialize(NPNetscapeFuncs* bFuncs);
 typedef NPError     (OSCALL *NP_ShutdownFunc)(void);
 NPError OSCALL      NP_Shutdown(void);
 typedef const char* (*NP_GetMIMEDescriptionFunc)(void);
 const char*         NP_GetMIMEDescription(void);
 #ifdef __cplusplus
 }
 #endif
 #endif
 
-#if defined(__OS2__)
-#pragma pack()
-#endif
-
 #ifdef XP_UNIX
 #ifdef __cplusplus
 extern "C" {
 #endif
 typedef char*          (*NP_GetPluginVersionFunc)(void);
 NP_EXPORT(char*)       NP_GetPluginVersion(void);
 typedef const char*    (*NP_GetMIMEDescriptionFunc)(void);
 NP_EXPORT(const char*) NP_GetMIMEDescription(void);
--- a/dom/plugins/base/nptypes.h
+++ b/dom/plugins/base/nptypes.h
@@ -6,17 +6,17 @@
 #ifndef nptypes_h_
 #define nptypes_h_
 
 /*
  * Header file for ensuring that C99 types ([u]int32_t, [u]int64_t and bool) and
  * true/false macros are available.
  */
 
-#if defined(WIN32) || defined(OS2)
+#if defined(WIN32)
   /*
    * Win32 and OS/2 don't know C99, so define [u]int_16/32/64 here. The bool
    * is predefined tho, both in C and C++.
    */
   typedef short int16_t;
   typedef unsigned short uint16_t;
   typedef int int32_t;
   typedef unsigned int uint32_t;
--- a/dom/plugins/base/nsNPAPIPlugin.cpp
+++ b/dom/plugins/base/nsNPAPIPlugin.cpp
@@ -58,22 +58,16 @@
 #if (MOZ_WIDGET_GTK)
 #include <gdk/gdk.h>
 #include <gdk/gdkx.h>
 #if (MOZ_WIDGET_GTK == 2)
 #include "gtk2xtbin.h"
 #endif
 #endif
 
-#ifdef XP_OS2
-#define INCL_DOS
-#define INCL_DOSERRORS
-#include <os2.h>
-#endif
-
 #include "nsJSNPRuntime.h"
 #include "nsIHttpAuthManager.h"
 #include "nsICookieService.h"
 #include "nsILoadContext.h"
 #include "nsIDocShell.h"
 
 #include "nsNetUtil.h"
 
@@ -426,17 +420,17 @@ nsNPAPIPlugin::CreatePlugin(nsPluginTag 
 
   plugin->mLibrary = pluginLib;
   pluginLib->SetPlugin(plugin);
 
   NPError pluginCallError;
   nsresult rv;
 
 // Exchange NPAPI entry points.
-#if defined(XP_WIN) || defined(XP_OS2)
+#if defined(XP_WIN)
   // NP_GetEntryPoints must be called before NP_Initialize on Windows.
   rv = pluginLib->NP_GetEntryPoints(&plugin->mPluginFuncs, &pluginCallError);
   if (rv != NS_OK || pluginCallError != NPERR_NO_ERROR) {
     return NS_ERROR_FAILURE;
   }
 
   // NP_Initialize must be called after NP_GetEntryPoints on Windows.
   rv = pluginLib->NP_Initialize(&sBrowserFuncs, &pluginCallError);
@@ -859,17 +853,17 @@ PopException()
 //
 // Static callbacks that get routed back through the new C++ API
 //
 
 namespace mozilla {
 namespace plugins {
 namespace parent {
 
-NPError NP_CALLBACK
+NPError
 _geturl(NPP npp, const char* relativeURL, const char* target)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_geturl called from the wrong thread\n"));
     return NPERR_INVALID_PARAM;
   }
 
   NPN_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
@@ -895,17 +889,17 @@ NPError NP_CALLBACK
       return NPERR_NO_ERROR;
     }
   }
 
   return MakeNewNPAPIStreamInternal(npp, relativeURL, target,
                                     eNPPStreamTypeInternal_Get);
 }
 
-NPError NP_CALLBACK
+NPError
 _geturlnotify(NPP npp, const char* relativeURL, const char* target,
               void* notifyData)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_geturlnotify called from the wrong thread\n"));
     return NPERR_INVALID_PARAM;
   }
 
@@ -915,17 +909,17 @@ NPError NP_CALLBACK
 
   PluginDestructionGuard guard(npp);
 
   return MakeNewNPAPIStreamInternal(npp, relativeURL, target,
                                     eNPPStreamTypeInternal_Get, true,
                                     notifyData);
 }
 
-NPError NP_CALLBACK
+NPError
 _posturlnotify(NPP npp, const char *relativeURL, const char *target,
                uint32_t len, const char *buf, NPBool file, void *notifyData)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_posturlnotify called from the wrong thread\n"));
     return NPERR_INVALID_PARAM;
   }
   if (!buf)
@@ -939,17 +933,17 @@ NPError NP_CALLBACK
 
   PluginDestructionGuard guard(npp);
 
   return MakeNewNPAPIStreamInternal(npp, relativeURL, target,
                                     eNPPStreamTypeInternal_Post, true,
                                     notifyData, len, buf, file);
 }
 
-NPError NP_CALLBACK
+NPError
 _posturl(NPP npp, const char *relativeURL, const char *target,
          uint32_t len, const char *buf, NPBool file)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_posturl called from the wrong thread\n"));
     return NPERR_INVALID_PARAM;
   }
   NPN_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
@@ -959,17 +953,17 @@ NPError NP_CALLBACK
 
   PluginDestructionGuard guard(npp);
 
   return MakeNewNPAPIStreamInternal(npp, relativeURL, target,
                                     eNPPStreamTypeInternal_Post, false, nullptr,
                                     len, buf, file);
 }
 
-NPError NP_CALLBACK
+NPError
 _newstream(NPP npp, NPMIMEType type, const char* target, NPStream* *result)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_newstream called from the wrong thread\n"));
     return NPERR_INVALID_PARAM;
   }
   NPN_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
   ("NPN_NewStream: npp=%p, type=%s, target=%s\n", (void*)npp,
@@ -993,17 +987,17 @@ NPError NP_CALLBACK
       }
     } else {
       err = NPERR_GENERIC_ERROR;
     }
   }
   return err;
 }
 
-int32_t NP_CALLBACK
+int32_t
 _write(NPP npp, NPStream *pstream, int32_t len, void *buffer)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_write called from the wrong thread\n"));
     return 0;
   }
   NPN_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
                  ("NPN_Write: npp=%p, url=%s, len=%d, buffer=%s\n", (void*)npp,
@@ -1030,17 +1024,17 @@ int32_t NP_CALLBACK
 
   if (NS_FAILED(rv)) {
     return -1;
   }
 
   return (int32_t)count;
 }
 
-NPError NP_CALLBACK
+NPError
 _destroystream(NPP npp, NPStream *pstream, NPError reason)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_write called from the wrong thread\n"));
     return NPERR_INVALID_PARAM;
   }
   NPN_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
                  ("NPN_DestroyStream: npp=%p, url=%s, reason=%d\n", (void*)npp,
@@ -1080,17 +1074,17 @@ NPError NP_CALLBACK
   }
 
   // 'listener' and/or 'streamWrapper' may be invalid (deleted) at this point. Don't
   // touch them again!
 
   return NPERR_NO_ERROR;
 }
 
-void NP_CALLBACK
+void
 _status(NPP npp, const char *message)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_status called from the wrong thread\n"));
     return;
   }
   NPN_PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("NPN_Status: npp=%p, message=%s\n",
                                      (void*)npp, message));
@@ -1102,58 +1096,58 @@ void NP_CALLBACK
 
   nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance*)npp->ndata;
 
   PluginDestructionGuard guard(inst);
 
   inst->ShowStatus(message);
 }
 
-void NP_CALLBACK
+void
 _memfree (void *ptr)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_memfree called from the wrong thread\n"));
   }
   NPN_PLUGIN_LOG(PLUGIN_LOG_NOISY, ("NPN_MemFree: ptr=%p\n", ptr));
 
   if (ptr)
     nsMemory::Free(ptr);
 }
 
-uint32_t NP_CALLBACK
+uint32_t
 _memflush(uint32_t size)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_memflush called from the wrong thread\n"));
   }
   NPN_PLUGIN_LOG(PLUGIN_LOG_NOISY, ("NPN_MemFlush: size=%d\n", size));
 
   nsMemory::HeapMinimize(true);
   return 0;
 }
 
-void NP_CALLBACK
+void
 _reloadplugins(NPBool reloadPages)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_reloadplugins called from the wrong thread\n"));
     return;
   }
   NPN_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
                  ("NPN_ReloadPlugins: reloadPages=%d\n", reloadPages));
 
   nsCOMPtr<nsIPluginHost> pluginHost(do_GetService(MOZ_PLUGIN_HOST_CONTRACTID));
   if (!pluginHost)
     return;
 
   pluginHost->ReloadPlugins();
 }
 
-void NP_CALLBACK
+void
 _invalidaterect(NPP npp, NPRect *invalidRect)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_invalidaterect called from the wrong thread\n"));
     return;
   }
   NPN_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
                  ("NPN_InvalidateRect: npp=%p, top=%d, left=%d, bottom=%d, "
@@ -1167,17 +1161,17 @@ void NP_CALLBACK
 
   nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance*)npp->ndata;
 
   PluginDestructionGuard guard(inst);
 
   inst->InvalidateRect((NPRect *)invalidRect);
 }
 
-void NP_CALLBACK
+void
 _invalidateregion(NPP npp, NPRegion invalidRegion)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_invalidateregion called from the wrong thread\n"));
     return;
   }
   NPN_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
                  ("NPN_InvalidateRegion: npp=%p, region=%p\n", (void*)npp,
@@ -1190,22 +1184,22 @@ void NP_CALLBACK
 
   nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance*)npp->ndata;
 
   PluginDestructionGuard guard(inst);
 
   inst->InvalidateRegion((NPRegion)invalidRegion);
 }
 
-void NP_CALLBACK
+void
 _forceredraw(NPP npp)
 {
 }
 
-NPObject* NP_CALLBACK
+NPObject*
 _getwindowobject(NPP npp)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_getwindowobject called from the wrong thread\n"));
     return nullptr;
   }
 
   // The window want to return here is the outer window, *not* the inner (since
@@ -1215,17 +1209,17 @@ NPObject* NP_CALLBACK
   nsCOMPtr<nsPIDOMWindow> outer = do_QueryInterface(doc->GetWindow());
   NS_ENSURE_TRUE(outer, nullptr);
 
   AutoJSContext cx;
   JS::Rooted<JSObject*> global(cx, static_cast<nsGlobalWindow*>(outer.get())->GetGlobalJSObject());
   return nsJSObjWrapper::GetNewOrUsed(npp, cx, global);
 }
 
-NPObject* NP_CALLBACK
+NPObject*
 _getpluginelement(NPP npp)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_getpluginelement called from the wrong thread\n"));
     return nullptr;
   }
 
   nsNPAPIPluginInstance* inst = static_cast<nsNPAPIPluginInstance*>(npp->ndata);
@@ -1252,32 +1246,32 @@ NPObject* NP_CALLBACK
   NS_ENSURE_TRUE(holder, nullptr);
 
   JS::Rooted<JSObject*> obj(cx, holder->GetJSObject());
   NS_ENSURE_TRUE(obj, nullptr);
 
   return nsJSObjWrapper::GetNewOrUsed(npp, cx, obj);
 }
 
-NPIdentifier NP_CALLBACK
+NPIdentifier
 _getstringidentifier(const NPUTF8* name)
 {
   if (!name) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS, ("NPN_getstringidentifier: passed null name"));
     return nullptr;
   }
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_getstringidentifier called from the wrong thread\n"));
   }
 
   AutoSafeJSContext cx;
   return doGetIdentifier(cx, name);
 }
 
-void NP_CALLBACK
+void
 _getstringidentifiers(const NPUTF8** names, int32_t nameCount,
                       NPIdentifier *identifiers)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_getstringidentifiers called from the wrong thread\n"));
   }
 
   AutoSafeJSContext cx;
@@ -1287,26 +1281,26 @@ void NP_CALLBACK
       identifiers[i] = doGetIdentifier(cx, names[i]);
     } else {
       NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS, ("NPN_getstringidentifiers: passed null name"));
       identifiers[i] = nullptr;
     }
   }
 }
 
-NPIdentifier NP_CALLBACK
+NPIdentifier
 _getintidentifier(int32_t intid)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_getstringidentifier called from the wrong thread\n"));
   }
   return IntToNPIdentifier(intid);
 }
 
-NPUTF8* NP_CALLBACK
+NPUTF8*
 _utf8fromidentifier(NPIdentifier id)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_utf8fromidentifier called from the wrong thread\n"));
   }
   if (!id)
     return nullptr;
 
@@ -1316,41 +1310,41 @@ NPUTF8* NP_CALLBACK
 
   JSString *str = NPIdentifierToString(id);
 
   return
     ToNewUTF8String(nsDependentString(::JS_GetInternedStringChars(str),
                                       ::JS_GetStringLength(str)));
 }
 
-int32_t NP_CALLBACK
+int32_t
 _intfromidentifier(NPIdentifier id)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_intfromidentifier called from the wrong thread\n"));
   }
 
   if (!NPIdentifierIsInt(id)) {
     return INT32_MIN;
   }
 
   return NPIdentifierToInt(id);
 }
 
-bool NP_CALLBACK
+bool
 _identifierisstring(NPIdentifier id)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_identifierisstring called from the wrong thread\n"));
   }
 
   return NPIdentifierIsString(id);
 }
 
-NPObject* NP_CALLBACK
+NPObject*
 _createobject(NPP npp, NPClass* aClass)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_createobject called from the wrong thread\n"));
     return nullptr;
   }
   if (!npp) {
     NS_ERROR("Null npp passed to _createobject()!");
@@ -1383,34 +1377,34 @@ NPObject* NP_CALLBACK
   }
 
   NPN_PLUGIN_LOG(PLUGIN_LOG_NOISY,
                  ("Created NPObject %p, NPClass %p\n", npobj, aClass));
 
   return npobj;
 }
 
-NPObject* NP_CALLBACK
+NPObject*
 _retainobject(NPObject* npobj)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_retainobject called from the wrong thread\n"));
   }
   if (npobj) {
 #ifdef NS_BUILD_REFCNT_LOGGING
     int32_t refCnt =
 #endif
       PR_ATOMIC_INCREMENT((int32_t*)&npobj->referenceCount);
     NS_LOG_ADDREF(npobj, refCnt, "BrowserNPObject", sizeof(NPObject));
   }
 
   return npobj;
 }
 
-void NP_CALLBACK
+void
 _releaseobject(NPObject* npobj)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_releaseobject called from the wrong thread\n"));
   }
   if (!npobj)
     return;
 
@@ -1426,17 +1420,17 @@ void NP_CALLBACK
     if (npobj->_class && npobj->_class->deallocate) {
       npobj->_class->deallocate(npobj);
     } else {
       PR_Free(npobj);
     }
   }
 }
 
-bool NP_CALLBACK
+bool
 _invoke(NPP npp, NPObject* npobj, NPIdentifier method, const NPVariant *args,
         uint32_t argCount, NPVariant *result)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_invoke called from the wrong thread\n"));
     return false;
   }
   if (!npp || !npobj || !npobj->_class || !npobj->_class->invoke)
@@ -1449,17 +1443,17 @@ bool NP_CALLBACK
 
   NPN_PLUGIN_LOG(PLUGIN_LOG_NOISY,
                  ("NPN_Invoke(npp %p, npobj %p, method %p, args %d\n", npp,
                   npobj, method, argCount));
 
   return npobj->_class->invoke(npobj, method, args, argCount, result);
 }
 
-bool NP_CALLBACK
+bool
 _invokeDefault(NPP npp, NPObject* npobj, const NPVariant *args,
                uint32_t argCount, NPVariant *result)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_invokedefault called from the wrong thread\n"));
     return false;
   }
   if (!npp || !npobj || !npobj->_class || !npobj->_class->invokeDefault)
@@ -1470,17 +1464,17 @@ bool NP_CALLBACK
 
   NPN_PLUGIN_LOG(PLUGIN_LOG_NOISY,
                  ("NPN_InvokeDefault(npp %p, npobj %p, args %d\n", npp,
                   npobj, argCount));
 
   return npobj->_class->invokeDefault(npobj, args, argCount, result);
 }
 
-bool NP_CALLBACK
+bool
 _evaluate(NPP npp, NPObject* npobj, NPString *script, NPVariant *result)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_evaluate called from the wrong thread\n"));
     return false;
   }
   if (!npp)
     return false;
@@ -1562,17 +1556,17 @@ bool NP_CALLBACK
   nsresult rv = scx->EvaluateString(utf16script, obj, options,
                                     /* aCoerceToString = */ false,
                                     rval.address());
 
   return NS_SUCCEEDED(rv) &&
          (!result || JSValToNPVariant(npp, cx, rval, result));
 }
 
-bool NP_CALLBACK
+bool
 _getproperty(NPP npp, NPObject* npobj, NPIdentifier property,
              NPVariant *result)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_getproperty called from the wrong thread\n"));
     return false;
   }
   if (!npp || !npobj || !npobj->_class || !npobj->_class->getProperty)
@@ -1668,17 +1662,17 @@ bool NP_CALLBACK
   _releasevariantvalue(result);
   char* fakeurl = (char *) _memalloc(inst->mFakeURL.Length() + 1);
   strcpy(fakeurl, inst->mFakeURL);
   STRINGZ_TO_NPVARIANT(fakeurl, *result);
 
   return true;
 }
 
-bool NP_CALLBACK
+bool
 _setproperty(NPP npp, NPObject* npobj, NPIdentifier property,
              const NPVariant *value)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_setproperty called from the wrong thread\n"));
     return false;
   }
   if (!npp || !npobj || !npobj->_class || !npobj->_class->setProperty)
@@ -1689,17 +1683,17 @@ bool NP_CALLBACK
 
   NPN_PLUGIN_LOG(PLUGIN_LOG_NOISY,
                  ("NPN_SetProperty(npp %p, npobj %p, property %p) called\n",
                   npp, npobj, property));
 
   return npobj->_class->setProperty(npobj, property, value);
 }
 
-bool NP_CALLBACK
+bool
 _removeproperty(NPP npp, NPObject* npobj, NPIdentifier property)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_removeproperty called from the wrong thread\n"));
     return false;
   }
   if (!npp || !npobj || !npobj->_class || !npobj->_class->removeProperty)
     return false;
@@ -1709,17 +1703,17 @@ bool NP_CALLBACK
 
   NPN_PLUGIN_LOG(PLUGIN_LOG_NOISY,
                  ("NPN_RemoveProperty(npp %p, npobj %p, property %p) called\n",
                   npp, npobj, property));
 
   return npobj->_class->removeProperty(npobj, property);
 }
 
-bool NP_CALLBACK
+bool
 _hasproperty(NPP npp, NPObject* npobj, NPIdentifier propertyName)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_hasproperty called from the wrong thread\n"));
     return false;
   }
   if (!npp || !npobj || !npobj->_class || !npobj->_class->hasProperty)
     return false;
@@ -1729,17 +1723,17 @@ bool NP_CALLBACK
 
   NPN_PLUGIN_LOG(PLUGIN_LOG_NOISY,
                  ("NPN_HasProperty(npp %p, npobj %p, property %p) called\n",
                   npp, npobj, propertyName));
 
   return npobj->_class->hasProperty(npobj, propertyName);
 }
 
-bool NP_CALLBACK
+bool
 _hasmethod(NPP npp, NPObject* npobj, NPIdentifier methodName)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_hasmethod called from the wrong thread\n"));
     return false;
   }
   if (!npp || !npobj || !npobj->_class || !npobj->_class->hasMethod)
     return false;
@@ -1749,17 +1743,17 @@ bool NP_CALLBACK
 
   NPN_PLUGIN_LOG(PLUGIN_LOG_NOISY,
                  ("NPN_HasMethod(npp %p, npobj %p, property %p) called\n",
                   npp, npobj, methodName));
 
   return npobj->_class->hasMethod(npobj, methodName);
 }
 
-bool NP_CALLBACK
+bool
 _enumerate(NPP npp, NPObject *npobj, NPIdentifier **identifier,
            uint32_t *count)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_enumerate called from the wrong thread\n"));
     return false;
   }
   if (!npp || !npobj || !npobj->_class)
@@ -1776,17 +1770,17 @@ bool NP_CALLBACK
   }
 
   NPPExceptionAutoHolder nppExceptionHolder;
   NPPAutoPusher nppPusher(npp);
 
   return npobj->_class->enumerate(npobj, identifier, count);
 }
 
-bool NP_CALLBACK
+bool
 _construct(NPP npp, NPObject* npobj, const NPVariant *args,
                uint32_t argCount, NPVariant *result)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_construct called from the wrong thread\n"));
     return false;
   }
   if (!npp || !npobj || !npobj->_class ||
@@ -1796,17 +1790,17 @@ bool NP_CALLBACK
   }
 
   NPPExceptionAutoHolder nppExceptionHolder;
   NPPAutoPusher nppPusher(npp);
 
   return npobj->_class->construct(npobj, args, argCount, result);
 }
 
-void NP_CALLBACK
+void
 _releasevariantvalue(NPVariant* variant)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_releasevariantvalue called from the wrong thread\n"));
   }
   switch (variant->type) {
   case NPVariantType_Void :
   case NPVariantType_Null :
@@ -1853,17 +1847,17 @@ void NP_CALLBACK
     }
   default:
     NS_ERROR("Unknown NPVariant type!");
   }
 
   VOID_TO_NPVARIANT(*variant);
 }
 
-void NP_CALLBACK
+void
 _setexception(NPObject* npobj, const NPUTF8 *message)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_setexception called from the wrong thread\n"));
     return;
   }
 
   if (!message) return;
@@ -1872,17 +1866,17 @@ void NP_CALLBACK
     // If a plugin throws multiple exceptions, we'll only report the
     // last one for now.
     free(gNPPException);
   }
 
   gNPPException = strdup(message);
 }
 
-NPError NP_CALLBACK
+NPError
 _getvalue(NPP npp, NPNVariable variable, void *result)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_getvalue called from the wrong thread\n"));
     return NPERR_INVALID_PARAM;
   }
   NPN_PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("NPN_GetValue: npp=%p, var=%d\n",
                                      (void*)npp, (int)variable));
@@ -1935,18 +1929,17 @@ NPError NP_CALLBACK
 #endif
     return NPERR_GENERIC_ERROR;
   }
 
   case NPNVxtAppContext:
     return NPERR_GENERIC_ERROR;
 #endif
 
-#if defined(XP_WIN) || defined(XP_OS2) || (MOZ_WIDGET_GTK == 2) \
- || defined(MOZ_WIDGET_QT)
+#if defined(XP_WIN) || (MOZ_WIDGET_GTK == 2) || defined(MOZ_WIDGET_QT)
   case NPNVnetscapeWindow: {
     if (!npp || !npp->ndata)
       return NPERR_INVALID_INSTANCE_ERROR;
 
     nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *) npp->ndata;
 
     nsRefPtr<nsPluginInstanceOwner> owner = inst->GetOwner();
     NS_ENSURE_TRUE(owner, NPERR_NO_ERROR);
@@ -2343,17 +2336,17 @@ NPError NP_CALLBACK
     *(nsISupports**)result = nullptr;
     // fall through
   default:
     NPN_PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("NPN_getvalue unhandled get value: %d\n", variable));
     return NPERR_GENERIC_ERROR;
   }
 }
 
-NPError NP_CALLBACK
+NPError
 _setvalue(NPP npp, NPPVariable variable, void *result)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_setvalue called from the wrong thread\n"));
     return NPERR_INVALID_PARAM;
   }
   NPN_PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("NPN_SetValue: npp=%p, var=%d\n",
                                      (void*)npp, (int)variable));
@@ -2439,17 +2432,17 @@ NPError NP_CALLBACK
   case kAcceptEvents_ANPSetValue:
     return NPERR_NO_ERROR;
 #endif
     default:
       return NPERR_GENERIC_ERROR;
   }
 }
 
-NPError NP_CALLBACK
+NPError
 _requestread(NPStream *pstream, NPByteRange *rangeList)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_requestread called from the wrong thread\n"));
     return NPERR_INVALID_PARAM;
   }
   NPN_PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("NPN_RequestRead: stream=%p\n",
                                      (void*)pstream));
@@ -2485,24 +2478,24 @@ NPError NP_CALLBACK
   nsresult rv = streamlistener->mStreamListenerPeer->RequestRead((NPByteRange *)rangeList);
   if (NS_FAILED(rv))
     return NPERR_GENERIC_ERROR;
 
   return NPERR_NO_ERROR;
 }
 
 // Deprecated, only stubbed out
-void* NP_CALLBACK /* OJI type: JRIEnv* */
+void* /* OJI type: JRIEnv* */
 _getJavaEnv()
 {
   NPN_PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("NPN_GetJavaEnv\n"));
   return nullptr;
 }
 
-const char * NP_CALLBACK
+const char *
 _useragent(NPP npp)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_useragent called from the wrong thread\n"));
     return nullptr;
   }
   NPN_PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("NPN_UserAgent: npp=%p\n", (void*)npp));
 
@@ -2515,79 +2508,79 @@ const char * NP_CALLBACK
   const char *retstr;
   nsresult rv = pluginHost->UserAgent(&retstr);
   if (NS_FAILED(rv))
     return nullptr;
 
   return retstr;
 }
 
-void * NP_CALLBACK
+void *
 _memalloc (uint32_t size)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_NORMAL,("NPN_memalloc called from the wrong thread\n"));
   }
   NPN_PLUGIN_LOG(PLUGIN_LOG_NOISY, ("NPN_MemAlloc: size=%d\n", size));
   return nsMemory::Alloc(size);
 }
 
 // Deprecated, only stubbed out
-void* NP_CALLBACK /* OJI type: jref */
+void* /* OJI type: jref */
 _getJavaPeer(NPP npp)
 {
   NPN_PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("NPN_GetJavaPeer: npp=%p\n", (void*)npp));
   return nullptr;
 }
 
-void NP_CALLBACK
+void
 _pushpopupsenabledstate(NPP npp, NPBool enabled)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_pushpopupsenabledstate called from the wrong thread\n"));
     return;
   }
   nsNPAPIPluginInstance *inst = npp ? (nsNPAPIPluginInstance *)npp->ndata : nullptr;
   if (!inst)
     return;
 
   inst->PushPopupsEnabledState(enabled);
 }
 
-void NP_CALLBACK
+void
 _poppopupsenabledstate(NPP npp)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_poppopupsenabledstate called from the wrong thread\n"));
     return;
   }
   nsNPAPIPluginInstance *inst = npp ? (nsNPAPIPluginInstance *)npp->ndata : nullptr;
   if (!inst)
     return;
 
   inst->PopPopupsEnabledState();
 }
 
-void NP_CALLBACK
+void
 _pluginthreadasynccall(NPP instance, PluginThreadCallback func, void *userData)
 {
   if (NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_NOISY,("NPN_pluginthreadasynccall called from the main thread\n"));
   } else {
     NPN_PLUGIN_LOG(PLUGIN_LOG_NOISY,("NPN_pluginthreadasynccall called from a non main thread\n"));
   }
   nsRefPtr<nsPluginThreadRunnable> evt =
     new nsPluginThreadRunnable(instance, func, userData);
 
   if (evt && evt->IsValid()) {
     NS_DispatchToMainThread(evt);
   }
 }
 
-NPError NP_CALLBACK
+NPError
 _getvalueforurl(NPP instance, NPNURLVariable variable, const char *url,
                 char **value, uint32_t *len)
 {
   if (!instance) {
     return NPERR_INVALID_PARAM;
   }
 
   if (!url || !*url || !len) {
@@ -2636,17 +2629,17 @@ NPError NP_CALLBACK
   default:
     // Fall through and return an error...
     ;
   }
 
   return NPERR_GENERIC_ERROR;
 }
 
-NPError NP_CALLBACK
+NPError
 _setvalueforurl(NPP instance, NPNURLVariable variable, const char *url,
                 const char *value, uint32_t len)
 {
   if (!instance) {
     return NPERR_INVALID_PARAM;
   }
 
   if (!url || !*url) {
@@ -2690,17 +2683,17 @@ NPError NP_CALLBACK
   default:
     // Fall through and return an error...
     ;
   }
 
   return NPERR_GENERIC_ERROR;
 }
 
-NPError NP_CALLBACK
+NPError
 _getauthenticationinfo(NPP instance, const char *protocol, const char *host,
                        int32_t port, const char *scheme, const char *realm,
                        char **username, uint32_t *ulen, char **password,
                        uint32_t *plen)
 {
   if (!instance || !protocol || !host || !scheme || !realm || !username ||
       !ulen || !password || !plen)
     return NPERR_INVALID_PARAM;
@@ -2749,93 +2742,93 @@ NPError NP_CALLBACK
   *ulen = *username ? uname8.Length() : 0;
 
   *password = ToNewCString(pwd8);
   *plen = *password ? pwd8.Length() : 0;
 
   return NPERR_NO_ERROR;
 }
 
-uint32_t NP_CALLBACK
+uint32_t
 _scheduletimer(NPP instance, uint32_t interval, NPBool repeat, PluginTimerFunc timerFunc)
 {
   nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *)instance->ndata;
   if (!inst)
     return 0;
 
   return inst->ScheduleTimer(interval, repeat, timerFunc);
 }
 
-void NP_CALLBACK
+void
 _unscheduletimer(NPP instance, uint32_t timerID)
 {
 #ifdef MOZ_WIDGET_ANDROID
   // Sometimes Flash calls this with a dead NPP instance. Ensure the one we have
   // here is valid and maps to a nsNPAPIPluginInstance.
   nsNPAPIPluginInstance *inst = nsNPAPIPluginInstance::GetFromNPP(instance);
 #else
   nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *)instance->ndata;
 #endif
   if (!inst)
     return;
 
   inst->UnscheduleTimer(timerID);
 }
 
-NPError NP_CALLBACK
+NPError
 _popupcontextmenu(NPP instance, NPMenu* menu)
 {
   nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *)instance->ndata;
   if (!inst)
     return NPERR_GENERIC_ERROR;
 
   return inst->PopUpContextMenu(menu);
 }
 
-NPError NP_CALLBACK
+NPError
 _initasyncsurface(NPP instance, NPSize *size, NPImageFormat format, void *initData, NPAsyncSurface *surface)
 {
   nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *)instance->ndata;
   if (!inst)
     return NPERR_GENERIC_ERROR;
 
   return inst->InitAsyncSurface(size, format, initData, surface);
 }
 
-NPError NP_CALLBACK
+NPError
 _finalizeasyncsurface(NPP instance, NPAsyncSurface *surface)
 {
   nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *)instance->ndata;
   if (!inst)
     return NPERR_GENERIC_ERROR;
 
   return inst->FinalizeAsyncSurface(surface);
 }
 
-void NP_CALLBACK
+void
 _setcurrentasyncsurface(NPP instance, NPAsyncSurface *surface, NPRect *changed)
 {
   nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *)instance->ndata;
   if (!inst)
     return;
 
   inst->SetCurrentAsyncSurface(surface, changed);
 }
 
-NPBool NP_CALLBACK
+NPBool
 _convertpoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace)
 {
   nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *)instance->ndata;
   if (!inst)
     return false;
 
   return inst->ConvertPoint(sourceX, sourceY, sourceSpace, destX, destY, destSpace);
 }
 
-void NP_CALLBACK
+void
 _urlredirectresponse(NPP instance, void* notifyData, NPBool allow)
 {
   nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *)instance->ndata;
   if (!inst) {
     return;
   }
 
   inst->URLRedirectResponse(notifyData, allow);
--- a/dom/plugins/base/nsNPAPIPlugin.h
+++ b/dom/plugins/base/nsNPAPIPlugin.h
@@ -9,28 +9,18 @@
 #include "prlink.h"
 #include "npfunctions.h"
 #include "nsPluginHost.h"
 
 #include "nsCxPusher.h"
 
 #include "mozilla/PluginLibrary.h"
 
-/*
- * Use this macro before each exported function
- * (between the return address and the function
- * itself), to ensure that the function has the
- * right calling conventions on OS/2.
- */
-#define NP_CALLBACK NP_LOADDS
-
 #if defined(XP_WIN)
 #define NS_NPAPIPLUGIN_CALLBACK(_type, _name) _type (__stdcall * _name)
-#elif defined(XP_OS2)
-#define NS_NPAPIPLUGIN_CALLBACK(_type, _name) _type (_System * _name)
 #else
 #define NS_NPAPIPLUGIN_CALLBACK(_type, _name) _type (* _name)
 #endif
 
 typedef NS_NPAPIPLUGIN_CALLBACK(NPError, NP_GETENTRYPOINTS) (NPPluginFuncs* pCallbacks);
 typedef NS_NPAPIPLUGIN_CALLBACK(NPError, NP_PLUGININIT) (const NPNetscapeFuncs* pCallbacks);
 typedef NS_NPAPIPLUGIN_CALLBACK(NPError, NP_PLUGINUNIXINIT) (const NPNetscapeFuncs* pCallbacks, NPPluginFuncs* fCallbacks);
 typedef NS_NPAPIPLUGIN_CALLBACK(NPError, NP_PLUGINSHUTDOWN) ();
@@ -138,209 +128,209 @@ inline bool
 NPStringIdentifierIsPermanent(NPP npp, NPIdentifier id)
 {
   AutoSafeJSContext cx;
   return JS_StringHasBeenInterned(cx, NPIdentifierToString(id));
 }
 
 #define NPIdentifier_VOID (JSIdToNPIdentifier(JSID_VOID))
 
-NPObject* NP_CALLBACK
+NPObject*
 _getwindowobject(NPP npp);
 
-NPObject* NP_CALLBACK
+NPObject*
 _getpluginelement(NPP npp);
 
-NPIdentifier NP_CALLBACK
+NPIdentifier
 _getstringidentifier(const NPUTF8* name);
 
-void NP_CALLBACK
+void
 _getstringidentifiers(const NPUTF8** names, int32_t nameCount,
                       NPIdentifier *identifiers);
 
-bool NP_CALLBACK
+bool
 _identifierisstring(NPIdentifier identifiers);
 
-NPIdentifier NP_CALLBACK
+NPIdentifier
 _getintidentifier(int32_t intid);
 
-NPUTF8* NP_CALLBACK
+NPUTF8*
 _utf8fromidentifier(NPIdentifier identifier);
 
-int32_t NP_CALLBACK
+int32_t
 _intfromidentifier(NPIdentifier identifier);
 
-NPObject* NP_CALLBACK
+NPObject*
 _createobject(NPP npp, NPClass* aClass);
 
-NPObject* NP_CALLBACK
+NPObject*
 _retainobject(NPObject* npobj);
 
-void NP_CALLBACK
+void
 _releaseobject(NPObject* npobj);
 
-bool NP_CALLBACK
+bool
 _invoke(NPP npp, NPObject* npobj, NPIdentifier method, const NPVariant *args,
         uint32_t argCount, NPVariant *result);
 
-bool NP_CALLBACK
+bool
 _invokeDefault(NPP npp, NPObject* npobj, const NPVariant *args,
                uint32_t argCount, NPVariant *result);
 
-bool NP_CALLBACK
+bool
 _evaluate(NPP npp, NPObject* npobj, NPString *script, NPVariant *result);
 
-bool NP_CALLBACK
+bool
 _getproperty(NPP npp, NPObject* npobj, NPIdentifier property,
              NPVariant *result);
 
-bool NP_CALLBACK
+bool
 _setproperty(NPP npp, NPObject* npobj, NPIdentifier property,
              const NPVariant *value);
 
-bool NP_CALLBACK
+bool
 _removeproperty(NPP npp, NPObject* npobj, NPIdentifier property);
 
-bool NP_CALLBACK
+bool
 _hasproperty(NPP npp, NPObject* npobj, NPIdentifier propertyName);
 
-bool NP_CALLBACK
+bool
 _hasmethod(NPP npp, NPObject* npobj, NPIdentifier methodName);
 
-bool NP_CALLBACK
+bool
 _enumerate(NPP npp, NPObject *npobj, NPIdentifier **identifier,
            uint32_t *count);
 
-bool NP_CALLBACK
+bool
 _construct(NPP npp, NPObject* npobj, const NPVariant *args,
            uint32_t argCount, NPVariant *result);
 
-void NP_CALLBACK
+void
 _releasevariantvalue(NPVariant *variant);
 
-void NP_CALLBACK
+void
 _setexception(NPObject* npobj, const NPUTF8 *message);
 
-void NP_CALLBACK
+void
 _pushpopupsenabledstate(NPP npp, NPBool enabled);
 
-void NP_CALLBACK
+void
 _poppopupsenabledstate(NPP npp);
 
 typedef void(*PluginThreadCallback)(void *);
 
-void NP_CALLBACK
+void
 _pluginthreadasynccall(NPP instance, PluginThreadCallback func,
                        void *userData);
 
-NPError NP_CALLBACK
+NPError
 _getvalueforurl(NPP instance, NPNURLVariable variable, const char *url,
                 char **value, uint32_t *len);
 
-NPError NP_CALLBACK
+NPError
 _setvalueforurl(NPP instance, NPNURLVariable variable, const char *url,
                 const char *value, uint32_t len);
 
-NPError NP_CALLBACK
+NPError
 _getauthenticationinfo(NPP instance, const char *protocol, const char *host,
                        int32_t port, const char *scheme, const char *realm,
                        char **username, uint32_t *ulen, char **password,
                        uint32_t *plen);
 
 typedef void(*PluginTimerFunc)(NPP npp, uint32_t timerID);
 
-uint32_t NP_CALLBACK
+uint32_t
 _scheduletimer(NPP instance, uint32_t interval, NPBool repeat, PluginTimerFunc timerFunc);
 
-void NP_CALLBACK
+void
 _unscheduletimer(NPP instance, uint32_t timerID);
 
-NPError NP_CALLBACK
+NPError
 _popupcontextmenu(NPP instance, NPMenu* menu);
 
-NPError NP_CALLBACK
+NPError
 _initasyncsurface(NPP instance, NPSize *size, NPImageFormat format, void *initData, NPAsyncSurface *surface);
 
-NPError NP_CALLBACK
+NPError
 _finalizeasyncsurface(NPP instance, NPAsyncSurface *surface);
 
-void NP_CALLBACK
+void
 _setcurrentasyncsurface(NPP instance, NPAsyncSurface *surface, NPRect *changed);
 
-NPBool NP_CALLBACK
+NPBool
 _convertpoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace);
 
-NPError NP_CALLBACK
+NPError
 _requestread(NPStream *pstream, NPByteRange *rangeList);
 
-NPError NP_CALLBACK
+NPError
 _geturlnotify(NPP npp, const char* relativeURL, const char* target,
               void* notifyData);
 
-NPError NP_CALLBACK
+NPError
 _getvalue(NPP npp, NPNVariable variable, void *r_value);
 
-NPError NP_CALLBACK
+NPError
 _setvalue(NPP npp, NPPVariable variable, void *r_value);
 
-NPError NP_CALLBACK
+NPError
 _geturl(NPP npp, const char* relativeURL, const char* target);
 
-NPError NP_CALLBACK
+NPError
 _posturlnotify(NPP npp, const char* relativeURL, const char *target,
                uint32_t len, const char *buf, NPBool file, void* notifyData);
 
-NPError NP_CALLBACK
+NPError
 _posturl(NPP npp, const char* relativeURL, const char *target, uint32_t len,
             const char *buf, NPBool file);
 
-NPError NP_CALLBACK
+NPError
 _newstream(NPP npp, NPMIMEType type, const char* window, NPStream** pstream);
 
-int32_t NP_CALLBACK
+int32_t
 _write(NPP npp, NPStream *pstream, int32_t len, void *buffer);
 
-NPError NP_CALLBACK
+NPError
 _destroystream(NPP npp, NPStream *pstream, NPError reason);
 
-void NP_CALLBACK
+void
 _status(NPP npp, const char *message);
 
-void NP_CALLBACK
+void
 _memfree (void *ptr);
 
-uint32_t NP_CALLBACK
+uint32_t
 _memflush(uint32_t size);
 
-void NP_CALLBACK
+void
 _reloadplugins(NPBool reloadPages);
 
-void NP_CALLBACK
+void
 _invalidaterect(NPP npp, NPRect *invalidRect);
 
-void NP_CALLBACK
+void
 _invalidateregion(NPP npp, NPRegion invalidRegion);
 
-void NP_CALLBACK
+void
 _forceredraw(NPP npp);
 
-const char* NP_CALLBACK
+const char*
 _useragent(NPP npp);
 
-void* NP_CALLBACK
+void*
 _memalloc (uint32_t size);
 
 // Deprecated entry points for the old Java plugin.
-void* NP_CALLBACK /* OJI type: JRIEnv* */
+void* /* OJI type: JRIEnv* */
 _getJavaEnv();
 
-void* NP_CALLBACK /* OJI type: jref */
+void* /* OJI type: jref */
 _getJavaPeer(NPP npp);
 
-void NP_CALLBACK
+void
 _urlredirectresponse(NPP instance, void* notifyData, NPBool allow);
 
 } /* namespace parent */
 } /* namespace plugins */
 } /* namespace mozilla */
 
 const char *
 PeekException();
--- a/dom/plugins/base/nsNPAPIPluginInstance.cpp
+++ b/dom/plugins/base/nsNPAPIPluginInstance.cpp
@@ -693,17 +693,17 @@ nsresult nsNPAPIPluginInstance::HandleEv
     return NS_ERROR_FAILURE;
 
   NPPluginFuncs* pluginFunctions = mPlugin->PluginFuncs();
 
   int16_t tmpResult = kNPEventNotHandled;
 
   if (pluginFunctions->event) {
     mCurrentPluginEvent = event;
-#if defined(XP_WIN) || defined(XP_OS2)
+#if defined(XP_WIN)
     NS_TRY_SAFE_CALL_RETURN(tmpResult, (*pluginFunctions->event)(&mNPP, event), this,
                             aSafeToReenterGecko);
 #else
     MAIN_THREAD_JNI_REF_GUARD;
     tmpResult = (*pluginFunctions->event)(&mNPP, event);
 #endif
     NPP_PLUGIN_LOG(PLUGIN_LOG_NOISY,
       ("NPP HandleEvent called: this=%p, npp=%p, event=%p, return=%d\n", 
--- a/dom/plugins/base/nsNPAPIPluginStreamListener.cpp
+++ b/dom/plugins/base/nsNPAPIPluginStreamListener.cpp
@@ -861,17 +861,17 @@ nsNPAPIPluginStreamListener::HandleRedir
         nsAutoCString spec;
         if (NS_SUCCEEDED(uri->GetAsciiSpec(spec))) {
           // At this point the plugin will be responsible for making the callback
           // so save the callback object.
           mHTTPRedirectCallback = callback;
 
           NPP npp;
           mInst->GetNPP(&npp);
-#if defined(XP_WIN) || defined(XP_OS2)
+#if defined(XP_WIN)
           NS_TRY_SAFE_CALL_VOID((*pluginFunctions->urlredirectnotify)(npp, spec.get(), static_cast<int32_t>(status), mNPStreamWrapper->mNPStream.notifyData), mInst,
                                 NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
 #else
           MAIN_THREAD_JNI_REF_GUARD;
           (*pluginFunctions->urlredirectnotify)(npp, spec.get(), static_cast<int32_t>(status), mNPStreamWrapper->mNPStream.notifyData);
 #endif
           return true;
         }
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -649,17 +649,17 @@ nsPluginInstanceOwner::RedrawPlugin()
 
 NS_IMETHODIMP nsPluginInstanceOwner::GetNetscapeWindow(void *value)
 {
   if (!mObjectFrame) {
     NS_WARNING("plugin owner has no owner in getting doc's window handle");
     return NS_ERROR_FAILURE;
   }
   
-#if defined(XP_WIN) || defined(XP_OS2)
+#if defined(XP_WIN)
   void** pvalue = (void**)value;
   nsViewManager* vm = mObjectFrame->PresContext()->GetPresShell()->GetViewManager();
   if (!vm)
     return NS_ERROR_FAILURE;
 #if defined(XP_WIN)
   // This property is provided to allow a "windowless" plugin to determine the window it is drawing
   // in, so it can translate mouse coordinates it receives directly from the operating system
   // to coordinates relative to itself.
@@ -2445,42 +2445,16 @@ void nsPluginInstanceOwner::Paint(const 
   NPEvent pluginEvent;
   pluginEvent.event = WM_PAINT;
   pluginEvent.wParam = WPARAM(aDC);
   pluginEvent.lParam = LPARAM(&aDirty);
   mInstance->HandleEvent(&pluginEvent, nullptr);
 }
 #endif
 
-#ifdef XP_OS2
-void nsPluginInstanceOwner::Paint(const nsRect& aDirtyRect, HPS aHPS)
-{
-  if (!mInstance || !mObjectFrame)
-    return;
-
-  NPWindow *window;
-  GetWindow(window);
-  nsIntRect relDirtyRect = aDirtyRect.ToOutsidePixels(mObjectFrame->PresContext()->AppUnitsPerDevPixel());
-
-  // we got dirty rectangle in relative window coordinates, but we
-  // need it in absolute units and in the (left, top, right, bottom) form
-  RECTL rectl;
-  rectl.xLeft   = relDirtyRect.x + window->x;
-  rectl.yBottom = relDirtyRect.y + window->y;
-  rectl.xRight  = rectl.xLeft + relDirtyRect.width;
-  rectl.yTop    = rectl.yBottom + relDirtyRect.height;
-
-  NPEvent pluginEvent;
-  pluginEvent.event = WM_PAINT;
-  pluginEvent.wParam = (uint32_t)aHPS;
-  pluginEvent.lParam = (uint32_t)&rectl;
-  mInstance->HandleEvent(&pluginEvent, nullptr);
-}
-#endif
-
 #ifdef MOZ_WIDGET_ANDROID
 
 void nsPluginInstanceOwner::Paint(gfxContext* aContext,
                                   const gfxRect& aFrameRect,
                                   const gfxRect& aDirtyRect)
 {
   if (!mInstance || !mObjectFrame || !mPluginDocumentActiveState || mFullScreen)
     return;
--- a/dom/plugins/base/nsPluginInstanceOwner.h
+++ b/dom/plugins/base/nsPluginInstanceOwner.h
@@ -33,22 +33,16 @@ class nsDisplayListBuilder;
 class gfxXlibSurface;
 #ifdef MOZ_WIDGET_QT
 #include "gfxQtNativeRenderer.h"
 #else
 #include "gfxXlibNativeRenderer.h"
 #endif
 #endif
 
-#ifdef XP_OS2
-#define INCL_PM
-#define INCL_GPI
-#include <os2.h>
-#endif
-
 class nsPluginInstanceOwner : public nsIPluginInstanceOwner,
                               public nsIDOMEventListener,
                               public nsIPrivacyTransitionObserver,
                               public nsSupportsWeakReference
 {
 public:
   nsPluginInstanceOwner();
   virtual ~nsPluginInstanceOwner();
@@ -145,18 +139,16 @@ public:
 #elif defined(XP_MACOSX)
   void Paint(const gfxRect& aDirtyRect, CGContextRef cgContext);  
   void RenderCoreAnimation(CGContextRef aCGContext, int aWidth, int aHeight);
   void DoCocoaEventDrawRect(const gfxRect& aDrawRect, CGContextRef cgContext);
 #elif defined(MOZ_X11) || defined(ANDROID)
   void Paint(gfxContext* aContext,
              const gfxRect& aFrameRect,
              const gfxRect& aDirtyRect);
-#elif defined(XP_OS2)
-  void Paint(const nsRect& aDirtyRect, HPS aHPS);
 #endif
 
   //locals
   
   nsresult Init(nsIContent* aContent);
   
   void* GetPluginPortFromWidget();
   void ReleasePluginPort(void* pluginPort);
deleted file mode 100644
--- a/dom/plugins/base/nsPluginNativeWindowOS2.cpp
+++ /dev/null
@@ -1,523 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/*****************************************************************************/
-
-#define INCL_WIN
-#include "os2.h"
-
-#include "nsDebug.h"
-#include "nsPluginNativeWindow.h"
-#include "nsThreadUtils.h"
-#include "nsAutoPtr.h"
-#include "nsTWeakRef.h"
-
-#define NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION "MozillaPluginWindowPropertyAssociation"
-#define NS_PLUGIN_CUSTOM_MSG_ID "MozFlashUserRelay"
-#define WM_USER_FLASH WM_USER+1
-#ifndef WM_FOCUSCHANGED
-#define WM_FOCUSCHANGED 0x000E
-#endif
-
-#define NP_POPUP_API_VERSION 16
-
-#define nsMajorVersion(v)       (((int32_t)(v) >> 16) & 0xffff)
-#define nsMinorVersion(v)       ((int32_t)(v) & 0xffff)
-#define versionOK(suppliedV, requiredV)                   \
-  (nsMajorVersion(suppliedV) == nsMajorVersion(requiredV) \
-   && nsMinorVersion(suppliedV) >= nsMinorVersion(requiredV))
-
-typedef nsTWeakRef<class nsPluginNativeWindowOS2> PluginWindowWeakRef;
-
-extern "C" {
-PVOID APIENTRY WinQueryProperty(HWND hwnd, PCSZ  pszNameOrAtom);
-
-PVOID APIENTRY WinRemoveProperty(HWND hwnd, PCSZ  pszNameOrAtom);
-
-BOOL  APIENTRY WinSetProperty(HWND hwnd, PCSZ  pszNameOrAtom,
-                              PVOID pvData, ULONG ulFlags);
-}
-
-/*****************************************************************************/
-
-static ULONG sWM_FLASHBOUNCEMSG = 0;
-
-/*****************************************************************************/
-/**
- *  PLEvent handling code
- */
-
-class PluginWindowEvent : public nsRunnable
-{
-public:
-  PluginWindowEvent();
-  void Init(const PluginWindowWeakRef &ref, HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2);
-  void Clear();
-  HWND   GetWnd()    { return mWnd; };
-  ULONG  GetMsg()    { return mMsg; };
-  MPARAM GetWParam() { return mWParam; };
-  MPARAM GetLParam() { return mLParam; };
-  bool InUse()       { return mWnd != nullptr; };
-  
-  NS_DECL_NSIRUNNABLE
-
-protected:
-  PluginWindowWeakRef mPluginWindowRef;
-  HWND   mWnd;
-  ULONG  mMsg;
-  MPARAM mWParam;
-  MPARAM mLParam;
-};
-
-PluginWindowEvent::PluginWindowEvent()
-{
-  Clear();
-}
-
-void PluginWindowEvent::Clear()
-{
-  mWnd    = nullptr;
-  mMsg    = 0;
-  mWParam = 0;
-  mLParam = 0;
-}
-
-void PluginWindowEvent::Init(const PluginWindowWeakRef &ref, HWND aWnd,
-                             ULONG aMsg, MPARAM mp1, MPARAM mp2)
-{
-  NS_ASSERTION(aWnd != nullptr, "invalid plugin event value");
-  NS_ASSERTION(mWnd == nullptr, "event already in use");
-  mPluginWindowRef = ref;
-  mWnd    = aWnd;
-  mMsg    = aMsg;
-  mWParam = mp1;
-  mLParam = mp2;
-}
-
-/*****************************************************************************/
-
-class nsDelayedPopupsEnabledEvent : public nsRunnable
-{
-public:
-  nsDelayedPopupsEnabledEvent(nsNPAPIPluginInstance *inst)
-    : mInst(inst)
-  {}
-
-  NS_DECL_NSIRUNNABLE
-
-private:
-  nsRefPtr<nsNPAPIPluginInstance> mInst;
-};
-
-NS_IMETHODIMP nsDelayedPopupsEnabledEvent::Run()
-{
-  mInst->PushPopupsEnabledState(false);
-  return NS_OK;	
-}
-
-/*****************************************************************************/
-/**
- *  nsPluginNativeWindow OS/2-specific class declaration
- */
-
-typedef enum {
-  nsPluginType_Unknown = 0,
-  nsPluginType_Flash,
-  nsPluginType_Java_vm,
-  nsPluginType_Other
-} nsPluginType;
-
-class nsPluginNativeWindowOS2 : public nsPluginNativeWindow
-{
-public: 
-  nsPluginNativeWindowOS2();
-  virtual ~nsPluginNativeWindowOS2();
-
-  virtual nsresult CallSetWindow(nsRefPtr<nsNPAPIPluginInstance> &aPluginInstance);
-
-private:
-  nsresult SubclassAndAssociateWindow();
-  nsresult UndoSubclassAndAssociateWindow();
-
-public:
-  // locals
-  PFNWP GetWindowProc();
-  PluginWindowEvent* GetPluginWindowEvent(HWND aWnd,
-                                          ULONG aMsg,
-                                          MPARAM mp1, 
-                                          MPARAM mp2);
-
-private:
-  PFNWP mPluginWinProc;
-  PluginWindowWeakRef mWeakRef;
-  nsRefPtr<PluginWindowEvent> mCachedPluginWindowEvent;
-
-public:
-  nsPluginType mPluginType;
-};
-
-/*****************************************************************************/
-
-static bool ProcessFlashMessageDelayed(nsPluginNativeWindowOS2 * aWin,
-                                         nsNPAPIPluginInstance * aInst,
-                                         HWND hWnd, ULONG msg,
-                                         MPARAM mp1, MPARAM mp2)
-{
-  NS_ENSURE_TRUE(aWin, NS_ERROR_NULL_POINTER);
-  NS_ENSURE_TRUE(aInst, NS_ERROR_NULL_POINTER);
-
-  if (msg == sWM_FLASHBOUNCEMSG) {
-    // See PluginWindowEvent::Run() below.
-    NS_TRY_SAFE_CALL_VOID((aWin->GetWindowProc())(hWnd, WM_USER_FLASH, mp1, mp2),
-                           inst,
-                           NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
-    return TRUE;
-  }
-
-  if (msg != WM_USER_FLASH)
-    return false; // no need to delay
-
-  // do stuff
-  nsCOMPtr<nsIRunnable> pwe = aWin->GetPluginWindowEvent(hWnd, msg, mp1, mp2);
-  if (pwe) {
-    NS_DispatchToCurrentThread(pwe);
-    return true;  
-  }
-  return false;
-}
-
-/*****************************************************************************/
-/**
- *   New plugin window procedure
- */
-
-static MRESULT EXPENTRY PluginWndProc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
-{
-  nsPluginNativeWindowOS2 * win = (nsPluginNativeWindowOS2 *)
-            ::WinQueryProperty(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION);
-  if (!win)
-    return (MRESULT)TRUE;
-
-  // The DispatchEvent(NS_PLUGIN_ACTIVATE) below can trigger a reentrant focus
-  // event which might destroy us.  Hold a strong ref on the plugin instance
-  // to prevent that, bug 374229.
-  nsRefPtr<nsNPAPIPluginInstance> inst;
-  win->GetPluginInstance(inst);
-
-  // check plugin mime type and cache whether it is Flash or java-vm or not;
-  // flash and java-vm will need special treatment later
-  if (win->mPluginType == nsPluginType_Unknown) {
-    if (inst) {
-      const char* mimetype = nullptr;
-      inst->GetMIMEType(&mimetype);
-      if (mimetype) {
-        if (!strcmp(mimetype, "application/x-shockwave-flash"))
-          win->mPluginType = nsPluginType_Flash;
-        else if (!strcmp(mimetype, "application/x-java-vm"))
-          win->mPluginType = nsPluginType_Java_vm;
-        else
-          win->mPluginType = nsPluginType_Other;
-      }
-    }
-  }
-
-  bool enablePopups = false;
-
-  // Activate/deactivate mouse capture on the plugin widget
-  // here, before we pass the Windows event to the plugin
-  // because its possible our widget won't get paired events
-  // (see bug 131007) and we'll look frozen. Note that this
-  // is also done in ChildWindow::DispatchMouseEvent.
-  switch (msg) {
-    case WM_BUTTON1DOWN:
-    case WM_BUTTON2DOWN:
-    case WM_BUTTON3DOWN: {
-      nsCOMPtr<nsIWidget> widget;
-      win->GetPluginWidget(getter_AddRefs(widget));
-      if (widget)
-        widget->CaptureMouse(true);
-      break;
-    }
-
-    case WM_BUTTON1UP:
-    case WM_BUTTON2UP:
-    case WM_BUTTON3UP: {
-      if (msg == WM_BUTTON1UP)
-        enablePopups = true;
-
-      nsCOMPtr<nsIWidget> widget;
-      win->GetPluginWidget(getter_AddRefs(widget));
-      if (widget)
-        widget->CaptureMouse(false);
-      break;
-    }
-
-    case WM_CHAR:
-      // Ignore repeating keydown messages...
-      if (SHORT1FROMMP(mp1) & KC_PREVDOWN)
-        break;
-      enablePopups = true;
-      break;
-
-    // When the child of a plugin gets the focus, nsWindow doesn't get
-    // a WM_FOCUSCHANGED msg, so plugin and window activation events
-    // don't happen.  This fixes the problem by synthesizing a msg
-    // that makes it look like the plugin widget just got the focus.
-    case WM_FOCUSCHANGE: {
-
-      // Some plugins don't pass this msg on.  If the default window proc
-      // doesn't receive it, window activation/deactivation won't happen.
-      WinDefWindowProc(hWnd, msg, mp1, mp2);
-
-      // If focus is being gained, and the plugin widget neither lost nor
-      // gained the focus, then a child just got it from some other window.
-      // If that other window was neither a child of the widget nor owned
-      // by a child of the widget (e.g. a popup menu), post a WM_FOCUSCHANGED
-      // msg that identifies the child as the window losing focus.  After
-      // nsWindow:: ActivatePlugin() activates the plugin, it will restore
-      // the focus to the child.
-      if (SHORT1FROMMP(mp2) && (HWND)mp1 != hWnd) {
-        HWND hFocus = WinQueryFocus(HWND_DESKTOP);
-        if (hFocus != hWnd &&
-            WinIsChild(hFocus, hWnd) &&
-            !WinIsChild((HWND)mp1, hWnd) &&
-            !WinIsChild(WinQueryWindow((HWND)mp1, QW_OWNER), hWnd)) {
-          WinPostMsg(hWnd, WM_FOCUSCHANGED, (MPARAM)hFocus, mp2);
-        }
-      }
-      break;
-    }
-  }
-
-  // Macromedia Flash plugin may flood the message queue with some special messages
-  // (WM_USER+1) causing 100% CPU consumption and GUI freeze, see mozilla bug 132759;
-  // we can prevent this from happening by delaying the processing such messages;
-  if (win->mPluginType == nsPluginType_Flash) {
-    if (ProcessFlashMessageDelayed(win, inst, hWnd, msg, mp1, mp2))
-      return (MRESULT)TRUE;
-  }
-
-  if (enablePopups && inst) {
-    uint16_t apiVersion;
-    if (NS_SUCCEEDED(inst->GetPluginAPIVersion(&apiVersion)) &&
-        !versionOK(apiVersion, NP_POPUP_API_VERSION))
-      inst->PushPopupsEnabledState(true);
-  }
-
-  MRESULT res = (MRESULT)TRUE;
-  if (win->mPluginType == nsPluginType_Java_vm)
-    NS_TRY_SAFE_CALL_RETURN(res, ::WinDefWindowProc(hWnd, msg, mp1, mp2), inst,
-                            NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
-  else
-    NS_TRY_SAFE_CALL_RETURN(res, (win->GetWindowProc())(hWnd, msg, mp1, mp2), inst,
-                            NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
-
-  if (inst) {
-    // Popups are enabled (were enabled before the call to
-    // CallWindowProc()). Some plugins (at least the flash player)
-    // post messages from their key handlers etc that delay the actual
-    // processing, so we need to delay the disabling of popups so that
-    // popups remain enabled when the flash player ends up processing
-    // the actual key handlers. We do this by posting an event that
-    // does the disabling, this way our disabling will happen after
-    // the handlers in the plugin are done.
-
-    // Note that it's not fatal if any of this fails (which won't
-    // happen unless we're out of memory anyways) since the plugin
-    // code will pop any popup state pushed by this plugin on
-    // destruction.
-
-    nsCOMPtr<nsIRunnable> event = new nsDelayedPopupsEnabledEvent(inst);
-    if (event)
-      NS_DispatchToCurrentThread(event);
-  }
-
-  return res;
-}
-
-/*****************************************************************************/
-/**
- *   nsPluginNativeWindowOS2 implementation
- */
-
-nsPluginNativeWindowOS2::nsPluginNativeWindowOS2() : nsPluginNativeWindow()
-{
-  // initialize the struct fields
-  window = nullptr; 
-  x = 0; 
-  y = 0; 
-  width = 0; 
-  height = 0; 
-
-  mPluginWinProc = nullptr;
-  mPluginType = nsPluginType_Unknown;
-
-  // once the atom has been added, it won't be deleted
-  if (!sWM_FLASHBOUNCEMSG) {
-    sWM_FLASHBOUNCEMSG = ::WinFindAtom(WinQuerySystemAtomTable(),
-                                       NS_PLUGIN_CUSTOM_MSG_ID);
-    if (!sWM_FLASHBOUNCEMSG)
-      sWM_FLASHBOUNCEMSG = ::WinAddAtom(WinQuerySystemAtomTable(),
-                                        NS_PLUGIN_CUSTOM_MSG_ID);
-  }
-}
-
-nsPluginNativeWindowOS2::~nsPluginNativeWindowOS2()
-{
-  // clear weak reference to self to prevent any pending events from
-  // dereferencing this.
-  mWeakRef.forget();
-}
-
-PFNWP nsPluginNativeWindowOS2::GetWindowProc()
-{
-  return mPluginWinProc;
-}
-
-NS_IMETHODIMP PluginWindowEvent::Run()
-{
-  nsPluginNativeWindowOS2 *win = mPluginWindowRef.get();
-  if (!win)
-    return NS_OK;
-
-  HWND hWnd = GetWnd();
-  if (!hWnd)
-    return NS_OK;
-
-  nsRefPtr<nsNPAPIPluginInstance> inst;
-  win->GetPluginInstance(inst);
-
-  if (GetMsg() == WM_USER_FLASH)
-    // XXX Unwind issues related to runnable event callback depth for this
-    // event and destruction of the plugin. (Bug 493601)
-    ::WinPostMsg(hWnd, sWM_FLASHBOUNCEMSG, GetWParam(), GetLParam());
-  else
-    // Currently not used, but added so that processing events here
-    // is more generic.
-    NS_TRY_SAFE_CALL_VOID((win->GetWindowProc()) 
-                          (hWnd, GetMsg(), GetWParam(), GetLParam()),
-                          inst,
-                          NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
-
-  Clear();
-  return NS_OK;
-}
-
-PluginWindowEvent*
-nsPluginNativeWindowOS2::GetPluginWindowEvent(HWND aWnd, ULONG aMsg, MPARAM aMp1, MPARAM aMp2)
-{
-  if (!mWeakRef) {
-    mWeakRef = this;
-    if (!mWeakRef)
-      return nullptr;
-  }
-
-  PluginWindowEvent *event;
-
-  // We have the ability to alloc if needed in case in the future some plugin
-  // should post multiple PostMessages. However, this could lead to many
-  // alloc's per second which could become a performance issue. See bug 169247.
-  if (!mCachedPluginWindowEvent) {
-    event = new PluginWindowEvent();
-    if (!event)
-      return nullptr;
-    mCachedPluginWindowEvent = event;
-  }
-  else
-  if (mCachedPluginWindowEvent->InUse()) {
-    event = new PluginWindowEvent();
-    if (!event)
-      return nullptr;
-  }
-  else
-    event = mCachedPluginWindowEvent;
-
-  event->Init(mWeakRef, aWnd, aMsg, aMp1, aMp2);
-  return event;
-}
-
-nsresult nsPluginNativeWindowOS2::CallSetWindow(nsRefPtr<nsNPAPIPluginInstance> &aPluginInstance)
-{
-  // check the incoming instance, null indicates that window is going away and we are
-  // not interested in subclassing business any more, undo and don't subclass
-  if (!aPluginInstance) {
-    UndoSubclassAndAssociateWindow();
-  }
-
-  nsPluginNativeWindow::CallSetWindow(aPluginInstance);
-
-  if (aPluginInstance)
-    SubclassAndAssociateWindow();
-
-  return NS_OK;
-}
-
-nsresult nsPluginNativeWindowOS2::SubclassAndAssociateWindow()
-{
-  if (type != NPWindowTypeWindow)
-    return NS_ERROR_FAILURE;
-
-  HWND hWnd = (HWND)window;
-  if (!hWnd)
-    return NS_ERROR_FAILURE;
-
-  // check if we need to re-subclass
-  PFNWP currentWndProc = (PFNWP)::WinQueryWindowPtr(hWnd, QWP_PFNWP);
-  if (PluginWndProc == currentWndProc)
-    return NS_OK;
-
-  mPluginWinProc = ::WinSubclassWindow(hWnd, PluginWndProc);
-  if (!mPluginWinProc)
-    return NS_ERROR_FAILURE;
-
-#ifdef DEBUG
-  nsPluginNativeWindowOS2 * win = (nsPluginNativeWindowOS2 *)
-            ::WinQueryProperty(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION);
-  NS_ASSERTION(!win || (win == this), "plugin window already has property and this is not us");
-#endif
-
-  if (!::WinSetProperty(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION, (PVOID)this, 0))
-    return NS_ERROR_FAILURE;
-
-  return NS_OK;
-}
-
-nsresult nsPluginNativeWindowOS2::UndoSubclassAndAssociateWindow()
-{
-  // release plugin instance
-  SetPluginInstance(nullptr);
-
-  // remove window property
-  HWND hWnd = (HWND)window;
-  if (::WinIsWindow(/*HAB*/0, hWnd))
-    ::WinRemoveProperty(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION);
-
-  // restore the original win proc
-  // but only do this if this were us last time
-  if (mPluginWinProc) {
-    PFNWP currentWndProc = (PFNWP)::WinQueryWindowPtr(hWnd, QWP_PFNWP);
-    if (currentWndProc == PluginWndProc)
-      ::WinSubclassWindow(hWnd, mPluginWinProc);
-  }
-
-  return NS_OK;
-}
-
-nsresult PLUG_NewPluginNativeWindow(nsPluginNativeWindow ** aPluginNativeWindow)
-{
-  NS_ENSURE_ARG_POINTER(aPluginNativeWindow);
-
-  *aPluginNativeWindow = new nsPluginNativeWindowOS2();
-
-  return *aPluginNativeWindow ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
-}
-
-nsresult PLUG_DeletePluginNativeWindow(nsPluginNativeWindow * aPluginNativeWindow)
-{
-  NS_ENSURE_ARG_POINTER(aPluginNativeWindow);
-  nsPluginNativeWindowOS2 *p = (nsPluginNativeWindowOS2 *)aPluginNativeWindow;
-  delete p;
-  return NS_OK;
-}
deleted file mode 100644
--- a/dom/plugins/base/nsPluginsDirOS2.cpp
+++ /dev/null
@@ -1,274 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// OS/2 plugin-loading code.
-
-#define INCL_DOS
-#define INCL_DOSERRORS
-#include <os2.h>
-
-#include "nsPluginsDir.h"
-#include "prlink.h"
-#include "plstr.h"
-#include "prmem.h"
-#include "prprf.h"
-#include "npapi.h"
-
-#include "nsString.h"
-
-/* Load a string stored as RCDATA in a resource segment */
-/* Returned string needs to be PR_Free'd by caller */
-static char *LoadRCDATAString( HMODULE hMod, ULONG resid)
-{
-   APIRET rc;
-   ULONG  ulSize = 0;
-   char  *string = 0;
-
-   rc = DosQueryResourceSize( hMod, RT_RCDATA, resid, &ulSize);
-
-   if( rc == NO_ERROR)
-   {
-      char *readOnlyString = 0;
-      rc = DosGetResource( hMod, RT_RCDATA, resid, (void**) &readOnlyString);
-
-      /* allow for 0-termination if user hasn't got it right */
-      if( readOnlyString[ ulSize - 1] != '\0')
-         ulSize++;
-
-      if( rc == NO_ERROR)
-      {
-         /* copy string & zero-terminate */
-         string = (char*) PR_Malloc( ulSize);
-         memcpy( string, readOnlyString, ulSize - 1);
-         string[ ulSize - 1] = '\0';
-
-         DosFreeResource( readOnlyString);
-      }
-   }
-
-   return string;
-}
-
-/* Load a version string stored as RCDATA in a resource segment */
-/* Returned string needs to be PR_Free'd by caller */
-static char *LoadRCDATAVersion(HMODULE hMod, ULONG resid)
-{
-   APIRET rc;
-   ULONG  ulSize = 0;
-   char  *string = 0;
-
-   rc = DosQueryResourceSize(hMod, RT_RCDATA, resid, &ulSize);
-
-   // version info is should be 8 chars
-   if (rc == NO_ERROR && ulSize == 8)
-   {
-      char *version = nullptr;
-      rc = DosGetResource(hMod, RT_RCDATA, resid, (void**) &version);
-
-      if (rc == NO_ERROR)
-      {
-         string = PR_smprintf("%d.%d.%d.%d\n",
-                              version[0], version[2], version[4], version[6]);
-
-         DosFreeResource(version);
-      }
-   }
-
-   return string;
-}
-
-static uint32_t CalculateVariantCount(char* mimeTypes)
-{
-  uint32_t variants = 1;
-
-  if(mimeTypes == nullptr)
-    return 0;
-
-  char* index = mimeTypes;
-  while (*index)
-  {
-    if (*index == '|')
-    variants++;
-
-    ++index;
-  }
-  return variants;
-}
-
-static char** MakeStringArray(uint32_t variants, char* data)
-{
-  if((variants <= 0) || (data == nullptr))
-    return nullptr;
-
-  char ** array = (char **)PR_Calloc(variants, sizeof(char *));
-  if(array == nullptr)
-    return nullptr;
-
-  char * start = data;
-  for(uint32_t i = 0; i < variants; i++)
-  {
-    char * p = PL_strchr(start, '|');
-    if(p != nullptr)
-      *p = 0;
-
-    array[i] = PL_strdup(start);
-    start = ++p;
-  }
-  return array;
-}
-
-static void FreeStringArray(uint32_t variants, char ** array)
-{
-  if((variants == 0) || (array == nullptr))
-    return;
-
-  for(uint32_t i = 0; i < variants; i++)
-  {
-    if(array[i] != nullptr)
-    {
-      PL_strfree(array[i]);
-      array[i] = nullptr;
-    }
-  }
-  PR_Free(array);
-}
-
-// nsPluginsDir class
-
-bool nsPluginsDir::IsPluginFile(nsIFile* file)
-{
-    nsAutoCString leaf;
-    if (NS_FAILED(file->GetNativeLeafName(leaf)))
-        return false;
-
-    const char *leafname = leaf.get();
-    
-    if( nullptr != leafname)
-    {
-      int len = strlen( leafname);
-      if( len > 6 &&                 // np*.dll
-          (0 == strnicmp( &(leafname[len - 4]), ".dll", 4)) &&
-          (0 == strnicmp( leafname, "np", 2)))
-      {
-        return true;
-      }
-    }
-    return false;
-}
-
-// nsPluginFile implementation
-
-nsPluginFile::nsPluginFile(nsIFile* file)
-: mPlugin(file)
-{}
-
-nsPluginFile::~nsPluginFile()
-{}
-
-// Loads the plugin into memory using NSPR's shared-library loading
-nsresult nsPluginFile::LoadPlugin(PRLibrary **outLibrary)
-{
-    if (!mPlugin)
-      return NS_ERROR_NULL_POINTER;
-   
-    nsAutoCString temp;
-    mPlugin->GetNativePath(temp);
-
-    *outLibrary = PR_LoadLibrary(temp.get());
-    return *outLibrary == nullptr ? NS_ERROR_FAILURE : NS_OK;
-}
-
-// Obtains all of the information currently available for this plugin.
-nsresult nsPluginFile::GetPluginInfo(nsPluginInfo &info, PRLibrary **outLibrary)
-{
-   *outLibrary = nullptr;
-
-   nsresult   rv = NS_ERROR_FAILURE;
-   HMODULE    hPlug = 0; // Need a HMODULE to query resource statements
-   char       failure[ CCHMAXPATH] = "";
-   APIRET     ret;
-
-   nsAutoCString path;
-   if (NS_FAILED(rv = mPlugin->GetNativePath(path)))
-     return rv;
-
-   nsAutoCString fileName;
-   if (NS_FAILED(rv = mPlugin->GetNativeLeafName(fileName)))
-     return rv;
-
-   ret = DosLoadModule( failure, CCHMAXPATH, path.get(), &hPlug);
-   info.fVersion = nullptr;
-
-   while( ret == NO_ERROR)
-   {
-      info.fName = LoadRCDATAString( hPlug, NP_INFO_ProductName);
-
-      info.fVersion = LoadRCDATAVersion( hPlug, NP_INFO_ProductVersion);
-
-      // get description (doesn't matter if it's missing)...
-      info.fDescription = LoadRCDATAString( hPlug, NP_INFO_FileDescription);
-
-      char * mimeType = LoadRCDATAString( hPlug, NP_INFO_MIMEType);
-      if( nullptr == mimeType) break;
-
-      char * mimeDescription = LoadRCDATAString( hPlug, NP_INFO_FileOpenName);
-      if( nullptr == mimeDescription) break;
-
-      char * extensions = LoadRCDATAString( hPlug, NP_INFO_FileExtents);
-      if( nullptr == extensions) break;
-
-      info.fVariantCount = CalculateVariantCount(mimeType);
-
-      info.fMimeTypeArray = MakeStringArray(info.fVariantCount, mimeType);
-      if( info.fMimeTypeArray == nullptr) break;
-
-      info.fMimeDescriptionArray = MakeStringArray(info.fVariantCount, mimeDescription);
-      if( nullptr == info.fMimeDescriptionArray) break;
-
-      info.fExtensionArray = MakeStringArray(info.fVariantCount, extensions);
-      if( nullptr == info.fExtensionArray) break;
-
-      info.fFullPath = PL_strdup(path.get());
-      info.fFileName = PL_strdup(fileName.get());
-
-      rv = NS_OK;
-      break;
-   }
-
-   if( 0 != hPlug)
-      DosFreeModule( hPlug);
-
-   return rv;
-}
-
-nsresult nsPluginFile::FreePluginInfo(nsPluginInfo& info)
-{
-   if(info.fName != nullptr)
-     PL_strfree(info.fName);
-
-   if(info.fFullPath != nullptr)
-     PL_strfree(info.fFullPath);
-
-   if(info.fFileName != nullptr)
-     PL_strfree(info.fFileName);
- 
-   if(info.fVersion != nullptr)
-     PL_strfree(info.fVersion);
- 
-   if(info.fDescription != nullptr)
-     PL_strfree(info.fDescription);
- 
-   if(info.fMimeTypeArray != nullptr)
-     FreeStringArray(info.fVariantCount, info.fMimeTypeArray);
- 
-   if(info.fMimeDescriptionArray != nullptr)
-     FreeStringArray(info.fVariantCount, info.fMimeDescriptionArray);
- 
-   if(info.fExtensionArray != nullptr)
-     FreeStringArray(info.fVariantCount, info.fExtensionArray);
- 
-   memset((void *)&info, 0, sizeof(info));
- 
-   return NS_OK;
-}
--- a/dom/plugins/ipc/PluginLibrary.h
+++ b/dom/plugins/ipc/PluginLibrary.h
@@ -49,17 +49,17 @@ public:
   virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs, NPError* error) = 0;
 #else
   virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error) = 0;
 #endif
   virtual nsresult NP_Shutdown(NPError* error) = 0;
   virtual nsresult NP_GetMIMEDescription(const char** mimeDesc) = 0;
   virtual nsresult NP_GetValue(void *future, NPPVariable aVariable,
                                void *aValue, NPError* error) = 0;
-#if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_OS2)
+#if defined(XP_WIN) || defined(XP_MACOSX)
   virtual nsresult NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error) = 0;
 #endif
   virtual nsresult NPP_New(NPMIMEType pluginType, NPP instance,
                            uint16_t mode, int16_t argc, char* argn[],
                            char* argv[], NPSavedData* saved,
                            NPError* error) = 0;
 
   virtual nsresult NPP_ClearSiteData(const char* site, uint64_t flags,
--- a/dom/plugins/ipc/PluginMessageUtils.h
+++ b/dom/plugins/ipc/PluginMessageUtils.h
@@ -899,18 +899,16 @@ struct ParamTraits<NPCoordinateSpace>
 // into separate files and have the only macro crud live here.
 // 
 // NB: these guards are based on those where struct NPEvent is defined
 // in npapi.h.  They should be kept in sync.
 #if defined(XP_MACOSX)
 #  include "mozilla/plugins/NPEventOSX.h"
 #elif defined(XP_WIN)
 #  include "mozilla/plugins/NPEventWindows.h"
-#elif defined(XP_OS2)
-#  error Sorry, OS/2 is not supported
 #elif defined(ANDROID)
 #  include "mozilla/plugins/NPEventAndroid.h"
 #elif defined(XP_UNIX)
 #  include "mozilla/plugins/NPEventUnix.h"
 #else
 #  error Unsupported platform
 #endif
 
--- a/dom/plugins/ipc/PluginModuleChild.cpp
+++ b/dom/plugins/ipc/PluginModuleChild.cpp
@@ -772,178 +772,178 @@ PluginModuleChild::NPObjectIsRegistered(
 
 //-----------------------------------------------------------------------------
 // FIXME/cjones: just getting this out of the way for the moment ...
 
 namespace mozilla {
 namespace plugins {
 namespace child {
 
-static NPError NP_CALLBACK
+static NPError
 _requestread(NPStream *pstream, NPByteRange *rangeList);
 
-static NPError NP_CALLBACK
+static NPError
 _geturlnotify(NPP aNPP, const char* relativeURL, const char* target,
               void* notifyData);
 
-static NPError NP_CALLBACK
+static NPError
 _getvalue(NPP aNPP, NPNVariable variable, void *r_value);
 
-static NPError NP_CALLBACK
+static NPError
 _setvalue(NPP aNPP, NPPVariable variable, void *r_value);
 
-static NPError NP_CALLBACK
+static NPError
 _geturl(NPP aNPP, const char* relativeURL, const char* target);
 
-static NPError NP_CALLBACK
+static NPError
 _posturlnotify(NPP aNPP, const char* relativeURL, const char *target,
                uint32_t len, const char *buf, NPBool file, void* notifyData);
 
-static NPError NP_CALLBACK
+static NPError
 _posturl(NPP aNPP, const char* relativeURL, const char *target, uint32_t len,
          const char *buf, NPBool file);
 
-static NPError NP_CALLBACK
+static NPError
 _newstream(NPP aNPP, NPMIMEType type, const char* window, NPStream** pstream);
 
-static int32_t NP_CALLBACK
+static int32_t
 _write(NPP aNPP, NPStream *pstream, int32_t len, void *buffer);
 
-static NPError NP_CALLBACK
+static NPError
 _destroystream(NPP aNPP, NPStream *pstream, NPError reason);
 
-static void NP_CALLBACK
+static void
 _status(NPP aNPP, const char *message);
 
-static void NP_CALLBACK
+static void
 _memfree (void *ptr);
 
-static uint32_t NP_CALLBACK
+static uint32_t
 _memflush(uint32_t size);
 
-static void NP_CALLBACK
+static void
 _reloadplugins(NPBool reloadPages);
 
-static void NP_CALLBACK
+static void
 _invalidaterect(NPP aNPP, NPRect *invalidRect);
 
-static void NP_CALLBACK
+static void
 _invalidateregion(NPP aNPP, NPRegion invalidRegion);
 
-static void NP_CALLBACK
+static void
 _forceredraw(NPP aNPP);
 
-static const char* NP_CALLBACK
+static const char*
 _useragent(NPP aNPP);
 
-static void* NP_CALLBACK
+static void*
 _memalloc (uint32_t size);
 
 // Deprecated entry points for the old Java plugin.
-static void* NP_CALLBACK /* OJI type: JRIEnv* */
+static void* /* OJI type: JRIEnv* */
 _getjavaenv(void);
 
 // Deprecated entry points for the old Java plugin.
-static void* NP_CALLBACK /* OJI type: jref */
+static void* /* OJI type: jref */
 _getjavapeer(NPP aNPP);
 
-static bool NP_CALLBACK
+static bool
 _invoke(NPP aNPP, NPObject* npobj, NPIdentifier method, const NPVariant *args,
         uint32_t argCount, NPVariant *result);
 
-static bool NP_CALLBACK
+static bool
 _invokedefault(NPP aNPP, NPObject* npobj, const NPVariant *args,
                uint32_t argCount, NPVariant *result);
 
-static bool NP_CALLBACK
+static bool
 _evaluate(NPP aNPP, NPObject* npobj, NPString *script, NPVariant *result);
 
-static bool NP_CALLBACK
+static bool
 _getproperty(NPP aNPP, NPObject* npobj, NPIdentifier property,
              NPVariant *result);
 
-static bool NP_CALLBACK
+static bool
 _setproperty(NPP aNPP, NPObject* npobj, NPIdentifier property,
              const NPVariant *value);
 
-static bool NP_CALLBACK
+static bool
 _removeproperty(NPP aNPP, NPObject* npobj, NPIdentifier property);
 
-static bool NP_CALLBACK
+static bool
 _hasproperty(NPP aNPP, NPObject* npobj, NPIdentifier propertyName);
 
-static bool NP_CALLBACK
+static bool
 _hasmethod(NPP aNPP, NPObject* npobj, NPIdentifier methodName);
 
-static bool NP_CALLBACK
+static bool
 _enumerate(NPP aNPP, NPObject *npobj, NPIdentifier **identifier,
            uint32_t *count);
 
-static bool NP_CALLBACK
+static bool
 _construct(NPP aNPP, NPObject* npobj, const NPVariant *args,
            uint32_t argCount, NPVariant *result);
 
-static void NP_CALLBACK
+static void
 _releasevariantvalue(NPVariant *variant);
 
-static void NP_CALLBACK
+static void
 _setexception(NPObject* npobj, const NPUTF8 *message);
 
-static void NP_CALLBACK
+static void
 _pushpopupsenabledstate(NPP aNPP, NPBool enabled);
 
-static void NP_CALLBACK
+static void
 _poppopupsenabledstate(NPP aNPP);
 
-static void NP_CALLBACK
+static void
 _pluginthreadasynccall(NPP instance, PluginThreadCallback func,
                        void *userData);
 
-static NPError NP_CALLBACK
+static NPError
 _getvalueforurl(NPP npp, NPNURLVariable variable, const char *url,
                 char **value, uint32_t *len);
 
-static NPError NP_CALLBACK
+static NPError
 _setvalueforurl(NPP npp, NPNURLVariable variable, const char *url,
                 const char *value, uint32_t len);
 
-static NPError NP_CALLBACK
+static NPError
 _getauthenticationinfo(NPP npp, const char *protocol,
                        const char *host, int32_t port,
                        const char *scheme, const char *realm,
                        char **username, uint32_t *ulen,
                        char **password, uint32_t *plen);
 
-static uint32_t NP_CALLBACK
+static uint32_t
 _scheduletimer(NPP instance, uint32_t interval, NPBool repeat,
                void (*timerFunc)(NPP npp, uint32_t timerID));
 
-static void NP_CALLBACK
+static void
 _unscheduletimer(NPP instance, uint32_t timerID);
 
-static NPError NP_CALLBACK
+static NPError
 _popupcontextmenu(NPP instance, NPMenu* menu);
 
-static NPBool NP_CALLBACK
+static NPBool
 _convertpoint(NPP instance, 
               double sourceX, double sourceY, NPCoordinateSpace sourceSpace,
               double *destX, double *destY, NPCoordinateSpace destSpace);
 
-static void NP_CALLBACK
+static void
 _urlredirectresponse(NPP instance, void* notifyData, NPBool allow);
 
-static NPError NP_CALLBACK
+static NPError
 _initasyncsurface(NPP instance, NPSize *size,
                   NPImageFormat format, void *initData,
                   NPAsyncSurface *surface);
 
-static NPError NP_CALLBACK
+static NPError
 _finalizeasyncsurface(NPP instance, NPAsyncSurface *surface);
 
-static void NP_CALLBACK
+static void
 _setcurrentasyncsurface(NPP instance, NPAsyncSurface *surface, NPRect *changed);
 
 } /* namespace child */
 } /* namespace plugins */
 } /* namespace mozilla */
 
 const NPNetscapeFuncs PluginModuleChild::sBrowserFuncs = {
     sizeof(sBrowserFuncs),
@@ -1014,30 +1014,30 @@ InstCast(NPP aNPP)
     NS_ABORT_IF_FALSE(!!(aNPP->ndata), "nil instance");
     return static_cast<PluginInstanceChild*>(aNPP->ndata);
 }
 
 namespace mozilla {
 namespace plugins {
 namespace child {
 
-NPError NP_CALLBACK
+NPError
 _requestread(NPStream* aStream,
              NPByteRange* aRangeList)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     ENSURE_PLUGIN_THREAD(NPERR_INVALID_PARAM);
 
     BrowserStreamChild* bs =
         static_cast<BrowserStreamChild*>(static_cast<AStream*>(aStream->ndata));
     bs->EnsureCorrectStream(aStream);
     return bs->NPN_RequestRead(aRangeList);
 }
 
-NPError NP_CALLBACK
+NPError
 _geturlnotify(NPP aNPP,
               const char* aRelativeURL,
               const char* aTarget,
               void* aNotifyData)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     ENSURE_PLUGIN_THREAD(NPERR_INVALID_PARAM);
 
@@ -1055,17 +1055,17 @@ NPError NP_CALLBACK
         // If NPN_PostURLNotify fails, the parent will immediately send us
         // a PStreamNotifyDestructor, which should not call NPP_URLNotify.
         sn->SetValid(aNotifyData);
     }
 
     return err;
 }
 
-NPError NP_CALLBACK
+NPError
 _getvalue(NPP aNPP,
           NPNVariable aVariable,
           void* aValue)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     ENSURE_PLUGIN_THREAD(NPERR_INVALID_PARAM);
 
     switch (aVariable) {
@@ -1111,41 +1111,41 @@ NPError NP_CALLBACK
             return NPERR_INVALID_INSTANCE_ERROR;
         }
     }
 
     NS_NOTREACHED("Shouldn't get here!");
     return NPERR_GENERIC_ERROR;
 }
 
-NPError NP_CALLBACK
+NPError
 _setvalue(NPP aNPP,
           NPPVariable aVariable,
           void* aValue)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     ENSURE_PLUGIN_THREAD(NPERR_INVALID_PARAM);
     return InstCast(aNPP)->NPN_SetValue(aVariable, aValue);
 }
 
-NPError NP_CALLBACK
+NPError
 _geturl(NPP aNPP,
         const char* aRelativeURL,
         const char* aTarget)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     ENSURE_PLUGIN_THREAD(NPERR_INVALID_PARAM);
 
     NPError err;
     InstCast(aNPP)->CallNPN_GetURL(NullableString(aRelativeURL),
                                    NullableString(aTarget), &err);
     return err;
 }
 
-NPError NP_CALLBACK
+NPError
 _posturlnotify(NPP aNPP,
                const char* aRelativeURL,
                const char* aTarget,
                uint32_t aLength,
                const char* aBuffer,
                NPBool aIsFile,
                void* aNotifyData)
 {
@@ -1167,17 +1167,17 @@ NPError NP_CALLBACK
         // If NPN_PostURLNotify fails, the parent will immediately send us
         // a PStreamNotifyDestructor, which should not call NPP_URLNotify.
         sn->SetValid(aNotifyData);
     }
 
     return err;
 }
 
-NPError NP_CALLBACK
+NPError
 _posturl(NPP aNPP,
          const char* aRelativeURL,
          const char* aTarget,
          uint32_t aLength,
          const char* aBuffer,
          NPBool aIsFile)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
@@ -1187,44 +1187,44 @@ NPError NP_CALLBACK
     // FIXME what should happen when |aBuffer| is null?
     InstCast(aNPP)->CallNPN_PostURL(NullableString(aRelativeURL),
                                     NullableString(aTarget),
                                     nsDependentCString(aBuffer, aLength),
                                     aIsFile, &err);
     return err;
 }
 
-NPError NP_CALLBACK
+NPError
 _newstream(NPP aNPP,
            NPMIMEType aMIMEType,
            const char* aWindow,
            NPStream** aStream)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     ENSURE_PLUGIN_THREAD(NPERR_INVALID_PARAM);
     return InstCast(aNPP)->NPN_NewStream(aMIMEType, aWindow, aStream);
 }
 
-int32_t NP_CALLBACK
+int32_t
 _write(NPP aNPP,
        NPStream* aStream,
        int32_t aLength,
        void* aBuffer)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     ENSURE_PLUGIN_THREAD(0);
 
     PluginStreamChild* ps =
         static_cast<PluginStreamChild*>(static_cast<AStream*>(aStream->ndata));
     ps->EnsureCorrectInstance(InstCast(aNPP));
     ps->EnsureCorrectStream(aStream);
     return ps->NPN_Write(aLength, aBuffer);
 }
 
-NPError NP_CALLBACK
+NPError
 _destroystream(NPP aNPP,
                NPStream* aStream,
                NPError aReason)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     ENSURE_PLUGIN_THREAD(NPERR_INVALID_PARAM);
 
     PluginInstanceChild* p = InstCast(aNPP);
@@ -1237,149 +1237,149 @@ NPError NP_CALLBACK
     else {
         PluginStreamChild* ps = static_cast<PluginStreamChild*>(s);
         ps->EnsureCorrectInstance(p);
         PPluginStreamChild::Call__delete__(ps, aReason, false);
     }
     return NPERR_NO_ERROR;
 }
 
-void NP_CALLBACK
+void
 _status(NPP aNPP,
         const char* aMessage)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     ENSURE_PLUGIN_THREAD_VOID();
     NS_WARNING("Not yet implemented!");
 }
 
-void NP_CALLBACK
+void
 _memfree(void* aPtr)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     // Only assert plugin thread here for consistency with in-process plugins.
     AssertPluginThread();
     NS_Free(aPtr);
 }
 
-uint32_t NP_CALLBACK
+uint32_t
 _memflush(uint32_t aSize)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     // Only assert plugin thread here for consistency with in-process plugins.
     AssertPluginThread();
     return 0;
 }
 
-void NP_CALLBACK
+void
 _reloadplugins(NPBool aReloadPages)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     ENSURE_PLUGIN_THREAD_VOID();
 
     PluginModuleChild::current()->SendNPN_ReloadPlugins(!!aReloadPages);
 }
 
-void NP_CALLBACK
+void
 _invalidaterect(NPP aNPP,
                 NPRect* aInvalidRect)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     ENSURE_PLUGIN_THREAD_VOID();
     // nullptr check for nspluginwrapper (bug 548434)
     if (aNPP) {
         InstCast(aNPP)->InvalidateRect(aInvalidRect);
     }
 }
 
-void NP_CALLBACK
+void
 _invalidateregion(NPP aNPP,
                   NPRegion aInvalidRegion)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     ENSURE_PLUGIN_THREAD_VOID();
     NS_WARNING("Not yet implemented!");
 }
 
-void NP_CALLBACK
+void
 _forceredraw(NPP aNPP)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     ENSURE_PLUGIN_THREAD_VOID();
 
     // We ignore calls to NPN_ForceRedraw. Such calls should
     // never be necessary.
 }
 
-const char* NP_CALLBACK
+const char*
 _useragent(NPP aNPP)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     ENSURE_PLUGIN_THREAD(nullptr);
     return PluginModuleChild::current()->GetUserAgent();
 }
 
-void* NP_CALLBACK
+void*
 _memalloc(uint32_t aSize)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     // Only assert plugin thread here for consistency with in-process plugins.
     AssertPluginThread();
     return NS_Alloc(aSize);
 }
 
 // Deprecated entry points for the old Java plugin.
-void* NP_CALLBACK /* OJI type: JRIEnv* */
+void* /* OJI type: JRIEnv* */
 _getjavaenv(void)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     return 0;
 }
 
-void* NP_CALLBACK /* OJI type: jref */
+void* /* OJI type: jref */
 _getjavapeer(NPP aNPP)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     return 0;
 }
 
-bool NP_CALLBACK
+bool
 _invoke(NPP aNPP,
         NPObject* aNPObj,
         NPIdentifier aMethod,
         const NPVariant* aArgs,
         uint32_t aArgCount,
         NPVariant* aResult)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     ENSURE_PLUGIN_THREAD(false);
 
     if (!aNPP || !aNPObj || !aNPObj->_class || !aNPObj->_class->invoke)
         return false;
 
     return aNPObj->_class->invoke(aNPObj, aMethod, aArgs, aArgCount, aResult);
 }
 
-bool NP_CALLBACK
+bool
 _invokedefault(NPP aNPP,
                NPObject* aNPObj,
                const NPVariant* aArgs,
                uint32_t aArgCount,
                NPVariant* aResult)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     ENSURE_PLUGIN_THREAD(false);
 
     if (!aNPP || !aNPObj || !aNPObj->_class || !aNPObj->_class->invokeDefault)
         return false;
 
     return aNPObj->_class->invokeDefault(aNPObj, aArgs, aArgCount, aResult);
 }
 
-bool NP_CALLBACK
+bool
 _evaluate(NPP aNPP,
           NPObject* aObject,
           NPString* aScript,
           NPVariant* aResult)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     ENSURE_PLUGIN_THREAD(false);
 
@@ -1400,89 +1400,89 @@ bool NP_CALLBACK
         ReplyMessage(0);
         gDelayFlashFocusReplyUntilEval = false;
     }
 #endif
 
     return actor->Evaluate(aScript, aResult);
 }
 
-bool NP_CALLBACK
+bool
 _getproperty(NPP aNPP,
              NPObject* aNPObj,
              NPIdentifier aPropertyName,
              NPVariant* aResult)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     ENSURE_PLUGIN_THREAD(false);
 
     if (!aNPP || !aNPObj || !aNPObj->_class || !aNPObj->_class->getProperty)
         return false;
 
     return aNPObj->_class->getProperty(aNPObj, aPropertyName, aResult);
 }
 
-bool NP_CALLBACK
+bool
 _setproperty(NPP aNPP,
              NPObject* aNPObj,
              NPIdentifier aPropertyName,
              const NPVariant* aValue)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     ENSURE_PLUGIN_THREAD(false);
 
     if (!aNPP || !aNPObj || !aNPObj->_class || !aNPObj->_class->setProperty)
         return false;
 
     return aNPObj->_class->setProperty(aNPObj, aPropertyName, aValue);
 }
 
-bool NP_CALLBACK
+bool
 _removeproperty(NPP aNPP,
                 NPObject* aNPObj,
                 NPIdentifier aPropertyName)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     ENSURE_PLUGIN_THREAD(false);
 
     if (!aNPP || !aNPObj || !aNPObj->_class || !aNPObj->_class->removeProperty)
         return false;
 
     return aNPObj->_class->removeProperty(aNPObj, aPropertyName);
 }
 
-bool NP_CALLBACK
+bool
 _hasproperty(NPP aNPP,
              NPObject* aNPObj,
              NPIdentifier aPropertyName)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     ENSURE_PLUGIN_THREAD(false);
 
     if (!aNPP || !aNPObj || !aNPObj->_class || !aNPObj->_class->hasProperty)
         return false;
 
     return aNPObj->_class->hasProperty(aNPObj, aPropertyName);
 }
 
-bool NP_CALLBACK
+bool
 _hasmethod(NPP aNPP,
            NPObject* aNPObj,
            NPIdentifier aMethodName)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     ENSURE_PLUGIN_THREAD(false);
 
     if (!aNPP || !aNPObj || !aNPObj->_class || !aNPObj->_class->hasMethod)
         return false;
 
     return aNPObj->_class->hasMethod(aNPObj, aMethodName);
 }
 
-bool NP_CALLBACK
+bool
 _enumerate(NPP aNPP,
            NPObject* aNPObj,
            NPIdentifier** aIdentifiers,
            uint32_t* aCount)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     ENSURE_PLUGIN_THREAD(false);
 
@@ -1494,17 +1494,17 @@ bool NP_CALLBACK
         *aIdentifiers = 0;
         *aCount = 0;
         return true;
     }
 
     return aNPObj->_class->enumerate(aNPObj, aIdentifiers, aCount);
 }
 
-bool NP_CALLBACK
+bool
 _construct(NPP aNPP,
            NPObject* aNPObj,
            const NPVariant* aArgs,
            uint32_t aArgCount,
            NPVariant* aResult)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     ENSURE_PLUGIN_THREAD(false);
@@ -1513,17 +1513,17 @@ bool NP_CALLBACK
         !NP_CLASS_STRUCT_VERSION_HAS_CTOR(aNPObj->_class) ||
         !aNPObj->_class->construct) {
         return false;
     }
 
     return aNPObj->_class->construct(aNPObj, aArgs, aArgCount, aResult);
 }
 
-void NP_CALLBACK
+void
 _releasevariantvalue(NPVariant* aVariant)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     // Only assert plugin thread here for consistency with in-process plugins.
     AssertPluginThread();
 
     if (NPVARIANT_IS_STRING(*aVariant)) {
         NPString str = NPVARIANT_TO_STRING(*aVariant);
@@ -1533,17 +1533,17 @@ void NP_CALLBACK
         NPObject* object = NPVARIANT_TO_OBJECT(*aVariant);
         if (object) {
             PluginModuleChild::NPN_ReleaseObject(object);
         }
     }
     VOID_TO_NPVARIANT(*aVariant);
 }
 
-void NP_CALLBACK
+void
 _setexception(NPObject* aNPObj,
               const NPUTF8* aMessage)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     ENSURE_PLUGIN_THREAD_VOID();
 
     PluginModuleChild* self = PluginModuleChild::current();
     PluginScriptableObjectChild* actor = nullptr;
@@ -1554,48 +1554,48 @@ void NP_CALLBACK
             return;
         }
     }
 
     self->SendNPN_SetException(static_cast<PPluginScriptableObjectChild*>(actor),
                                NullableString(aMessage));
 }
 
-void NP_CALLBACK
+void
 _pushpopupsenabledstate(NPP aNPP,
                         NPBool aEnabled)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     ENSURE_PLUGIN_THREAD_VOID();
 
     InstCast(aNPP)->CallNPN_PushPopupsEnabledState(aEnabled ? true : false);
 }
 
-void NP_CALLBACK
+void
 _poppopupsenabledstate(NPP aNPP)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     ENSURE_PLUGIN_THREAD_VOID();
 
     InstCast(aNPP)->CallNPN_PopPopupsEnabledState();
 }
 
-void NP_CALLBACK
+void
 _pluginthreadasynccall(NPP aNPP,
                        PluginThreadCallback aFunc,
                        void* aUserData)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     if (!aFunc)
         return;
 
     InstCast(aNPP)->AsyncCall(aFunc, aUserData);
 }
 
-NPError NP_CALLBACK
+NPError
 _getvalueforurl(NPP npp, NPNURLVariable variable, const char *url,
                 char **value, uint32_t *len)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     AssertPluginThread();
 
     if (!url)
         return NPERR_INVALID_URL;
@@ -1615,17 +1615,17 @@ NPError NP_CALLBACK
             *len = v.Length();
         }
         return result;
     }
 
     return NPERR_INVALID_PARAM;
 }
 
-NPError NP_CALLBACK
+NPError
 _setvalueforurl(NPP npp, NPNURLVariable variable, const char *url,
                 const char *value, uint32_t len)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     AssertPluginThread();
 
     if (!value)
         return NPERR_INVALID_PARAM;
@@ -1641,17 +1641,17 @@ NPError NP_CALLBACK
                                               nsDependentCString(value, len),
                                               &result);
         return result;
     }
 
     return NPERR_INVALID_PARAM;
 }
 
-NPError NP_CALLBACK
+NPError
 _getauthenticationinfo(NPP npp, const char *protocol,
                        const char *host, int32_t port,
                        const char *scheme, const char *realm,
                        char **username, uint32_t *ulen,
                        char **password, uint32_t *plen)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     AssertPluginThread();
@@ -1674,26 +1674,26 @@ NPError NP_CALLBACK
         *username = ToNewCString(u);
         *ulen = u.Length();
         *password = ToNewCString(p);
         *plen = p.Length();
     }
     return result;
 }
 
-uint32_t NP_CALLBACK
+uint32_t
 _scheduletimer(NPP npp, uint32_t interval, NPBool repeat,
                void (*timerFunc)(NPP npp, uint32_t timerID))
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     AssertPluginThread();
     return InstCast(npp)->ScheduleTimer(interval, repeat, timerFunc);
 }
 
-void NP_CALLBACK
+void
 _unscheduletimer(NPP npp, uint32_t timerID)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     AssertPluginThread();
     InstCast(npp)->UnscheduleTimer(timerID);
 }
 
 
@@ -1703,17 +1703,17 @@ static void ProcessBrowserEvents(void* p
 
     if (!pmc)
         return;
 
     pmc->CallProcessSomeEvents();
 }
 #endif
 
-NPError NP_CALLBACK
+NPError
 _popupcontextmenu(NPP instance, NPMenu* menu)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     AssertPluginThread();
 
 #ifdef MOZ_WIDGET_COCOA
     double pluginX, pluginY; 
     double screenX, screenY;
@@ -1754,17 +1754,17 @@ NPError NP_CALLBACK
     }
 
 #else
     NS_WARNING("Not supported on this platform!");
     return NPERR_GENERIC_ERROR;
 #endif
 }
 
-NPBool NP_CALLBACK
+NPBool
 _convertpoint(NPP instance, 
               double sourceX, double sourceY, NPCoordinateSpace sourceSpace,
               double *destX, double *destY, NPCoordinateSpace destSpace)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     if (!IsPluginThread()) {
         NS_WARNING("Not running on the plugin's main thread!");
         return false;
@@ -1782,37 +1782,37 @@ NPBool NP_CALLBACK
             *destX = rDestX;
         if (destY)
             *destY = rDestY;
     }
 
     return result;
 }
 
-void NP_CALLBACK
+void
 _urlredirectresponse(NPP instance, void* notifyData, NPBool allow)
 {
     InstCast(instance)->NPN_URLRedirectResponse(notifyData, allow);
 }
 
-NPError NP_CALLBACK
+NPError
 _initasyncsurface(NPP instance, NPSize *size,
                   NPImageFormat format, void *initData,
                   NPAsyncSurface *surface)
 {
     return InstCast(instance)->NPN_InitAsyncSurface(size, format, initData, surface);
 }
 
-NPError NP_CALLBACK
+NPError
 _finalizeasyncsurface(NPP instance, NPAsyncSurface *surface)
 {
     return InstCast(instance)->NPN_FinalizeAsyncSurface(surface);
 }
 
-void NP_CALLBACK
+void
 _setcurrentasyncsurface(NPP instance, NPAsyncSurface *surface, NPRect *changed)
 {
     InstCast(instance)->NPN_SetCurrentAsyncSurface(surface, changed);
 }
 
 } /* namespace child */
 } /* namespace plugins */
 } /* namespace mozilla */
@@ -2072,17 +2072,17 @@ PluginModuleChild::DeallocPPluginInstanc
     PLUGIN_LOG_DEBUG_METHOD;
     AssertPluginThread();
 
     delete aActor;
 
     return true;
 }
 
-NPObject* NP_CALLBACK
+NPObject*
 PluginModuleChild::NPN_CreateObject(NPP aNPP, NPClass* aClass)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     ENSURE_PLUGIN_THREAD(nullptr);
 
     PluginInstanceChild* i = InstCast(aNPP);
     if (i->mDeletingHash) {
         NS_ERROR("Plugin used NPP after NPP_Destroy");
@@ -2106,31 +2106,31 @@ PluginModuleChild::NPN_CreateObject(NPP 
     NPObjectData* d = static_cast<PluginModuleChild*>(i->Manager())
         ->mObjectMap.PutEntry(newObject);
     NS_ASSERTION(!d->instance, "New NPObject already mapped?");
     d->instance = i;
 
     return newObject;
 }
 
-NPObject* NP_CALLBACK
+NPObject*
 PluginModuleChild::NPN_RetainObject(NPObject* aNPObj)
 {
     AssertPluginThread();
 
 #ifdef NS_BUILD_REFCNT_LOGGING
     int32_t refCnt =
 #endif
     PR_ATOMIC_INCREMENT((int32_t*)&aNPObj->referenceCount);
     NS_LOG_ADDREF(aNPObj, refCnt, "NPObject", sizeof(NPObject));
 
     return aNPObj;
 }
 
-void NP_CALLBACK
+void
 PluginModuleChild::NPN_ReleaseObject(NPObject* aNPObj)
 {
     AssertPluginThread();
 
     NPObjectData* d = current()->mObjectMap.GetEntry(aNPObj);
     if (!d) {
         NS_ERROR("Releasing object not in mObjectMap?");
         return;
@@ -2187,17 +2187,17 @@ PluginModuleChild::CollectForInstance(NP
     PluginInstanceChild* instance = static_cast<PluginInstanceChild*>(userArg);
     if (d->instance == instance) {
         NPObject* o = d->GetKey();
         instance->mDeletingHash->PutEntry(o);
     }
     return PL_DHASH_NEXT;
 }
 
-NPIdentifier NP_CALLBACK
+NPIdentifier
 PluginModuleChild::NPN_GetStringIdentifier(const NPUTF8* aName)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     AssertPluginThread();
 
     if (!aName)
         return 0;
 
@@ -2210,17 +2210,17 @@ PluginModuleChild::NPN_GetStringIdentifi
 
         ident = new PluginIdentifierChildString(nameCopy);
         self->SendPPluginIdentifierConstructor(ident, nameCopy, -1, false);
     }
     ident->MakePermanent();
     return ident;
 }
 
-void NP_CALLBACK
+void
 PluginModuleChild::NPN_GetStringIdentifiers(const NPUTF8** aNames,
                                             int32_t aNameCount,
                                             NPIdentifier* aIdentifiers)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     AssertPluginThread();
 
     if (!(aNames && aNameCount > 0 && aIdentifiers)) {
@@ -2242,27 +2242,27 @@ PluginModuleChild::NPN_GetStringIdentifi
             ident = new PluginIdentifierChildString(nameCopy);
             self->SendPPluginIdentifierConstructor(ident, nameCopy, -1, false);
         }
         ident->MakePermanent();
         aIdentifiers[index] = ident;
     }
 }
 
-bool NP_CALLBACK
+bool
 PluginModuleChild::NPN_IdentifierIsString(NPIdentifier aIdentifier)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
 
     PluginIdentifierChild* ident =
         static_cast<PluginIdentifierChild*>(aIdentifier);
     return ident->IsString();
 }
 
-NPIdentifier NP_CALLBACK
+NPIdentifier
 PluginModuleChild::NPN_GetIntIdentifier(int32_t aIntId)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
     AssertPluginThread();
 
     PluginModuleChild* self = PluginModuleChild::current();
 
     PluginIdentifierChildInt* ident = self->mIntIdentifiers.Get(aIntId);
@@ -2272,28 +2272,28 @@ PluginModuleChild::NPN_GetIntIdentifier(
 
         ident = new PluginIdentifierChildInt(aIntId);
         self->SendPPluginIdentifierConstructor(ident, voidString, aIntId, false);
     }
     ident->MakePermanent();
     return ident;
 }
 
-NPUTF8* NP_CALLBACK
+NPUTF8*
 PluginModuleChild::NPN_UTF8FromIdentifier(NPIdentifier aIdentifier)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
 
     if (static_cast<PluginIdentifierChild*>(aIdentifier)->IsString()) {
       return static_cast<PluginIdentifierChildString*>(aIdentifier)->ToString();
     }
     return nullptr;
 }
 
-int32_t NP_CALLBACK
+int32_t
 PluginModuleChild::NPN_IntFromIdentifier(NPIdentifier aIdentifier)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
 
     if (!static_cast<PluginIdentifierChild*>(aIdentifier)->IsString()) {
       return static_cast<PluginIdentifierChildInt*>(aIdentifier)->ToInt();
     }
     return INT32_MIN;
--- a/dom/plugins/ipc/PluginModuleChild.h
+++ b/dom/plugins/ipc/PluginModuleChild.h
@@ -30,28 +30,18 @@
 
 #include "mozilla/plugins/PPluginModuleChild.h"
 #include "mozilla/plugins/PluginInstanceChild.h"
 #include "mozilla/plugins/PluginIdentifierChild.h"
 #include "mozilla/plugins/PluginMessageUtils.h"
 
 // NOTE: stolen from nsNPAPIPlugin.h
 
-/*
- * Use this macro before each exported function
- * (between the return address and the function
- * itself), to ensure that the function has the
- * right calling conventions on OS/2.
- */
-#define NP_CALLBACK NP_LOADDS
-
 #if defined(XP_WIN)
 #define NS_NPAPIPLUGIN_CALLBACK(_type, _name) _type (__stdcall * _name)
-#elif defined(XP_OS2)
-#define NS_NPAPIPLUGIN_CALLBACK(_type, _name) _type (_System * _name)
 #else
 #define NS_NPAPIPLUGIN_CALLBACK(_type, _name) _type (* _name)
 #endif
 
 typedef NS_NPAPIPLUGIN_CALLBACK(NPError, NP_GETENTRYPOINTS) (NPPluginFuncs* pCallbacks);
 typedef NS_NPAPIPLUGIN_CALLBACK(NPError, NP_PLUGININIT) (const NPNetscapeFuncs* pCallbacks);
 typedef NS_NPAPIPLUGIN_CALLBACK(NPError, NP_PLUGINUNIXINIT) (const NPNetscapeFuncs* pCallbacks, NPPluginFuncs* fCallbacks);
 typedef NS_NPAPIPLUGIN_CALLBACK(NPError, NP_PLUGINSHUTDOWN) (void);
@@ -193,37 +183,37 @@ public:
     bool NPObjectIsRegistered(NPObject* aObject);
 #endif
 
     bool AsyncDrawingAllowed() { return mAsyncDrawingAllowed; }
 
     /**
      * The child implementation of NPN_CreateObject.
      */
-    static NPObject* NP_CALLBACK NPN_CreateObject(NPP aNPP, NPClass* aClass);
+    static NPObject* NPN_CreateObject(NPP aNPP, NPClass* aClass);
     /**
      * The child implementation of NPN_RetainObject.
      */
-    static NPObject* NP_CALLBACK NPN_RetainObject(NPObject* aNPObj);
+    static NPObject* NPN_RetainObject(NPObject* aNPObj);
     /**
      * The child implementation of NPN_ReleaseObject.
      */
-    static void NP_CALLBACK NPN_ReleaseObject(NPObject* aNPObj);
+    static void NPN_ReleaseObject(NPObject* aNPObj);
 
     /**
      * The child implementations of NPIdentifier-related functions.
      */
-    static NPIdentifier NP_CALLBACK NPN_GetStringIdentifier(const NPUTF8* aName);
-    static void NP_CALLBACK NPN_GetStringIdentifiers(const NPUTF8** aNames,
+    static NPIdentifier NPN_GetStringIdentifier(const NPUTF8* aName);
+    static void NPN_GetStringIdentifiers(const NPUTF8** aNames,
                                                      int32_t aNameCount,
                                                      NPIdentifier* aIdentifiers);
-    static NPIdentifier NP_CALLBACK NPN_GetIntIdentifier(int32_t aIntId);
-    static bool NP_CALLBACK NPN_IdentifierIsString(NPIdentifier aIdentifier);
-    static NPUTF8* NP_CALLBACK NPN_UTF8FromIdentifier(NPIdentifier aIdentifier);
-    static int32_t NP_CALLBACK NPN_IntFromIdentifier(NPIdentifier aIdentifier);
+    static NPIdentifier NPN_GetIntIdentifier(int32_t aIntId);
+    static bool NPN_IdentifierIsString(NPIdentifier aIdentifier);
+    static NPUTF8* NPN_UTF8FromIdentifier(NPIdentifier aIdentifier);
+    static int32_t NPN_IntFromIdentifier(NPIdentifier aIdentifier);
 
 #ifdef MOZ_WIDGET_COCOA
     void ProcessNativeEvents();
     
     void PluginShowWindow(uint32_t window_id, bool modal, CGRect r) {
         SendPluginShowWindow(window_id, modal, r.origin.x, r.origin.y, r.size.width, r.size.height);
     }
 
--- a/dom/plugins/ipc/PluginModuleParent.cpp
+++ b/dom/plugins/ipc/PluginModuleParent.cpp
@@ -1290,17 +1290,17 @@ PluginModuleParent::NP_GetValue(void *fu
     PR_LOG(GetPluginLog(), PR_LOG_WARNING, ("%s Not implemented, requested variable %i", __FUNCTION__,
                                         (int) aVariable));
 
     //TODO: implement this correctly
     *error = NPERR_GENERIC_ERROR;
     return NS_OK;
 }
 
-#if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_OS2)
+#if defined(XP_WIN) || defined(XP_MACOSX)
 nsresult
 PluginModuleParent::NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error)
 {
     NS_ASSERTION(pFuncs, "Null pointer!");
 
     // We need to have the child process update its function table
     // here by actually calling NP_GetEntryPoints since the parent's
     // function table can reflect nullptr entries in the child's table.
--- a/dom/plugins/ipc/PluginModuleParent.h
+++ b/dom/plugins/ipc/PluginModuleParent.h
@@ -255,17 +255,17 @@ private:
     virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs, NPError* error);
 #else
     virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error);
 #endif
     virtual nsresult NP_Shutdown(NPError* error);
     virtual nsresult NP_GetMIMEDescription(const char** mimeDesc);
     virtual nsresult NP_GetValue(void *future, NPPVariable aVariable,
                                  void *aValue, NPError* error);
-#if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_OS2)
+#if defined(XP_WIN) || defined(XP_MACOSX)
     virtual nsresult NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error);
 #endif
     virtual nsresult NPP_New(NPMIMEType pluginType, NPP instance,
                              uint16_t mode, int16_t argc, char* argn[],
                              char* argv[], NPSavedData* saved,
                              NPError* error);
     virtual nsresult NPP_ClearSiteData(const char* site, uint64_t flags,
                                        uint64_t maxAge);
--- a/dom/plugins/test/testplugin/nptest.cpp
+++ b/dom/plugins/test/testplugin/nptest.cpp
@@ -642,17 +642,17 @@ NP_GetPluginVersion()
   return sPluginVersion;
 }
 #endif
 
 extern const char *sMimeDescription;
 
 #if defined(XP_UNIX)
 NP_EXPORT(const char*) NP_GetMIMEDescription()
-#elif defined(XP_WIN) || defined(XP_OS2)
+#elif defined(XP_WIN)
 const char* NP_GetMIMEDescription()
 #endif
 {
   return sMimeDescription;
 }
 
 #ifdef XP_UNIX
 NP_EXPORT(NPError)
@@ -696,17 +696,17 @@ static bool fillPluginFunctionTable(NPPl
   pFuncs->clearsitedata = NPP_ClearSiteData;
   pFuncs->getsiteswithdata = NPP_GetSitesWithData;
 
   return true;
 }
 
 #if defined(XP_MACOSX)
 NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs)
-#elif defined(XP_WIN) || defined(XP_OS2)
+#elif defined(XP_WIN)
 NPError OSCALL NP_Initialize(NPNetscapeFuncs* bFuncs)
 #elif defined(XP_UNIX)
 NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs)
 #endif
 {
   sBrowserFuncs = bFuncs;
 
   initializeIdentifiers();
@@ -736,32 +736,32 @@ NP_EXPORT(NPError) NP_Initialize(NPNetsc
   }
 #endif
 
   return NPERR_NO_ERROR;
 }
 
 #if defined(XP_MACOSX)
 NP_EXPORT(NPError) NP_GetEntryPoints(NPPluginFuncs* pFuncs)
-#elif defined(XP_WIN) || defined(XP_OS2)
+#elif defined(XP_WIN)
 NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs)
 #endif
-#if defined(XP_MACOSX) || defined(XP_WIN) || defined(XP_OS2)
+#if defined(XP_MACOSX) || defined(XP_WIN)
 {
   if (!fillPluginFunctionTable(pFuncs)) {
     return NPERR_INVALID_FUNCTABLE_ERROR;
   }
 
   return NPERR_NO_ERROR;
 }
 #endif
 
 #if defined(XP_UNIX)
 NP_EXPORT(NPError) NP_Shutdown()
-#elif defined(XP_WIN) || defined(XP_OS2)
+#elif defined(XP_WIN)
 NPError OSCALL NP_Shutdown()
 #endif
 {
   clearIdentifiers();
 
   for (unsigned int i = 0; i < ARRAY_LENGTH(sPluginPropertyValues); i++) {
     NPN_ReleaseVariantValue(&sPluginPropertyValues[i]);
   }
deleted file mode 100644
--- a/dom/plugins/test/testplugin/nptest_os2.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * 
- * Copyright (c) 2008, Mozilla Corporation
- * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * 
- * * Redistributions of source code must retain the above copyright notice, this
- *   list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * * Neither the name of the Mozilla Corporation nor the names of its
- *   contributors may be used to endorse or promote products derived from this
- *   software without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * 
- * Contributor(s):
- *   Josh Aas <josh@mozilla.com>
- * 
- * ***** END LICENSE BLOCK ***** */
-
-#include "nptest_platform.h"
-
- using namespace std;
-
-bool
-pluginSupportsWindowMode()
-{
-  return false;
-}
-
-bool
-pluginSupportsWindowlessMode()
-{
-  return true;
-}
-
-bool
-pluginSupportsAsyncBitmapDrawing()
-{
-  return false;
-}
-
-NPError
-pluginInstanceInit(InstanceData* instanceData)
-{
-  return NPERR_NO_ERROR;
-}
-
-void
-pluginInstanceShutdown(InstanceData* instanceData)
-{
-}
-
-void
-pluginDoSetWindow(InstanceData* instanceData, NPWindow* newWindow)
-{
-  instanceData->window = *newWindow;
-}
-
-void
-pluginWidgetInit(InstanceData* instanceData, void* oldWindow)
-{
-}
-
-int16_t
-pluginHandleEvent(InstanceData* instanceData, void* event)
-{
-  return 0;
-}
-
-int32_t pluginGetEdge(InstanceData* instanceData, RectEdge edge)
-{
-  // XXX nothing here yet since we don't support windowed plugins
-  return NPTEST_INT32_ERROR;
-}
-
-int32_t pluginGetClipRegionRectCount(InstanceData* instanceData)
-{
-  // XXX nothing here yet since we don't support windowed plugins
-  return NPTEST_INT32_ERROR;
-}
-
-int32_t pluginGetClipRegionRectEdge(InstanceData* instanceData, 
-    int32_t rectIndex, RectEdge edge)
-{
-  // XXX nothing here yet since we don't support windowed plugins
-  return NPTEST_INT32_ERROR;
-}
-
-void pluginDoInternalConsistencyCheck(InstanceData* instanceData, string& error)
-{
-}
--- a/dom/plugins/test/testplugin/testplugin.mozbuild
+++ b/dom/plugins/test/testplugin/testplugin.mozbuild
@@ -23,20 +23,16 @@ if toolkit == 'cocoa':
 elif toolkit == 'gtk2':
     UNIFIED_SOURCES += [
         relative_path + '/nptest_gtk2.cpp',
     ]
 elif toolkit == 'android':
     UNIFIED_SOURCES += [
         relative_path + '/nptest_droid.cpp',
     ]
-elif toolkit == 'os2':
-    UNIFIED_SOURCES += [
-        relative_path + '/nptest_os2.cpp',
-    ]
 elif toolkit == 'qt':
     UNIFIED_SOURCES += [
         relative_path + '/nptest_qt.cpp',
     ]
 elif toolkit == 'windows':
     UNIFIED_SOURCES += [
         relative_path + '/nptest_windows.cpp',
     ]
--- a/dom/xbl/builtin/moz.build
+++ b/dom/xbl/builtin/moz.build
@@ -1,15 +1,15 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-if CONFIG['OS_ARCH'] in ('OS2', 'WINNT'):
+if CONFIG['OS_ARCH'] == 'WINNT':
     DIRS += ['win']
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
     DIRS += ['mac']
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
     DIRS += ['android']
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] in ('qt', 'gtk2'):
     DIRS += ['unix']
 else:
--- a/dom/xslt/xslt/txXPathResultComparator.cpp
+++ b/dom/xslt/xslt/txXPathResultComparator.cpp
@@ -7,17 +7,16 @@
 
 #include "txXPathResultComparator.h"
 #include "txExpr.h"
 #include "txCore.h"
 #include "nsCollationCID.h"
 #include "nsILocale.h"
 #include "nsILocaleService.h"
 #include "nsIServiceManager.h"
-#include "nsLocaleCID.h"
 #include "prmem.h"
 
 #define kAscending (1<<0)
 #define kUpperFirst (1<<1)
 
 txResultStringComparator::txResultStringComparator(bool aAscending,
                                                    bool aUpperFirst,
                                                    const nsAFlatString& aLanguage)
--- a/editor/libeditor/html/nsHTMLEditorEventListener.cpp
+++ b/editor/libeditor/html/nsHTMLEditorEventListener.cpp
@@ -199,19 +199,17 @@ nsHTMLEditorEventListener::MouseDown(nsI
     // HACK !!! Context click places the caret but the context menu consumes
     // the event; so we need to check resizing state ourselves
     htmlEditor->CheckSelectionStateForAnonymousButtons(selection);
 
     // Prevent bubbling if we changed selection or 
     //   for all context clicks
     if (element || isContextClick)
     {
-    #ifndef XP_OS2
       mouseEvent->PreventDefault();
-    #endif
       return NS_OK;
     }
   }
   else if (!isContextClick && buttonNumber == 0 && clickCount == 1)
   {
     // if the target element is an image, we have to display resizers
     int32_t clientX, clientY;
     mouseEvent->GetClientX(&clientX);
--- a/embedding/browser/webBrowser/nsIPrintingPrompt.idl
+++ b/embedding/browser/webBrowser/nsIPrintingPrompt.idl
@@ -86,25 +86,16 @@ interface nsIPrintingPrompt : nsISupport
    *                
    *  GTK: There are no native dialog for GTK.
    *
    *       Defaults for platform service:           
    *         showPrintDialog       - displays a XUL dialog
    *         showPageSetup         - displays a XUL dialog
    *         showProgress          - displays a XUL dialog
    *         showPrinterProperties - displays a XUL dialog
-   *              
-   *  OS2: 
-   *
-   *       Defaults for platform service:           
-   *         showPrintDialog       - displays a XUL dialog
-   *         showPageSetup         - displays a XUL dialog
-   *         showProgress          - displays a XUL dialog
-   *         showPrinterProperties - displays a native dialog
-   *              
    *
    */
  
 
   /**
    *  Show the Print Dialog 
    *
    *  @param webBrowserPrint - represents the document to be printed
--- a/embedding/browser/webBrowser/nsIPrintingPromptService.idl
+++ b/embedding/browser/webBrowser/nsIPrintingPromptService.idl
@@ -82,25 +82,16 @@ interface nsIPrintingPromptService : nsI
    *                
    *  GTK: There are no native dialog for GTK.
    *
    *       Defaults for platform service:           
    *         showPrintDialog       - displays a XUL dialog
    *         showPageSetup         - displays a XUL dialog
    *         showProgress          - displays a XUL dialog
    *         showPrinterProperties - displays a XUL dialog
-   *              
-   *  OS2: 
-   *
-   *       Defaults for platform service:           
-   *         showPrintDialog       - displays a XUL dialog
-   *         showPageSetup         - displays a XUL dialog
-   *         showProgress          - displays a XUL dialog
-   *         showPrinterProperties - displays a native dialog
-   *              
    *
    */
  
 
 
   /**
    *  Show the Print Dialog 
    *
--- a/embedding/components/build/moz.build
+++ b/embedding/components/build/moz.build
@@ -16,21 +16,17 @@ FINAL_LIBRARY = 'xul'
 LOCAL_INCLUDES += [
     '../appstartup/src',
     '../commandhandler/src',
     '../find/src',
     '../webbrowserpersist/src',
     '../windowwatcher/src',
 ]
 
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'os2':
-    LOCAL_INCLUDES += [
-        '../printingui/src/os2',
-    ]
-elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
+if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
     LOCAL_INCLUDES += [
         '../printingui/src/win',
     ]
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
     LOCAL_INCLUDES += [
         '../printingui/src/mac',
     ]
 
--- a/embedding/components/printingui/src/moz.build
+++ b/embedding/components/printingui/src/moz.build
@@ -1,16 +1,14 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 toolkit = CONFIG['MOZ_WIDGET_TOOLKIT']
 
-if toolkit == 'os2':
-    DIRS += ['os2']
-elif toolkit == 'windows':
+if toolkit == 'windows':
     DIRS += ['win']
 elif toolkit == 'cocoa':
     DIRS += ['mac']
 elif CONFIG['MOZ_PDF_PRINTING']:
     DIRS += ['unixshared']
deleted file mode 100644
--- a/embedding/components/printingui/src/os2/moz.build
+++ /dev/null
@@ -1,13 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-SOURCES += [
-    'nsPrintingPromptService.cpp',
-    'nsPrintProgress.cpp',
-    'nsPrintProgressParams.cpp',
-]
-
-FINAL_LIBRARY = 'embedcomponents'
deleted file mode 100644
--- a/embedding/components/printingui/src/os2/nsPrintProgress.cpp
+++ /dev/null
@@ -1,254 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsPrintProgress.h"
-
-#include "nsIBaseWindow.h"
-#include "nsISupportsArray.h"
-#include "nsXPCOM.h"
-#include "nsISupportsPrimitives.h"
-#include "nsIComponentManager.h"
-
-NS_IMPL_ADDREF(nsPrintProgress)
-NS_IMPL_RELEASE(nsPrintProgress)
-
-NS_INTERFACE_MAP_BEGIN(nsPrintProgress)
-   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIPrintStatusFeedback)
-   NS_INTERFACE_MAP_ENTRY(nsIPrintProgress)
-   NS_INTERFACE_MAP_ENTRY(nsIPrintStatusFeedback)
-   NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener)
-NS_INTERFACE_MAP_END_THREADSAFE
-
-
-nsPrintProgress::nsPrintProgress()
-{
-  m_closeProgress = false;
-  m_processCanceled = false;
-  m_pendingStateFlags = -1;
-  m_pendingStateValue = 0;
-}
-
-nsPrintProgress::~nsPrintProgress()
-{
-  (void)ReleaseListeners();
-}
-
-/* void openProgressDialog (in nsIDOMWindow parent, in string dialogURL, in nsISupports parameters); */
-NS_IMETHODIMP nsPrintProgress::OpenProgressDialog(nsIDOMWindow *parent,
-                                                  const char *dialogURL,
-                                                  nsISupports *parameters, 
-                                                  nsIObserver *openDialogObserver,
-                                                  bool *notifyOnOpen)
-{
-  *notifyOnOpen = true;
-  m_observer = openDialogObserver;
-  nsresult rv = NS_ERROR_FAILURE;
-  
-  if (m_dialog)
-    return NS_ERROR_ALREADY_INITIALIZED;
-  
-  if (!dialogURL || !*dialogURL)
-    return NS_ERROR_INVALID_ARG;
-
-  if (parent)
-  {
-    // Set up window.arguments[0]...
-    nsCOMPtr<nsISupportsArray> array;
-    rv = NS_NewISupportsArray(getter_AddRefs(array));
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    nsCOMPtr<nsISupportsInterfacePointer> ifptr =
-      do_CreateInstance(NS_SUPPORTS_INTERFACE_POINTER_CONTRACTID, &rv);
-    NS_ENSURE_SUCCESS(rv, rv);
-    
-    ifptr->SetData(static_cast<nsIPrintProgress*>(this));
-    ifptr->SetDataIID(&NS_GET_IID(nsIPrintProgress));
-
-    array->AppendElement(ifptr);
-
-    array->AppendElement(parameters);
-
-    // Open the dialog.
-    nsCOMPtr<nsIDOMWindow> newWindow;
-    rv = parent->OpenDialog(NS_ConvertASCIItoUTF16(dialogURL),
-                            NS_LITERAL_STRING("_blank"),
-                            NS_LITERAL_STRING("chrome,titlebar,dependent,centerscreen"),
-                            array, getter_AddRefs(newWindow));
-  }
-
-  return rv;
-}
-
-/* void closeProgressDialog (in boolean forceClose); */
-NS_IMETHODIMP nsPrintProgress::CloseProgressDialog(bool forceClose)
-{
-  m_closeProgress = true;
-  return OnStateChange(nullptr, nullptr, nsIWebProgressListener::STATE_STOP, forceClose);
-}
-
-/* nsIPrompt GetPrompter (); */
-NS_IMETHODIMP nsPrintProgress::GetPrompter(nsIPrompt **_retval)
-{
-  NS_ENSURE_ARG_POINTER(_retval);
-  *_retval = nullptr;
-
-  if (! m_closeProgress && m_dialog)
-    return m_dialog->GetPrompter(_retval);
-    
-  return NS_ERROR_FAILURE;
-}
-
-/* attribute boolean processCanceledByUser; */
-NS_IMETHODIMP nsPrintProgress::GetProcessCanceledByUser(bool *aProcessCanceledByUser)
-{
-  NS_ENSURE_ARG_POINTER(aProcessCanceledByUser);
-  *aProcessCanceledByUser = m_processCanceled;
-  return NS_OK;
-}
-NS_IMETHODIMP nsPrintProgress::SetProcessCanceledByUser(bool aProcessCanceledByUser)
-{
-  m_processCanceled = aProcessCanceledByUser;
-  OnStateChange(nullptr, nullptr, nsIWebProgressListener::STATE_STOP, false);
-  return NS_OK;
-}
-
-/* void RegisterListener (in nsIWebProgressListener listener); */
-NS_IMETHODIMP nsPrintProgress::RegisterListener(nsIWebProgressListener * listener)
-{
-  if (!listener) //Nothing to do with a null listener!
-    return NS_OK;
-  
-  m_listenerList.AppendObject(listener);
-  if (m_closeProgress || m_processCanceled)
-    listener->OnStateChange(nullptr, nullptr, nsIWebProgressListener::STATE_STOP, 0);
-  else
-  {
-    listener->OnStatusChange(nullptr, nullptr, 0, m_pendingStatus.get());
-    if (m_pendingStateFlags != -1)
-      listener->OnStateChange(nullptr, nullptr, m_pendingStateFlags, m_pendingStateValue);
-  }
-    
-  return NS_OK;
-}
-
-/* void UnregisterListener (in nsIWebProgressListener listener); */
-NS_IMETHODIMP nsPrintProgress::UnregisterListener(nsIWebProgressListener *listener)
-{
-  if (listener)
-    m_listenerList.RemoveObject(listener);
-  
-  return NS_OK;
-}
-
-/* void doneIniting (); */
-NS_IMETHODIMP nsPrintProgress::DoneIniting()
-{
-  if (m_observer) {
-    m_observer->Observe(nullptr, nullptr, nullptr);
-  }
-  return NS_OK;
-}
-
-/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long aStateFlags, in nsresult aStatus); */
-NS_IMETHODIMP nsPrintProgress::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, uint32_t aStateFlags, nsresult aStatus)
-{
-  m_pendingStateFlags = aStateFlags;
-  m_pendingStateValue = aStatus;
-  
-  uint32_t count = m_listenerList.Count();
-  for (uint32_t i = count - 1; i < count; i --)
-  {
-    nsCOMPtr<nsIWebProgressListener> progressListener = m_listenerList.SafeObjectAt(i);
-    if (progressListener)
-      progressListener->OnStateChange(aWebProgress, aRequest, aStateFlags, aStatus);
-  }
-  
-  return NS_OK;
-}
-
-/* void onProgressChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aCurSelfProgress, in long aMaxSelfProgress, in long aCurTotalProgress, in long aMaxTotalProgress); */
-NS_IMETHODIMP nsPrintProgress::OnProgressChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, int32_t aCurSelfProgress, int32_t aMaxSelfProgress, int32_t aCurTotalProgress, int32_t aMaxTotalProgress)
-{
-  uint32_t count = m_listenerList.Count();
-  for (uint32_t i = count - 1; i < count; i --)
-  {
-    nsCOMPtr<nsIWebProgressListener> progressListener = m_listenerList.safeObjectAt(i);
-    if (progressListener)
-      progressListener->OnProgressChange(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress);
-  }
-  
-  return NS_OK;
-}
-
-/* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI location, in unsigned long aFlags); */
-NS_IMETHODIMP nsPrintProgress::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location, uint32_t aFlags)
-{
-    return NS_OK;
-}
-
-/* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */
-NS_IMETHODIMP nsPrintProgress::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const char16_t *aMessage)
-{
-  if (aMessage && *aMessage)
-  m_pendingStatus = aMessage;
-
-  uint32_t count = m_listenerList.Count();
-  for (uint32_t i = count - 1; i < count; i --)
-  {
-    nsCOMPtr<nsIWebProgressListener> progressListener = m_listenerList.SafeObjectAt(i);
-    if (progressListener)
-      progressListener->OnStatusChange(aWebProgress, aRequest, aStatus, aMessage);
-  }
-  
-  return NS_OK;
-}
-
-/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */
-NS_IMETHODIMP nsPrintProgress::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, uint32_t state)
-{
-    return NS_OK;
-}
-
-nsresult nsPrintProgress::ReleaseListeners()
-{
-  m_listenerList.Clear();
-  return NS_OK;
-}
-
-NS_IMETHODIMP nsPrintProgress::ShowStatusString(const char16_t *status)
-{
-  return OnStatusChange(nullptr, nullptr, NS_OK, status);
-}
-
-/* void startMeteors (); */
-NS_IMETHODIMP nsPrintProgress::StartMeteors()
-{
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void stopMeteors (); */
-NS_IMETHODIMP nsPrintProgress::StopMeteors()
-{
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void showProgress (in long percent); */
-NS_IMETHODIMP nsPrintProgress::ShowProgress(int32_t percent)
-{
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* [noscript] void setDocShell (in nsIDocShell shell, in nsIDOMWindow window); */
-NS_IMETHODIMP nsPrintProgress::SetDocShell(nsIDocShell *shell, nsIDOMWindow *window)
-{
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* void closeWindow (); */
-NS_IMETHODIMP nsPrintProgress::CloseWindow()
-{
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
deleted file mode 100644
--- a/embedding/components/printingui/src/os2/nsPrintProgress.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef __nsPrintProgress_h
-#define __nsPrintProgress_h
-
-#include "nsIPrintProgress.h"
-
-#include "nsCOMArray.h"
-#include "nsCOMPtr.h"
-#include "nsIDOMWindow.h"
-#include "nsIPrintStatusFeedback.h"
-#include "nsIObserver.h"
-#include "nsString.h"
-
-class nsPrintProgress : public nsIPrintProgress, public nsIPrintStatusFeedback
-{
-public: 
-	NS_DECL_THREADSAFE_ISUPPORTS
-  NS_DECL_NSIPRINTPROGRESS
-  NS_DECL_NSIWEBPROGRESSLISTENER
-  NS_DECL_NSIPRINTSTATUSFEEDBACK
-
-	nsPrintProgress();
-	virtual ~nsPrintProgress();
-
-private:
-  nsresult ReleaseListeners();
-
-  bool                              m_closeProgress;
-  bool                              m_processCanceled;
-  nsString                          m_pendingStatus;
-  int32_t                           m_pendingStateFlags;
-  int32_t                           m_pendingStateValue;
-  nsCOMPtr<nsIDOMWindow>            m_dialog;
-  nsCOMArray<nsIWebProgressListener>        m_listenerList;
-  nsCOMPtr<nsIObserver>             m_observer;
-};
-
-#endif
deleted file mode 100644
--- a/embedding/components/printingui/src/os2/nsPrintProgressParams.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsPrintProgressParams.h"
-#include "nsReadableUtils.h"
-
-
-NS_IMPL_ISUPPORTS1(nsPrintProgressParams, nsIPrintProgressParams)
-
-nsPrintProgressParams::nsPrintProgressParams()
-{
-}
-
-nsPrintProgressParams::~nsPrintProgressParams()
-{
-}
-
-/* attribute wstring docTitle; */
-NS_IMETHODIMP nsPrintProgressParams::GetDocTitle(char16_t * *aDocTitle)
-{
-  NS_ENSURE_ARG(aDocTitle);
-  
-  *aDocTitle = ToNewUnicode(mDocTitle);
-  return NS_OK;
-}
-
-NS_IMETHODIMP nsPrintProgressParams::SetDocTitle(const char16_t * aDocTitle)
-{
-  mDocTitle = aDocTitle;
-  return NS_OK;
-}
-
-/* attribute wstring docURL; */
-NS_IMETHODIMP nsPrintProgressParams::GetDocURL(char16_t * *aDocURL)
-{
-  NS_ENSURE_ARG(aDocURL);
-  
-  *aDocURL = ToNewUnicode(mDocURL);
-  return NS_OK;
-}
-
-NS_IMETHODIMP nsPrintProgressParams::SetDocURL(const char16_t * aDocURL)
-{
-  mDocURL = aDocURL;
-  return NS_OK;
-}
-
deleted file mode 100644
--- a/embedding/components/printingui/src/os2/nsPrintProgressParams.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef __nsPrintProgressParams_h
-#define __nsPrintProgressParams_h
-
-#include "nsIPrintProgressParams.h"
-#include "nsString.h"
-
-class nsPrintProgressParams : public nsIPrintProgressParams
-{
-public: 
-	NS_DECL_ISUPPORTS
-  NS_DECL_NSIPRINTPROGRESSPARAMS
-
-	nsPrintProgressParams();
-	virtual ~nsPrintProgressParams();
-
-private:
-  nsString mDocTitle;
-  nsString mDocURL;
-};
-
-#endif
deleted file mode 100644
--- a/embedding/components/printingui/src/os2/nsPrintingPromptService.cpp
+++ /dev/null
@@ -1,288 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsPrintingPromptService.h"
-
-#include "nsIComponentManager.h"
-#include "nsIDialogParamBlock.h"
-#include "nsIDOMWindow.h"
-#include "nsIServiceManager.h"
-#include "nsISupportsUtils.h"
-#include "nsISupportsArray.h"
-#include "nsString.h"
-
-// Printing Progress Includes
-#include "nsPrintProgress.h"
-#include "nsPrintProgressParams.h"
-
-// Print Service Includes
-#include "nsIPrintOptions.h"
-#include "nsIServiceManager.h"
-#include "nsGfxCIID.h"
-static const char sPrintOptionsContractID[] = "@mozilla.org/gfx/printsettings-service;1";
-
-static const char *kPrintDialogURL         = "chrome://global/content/printdialog.xul";
-static const char *kPrintProgressDialogURL = "chrome://global/content/printProgress.xul";
-static const char *kPrtPrvProgressDialogURL = "chrome://global/content/printPreviewProgress.xul";
-static const char *kPageSetupDialogURL     = "chrome://global/content/printPageSetup.xul";
-
-/****************************************************************
- ************************* ParamBlock ***************************
- ****************************************************************/
-
-class ParamBlock {
-
-public:
-    ParamBlock() 
-    {
-        mBlock = 0;
-    }
-    ~ParamBlock() 
-    {
-        NS_IF_RELEASE(mBlock);
-    }
-    nsresult Init() {
-      return CallCreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID, &mBlock);
-    }
-    nsIDialogParamBlock * operator->() const { return mBlock; }
-    operator nsIDialogParamBlock * const ()  { return mBlock; }
-
-private:
-    nsIDialogParamBlock *mBlock;
-};
-
-/****************************************************************
- ***************** nsPrintingPromptService **********************
- ****************************************************************/
-
-NS_IMPL_ISUPPORTS2(nsPrintingPromptService, nsIPrintingPromptService, nsIWebProgressListener)
-
-nsPrintingPromptService::nsPrintingPromptService() 
-{
-}
-
-nsPrintingPromptService::~nsPrintingPromptService() 
-{
-}
-
-nsresult
-nsPrintingPromptService::Init()
-{
-    nsresult rv;
-    mWatcher = do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv);
-    return rv;
-}
-
-/* void showPrintDialog (in nsIDOMWindow parent, in nsIWebBrowserPrint webBrowserPrint, in nsIPrintSettings printSettings); */
-NS_IMETHODIMP 
-nsPrintingPromptService::ShowPrintDialog(nsIDOMWindow *parent, nsIWebBrowserPrint *webBrowserPrint, nsIPrintSettings *printSettings)
-{
-    NS_ENSURE_ARG(webBrowserPrint);
-    NS_ENSURE_ARG(printSettings);
-
-    ParamBlock block;
-    nsresult rv = block.Init();
-    if (NS_FAILED(rv))
-      return rv;
-
-    block->SetInt(0, 0);
-    return DoDialog(parent, block, webBrowserPrint, printSettings, kPrintDialogURL);
-}
-
-/* void showProgress (in nsIDOMWindow parent, in nsIWebBrowserPrint webBrowserPrint, in nsIPrintSettings printSettings, in nsIObserver openDialogObserver, in boolean isForPrinting, out nsIWebProgressListener webProgressListener, out nsIPrintProgressParams printProgressParams, out boolean notifyOnOpen); */
-NS_IMETHODIMP 
-nsPrintingPromptService::ShowProgress(nsIDOMWindow*            parent, 
-                                      nsIWebBrowserPrint*      webBrowserPrint,    // ok to be null
-                                      nsIPrintSettings*        printSettings,      // ok to be null
-                                      nsIObserver*             openDialogObserver, // ok to be null
-                                      bool                     isForPrinting,
-                                      nsIWebProgressListener** webProgressListener,
-                                      nsIPrintProgressParams** printProgressParams,
-                                      bool*                  notifyOnOpen)
-{
-    NS_ENSURE_ARG(webProgressListener);
-    NS_ENSURE_ARG(printProgressParams);
-    NS_ENSURE_ARG(notifyOnOpen);
-
-    *notifyOnOpen = false;
-
-    nsPrintProgress* prtProgress = new nsPrintProgress();
-    mPrintProgress = prtProgress;
-    mWebProgressListener = prtProgress;
-
-    nsCOMPtr<nsIPrintProgressParams> prtProgressParams = new nsPrintProgressParams();
-      
-    nsCOMPtr<nsIDOMWindow> parentWindow = parent;
-
-    if (mWatcher && !parentWindow) {
-        mWatcher->GetActiveWindow(getter_AddRefs(parentWindow));
-    }
-
-    if (parentWindow) {
-        mPrintProgress->OpenProgressDialog(parentWindow,
-                                           isForPrinting ? kPrintProgressDialogURL : kPrtPrvProgressDialogURL,
-                                           prtProgressParams, openDialogObserver, notifyOnOpen);
-    }
-
-    prtProgressParams.forget(printProgressParams);
-    nsCOMPtr<nsIWebProgressListener> myWebProgressListener = this;
-    myWebProgressListener.forget(webProgressListener);
-
-    return NS_OK;
-}
-
-/* void showPageSetup (in nsIDOMWindow parent, in nsIPrintSettings printSettings); */
-NS_IMETHODIMP 
-nsPrintingPromptService::ShowPageSetup(nsIDOMWindow *parent, nsIPrintSettings *printSettings, nsIObserver *aObs)
-{
-    NS_ENSURE_ARG(printSettings);
-
-    ParamBlock block;
-    nsresult rv = block.Init();
-    if (NS_FAILED(rv))
-      return rv;
-
-    block->SetInt(0, 0);
-    return DoDialog(parent, block, nullptr, printSettings, kPageSetupDialogURL);
-}
-
-/* void showPrinterProperties (in nsIDOMWindow parent, in wstring printerName, in nsIPrintSettings printSettings); */
-NS_IMETHODIMP 
-nsPrintingPromptService::ShowPrinterProperties(nsIDOMWindow *parent, const char16_t *printerName, nsIPrintSettings *printSettings)
-{
-  nsresult rv = NS_ERROR_FAILURE;
-  nsCOMPtr<nsIPrintOptions> printService = do_GetService(sPrintOptionsContractID, &rv);
-  if (NS_SUCCEEDED(rv)) {
-    bool displayed;
-    rv = printService->DisplayJobProperties(printerName, printSettings, &displayed);
-  }
-  return rv;
-}
-
-nsresult
-nsPrintingPromptService::DoDialog(nsIDOMWindow *aParent,
-                                  nsIDialogParamBlock *aParamBlock, 
-                                  nsIWebBrowserPrint *aWebBrowserPrint, 
-                                  nsIPrintSettings* aPS,
-                                  const char *aChromeURL)
-{
-    NS_ENSURE_ARG(aParamBlock);
-    NS_ENSURE_ARG(aPS);
-    NS_ENSURE_ARG(aChromeURL);
-
-    if (!mWatcher)
-        return NS_ERROR_FAILURE;
-
-    nsresult rv = NS_OK;
-
-    // get a parent, if at all possible
-    // (though we'd rather this didn't fail, it's OK if it does. so there's
-    // no failure or null check.)
-    nsCOMPtr<nsIDOMWindow> activeParent; // retain ownership for method lifetime
-    if (!aParent) 
-    {
-        mWatcher->GetActiveWindow(getter_AddRefs(activeParent));
-        aParent = activeParent;
-    }
-
-    // create a nsISupportsArray of the parameters 
-    // being passed to the window
-    nsCOMPtr<nsISupportsArray> array;
-    NS_NewISupportsArray(getter_AddRefs(array));
-    if (!array) return NS_ERROR_FAILURE;
-
-    nsCOMPtr<nsISupports> psSupports(do_QueryInterface(aPS));
-    NS_ASSERTION(psSupports, "PrintSettings must be a supports");
-    array->AppendElement(psSupports);
-
-    if (aWebBrowserPrint) {
-      nsCOMPtr<nsISupports> wbpSupports(do_QueryInterface(aWebBrowserPrint));
-      NS_ASSERTION(wbpSupports, "nsIWebBrowserPrint must be a supports");
-      array->AppendElement(wbpSupports);
-    }
-
-    nsCOMPtr<nsISupports> blkSupps(do_QueryInterface(aParamBlock));
-    NS_ASSERTION(blkSupps, "IOBlk must be a supports");
-    array->AppendElement(blkSupps);
-
-    nsCOMPtr<nsISupports> arguments(do_QueryInterface(array));
-    NS_ASSERTION(array, "array must be a supports");
-
-
-    nsCOMPtr<nsIDOMWindow> dialog;
-    rv = mWatcher->OpenWindow(aParent, aChromeURL, "_blank",
-                              "centerscreen,chrome,modal,titlebar", arguments,
-                              getter_AddRefs(dialog));
-
-    // if aWebBrowserPrint is not null then we are printing
-    // so we want to pass back NS_ERROR_ABORT on cancel
-    if (NS_SUCCEEDED(rv) && aWebBrowserPrint) 
-    {
-        int32_t status;
-        aParamBlock->GetInt(0, &status);
-        return status == 0?NS_ERROR_ABORT:NS_OK;
-    }
-
-    return rv;
-}
-
-//////////////////////////////////////////////////////////////////////
-// nsIWebProgressListener
-//////////////////////////////////////////////////////////////////////
-
-/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long aStateFlags, in nsresult aStatus); */
-NS_IMETHODIMP 
-nsPrintingPromptService::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, uint32_t aStateFlags, nsresult aStatus)
-{
-  if ((aStateFlags & STATE_STOP) && mWebProgressListener) {
-    mWebProgressListener->OnStateChange(aWebProgress, aRequest, aStateFlags, aStatus);
-    if (mPrintProgress) {
-      mPrintProgress->CloseProgressDialog(true);
-    }
-    mPrintProgress       = nullptr;
-    mWebProgressListener = nullptr;
-  }
-  return NS_OK;
-}
-
-/* void onProgressChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aCurSelfProgress, in long aMaxSelfProgress, in long aCurTotalProgress, in long aMaxTotalProgress); */
-NS_IMETHODIMP 
-nsPrintingPromptService::OnProgressChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, int32_t aCurSelfProgress, int32_t aMaxSelfProgress, int32_t aCurTotalProgress, int32_t aMaxTotalProgress)
-{
-  if (mWebProgressListener) {
-    return mWebProgressListener->OnProgressChange(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress);
-  }
-  return NS_OK;
-}
-
-/* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI location, in unsigned long aFlags); */
-NS_IMETHODIMP 
-nsPrintingPromptService::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location, uint32_t aFlags)
-{
-  if (mWebProgressListener) {
-    return mWebProgressListener->OnLocationChange(aWebProgress, aRequest, location, aFlags);
-  }
-  return NS_OK;
-}
-
-/* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */
-NS_IMETHODIMP 
-nsPrintingPromptService::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const char16_t *aMessage)
-{
-  if (mWebProgressListener) {
-    return mWebProgressListener->OnStatusChange(aWebProgress, aRequest, aStatus, aMessage);
-  }
-  return NS_OK;
-}
-
-/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */
-NS_IMETHODIMP 
-nsPrintingPromptService::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, uint32_t state)
-{
-  if (mWebProgressListener) {
-    return mWebProgressListener->OnSecurityChange(aWebProgress, aRequest, state);
-  }
-  return NS_OK;
-}
deleted file mode 100644
--- a/embedding/components/printingui/src/os2/nsPrintingPromptService.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef __nsPrintingPromptService_h
-#define __nsPrintingPromptService_h
-
-// {E042570C-62DE-4bb6-A6E0-798E3C07B4DF}
-#define NS_PRINTINGPROMPTSERVICE_CID \
- {0xe042570c, 0x62de, 0x4bb6, { 0xa6, 0xe0, 0x79, 0x8e, 0x3c, 0x7, 0xb4, 0xdf}}
-#define NS_PRINTINGPROMPTSERVICE_CONTRACTID \
- "@mozilla.org/embedcomp/printingprompt-service;1"
-
-#include "nsCOMPtr.h"
-#include "nsIPrintingPromptService.h"
-#include "nsPIPromptService.h"
-#include "nsIWindowWatcher.h"
-
-// Printing Progress Includes
-#include "nsPrintProgress.h"
-#include "nsPrintProgressParams.h"
-#include "nsIWebProgressListener.h"
-
-class nsIDOMWindow;
-class nsIDialogParamBlock;
-
-class nsPrintingPromptService: public nsIPrintingPromptService,
-                               public nsIWebProgressListener
-{
-
-public:
-
-  nsPrintingPromptService();
-  virtual ~nsPrintingPromptService();
-
-  nsresult Init();
-
-  NS_DECL_NSIPRINTINGPROMPTSERVICE
-  NS_DECL_NSIWEBPROGRESSLISTENER
-  NS_DECL_ISUPPORTS
-
-private:
-  nsresult DoDialog(nsIDOMWindow *aParent,
-                    nsIDialogParamBlock *aParamBlock, 
-                    nsIWebBrowserPrint *aWebBrowserPrint, 
-                    nsIPrintSettings* aPS,
-                    const char *aChromeURL);
-
-  nsCOMPtr<nsIWindowWatcher> mWatcher;
-  nsCOMPtr<nsIPrintProgress> mPrintProgress;
-  nsCOMPtr<nsIWebProgressListener> mWebProgressListener;
-};
-
-#endif
-
--- a/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp
+++ b/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp
@@ -5,20 +5,16 @@
 
 #include "mozilla/ArrayUtils.h"
 
 #include "nspr.h"
 
 #include "nsIFileStreams.h"       // New Necko file streams
 #include <algorithm>
 
-#ifdef XP_OS2
-#include "nsILocalFileOS2.h"
-#endif
-
 #include "nsNetUtil.h"
 #include "nsComponentManagerUtils.h"
 #include "nsIComponentRegistrar.h"
 #include "nsIStorageStream.h"
 #include "nsISeekableStream.h"
 #include "nsIHttpChannel.h"
 #include "nsIHttpChannelInternal.h"
 #include "nsIEncodedChannel.h"
@@ -701,39 +697,19 @@ NS_IMETHODIMP nsWebBrowserPersist::OnSto
     nsCOMPtr<nsISupports> keyPtr = do_QueryInterface(request);
     nsISupportsKey key(keyPtr);
     OutputData *data = (OutputData *) mOutputMap.Get(&key);
     if (data)
     {
         if (NS_SUCCEEDED(mPersistResult) && NS_FAILED(status))
             SendErrorStatusChange(true, status, request, data->mFile);
 
-#if defined(XP_OS2)
-        // delete 'data';  this will close the stream and let
-        // us tag the file it created with its source URI
-        nsCOMPtr<nsIURI> uriSource = data->mOriginalLocation;
-        nsCOMPtr<nsIFile> localFile;
-        GetLocalFileFromURI(data->mFile, getter_AddRefs(localFile));
-        delete data;
-        mOutputMap.Remove(&key);
-        if (localFile)
-        {
-            nsCOMPtr<nsILocalFileOS2> localFileOS2 = do_QueryInterface(localFile);
-            if (localFileOS2)
-            {
-                nsAutoCString url;
-                uriSource->GetSpec(url);
-                localFileOS2->SetFileSource(url);
-            }
-        }
-#else
         // This will close automatically close the output stream
         delete data;
         mOutputMap.Remove(&key);
-#endif
     }
     else
     {
         // if we didn't find the data in mOutputMap, try mUploadList
         UploadData *upData = (UploadData *) mUploadList.Get(&key);
         if (upData)
         {
             delete upData;
@@ -1673,26 +1649,16 @@ nsresult nsWebBrowserPersist::SaveDocume
                 {
                     // Add to list of things to delete later if all goes wrong
                     CleanupData *cleanupData = new CleanupData;
                     NS_ENSURE_TRUE(cleanupData, NS_ERROR_OUT_OF_MEMORY);
                     cleanupData->mFile = localDataPath;
                     cleanupData->mIsDirectory = true;
                     mCleanupList.AppendElement(cleanupData);
                 }
-#if defined(XP_OS2)
-                // tag the directory with the URI that originated its contents
-                nsCOMPtr<nsILocalFileOS2> localFileOS2 = do_QueryInterface(localDataPath);
-                if (localFileOS2)
-                {
-                    nsAutoCString url;
-                    mCurrentBaseURI->GetSpec(url);
-                    localFileOS2->SetFileSource(url);
-                }
-#endif
             }
         }
 
         mCurrentThingsToPersist = oldThingsToPersist;
         mCurrentDataPath = oldDataPath;
         mCurrentDataPathIsRelative = oldDataPathIsRelative;
         mCurrentRelativePathToData = oldCurrentRelativePathToData;
     }
@@ -3782,30 +3748,16 @@ nsWebBrowserPersist::SaveDocumentWithFix
         nsCOMPtr<nsIStorageStream> storStream(do_QueryInterface(outputStream));
         if (storStream)
         {
             outputStream->Close();
             rv = StartUpload(storStream, aFile, aFormatType);
             NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
         }
     }
-#if defined(XP_OS2)
-    else
-    {
-        // close the stream, then tag the file it created with its source URI
-        outputStream->Close();
-        nsCOMPtr<nsILocalFileOS2> localFileOS2 = do_QueryInterface(localFile);
-        if (localFileOS2)
-        {
-            nsAutoCString url;
-            mCurrentBaseURI->GetSpec(url);
-            localFileOS2->SetFileSource(url);
-        }
-    }
-#endif
 
     return rv;
 }
 
 
 // we store the current location as the key (absolutized version of domnode's attribute's value)
 nsresult
 nsWebBrowserPersist::MakeAndStoreLocalFilenameInURIMap(
--- a/extensions/pref/autoconfig/src/Makefile.in
+++ b/extensions/pref/autoconfig/src/Makefile.in
@@ -7,19 +7,15 @@ AUTOCFG_JS_EXPORTS = \
 		$(NULL)
 
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 AUTOCFG_JS_EXPORTS += $(srcdir)/mac/platform.js
 else
 ifeq ($(MOZ_WIDGET_TOOLKIT), windows)
 AUTOCFG_JS_EXPORTS += $(srcdir)/win/platform.js
 else
-ifeq ($(MOZ_WIDGET_TOOLKIT), os2)
-AUTOCFG_JS_EXPORTS += $(srcdir)/os2/platform.js
-else
 ifeq ($(MOZ_WIDGET_TOOLKIT), beos)
 AUTOCFG_JS_EXPORTS += $(srcdir)/beos/platform.js
 else
 AUTOCFG_JS_EXPORTS += $(srcdir)/unix/platform.js
 endif
 endif
 endif
-endif
deleted file mode 100644
--- a/extensions/pref/autoconfig/src/os2/platform.js
+++ /dev/null
@@ -1,6 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// OS2 specific auto configuration preference defaults
-platform.value = "windows";
--- a/gfx/cairo/cairo/src/moz.build
+++ b/gfx/cairo/cairo/src/moz.build
@@ -51,27 +51,16 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'wind
     DEFINES['DISABLE_SOME_FLOATING_POINT'] = True
     DEFINES['CAIRO_WIN32_STATIC_BUILD'] = True
     if CONFIG['NS_PRINTING']:
         SOURCES += [
             'cairo-win32-printing-surface.c',
         ]
     else:
         DEFINES['CAIRO_OMIT_WIN32_PRINTING'] = True
-elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'os2':
-    EXPORTS.cairo += [
-        'cairo-os2-private.h',
-        'cairo-os2.h',
-    ]
-    SOURCES += [
-        'cairo-os2-surface.c',
-    ]
-    DEFINES['OS2_USE_PLATFORM_ALLOC'] = True
-    if CONFIG['MOZ_OS2_HIGH_MEMORY']:
-        DEFINES['OS2_HIGH_MEMORY'] = True
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
     EXPORTS.cairo += [
         'cairo-quartz-image.h',
         'cairo-quartz.h',
     ]
     SOURCES += [
         'cairo-quartz-font.c',
         'cairo-quartz-image-surface.c',
--- a/gfx/cairo/libpixman/src/Makefile.in
+++ b/gfx/cairo/libpixman/src/Makefile.in
@@ -40,20 +40,18 @@ ifeq (64,$(findstring 64,$(OS_TEST)))
 USE_SSE2=1
 endif
 ifdef HAVE_GCC_ALIGN_ARG_POINTER
 USE_SSE2=1
 endif
 ifdef USE_SSE2
 SSE2_CFLAGS=-msse -msse2 -Winline
 endif
-ifneq ($(MOZ_WIDGET_TOOLKIT),os2)
 MMX_CFLAGS+=--param inline-unit-growth=10000 --param large-function-growth=10000
 endif
-endif
 ifeq (arm,$(findstring arm,$(OS_TEST)))
 # Apple's arm assembler doesn't support the same syntax as
 # the standard GNU assembler, so use the C fallback paths for now.
 # This may be fixable if clang's ARM/iOS assembler improves into a
 # viable solution in the future.
 ifneq (Darwin,$(OS_ARCH))
 ifdef HAVE_ARM_SIMD
 USE_ARM_SIMD_GCC=1
--- a/gfx/src/Makefile.in
+++ b/gfx/src/Makefile.in
@@ -6,15 +6,11 @@
 include $(topsrcdir)/config/rules.mk
 
 CXXFLAGS += $(MOZ_CAIRO_CFLAGS) $(TK_CFLAGS)
 
 ifdef MOZ_WIDGET_GTK
 CXXFLAGS += $(MOZ_PANGO_CFLAGS)
 endif
 
-ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
-CXXFLAGS += $(CAIRO_FT_CFLAGS)
-endif
-
 ifeq ($(MOZ_WIDGET_TOOLKIT),qt)
 CXXFLAGS += $(MOZ_QT_CFLAGS)
 endif
--- a/gfx/src/nsDeviceContext.cpp
+++ b/gfx/src/nsDeviceContext.cpp
@@ -38,18 +38,16 @@
 #if !XP_MACOSX
 #include "gfxPDFSurface.h"
 #endif
 
 #ifdef MOZ_WIDGET_GTK
 #include "gfxPSSurface.h"
 #elif XP_WIN
 #include "gfxWindowsSurface.h"
-#elif defined(XP_OS2)
-#include "gfxOS2Surface.h"
 #elif XP_MACOSX
 #include "gfxQuartzSurface.h"
 #endif
 
 using namespace mozilla;
 using mozilla::services::GetObserverService;
 
 class nsFontCache MOZ_FINAL : public nsIObserver
@@ -317,25 +315,16 @@ nsDeviceContext::SetDPI()
         case gfxSurfaceType::Win32Printing: {
             HDC dc = reinterpret_cast<gfxWindowsSurface*>(mPrintingSurface.get())->GetDC();
             int32_t OSVal = GetDeviceCaps(dc, LOGPIXELSY);
             dpi = 144.0f;
             mPrintingScale = float(OSVal) / dpi;
             break;
         }
 #endif
-#ifdef XP_OS2
-        case gfxSurfaceType::OS2: {
-            LONG lDPI;
-            HDC dc = GpiQueryDevice(reinterpret_cast<gfxOS2Surface*>(mPrintingSurface.get())->GetPS());
-            if (DevQueryCaps(dc, CAPS_VERTICAL_FONT_RES, 1, &lDPI))
-                dpi = lDPI;
-            break;
-        }
-#endif
         default:
             NS_NOTREACHED("Unexpected printing surface type");
             break;
         }
 
         mAppUnitsPerDevNotScaledPixel =
             NS_lround((AppUnitsPerCSSPixel() * 96) / dpi);
     } else {
@@ -693,36 +682,16 @@ nsDeviceContext::CalcPrintingSize()
             size.height = NSFloatPixelsToAppUnits(::GetDeviceCaps(dc, VERTRES)/mPrintingScale, AppUnitsPerDevPixel());
             mDepth = (uint32_t)::GetDeviceCaps(dc, BITSPIXEL);
             if (dc != reinterpret_cast<gfxWindowsSurface*>(mPrintingSurface.get())->GetDC())
                 ReleaseDC((HWND)mWidget->GetNativeData(NS_NATIVE_WIDGET), dc);
             break;
         }
 #endif
 
-#ifdef XP_OS2
-    case gfxSurfaceType::OS2:
-        {
-            inPoints = false;
-            // we already set the size in the surface constructor we set for
-            // printing, so just get those values here
-            size = reinterpret_cast<gfxOS2Surface*>(mPrintingSurface.get())->GetSize();
-            // as they are in pixels we need to scale them to app units
-            size.width = NSFloatPixelsToAppUnits(size.width, AppUnitsPerDevPixel());
-            size.height = NSFloatPixelsToAppUnits(size.height, AppUnitsPerDevPixel());
-            // still need to get the depth from the device context
-            HDC dc = GpiQueryDevice(reinterpret_cast<gfxOS2Surface*>(mPrintingSurface.get())->GetPS());
-            LONG value;
-            if (DevQueryCaps(dc, CAPS_COLOR_BITCOUNT, 1, &value))
-                mDepth = value;
-            else
-                mDepth = 8; // default to 8bpp, should be enough for printers
-            break;
-        }
-#endif
     default:
         NS_ERROR("trying to print to unknown surface type");
     }
 
     if (inPoints) {
         // For printing, CSS inches and physical inches are identical
         // so it doesn't matter which we use here
         mWidth = NSToCoordRound(float(size.width) * AppUnitsPerPhysicalInch() / 72);
--- a/gfx/thebes/Makefile.in
+++ b/gfx/thebes/Makefile.in
@@ -20,20 +20,16 @@ endif
 ifeq ($(MOZ_WIDGET_TOOLKIT),gonk)
 CXXFLAGS += $(CAIRO_FT_CFLAGS)
 endif
 
 ifdef MOZ_WIDGET_GTK
 CXXFLAGS += $(MOZ_PANGO_CFLAGS)
 endif
 
-ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
-CXXFLAGS += $(CAIRO_FT_CFLAGS)
-endif
-
 ifeq ($(MOZ_WIDGET_TOOLKIT),qt)
 CXXFLAGS += $(CAIRO_FT_CFLAGS) $(MOZ_PANGO_CFLAGS)
 endif
 
 # The file uses SSE2 intrinsics, so it needs special compile flags on some
 # compilers.
 ifneq (,$(INTEL_ARCHITECTURE))
 ifdef GNU_CC
deleted file mode 100644
--- a/gfx/thebes/gfxOS2Fonts.cpp
+++ /dev/null
@@ -1,846 +0,0 @@
-/* vim: set sw=4 sts=4 et cin: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "gfxContext.h"
-
-#include "gfxOS2Platform.h"
-#include "gfxOS2Surface.h"
-#include "gfxOS2Fonts.h"
-#include "nsTArray.h"
-#include "nsGkAtoms.h"
-
-#include "nsIPlatformCharset.h"
-
-#include "mozilla/Preferences.h"
-#include <algorithm>
-
-using namespace mozilla;
-
-/**********************************************************************
- * class gfxOS2Font
- **********************************************************************/
-
-gfxOS2Font::gfxOS2Font(gfxOS2FontEntry *aFontEntry, const gfxFontStyle *aFontStyle)
-    : gfxFont(aFontEntry, aFontStyle),
-      mFontFace(nullptr),
-      mMetrics(nullptr), mAdjustedSize(0),
-      mHinting(FC_HINT_MEDIUM), mAntialias(FcTrue)
-{
-#ifdef DEBUG_thebes_2
-    printf("gfxOS2Font[%p]::gfxOS2Font(%p \"%s\", aFontStyle)\n",
-           (void *)this, (void *)aFontEntry,
-           NS_LossyConvertUTF16toASCII(aFontEntry->Name()).get());
-#endif
-    // try to get the preferences for hinting, antialias, and embolden options
-    int32_t value;
-    nsresult rv = Preferences::GetInt("gfx.os2.font.hinting", &value);
-    if (NS_SUCCEEDED(rv) && value >= FC_HINT_NONE && value <= FC_HINT_FULL) {
-        mHinting = value;
-    }
-
-    mAntialias = Preferences::GetBool("gfx.os2.font.antialiasing", mAntialias);
-
-#ifdef DEBUG_thebes_2
-    printf("  font display options: hinting=%d, antialiasing=%s\n",
-           mHinting, mAntialias ? "on" : "off");
-#endif
-}
-
-gfxOS2Font::~gfxOS2Font()
-{
-#ifdef DEBUG_thebes_2
-    printf("gfxOS2Font[%#x]::~gfxOS2Font()\n", (unsigned)this);
-#endif
-    if (mFontFace) {
-        cairo_font_face_destroy(mFontFace);
-    }
-    if (mScaledFont) {
-        cairo_scaled_font_destroy(mScaledFont);
-    }
-    delete mMetrics;
-    mFontFace = nullptr;
-    mScaledFont = nullptr;
-    mMetrics = nullptr;
-}
-
-// fill font metrics structure with default values in case of error
-static void FillMetricsDefaults(gfxFont::Metrics *aMetrics)
-{
-    aMetrics->emAscent = 0.8 * aMetrics->emHeight;
-    aMetrics->emDescent = 0.2 * aMetrics->emHeight;
-    aMetrics->maxAscent = aMetrics->emAscent;
-    aMetrics->maxDescent = aMetrics->maxDescent;
-    aMetrics->maxHeight = aMetrics->emHeight;
-    aMetrics->internalLeading = 0.0;
-    aMetrics->externalLeading = 0.2 * aMetrics->emHeight;
-    aMetrics->spaceWidth = 0.5 * aMetrics->emHeight;
-    aMetrics->maxAdvance = aMetrics->spaceWidth;
-    aMetrics->aveCharWidth = aMetrics->spaceWidth;
-    aMetrics->zeroOrAveCharWidth = aMetrics->spaceWidth;
-    aMetrics->xHeight = 0.5 * aMetrics->emHeight;
-    aMetrics->underlineSize = aMetrics->emHeight / 14.0;
-    aMetrics->underlineOffset = -aMetrics->underlineSize;
-    aMetrics->strikeoutOffset = 0.25 * aMetrics->emHeight;
-    aMetrics->strikeoutSize = aMetrics->underlineSize;
-    aMetrics->superscriptOffset = aMetrics->xHeight;
-    aMetrics->subscriptOffset = aMetrics->xHeight;
-}
-
-// Snap a line to pixels while keeping the center and size of the
-// line as close to the original position as possible.
-static void SnapLineToPixels(gfxFloat& aOffset, gfxFloat& aSize)
-{
-    gfxFloat snappedSize = std::max(floor(aSize + 0.5), 1.0);
-    // Correct offset for change in size
-    gfxFloat offset = aOffset - 0.5 * (aSize - snappedSize);
-    // Snap offset
-    aOffset = floor(offset + 0.5);
-    aSize = snappedSize;
-}
-
-// gfxOS2Font::GetMetrics()
-// return the metrics of the current font using the gfxFont metrics structure.
-// If the metrics are not available yet, compute them using the FreeType
-// function on the font. (This is partly based on the respective function from
-// gfxPangoFonts)
-const gfxFont::Metrics& gfxOS2Font::GetMetrics()
-{
-#ifdef DEBUG_thebes_1
-    printf("gfxOS2Font[%#x]::GetMetrics()\n", (unsigned)this);
-#endif
-    if (mMetrics) {
-        return *mMetrics;
-    }
-
-    // whatever happens below, we can always create the metrics
-    mMetrics = new gfxFont::Metrics;
-    mSpaceGlyph = 0;
-
-    // round size to integer pixels, this is to get full pixels for layout
-    // together with internal/external leading (see below)
-    mMetrics->emHeight = floor(GetStyle()->size + 0.5);
-
-    cairo_scaled_font_t* scaledFont = CairoScaledFont();
-    if (!scaledFont) {
-        FillMetricsDefaults(mMetrics);
-        return *mMetrics;
-    }
-
-    FT_Face face = cairo_ft_scaled_font_lock_face(scaledFont);
-    if (!face) {
-        // Abort here already, otherwise we crash in the following
-        // this can happen if the font-size requested is zero.
-        FillMetricsDefaults(mMetrics);
-        return *mMetrics;
-    }
-    if (!face->charmap) {
-        // Also abort, if the charmap isn't loaded; then the char
-        // lookups won't work. This happens for fonts without Unicode
-        // charmap.
-        cairo_ft_scaled_font_unlock_face(scaledFont);
-        FillMetricsDefaults(mMetrics);
-        return *mMetrics;
-    }
-
-    // compute font scaling factors
-    gfxFloat emUnit = 1.0 * face->units_per_EM;
-    gfxFloat xScale = face->size->metrics.x_ppem / emUnit;
-    gfxFloat yScale = face->size->metrics.y_ppem / emUnit;
-
-    FT_UInt gid; // glyph ID
-
-    // properties of space
-    gid = FT_Get_Char_Index(face, ' ');
-    if (gid) {
-        // Load glyph into glyph slot. Use load_default here to get results in
-        // 26.6 fractional pixel format which is what is used for all other
-        // characters in gfxOS2FontGroup::CreateGlyphRunsFT.
-        FT_Load_Glyph(face, gid, FT_LOAD_DEFAULT);
-        // glyph width doesn't work for spaces, use advance instead
-        mMetrics->spaceWidth = face->glyph->advance.x >> 6;
-        // save the space glyph
-        mSpaceGlyph = gid;
-    } else {
-        NS_ASSERTION(gid, "this font doesn't have a space glyph!");
-        mMetrics->spaceWidth = face->max_advance_width * xScale;
-    }
-
-    // properties of 'x', also use its width as average width
-    gid = FT_Get_Char_Index(face, 'x'); // select the glyph
-    if (gid) {
-        // Load glyph into glyph slot. Here, use no_scale to get font units.
-        FT_Load_Glyph(face, gid, FT_LOAD_NO_SCALE);
-        mMetrics->xHeight = face->glyph->metrics.height * yScale;
-        mMetrics->aveCharWidth = face->glyph->metrics.horiAdvance * xScale;
-    } else {
-        // this font doesn't have an 'x'...
-        // fake these metrics using a fraction of the font size
-        mMetrics->xHeight = mMetrics->emHeight * 0.5;
-        mMetrics->aveCharWidth = mMetrics->emHeight * 0.5;
-    }
-
-    // properties of '0', for 'ch' units
-    gid = FT_Get_Char_Index(face, '0');
-    if (gid) {
-        FT_Load_Glyph(face, gid, FT_LOAD_NO_SCALE);
-        mMetrics->zeroOrAveCharWidth = face->glyph->metrics.horiAdvance * xScale;
-    } else {
-        // this font doesn't have a '0'
-        mMetrics->zeroOrAveCharWidth = mMetrics->aveCharWidth;
-    }
-
-    // compute an adjusted size if we need to
-    if (mAdjustedSize == 0 && GetStyle()->sizeAdjust != 0) {
-        gfxFloat aspect = mMetrics->xHeight / GetStyle()->size;
-        mAdjustedSize = GetStyle()->GetAdjustedSize(aspect);
-        mMetrics->emHeight = mAdjustedSize;
-    }
-
-    // now load the OS/2 TrueType table to access some more properties
-    TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(face, ft_sfnt_os2);
-    if (os2 && os2->version != 0xFFFF) { // should be there if not old Mac font
-        // if we are here we can improve the avgCharWidth
-        mMetrics->aveCharWidth = std::max(mMetrics->aveCharWidth,
-                                        os2->xAvgCharWidth * xScale);
-
-        mMetrics->superscriptOffset = std::max(os2->ySuperscriptYOffset * yScale, 1.0);
-        // some fonts have the incorrect sign (from gfxPangoFonts)
-        mMetrics->subscriptOffset   = std::max(fabs(os2->ySubscriptYOffset * yScale),
-                                             1.0);
-        mMetrics->strikeoutOffset   = os2->yStrikeoutPosition * yScale;
-        mMetrics->strikeoutSize     = os2->yStrikeoutSize * yScale;
-    } else {
-        // use fractions of emHeight instead of xHeight for these to be more robust
-        mMetrics->superscriptOffset = mMetrics->emHeight * 0.5;
-        mMetrics->subscriptOffset   = mMetrics->emHeight * 0.2;
-        mMetrics->strikeoutOffset   = mMetrics->emHeight * 0.3;
-        mMetrics->strikeoutSize     = face->underline_thickness * yScale;
-    }
-    SnapLineToPixels(mMetrics->strikeoutOffset, mMetrics->strikeoutSize);
-
-    // seems that underlineOffset really has to be negative
-    mMetrics->underlineOffset = face->underline_position * yScale;
-    mMetrics->underlineSize   = face->underline_thickness * yScale;
-
-    // descents are negative in FT but Thebes wants them positive
-    mMetrics->emAscent        = face->ascender * yScale;
-    mMetrics->emDescent       = -face->descender * yScale;
-    mMetrics->maxHeight       = face->height * yScale;
-    // the max units determine frame heights, better be generous
-    mMetrics->maxAscent       = std::max(face->bbox.yMax * yScale,
-                                       mMetrics->emAscent);
-    mMetrics->maxDescent      = std::max(-face->bbox.yMin * yScale,
-                                       mMetrics->emDescent);
-    mMetrics->maxAdvance      = std::max(face->max_advance_width * xScale,
-                                       mMetrics->aveCharWidth);
-
-    // leadings are not available directly (only for WinFNTs);
-    // better compute them on our own, to get integer values and make
-    // layout happy (see // LockedFTFace::GetMetrics in gfxPangoFonts.cpp)
-    mMetrics->internalLeading = floor(mMetrics->maxHeight
-                                         - mMetrics->emHeight + 0.5);
-    gfxFloat lineHeight = floor(mMetrics->maxHeight + 0.5);
-    mMetrics->externalLeading = lineHeight
-                              - mMetrics->internalLeading - mMetrics->emHeight;
-
-    SanitizeMetrics(mMetrics, false);
-
-#ifdef DEBUG_thebes_1
-    printf("gfxOS2Font[%#x]::GetMetrics():\n"
-           "  %s (%s)\n"
-           "  emHeight=%f == %f=gfxFont::style.size == %f=adjSz\n"
-           "  maxHeight=%f  xHeight=%f\n"
-           "  aveCharWidth=%f(x) zeroOrAveWidth=%f(0) spaceWidth=%f\n"
-           "  supOff=%f SubOff=%f   strOff=%f strSz=%f\n"
-           "  undOff=%f undSz=%f    intLead=%f extLead=%f\n"
-           "  emAsc=%f emDesc=%f maxH=%f\n"
-           "  maxAsc=%f maxDes=%f maxAdv=%f\n",
-           (unsigned)this,
-           NS_LossyConvertUTF16toASCII(GetName()).get(),
-           os2 && os2->version != 0xFFFF ? "has OS/2 table" : "no OS/2 table!",
-           mMetrics->emHeight, GetStyle()->size, mAdjustedSize,
-           mMetrics->maxHeight, mMetrics->xHeight,
-           mMetrics->aveCharWidth, mMetrics->zeroOrAveCharWidth, mMetrics->spaceWidth,
-           mMetrics->superscriptOffset, mMetrics->subscriptOffset,
-           mMetrics->strikeoutOffset, mMetrics->strikeoutSize,
-           mMetrics->underlineOffset, mMetrics->underlineSize,
-           mMetrics->internalLeading, mMetrics->externalLeading,
-           mMetrics->emAscent, mMetrics->emDescent, mMetrics->maxHeight,
-           mMetrics->maxAscent, mMetrics->maxDescent, mMetrics->maxAdvance
-          );
-#endif
-    cairo_ft_scaled_font_unlock_face(scaledFont);
-    return *mMetrics;
-}
-
-// weight list copied from fontconfig.h
-// unfortunately, the OS/2 version so far only supports regular and bold
-static const int8_t nFcWeight = 2; // 10; // length of weight list
-static const int fcWeight[] = {
-    //FC_WEIGHT_THIN,
-    //FC_WEIGHT_EXTRALIGHT, // == FC_WEIGHT_ULTRALIGHT
-    //FC_WEIGHT_LIGHT,
-    //FC_WEIGHT_BOOK,
-    FC_WEIGHT_REGULAR, // == FC_WEIGHT_NORMAL
-    //FC_WEIGHT_MEDIUM,
-    //FC_WEIGHT_DEMIBOLD, // == FC_WEIGHT_SEMIBOLD
-    FC_WEIGHT_BOLD,
-    //FC_WEIGHT_EXTRABOLD, // == FC_WEIGHT_ULTRABOLD
-    //FC_WEIGHT_BLACK // == FC_WEIGHT_HEAVY
-};
-
-// gfxOS2Font::CairoFontFace()
-// return a font face usable by cairo for font rendering
-// if none was created yet, use FontConfig patterns based on the current style
-// to create a new font face
-cairo_font_face_t *gfxOS2Font::CairoFontFace()
-{
-#ifdef DEBUG_thebes_2
-    printf("gfxOS2Font[%#x]::CairoFontFace()\n", (unsigned)this);
-#endif
-    if (!mFontFace) {
-#ifdef DEBUG_thebes
-        printf("gfxOS2Font[%#x]::CairoFontFace(): create it for %s, %f\n",
-               (unsigned)this, NS_LossyConvertUTF16toASCII(GetName()).get(), GetStyle()->size);
-#endif
-        FcPattern *fcPattern = FcPatternCreate();
-
-        // add (family) name to pattern
-        // convert name because FC stores it in UTF8 while we have it in UTF16
-        FcPatternAddString(fcPattern, FC_FAMILY,
-                           (FcChar8 *)NS_ConvertUTF16toUTF8(GetName()).get());
-
-        // The requirements outlined in gfxFont.h are difficult to meet without
-        // having a table of available font weights, so we map the gfxFont
-        // weight to possible FontConfig weights.
-        int8_t weight = GetStyle()->ComputeWeight();
-        // gfxFont weight   FC weight
-        //    400              80
-        //    700             200
-        int16_t fcW = 40 * weight - 80; // match gfxFont weight to base FC weight
-        // find the correct weight in the list
-        int8_t i = 0;
-        while (i < nFcWeight && fcWeight[i] < fcW) {
-            i++;
-        }
-        if (i < 0) {
-            i = 0;
-        } else if (i >= nFcWeight) {
-            i = nFcWeight - 1;
-        }
-        fcW = fcWeight[i];
-
-        // add weight to pattern
-        FcPatternAddInteger(fcPattern, FC_WEIGHT, fcW);
-
-        uint8_t fcProperty;
-        // add style to pattern
-        switch (GetStyle()->style) {
-        case NS_FONT_STYLE_ITALIC:
-            fcProperty = FC_SLANT_ITALIC;
-            break;
-        case NS_FONT_STYLE_OBLIQUE:
-            fcProperty = FC_SLANT_OBLIQUE;
-            break;
-        case NS_FONT_STYLE_NORMAL:
-        default:
-            fcProperty = FC_SLANT_ROMAN;
-        }
-        FcPatternAddInteger(fcPattern, FC_SLANT, fcProperty);
-
-        // add the size we want
-        FcPatternAddDouble(fcPattern, FC_PIXEL_SIZE,
-                           mAdjustedSize ? mAdjustedSize : GetStyle()->size);
-
-        // finally find a matching font
-        FcResult fcRes;
-        FcPattern *fcMatch = FcFontMatch(nullptr, fcPattern, &fcRes);
-
-        // Most code that depends on FcFontMatch() assumes it won't fail,
-        // then crashes when it does.  For now, at least, substitute the
-        // default serif font when it fails to avoid those crashes.
-        if (!fcMatch) {
-//#ifdef DEBUG
-            printf("Could not match font for:\n"
-                   "  family=%s, weight=%d, slant=%d, size=%f\n",
-                   NS_LossyConvertUTF16toASCII(GetName()).get(),
-                   GetStyle()->weight, GetStyle()->style, GetStyle()->size);
-//#endif
-            // FcPatternAddString() will free the existing FC_FAMILY string
-            FcPatternAddString(fcPattern, FC_FAMILY, (FcChar8*)"SERIF");
-            fcMatch = FcFontMatch(nullptr, fcPattern, &fcRes);
-//#ifdef DEBUG
-            printf("Attempt to substitute default SERIF font %s\n",
-                   fcMatch ? "succeeded" : "failed");
-//#endif
-        }
-        FcPatternDestroy(fcPattern);
-
-        if (fcMatch) {
-            int w = FC_WEIGHT_REGULAR;
-            FcPatternGetInteger(fcMatch, FC_WEIGHT, 0, &w);
-            if (fcW >= FC_WEIGHT_DEMIBOLD && w < FC_WEIGHT_DEMIBOLD) {
-                // if we want a bold font, but the selected font doesn't have a
-                // bold counterpart, artificially embolden it
-                FcPatternAddBool(fcMatch, FC_EMBOLDEN, FcTrue);
-            }
-            FcPatternAddBool(fcMatch, FC_ANTIALIAS, mAntialias);
-            FcPatternAddInteger(fcMatch, FC_HINT_STYLE, mHinting);
-
-            // and ask cairo to return a font face for this
-            mFontFace = cairo_ft_font_face_create_for_pattern(fcMatch);
-
-            FcPatternDestroy(fcMatch);
-        }
-    }
-
-    NS_ASSERTION(mFontFace, "Failed to make font face");
-    return mFontFace;
-}
-
-cairo_scaled_font_t *gfxOS2Font::CairoScaledFont()
-{
-#ifdef DEBUG_thebes_2
-    printf("gfxOS2Font[%#x]::CairoScaledFont()\n", (unsigned)this);
-#endif
-    if (mScaledFont) {
-        return mScaledFont;
-    }
-#ifdef DEBUG_thebes_2
-    printf("gfxOS2Font[%#x]::CairoScaledFont(): create it for %s, %f\n",
-           (unsigned)this, NS_LossyConvertUTF16toASCII(GetName()).get(), GetStyle()->size);
-#endif
-
-    double size = mAdjustedSize ? mAdjustedSize : GetStyle()->size;
-    cairo_matrix_t identityMatrix;
-    cairo_matrix_init_identity(&identityMatrix);
-    cairo_matrix_t fontMatrix;
-    // synthetic oblique by skewing via the font matrix
-    if (!mFontEntry->mItalic &&
-        (mStyle.style & (NS_FONT_STYLE_ITALIC | NS_FONT_STYLE_OBLIQUE)))
-    {
-        const double kSkewFactor = 0.2126; // 12 deg skew as used in e.g. ftview
-        cairo_matrix_init(&fontMatrix, size, 0, -kSkewFactor*size, size, 0, 0);
-    } else {
-        cairo_matrix_init_scale(&fontMatrix, size, size);
-    }
-
-    cairo_font_face_t * face = CairoFontFace();
-    if (!face)
-        return nullptr;
-
-    cairo_font_options_t *fontOptions = cairo_font_options_create();
-    mScaledFont = cairo_scaled_font_create(face, &fontMatrix,
-                                           &identityMatrix, fontOptions);
-    cairo_font_options_destroy(fontOptions);
-
-    NS_ASSERTION(cairo_scaled_font_status(mScaledFont) == CAIRO_STATUS_SUCCESS,
-                 "Failed to make scaled font");
-    return mScaledFont;
-}
-
-bool gfxOS2Font::SetupCairoFont(gfxContext *aContext)
-{
-#ifdef DEBUG_thebes_2
-    printf("gfxOS2Font[%#x]::SetupCairoFont(%#x)\n",
-           (unsigned)this, (unsigned) aContext);
-#endif
-    // gfxPangoFont checks the CTM but Windows doesn't so leave away here, too
-
-    // this implicitely ensures that mScaledFont is created if nullptr
-    cairo_scaled_font_t *scaledFont = CairoScaledFont();
-    if (!scaledFont || cairo_scaled_font_status(scaledFont) != CAIRO_STATUS_SUCCESS) {
-        // Don't cairo_set_scaled_font as that would propagate the error to
-        // the cairo_t, precluding any further drawing.
-        return false;
-    }
-    cairo_set_scaled_font(aContext->GetCairo(), scaledFont);
-    return true;
-}
-
-/**
- * Look up the font in the gfxFont cache. If we don't find it, create one.
- * In either case, add a ref and return it ---
- * except for OOM in which case we do nothing and return null.
- */
-already_AddRefed<gfxOS2Font> gfxOS2Font::GetOrMakeFont(const nsAString& aName,
-                                                       const gfxFontStyle *aStyle)
-{
-    nsRefPtr<gfxOS2FontEntry> fe = new gfxOS2FontEntry(aName);
-    nsRefPtr<gfxFont> font =
-      gfxFontCache::GetCache()->Lookup(static_cast<gfxFontEntry *>(fe), aStyle);
-    if (!font) {
-        font = new gfxOS2Font(fe, aStyle);
-        if (!font)
-            return nullptr;
-        gfxFontCache::GetCache()->AddNew(font);
-    }
-    gfxFont *f = nullptr;
-    font.swap(f);
-    return static_cast<gfxOS2Font *>(f);
-}
-
-/**********************************************************************
- * class gfxOS2FontGroup
- **********************************************************************/
-
-gfxOS2FontGroup::gfxOS2FontGroup(const nsAString& aFamilies,
-                                 const gfxFontStyle* aStyle,
-                                 gfxUserFontSet *aUserFontSet)
-    : gfxFontGroup(aFamilies, aStyle, aUserFontSet)
-{
-#ifdef DEBUG_thebes_2
-    printf("gfxOS2FontGroup[%#x]::gfxOS2FontGroup(\"%s\", %#x)\n",
-           (unsigned)this, NS_LossyConvertUTF16toASCII(aFamilies).get(),
-           (unsigned)aStyle);
-#endif
-
-    // check for WarpSans and as we cannot display that (yet), replace
-    // it with Workplace Sans
-    int pos = 0;
-    if ((pos = mFamilies.Find("WarpSans", false, 0, -1)) > -1) {
-        mFamilies.Replace(pos, 8, NS_LITERAL_STRING("Workplace Sans"));
-    }
-
-    nsTArray<nsString> familyArray;
-    ForEachFont(FontCallback, &familyArray);
-
-    // To be able to easily search for glyphs in other fonts, append the
-    // Unicode fonts as replacement candidates to the list.
-    nsString fontString;
-    gfxPlatform::GetPlatform()->GetPrefFonts(nsGkAtoms::Unicode, fontString, false);
-    ForEachFont(fontString, nsGkAtoms::Unicode, FontCallback, &familyArray);
-
-    // Should append some default font if there are no available fonts.
-    // Let's use Helv which should be available on any OS/2 system; if
-    // it's not there, Fontconfig replaces it with something else...
-    if (familyArray.Length() == 0) {
-        familyArray.AppendElement(NS_LITERAL_STRING("Helv"));
-    }
-
-    for (uint32_t i = 0; i < familyArray.Length(); i++) {
-        nsRefPtr<gfxOS2Font> font = gfxOS2Font::GetOrMakeFont(familyArray[i], &mStyle);
-        if (font) {
-            mFonts.AppendElement(font);
-        }
-    }
-}
-
-gfxOS2FontGroup::~gfxOS2FontGroup()
-{
-#ifdef DEBUG_thebes_2
-    printf("gfxOS2FontGroup[%#x]::~gfxOS2FontGroup()\n", (unsigned)this);
-#endif
-}
-
-gfxFontGroup *gfxOS2FontGroup::Copy(const gfxFontStyle *aStyle)
-{
-    return new gfxOS2FontGroup(mFamilies, aStyle, mUserFontSet);
-}
-
-/**
- * We use this to append an LTR or RTL Override character to the start of the
- * string. This forces Pango to honour our direction even if there are neutral
- * characters in the string.
- */
-static int32_t AppendDirectionalIndicatorUTF8(bool aIsRTL, nsACString& aString)
-{
-    static const char16_t overrides[2][2] = { { 0x202d, 0 }, { 0x202e, 0 }}; // LRO, RLO
-    AppendUTF16toUTF8(overrides[aIsRTL], aString);
-    return 3; // both overrides map to 3 bytes in UTF8
-}
-
-gfxTextRun *gfxOS2FontGroup::MakeTextRun(const char16_t* aString, uint32_t aLength,
-                                         const Parameters* aParams, uint32_t aFlags)
-{
-    NS_ASSERTION(aLength > 0, "should use MakeEmptyTextRun for zero-length text");
-    gfxTextRun *textRun = gfxTextRun::Create(aParams, aLength, this, aFlags);
-    if (!textRun)
-        return nullptr;
-
-    mEnableKerning = !(aFlags & gfxTextRunFactory::TEXT_OPTIMIZE_SPEED);
-
-    nsAutoCString utf8;
-    int32_t headerLen = AppendDirectionalIndicatorUTF8(textRun->IsRightToLeft(), utf8);
-    AppendUTF16toUTF8(Substring(aString, aString + aLength), utf8);
-
-#ifdef DEBUG_thebes_2
-    NS_ConvertUTF8toUTF16 u16(utf8);
-    printf("gfxOS2FontGroup[%#x]::MakeTextRun(char16_t %s, %d, %#x, %d)\n",
-           (unsigned)this, NS_LossyConvertUTF16toASCII(u16).get(), aLength, (unsigned)aParams, aFlags);
-#endif
-
-    InitTextRun(textRun, (uint8_t *)utf8.get(), utf8.Length(), headerLen);
-
-    textRun->FetchGlyphExtents(aParams->mContext);
-
-    return textRun;
-}
-
-gfxTextRun *gfxOS2FontGroup::MakeTextRun(const uint8_t* aString, uint32_t aLength,
-                                         const Parameters* aParams, uint32_t aFlags)
-{
-#ifdef DEBUG_thebes_2
-    const char *cStr = reinterpret_cast<const char *>(aString);
-    NS_ConvertASCIItoUTF16 us(cStr, aLength);
-    printf("gfxOS2FontGroup[%#x]::MakeTextRun(uint8_t %s, %d, %#x, %d)\n",
-           (unsigned)this, NS_LossyConvertUTF16toASCII(us).get(), aLength, (unsigned)aParams, aFlags);
-#endif
-    NS_ASSERTION(aLength > 0, "should use MakeEmptyTextRun for zero-length text");
-    NS_ASSERTION(aFlags & TEXT_IS_8BIT, "8bit should have been set");
-    gfxTextRun *textRun = gfxTextRun::Create(aParams, aLength, this, aFlags);
-    if (!textRun)
-        return nullptr;
-
-    mEnableKerning = !(aFlags & gfxTextRunFactory::TEXT_OPTIMIZE_SPEED);
-
-    const char *chars = reinterpret_cast<const char *>(aString);
-    bool isRTL = textRun->IsRightToLeft();
-    if ((aFlags & TEXT_IS_ASCII) && !isRTL) {
-        // We don't need to send an override character here, the characters must be all
-        // LTR
-        InitTextRun(textRun, (uint8_t *)chars, aLength, 0);
-    } else {
-        // Although chars in not necessarily ASCII (as it may point to the low
-        // bytes of any UCS-2 characters < 256), NS_ConvertASCIItoUTF16 seems
-        // to DTRT.
-        NS_ConvertASCIItoUTF16 unicodeString(chars, aLength);
-        nsAutoCString utf8;
-        int32_t headerLen = AppendDirectionalIndicatorUTF8(isRTL, utf8);
-        AppendUTF16toUTF8(unicodeString, utf8);
-        InitTextRun(textRun, (uint8_t *)utf8.get(), utf8.Length(), headerLen);
-    }
-
-    textRun->FetchGlyphExtents(aParams->mContext);
-
-    return textRun;
-}
-
-void gfxOS2FontGroup::InitTextRun(gfxTextRun *aTextRun, const uint8_t *aUTF8Text,
-                                  uint32_t aUTF8Length,
-                                  uint32_t aUTF8HeaderLength)
-{
-    CreateGlyphRunsFT(aTextRun, aUTF8Text + aUTF8HeaderLength,
-                      aUTF8Length - aUTF8HeaderLength);
-}
-
-// Helper function to return the leading UTF-8 character in a char pointer
-// as 32bit number. Also sets the length of the current character (i.e. the
-// offset to the next one) in the second argument
-uint32_t getUTF8CharAndNext(const uint8_t *aString, uint8_t *aLength)
-{
-    *aLength = 1;
-    if (aString[0] < 0x80) { // normal 7bit ASCII char
-        return aString[0];
-    }
-    if ((aString[0] >> 5) == 6) { // two leading ones -> two bytes
-        *aLength = 2;
-        return ((aString[0] & 0x1F) << 6) + (aString[1] & 0x3F);
-    }
-    if ((aString[0] >> 4) == 14) { // three leading ones -> three bytes
-        *aLength = 3;
-        return ((aString[0] & 0x0F) << 12) + ((aString[1] & 0x3F) << 6) +
-               (aString[2] & 0x3F);
-    }
-    if ((aString[0] >> 4) == 15) { // four leading ones -> four bytes
-        *aLength = 4;
-        return ((aString[0] & 0x07) << 18) + ((aString[1] & 0x3F) << 12) +
-               ((aString[2] & 0x3F) <<  6) + (aString[3] & 0x3F);
-    }
-    return aString[0];
-}
-
-void gfxOS2FontGroup::CreateGlyphRunsFT(gfxTextRun *aTextRun, const uint8_t *aUTF8,
-                                        uint32_t aUTF8Length)
-{
-#ifdef DEBUG_thebes_2
-    printf("gfxOS2FontGroup::CreateGlyphRunsFT(%#x, _aUTF8_, %d)\n",
-           (unsigned)aTextRun, /*aUTF8,*/ aUTF8Length);
-    for (uint32_t i = 0; i < FontListLength(); i++) {
-        gfxOS2Font *font = GetFontAt(i);
-        printf("  i=%d, name=%s, size=%f\n", i, NS_LossyConvertUTF16toASCII(font->GetName()).get(),
-               font->GetStyle()->size);
-    }
-#endif
-    uint32_t lastFont = FontListLength()-1;
-    gfxOS2Font *font0 = GetFontAt(0);
-    const uint8_t *p = aUTF8;
-    uint32_t utf16Offset = 0;
-    gfxTextRun::CompressedGlyph g;
-    const uint32_t appUnitsPerDevUnit = aTextRun->GetAppUnitsPerDevUnit();
-    gfxOS2Platform *platform = gfxOS2Platform::GetPlatform();
-
-    aTextRun->AddGlyphRun(font0, gfxTextRange::kFontGroup, 0, false);
-    // a textRun likely has the same font for most of the characters, so we can
-    // lock it before the loop for efficiency
-    FT_Face face0 = cairo_ft_scaled_font_lock_face(font0->CairoScaledFont());
-    while (p < aUTF8 + aUTF8Length) {
-        bool glyphFound = false;
-        // convert UTF-8 character and step to the next one in line
-        uint8_t chLen;
-        uint32_t ch = getUTF8CharAndNext(p, &chLen);
-        p += chLen; // move to next char
-#ifdef DEBUG_thebes_2
-        printf("\'%c\' (%d, %#x, %s) [%#x %#x]:", (char)ch, ch, ch, ch >=0x10000 ? "non-BMP!" : "BMP", ch >=0x10000 ? H_SURROGATE(ch) : 0, ch >=0x10000 ? L_SURROGATE(ch) : 0);
-#endif
-
-        if (ch == 0 || platform->noFontWithChar(ch)) {
-            // null bytes or missing characters cannot be displayed
-            aTextRun->SetMissingGlyph(utf16Offset, ch);
-        } else {
-            // Try to get a glyph from all fonts available to us.
-            // Once we found it in one of the fonts we quit the loop early.
-            // If we don't find the glyph even in the last font, we will fall
-            // back to searching all fonts on the system and finally set the
-            // missing glyph symbol after trying the last font.
-            for (uint32_t i = 0; i <= lastFont; i++) {
-                gfxOS2Font *font = font0;
-                FT_Face face = face0;
-                if (i > 0) {
-                    font = GetFontAt(i);
-                    face = cairo_ft_scaled_font_lock_face(font->CairoScaledFont());
-#ifdef DEBUG_thebes_2
-                    if (i == lastFont) {
-                        printf("Last font %d (%s) for ch=%#x (pos=%d)",
-                               i, NS_LossyConvertUTF16toASCII(font->GetName()).get(), ch, utf16Offset);
-                    }
-#endif
-                }
-                if (!face || !face->charmap) { // don't try to use fonts with non-Unicode charmaps
-                    if (face && face != face0)
-                        cairo_ft_scaled_font_unlock_face(font->CairoScaledFont());
-                    continue; // next font
-                }
-
-                NS_ASSERTION(!IsInvalidChar(ch), "Invalid char detected");
-                FT_UInt gid = FT_Get_Char_Index(face, ch); // find the glyph id
-
-                if (gid == 0 && i == lastFont) {
-                    // missing glyph, try to find a replacement in another font
-                    nsRefPtr<gfxOS2Font> fontX = platform->FindFontForChar(ch, font0);
-                    if (fontX) {
-                        font = fontX; // replace current font
-                        cairo_ft_scaled_font_unlock_face(font->CairoScaledFont());
-                        face = cairo_ft_scaled_font_lock_face(fontX->CairoScaledFont());
-                        gid = FT_Get_Char_Index(face, ch);
-                        // likely to find more chars in this font, append it
-                        // to the font list to find it quicker next time
-                        mFonts.AppendElement(fontX);
-                        lastFont = FontListLength()-1;
-                    }
-                }
-
-                // select the current font into the text run
-                aTextRun->AddGlyphRun(font, gfxTextRange::kFontGroup, utf16Offset, false);
-
-                int32_t advance = 0;
-                if (gid == font->GetSpaceGlyph()) {
-                    advance = (int)(font->GetMetrics().spaceWidth * appUnitsPerDevUnit);
-                } else if (gid == 0) {
-                    advance = -1; // trigger the missing glyphs case below
-                } else {
-                    // find next character and its glyph -- in case they exist
-                    // and exist in the current font face -- to compute kerning
-                    uint32_t chNext = 0;
-                    FT_UInt gidNext = 0;
-                    FT_Pos lsbDeltaNext = 0;
-#ifdef DEBUG_thebes_2
-                    printf("(kerning=%s/%s)", mEnableKerning ? "enable" : "disable", FT_HAS_KERNING(face) ? "yes" : "no");
-#endif
-                    if (mEnableKerning && FT_HAS_KERNING(face) && p < aUTF8 + aUTF8Length) {
-                        chNext = getUTF8CharAndNext(p, &chLen);
-                        if (chNext) {
-                            gidNext = FT_Get_Char_Index(face, chNext);
-                            if (gidNext && gidNext != font->GetSpaceGlyph()) {
-                                FT_Load_Glyph(face, gidNext, FT_LOAD_DEFAULT);
-                                lsbDeltaNext = face->glyph->lsb_delta;
-                            }
-                        }
-                    }
-
-                    // now load the current glyph
-                    FT_Load_Glyph(face, gid, FT_LOAD_DEFAULT); // load glyph into the slot
-                    advance = face->glyph->advance.x;
-
-                    // now add kerning to the current glyph's advance
-                    if (chNext && gidNext) {
-                        FT_Vector kerning;
-                        FT_Get_Kerning(face, gid, gidNext, FT_KERNING_DEFAULT, &kerning);
-                        advance += kerning.x;
-                        if (face->glyph->rsb_delta - lsbDeltaNext >= 32) {
-                            advance -= 64;
-