Revert to changeset a87ee7550f6a due to incomplete backout
authorMarco Bonardo <mbonardo@mozilla.com>
Fri, 24 Jun 2011 17:23:04 +0200
changeset 71666 0577771f2065856eb91202a6087badd3331cd8b5
parent 71665 ee72a39b1b8aa179acee7079649aa19aabc4a462
child 71679 0421a3198a3c559876581fdfcb6fcfaac47d4766
child 71749 55f11dd890474b4ce8c57e19a1225c61527d624e
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
milestone7.0a1
Revert to changeset a87ee7550f6a due to incomplete backout
build/autoconf/mozconfig-find
configure.in
dom/indexedDB/IDBObjectStore.cpp
dom/indexedDB/IDBObjectStore.h
dom/plugins/ipc/PPluginModule.ipdl
dom/plugins/ipc/PluginModuleChild.cpp
dom/plugins/ipc/PluginModuleChild.h
dom/plugins/ipc/PluginModuleParent.cpp
js/src/configure.in
modules/libpr0n/src/imgLoader.cpp
widget/src/windows/AudioSession.cpp
widget/src/windows/AudioSession.h
xpcom/base/nsTraceRefcntImpl.cpp
xpcom/ds/nsCRT.cpp
xpcom/ds/nsCRT.h
--- a/build/autoconf/mozconfig-find
+++ b/build/autoconf/mozconfig-find
@@ -42,25 +42,16 @@
 #    order:
 #       if $MOZCONFIG is set, use that.
 #       Otherwise, use $TOPSRCDIR/.mozconfig
 #       Otherwise, use $HOME/.mozconfig
 #
 topsrcdir=$1
 
 for _config in "$MOZCONFIG" \
-               "$MOZ_MYCONFIG"
-do
-  if [ -n "$_config" ] && ! [ -f "$_config" ]; then
-    echo "Specified MOZCONFIG \"$_config\" does not exist!"
-    exit 1
-  fi
-done
-
-for _config in "$MOZCONFIG" \
                "$MOZ_MYCONFIG" \
                "$topsrcdir/.mozconfig" \
                "$topsrcdir/mozconfig" \
                "$topsrcdir/mozconfig.sh" \
                "$topsrcdir/myconfig.sh" \
                "$HOME/.mozconfig" \
                "$HOME/.mozconfig.sh" \
                "$HOME/.mozmyconfig.sh"
--- a/configure.in
+++ b/configure.in
@@ -2298,19 +2298,16 @@ ia64*-hpux*)
         MKSHLIB_UNFORCE_ALL=
         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
         _USE_CPP_INCLUDE_FLAG=1
         _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
         _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
         CXXFLAGS="$CXXFLAGS -wd4800" # disable warning "forcing value to bool"
-        # make 'foo == bar;' error out
-        CFLAGS="$CFLAGS -we4553"
-        CXXFLAGS="$CXXFLAGS -we4553"
         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
         MOZ_DEBUG_FLAGS='-Zi'
         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
         WARNINGS_AS_ERRORS='-WX'
         # If we're building with --enable-profiling, we need -Oy-, which forces a frame pointer.
         if test -z "$MOZ_PROFILING"; then
             MOZ_OPTIMIZE_FLAGS='-O1'
         else
@@ -3307,17 +3304,17 @@ case $target in
     AC_SEARCH_LIBS(dlopen, dl, 
         MOZ_CHECK_HEADER(dlfcn.h, 
         AC_DEFINE(HAVE_DLOPEN)))
     ;;
 esac
 
 _SAVE_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS -D_GNU_SOURCE"
-AC_CHECK_FUNCS(dladdr memmem)
+AC_CHECK_FUNCS(dladdr)
 CFLAGS="$_SAVE_CFLAGS"
 
 if test ! "$GNU_CXX"; then
 
     case $target in
     *-aix*)
 	AC_CHECK_LIB(C_r, demangle)
 	;;
--- a/dom/indexedDB/IDBObjectStore.cpp
+++ b/dom/indexedDB/IDBObjectStore.cpp
@@ -58,19 +58,16 @@
 #include "IDBKeyRange.h"
 #include "IDBTransaction.h"
 #include "DatabaseInfo.h"
 
 USING_INDEXEDDB_NAMESPACE
 
 namespace {
 
-// This is just to give us some random marker in the byte stream
-static const PRUint64 kTotallyRandomNumber = 0x286F258B177D47A9;
-
 class AddHelper : public AsyncConnectionHelper
 {
 public:
   AddHelper(IDBTransaction* aTransaction,
             IDBRequest* aRequest,
             IDBObjectStore* aObjectStore,
             JSAutoStructuredCloneBuffer& aCloneBuffer,
             const Key& aKey,
@@ -94,16 +91,17 @@ public:
 
   void ReleaseMainThreadObjects()
   {
     mObjectStore = nsnull;
     IDBObjectStore::ClearStructuredCloneBuffer(mCloneBuffer);
     AsyncConnectionHelper::ReleaseMainThreadObjects();
   }
 
+  nsresult ModifyValueForNewKey();
   nsresult UpdateIndexes(mozIStorageConnection* aConnection,
                          PRInt64 aObjectDataId);
 
 private:
   // In-params.
   nsRefPtr<IDBObjectStore> mObjectStore;
 
   // These may change in the autoincrement case.
@@ -837,18 +835,19 @@ IDBObjectStore::ClearStructuredCloneBuff
 }
 
 // static
 bool
 IDBObjectStore::DeserializeValue(JSContext* aCx,
                                  JSAutoStructuredCloneBuffer& aBuffer,
                                  jsval* aValue)
 {
-  NS_ASSERTION(NS_IsMainThread(),
-               "Should only be deserializing on the main thread!");
+  /*
+   *  This function can be called on multiple threads!  Be careful!
+   */
   NS_ASSERTION(aCx, "A JSContext is required!");
 
   if (!aBuffer.data()) {
     *aValue = JSVAL_VOID;
     return true;
   }
 
   JSAutoRequest ar(aCx);
@@ -857,81 +856,29 @@ IDBObjectStore::DeserializeValue(JSConte
 }
 
 // static
 bool
 IDBObjectStore::SerializeValue(JSContext* aCx,
                                JSAutoStructuredCloneBuffer& aBuffer,
                                jsval aValue)
 {
-  NS_ASSERTION(NS_IsMainThread(),
-               "Should only be serializing on the main thread!");
+  /*
+   *  This function can be called on multiple threads!  Be careful!
+   */
   NS_ASSERTION(aCx, "A JSContext is required!");
 
   JSAutoRequest ar(aCx);
 
   return aBuffer.write(aCx, aValue, nsnull);
 }
 
-static inline jsdouble
-SwapBytes(PRUint64 u)
-{
-#ifdef IS_BIG_ENDIAN
-    return ((u & 0x00000000000000ffLLU) << 56) |
-           ((u & 0x000000000000ff00LLU) << 40) |
-           ((u & 0x0000000000ff0000LLU) << 24) |
-            ((u & 0x00000000ff000000LLU) << 8) |
-            ((u & 0x000000ff00000000LLU) >> 8) |
-           ((u & 0x0000ff0000000000LLU) >> 24) |
-           ((u & 0x00ff000000000000LLU) >> 40) |
-           ((u & 0xff00000000000000LLU) >> 56);
-#else
-     return u;
-#endif
-}
-
-nsresult
-IDBObjectStore::ModifyValueForNewKey(JSAutoStructuredCloneBuffer& aBuffer,
-                                     Key& aKey)
-{
-  NS_ASSERTION(IsAutoIncrement() && KeyPath().IsEmpty() && aKey.IsInt(),
-               "Don't call me!");
-  NS_ASSERTION(!NS_IsMainThread(), "Wrong thread");
-  NS_ASSERTION(mKeyPathSerializationOffset, "How did this happen?");
-
-  // The minus 8 dangling off the end here is to account for the null entry
-  // that terminates the buffer
-  const PRUint32 keyPropLen = mKeyPathSerialization.nbytes() -
-                              mKeyPathSerializationOffset - sizeof(PRUint64);
-
-  const char* location = nsCRT::memmem((char*)aBuffer.data(),
-                                       aBuffer.nbytes(),
-                                       (char*)mKeyPathSerialization.data() +
-                                       mKeyPathSerializationOffset,
-                                       keyPropLen);
-  NS_ASSERTION(location, "How did this happen?");
-
-  // This is a duplicate of the js engine's byte munging here
-  union {
-    jsdouble d;
-    PRUint64 u;
-  } pun;
-
-  pun.d = SwapBytes(aKey.IntValue());
-
-  memcpy(const_cast<char*>(location) + keyPropLen -
-         sizeof(pun.u), // We're overwriting the last 8 bytes
-         &pun.u, sizeof(PRUint64));
-  return NS_OK;
-}
-
 IDBObjectStore::IDBObjectStore()
 : mId(LL_MININT),
-  mAutoIncrement(PR_FALSE),
-  mKeyPathSerializationOffset(0)
+  mAutoIncrement(PR_FALSE)
 {
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
 }
 
 IDBObjectStore::~IDBObjectStore()
 {
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
 }
@@ -980,57 +927,21 @@ IDBObjectStore::GetAddInfo(JSContext* aC
   ObjectStoreInfo* info;
   if (!ObjectStoreInfo::Get(mTransaction->Database()->Id(), mName, &info)) {
     NS_ERROR("This should never fail!");
   }
 
   rv = GetIndexUpdateInfo(info, aCx, aValue, aUpdateInfoArray);
   NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
 
-  const jschar* keyPathChars =
-    reinterpret_cast<const jschar*>(mKeyPath.get());
-  const size_t keyPathLen = mKeyPath.Length();
-  JSBool ok = JS_FALSE;
-
-  if (!mKeyPath.IsEmpty() && aKey.IsUnset()) {
-    NS_ASSERTION(mAutoIncrement, "Should have bailed earlier!");
-
-    jsval key;
-    ok = JS_NewNumberValue(aCx, kTotallyRandomNumber, &key);
-    NS_ENSURE_TRUE(ok, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
- 
-    ok = JS_DefineUCProperty(aCx, JSVAL_TO_OBJECT(aValue), keyPathChars,
-                             keyPathLen, key, nsnull, nsnull,
-                             JSPROP_ENUMERATE);
-    NS_ENSURE_TRUE(ok, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
-
-    // From this point on we have to try to remove the property.
-    rv = EnsureKeyPathSerializationData(aCx);
+  if (!IDBObjectStore::SerializeValue(aCx, aCloneBuffer, aValue)) {
+    return NS_ERROR_DOM_DATA_CLONE_ERR;
   }
 
-  // We guard on rv being a success because we need to run the property
-  // deletion code below even if we should not be serializing the value
-  if (NS_SUCCEEDED(rv) && 
-      !IDBObjectStore::SerializeValue(aCx, aCloneBuffer, aValue)) {
-    rv = NS_ERROR_DOM_DATA_CLONE_ERR;
-  }
-
-  if (ok) {
-    // If this fails, we lose, and the web page sees a magical property
-    // appear on the object :-(
-    jsval succeeded;
-    ok = JS_DeleteUCProperty2(aCx, JSVAL_TO_OBJECT(aValue), keyPathChars,
-                              keyPathLen, &succeeded);
-    NS_ENSURE_TRUE(ok, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
-    NS_ASSERTION(JSVAL_IS_BOOLEAN(succeeded), "Wtf?");
-    NS_ENSURE_TRUE(JSVAL_TO_BOOLEAN(succeeded),
-                   NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
-  }
-
-  return rv;
+  return NS_OK;
 }
 
 nsresult
 IDBObjectStore::AddOrPut(const jsval& aValue,
                          const jsval& aKey,
                          JSContext* aCx,
                          PRUint8 aOptionalArgCount,
                          nsIIDBRequest** _retval,
@@ -1071,56 +982,16 @@ IDBObjectStore::AddOrPut(const jsval& aV
 
   rv = helper->DispatchToTransactionPool();
   NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
 
   request.forget(_retval);
   return NS_OK;
 }
 
-nsresult
-IDBObjectStore::EnsureKeyPathSerializationData(JSContext* aCx)
-{
-  NS_ASSERTION(NS_IsMainThread(), "Wrong thread");
-
-  if (!mKeyPathSerializationOffset) {
-    JSBool ok;
-
-    JSAutoStructuredCloneBuffer emptyObjectBuffer;
-    JSAutoStructuredCloneBuffer fakeObjectBuffer;
-
-    const jschar* keyPathChars =
-      reinterpret_cast<const jschar*>(mKeyPath.get());
-    const size_t keyPathLen = mKeyPath.Length();
-
-    JSObject* object = JS_NewObject(aCx, nsnull, nsnull, nsnull);
-    NS_ENSURE_TRUE(object, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
-
-    ok = emptyObjectBuffer.write(aCx, OBJECT_TO_JSVAL(object));
-    NS_ENSURE_TRUE(ok, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
-
-    jsval key;
-    // This is just to give us some random marker in the byte stream
-    ok = JS_NewNumberValue(aCx, kTotallyRandomNumber, &key);
-    NS_ENSURE_TRUE(ok, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
-
-    ok = JS_DefineUCProperty(aCx, object, keyPathChars, keyPathLen,
-                             key, nsnull, nsnull, JSPROP_ENUMERATE);
-    NS_ENSURE_TRUE(ok, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
-
-    ok = fakeObjectBuffer.write(aCx, OBJECT_TO_JSVAL(object));
-    NS_ENSURE_TRUE(ok, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
-
-    mKeyPathSerialization.swap(fakeObjectBuffer);
-    mKeyPathSerializationOffset = emptyObjectBuffer.nbytes();
-  }
-
-  return NS_OK;
-}
-
 NS_IMPL_CYCLE_COLLECTION_CLASS(IDBObjectStore)
 
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(IDBObjectStore)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mTransaction,
                                                        nsIDOMEventTarget)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOwner)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mScriptContext)
 
@@ -1845,17 +1716,17 @@ AddHelper::DoDatabaseWork(mozIStorageCon
       NS_ASSERTION(mKey.IntValue() == oldKey, "Something went haywire!");
     }
 #endif
 
     if (!keyPath.IsEmpty() && unsetKey) {
       // Special case where someone put an object into an autoIncrement'ing
       // objectStore with no key in its keyPath set. We needed to figure out
       // which row id we would get above before we could set that properly.
-      rv = mObjectStore->ModifyValueForNewKey(mCloneBuffer, mKey);
+      rv = ModifyValueForNewKey();
       NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
 
       scoper.Abandon();
       rv = stmt->Reset();
       NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
 
       stmt = mTransaction->AddStatement(false, true, true);
       NS_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
@@ -1902,16 +1773,68 @@ AddHelper::GetSuccessResult(JSContext* a
   NS_ASSERTION(!mKey.IsUnset(), "Badness!");
 
   mCloneBuffer.clear(aCx);
 
   return IDBObjectStore::GetJSValFromKey(mKey, aCx, aVal);
 }
 
 nsresult
+AddHelper::ModifyValueForNewKey()
+{
+  NS_ASSERTION(mObjectStore->IsAutoIncrement() &&
+               !mObjectStore->KeyPath().IsEmpty() &&
+               mKey.IsInt(),
+               "Don't call me!");
+
+  const nsString& keyPath = mObjectStore->KeyPath();
+
+  JSContext* cx = nsnull;
+  nsresult rv = nsContentUtils::ThreadJSContextStack()->GetSafeJSContext(&cx);
+  NS_ENSURE_SUCCESS(rv, rv);
+
+  JSAutoRequest ar(cx);
+
+  jsval clone;
+  if (!IDBObjectStore::DeserializeValue(cx, mCloneBuffer, &clone)) {
+    return NS_ERROR_DOM_DATA_CLONE_ERR;
+  }
+
+  NS_ASSERTION(!JSVAL_IS_PRIMITIVE(clone), "We should have an object!");
+
+  JSObject* obj = JSVAL_TO_OBJECT(clone);
+  JSBool ok;
+
+  const jschar* keyPathChars = reinterpret_cast<const jschar*>(keyPath.get());
+  const size_t keyPathLen = keyPath.Length();
+
+#ifdef DEBUG
+  {
+    jsval prop;
+    ok = JS_GetUCProperty(cx, obj, keyPathChars, keyPathLen, &prop);
+    NS_ASSERTION(ok && JSVAL_IS_VOID(prop), "Already has a key prop!");
+  }
+#endif
+
+  jsval key;
+  ok = JS_NewNumberValue(cx, mKey.IntValue(), &key);
+  NS_ENSURE_TRUE(ok, NS_ERROR_FAILURE);
+
+  ok = JS_DefineUCProperty(cx, obj, keyPathChars, keyPathLen, key, nsnull,
+                           nsnull, JSPROP_ENUMERATE);
+  NS_ENSURE_TRUE(ok, NS_ERROR_FAILURE);
+
+  if (!IDBObjectStore::SerializeValue(cx, mCloneBuffer, OBJECT_TO_JSVAL(obj))) {
+    return NS_ERROR_DOM_DATA_CLONE_ERR;
+  }
+
+  return NS_OK;
+}
+
+nsresult
 GetHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
 {
   NS_PRECONDITION(aConnection, "Passed a null connection!");
 
   nsCOMPtr<mozIStorageStatement> stmt =
     mTransaction->GetStatement(mObjectStore->IsAutoIncrement());
   NS_ENSURE_TRUE(stmt, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
 
--- a/dom/indexedDB/IDBObjectStore.h
+++ b/dom/indexedDB/IDBObjectStore.h
@@ -152,19 +152,16 @@ public:
     return mKeyPath;
   }
 
   IDBTransaction* Transaction()
   {
     return mTransaction;
   }
 
-  nsresult ModifyValueForNewKey(JSAutoStructuredCloneBuffer& aBuffer,
-                                Key& aKey);
-
 protected:
   IDBObjectStore();
   ~IDBObjectStore();
 
   nsresult GetAddInfo(JSContext* aCx,
                       jsval aValue,
                       jsval aKeyVal,
                       JSAutoStructuredCloneBuffer& aCloneBuffer,
@@ -173,35 +170,28 @@ protected:
 
   nsresult AddOrPut(const jsval& aValue,
                     const jsval& aKey,
                     JSContext* aCx,
                     PRUint8 aOptionalArgCount,
                     nsIIDBRequest** _retval,
                     bool aOverwrite);
 
-  nsresult EnsureKeyPathSerializationData(JSContext* aCx);
-
 private:
   nsRefPtr<IDBTransaction> mTransaction;
 
   nsCOMPtr<nsIScriptContext> mScriptContext;
   nsCOMPtr<nsPIDOMWindow> mOwner;
 
   PRInt64 mId;
   nsString mName;
   nsString mKeyPath;
   PRBool mAutoIncrement;
   PRUint32 mDatabaseId;
   PRUint32 mStructuredCloneVersion;
 
-  // Used to store a serialized representation of the fake property
-  // entry used to handle autoincrement with keypaths.
-  JSAutoStructuredCloneBuffer mKeyPathSerialization;
-  PRUint32 mKeyPathSerializationOffset;
-
   nsTArray<nsRefPtr<IDBIndex> > mCreatedIndexes;
 
 };
 
 END_INDEXEDDB_NAMESPACE
 
 #endif // mozilla_dom_indexeddb_idbobjectstore_h__
--- a/dom/plugins/ipc/PPluginModule.ipdl
+++ b/dom/plugins/ipc/PPluginModule.ipdl
@@ -43,17 +43,16 @@ include protocol PPluginInstance;
 include "npapi.h";
 include "mozilla/plugins/PluginMessageUtils.h";
 
 using NPError;
 using NPNVariable;
 using base::FileDescriptor;
 using mozilla::plugins::NativeThreadId;
 using mac_plugin_interposing::NSCursorInfo;
-using nsID;
 
 namespace mozilla {
 namespace plugins {
 
 rpc protocol PPluginModule
 {
   manages PPluginInstance;
   manages PPluginIdentifier;
@@ -101,21 +100,16 @@ child:
              bool aGetSitesWithData);
 
   rpc NPP_ClearSiteData(nsCString site, uint64_t flags, uint64_t maxAge)
     returns (NPError rv);
 
   rpc NPP_GetSitesWithData()
     returns (nsCString[] sites);
 
-  // Windows specific message to set up an audio session in the plugin process
-  async SetAudioSessionData(nsID aID,
-                            nsString aDisplayName,
-                            nsString aIconPath);
-
 parent:
   /**
    * This message is only used on X11 platforms.
    *
    * Send a dup of the plugin process's X socket to the parent
    * process.  In theory, this scheme keeps the plugin's X resources
    * around until after both the plugin process shuts down *and* the
    * parent process closes the dup fd.  This is used to prevent the
--- a/dom/plugins/ipc/PluginModuleChild.cpp
+++ b/dom/plugins/ipc/PluginModuleChild.cpp
@@ -66,17 +66,16 @@
 #include "mozilla/plugins/PluginStreamChild.h"
 #include "PluginIdentifierChild.h"
 
 #include "nsNPAPIPlugin.h"
 
 #ifdef XP_WIN
 #include "COMMessageFilter.h"
 #include "nsWindowsDllInterceptor.h"
-#include "mozilla/widget/AudioSession.h"
 #endif
 
 #ifdef OS_MACOSX
 #include "PluginInterposeOSX.h"
 #include "PluginUtilsOSX.h"
 #endif
 
 using namespace mozilla::plugins;
@@ -590,20 +589,16 @@ PluginModuleChild::DeinitGraphics()
 #endif
 }
 
 bool
 PluginModuleChild::AnswerNP_Shutdown(NPError *rv)
 {
     AssertPluginThread();
 
-#if defined XP_WIN && MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
-    mozilla::widget::StopAudioSession();
-#endif
-
     // the PluginModuleParent shuts down this process after this RPC
     // call pops off its stack
 
     *rv = mShutdownFunc ? mShutdownFunc() : NPERR_NO_ERROR;
 
     // weakly guard against re-entry after NP_Shutdown
     memset(&mFunctions, 0, sizeof(mFunctions));
 
@@ -649,35 +644,16 @@ PluginModuleChild::AnswerNPP_GetSitesWit
         NS_Free(*iterator);
         ++iterator;
     }
     NS_Free(result);
 
     return true;
 }
 
-bool
-PluginModuleChild::RecvSetAudioSessionData(const nsID& aId,
-                                           const nsString& aDisplayName,
-                                           const nsString& aIconPath)
-{
-    nsresult rv;
-#if !defined XP_WIN || MOZ_WINSDK_TARGETVER < MOZ_NTDDI_LONGHORN
-    NS_RUNTIMEABORT("Not Reached!");
-    return false;
-#else
-    rv = mozilla::widget::RecvAudioSessionData(aId, aDisplayName, aIconPath);
-    NS_ENSURE_SUCCESS(rv, true); // Bail early if this fails
-
-    // Ignore failures here; we can't really do anything about them
-    mozilla::widget::StartAudioSession();
-    return true;
-#endif
-}
-
 void
 PluginModuleChild::QuickExit()
 {
     NS_WARNING("plugin process _exit()ing");
     _exit(0);
 }
 
 void
--- a/dom/plugins/ipc/PluginModuleChild.h
+++ b/dom/plugins/ipc/PluginModuleChild.h
@@ -158,21 +158,16 @@ protected:
     AnswerNPP_ClearSiteData(const nsCString& aSite,
                             const uint64_t& aFlags,
                             const uint64_t& aMaxAge,
                             NPError* aResult);
 
     virtual bool
     AnswerNPP_GetSitesWithData(InfallibleTArray<nsCString>* aResult);
 
-    virtual bool
-    RecvSetAudioSessionData(const nsID& aId,
-                            const nsString& aDisplayName,
-                            const nsString& aIconPath);
-
     virtual void
     ActorDestroy(ActorDestroyReason why);
 
     NS_NORETURN void QuickExit();
 
     NS_OVERRIDE virtual bool
     RecvProcessNativeEventsInRPCCall();
 
--- a/dom/plugins/ipc/PluginModuleParent.cpp
+++ b/dom/plugins/ipc/PluginModuleParent.cpp
@@ -61,20 +61,16 @@
 #include "nsAutoPtr.h"
 #include "nsCRT.h"
 #ifdef MOZ_CRASHREPORTER
 #include "nsExceptionHandler.h"
 #endif
 #include "nsNPAPIPlugin.h"
 #include "nsILocalFile.h"
 
-#ifdef XP_WIN
-#include "mozilla/widget/AudioSession.h"
-#endif
-
 using base::KillProcess;
 
 using mozilla::PluginLibrary;
 using mozilla::ipc::SyncChannel;
 
 using namespace mozilla;
 using namespace mozilla::plugins;
 using namespace mozilla::plugins::parent;
@@ -749,18 +745,16 @@ PluginModuleParent::EndUpdateBackground(
 }
 
 #if defined(XP_UNIX) && !defined(XP_MACOSX)
 nsresult
 PluginModuleParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs, NPError* error)
 {
     PLUGIN_LOG_DEBUG_METHOD;
 
-    nsresult rv;
-
     mNPNIface = bFuncs;
 
     if (mShutdown) {
         *error = NPERR_GENERIC_ERROR;
         return NS_ERROR_FAILURE;
     }
 
     if (!CallNP_Initialize(&mPluginThread, error)) {
@@ -785,28 +779,16 @@ PluginModuleParent::NP_Initialize(NPNets
     if (mShutdown) {
         *error = NPERR_GENERIC_ERROR;
         return NS_ERROR_FAILURE;
     }
 
     if (!CallNP_Initialize(&mPluginThread, error))
         return NS_ERROR_FAILURE;
 
-#if defined XP_WIN && MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
-    // Send the info needed to join the chrome process's audio session to the
-    // plugin process
-    nsID id;
-    nsString sessionName;
-    nsString iconPath;
-
-    if (NS_SUCCEEDED(mozilla::widget::GetAudioSessionData(id, sessionName,
-                                                          iconPath)))
-        SendSetAudioSessionData(id, sessionName, iconPath);
-#endif
-
     return NS_OK;
 }
 #endif
 
 nsresult
 PluginModuleParent::NP_Shutdown(NPError* error)
 {
     PLUGIN_LOG_DEBUG_METHOD;
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -2236,19 +2236,16 @@ ia64*-hpux*)
         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
         _USE_CPP_INCLUDE_FLAG=1
         _DEFINES_CFLAGS='-FI $(DEPTH)/js-confdefs.h -DMOZILLA_CLIENT'
         _DEFINES_CXXFLAGS='-FI $(DEPTH)/js-confdefs.h -DMOZILLA_CLIENT'
         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
         # MSVC warnings C4244 and C4800 are ubiquitous, useless, and annoying.
         CXXFLAGS="$CXXFLAGS -wd4244 -wd4800"
-        # make 'foo == bar;' error out
-        CFLAGS="$CFLAGS -we4553"
-        CXXFLAGS="$CXXFLAGS -we4553"
         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
         MOZ_DEBUG_FLAGS='-Zi'
         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
         WARNINGS_AS_ERRORS='-WX'
         # If we're building with --enable-profiling, we need -Oy-, which forces a frame pointer.
         if test -z "$MOZ_PROFILING"; then
             MOZ_OPTIMIZE_FLAGS='-O1'
         else
--- a/modules/libpr0n/src/imgLoader.cpp
+++ b/modules/libpr0n/src/imgLoader.cpp
@@ -47,17 +47,16 @@
  * This #undef needs to be in multiple places because we don't always pull
  * headers in in the same order.
  */
 #undef LoadImage
 
 #include "nsCOMPtr.h"
 
 #include "nsNetUtil.h"
-#include "nsStreamUtils.h"
 #include "nsIHttpChannel.h"
 #include "nsICachingChannel.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIProgressEventSink.h"
 #include "nsIChannelEventSink.h"
 #include "nsIAsyncVerifyRedirectCallback.h"
 #include "nsIProxyObjectManager.h"
 #include "nsIServiceManager.h"
@@ -2163,29 +2162,38 @@ NS_IMETHODIMP imgCacheValidator::OnStopR
     return NS_OK;
 
   return mDestListener->OnStopRequest(aRequest, ctxt, status);
 }
 
 /** nsIStreamListener methods **/
 
 
+// XXX see bug 113959
+static NS_METHOD dispose_of_data(nsIInputStream* in, void* closure,
+                                 const char* fromRawSegment, PRUint32 toOffset,
+                                 PRUint32 count, PRUint32 *writeCount)
+{
+  *writeCount = count;
+  return NS_OK;
+}
+
 /* void onDataAvailable (in nsIRequest request, in nsISupports ctxt, in nsIInputStream inStr, in unsigned long sourceOffset, in unsigned long count); */
 NS_IMETHODIMP imgCacheValidator::OnDataAvailable(nsIRequest *aRequest, nsISupports *ctxt, nsIInputStream *inStr, PRUint32 sourceOffset, PRUint32 count)
 {
 #ifdef DEBUG
   nsCOMPtr<nsICachingChannel> cacheChan(do_QueryInterface(aRequest));
   if (cacheChan) {
     PRBool isFromCache;
     if (NS_SUCCEEDED(cacheChan->IsFromCache(&isFromCache)) && isFromCache)
       NS_ERROR("OnDataAvailable not suppressed by LOAD_ONLY_IF_MODIFIED load flag");
   }
 #endif
 
   if (!mDestListener) {
     // XXX see bug 113959
     PRUint32 _retval;
-    inStr->ReadSegments(NS_DiscardSegment, nsnull, count, &_retval);
+    inStr->ReadSegments(dispose_of_data, nsnull, count, &_retval);
     return NS_OK;
   }
 
   return mDestListener->OnDataAvailable(aRequest, ctxt, inStr, sourceOffset, count);
 }
deleted file mode 100644
--- a/widget/src/windows/AudioSession.cpp
+++ /dev/null
@@ -1,461 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- *   Kyle Huey <me@kylehuey.com>
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
-
-#include <windows.h>
-#include <audiopolicy.h>
-#include <Mmdeviceapi.h>
-
-#include "nsIStringBundle.h"
-#include "nsIUUIDGenerator.h"
-#include "nsIXULAppInfo.h"
-
-//#include "AudioSession.h"
-#include "nsCOMPtr.h"
-#include "nsAutoPtr.h"
-#include "nsServiceManagerUtils.h"
-#include "nsString.h"
-#include "nsXULAppApi.h"
-
-#include <objbase.h>
-
-namespace mozilla {
-namespace widget {
-
-/* 
- * To take advantage of what Vista+ have to offer with respect to audio,
- * we need to maintain an audio session.  This class wraps IAudioSessionControl
- * and implements IAudioSessionEvents (for callbacks from Windows)
- */
-class AudioSession: public IAudioSessionEvents {
-private:
-  AudioSession();
-  ~AudioSession();
-public:
-  static AudioSession* GetSingleton();
-
-  // COM IUnknown
-  STDMETHODIMP_(ULONG) AddRef();
-  STDMETHODIMP QueryInterface(REFIID, void**);
-  STDMETHODIMP_(ULONG) Release();
-
-  // IAudioSessionEvents
-  STDMETHODIMP OnChannelVolumeChanged(DWORD aChannelCount,
-                                      float aChannelVolumeArray[],
-                                      DWORD aChangedChannel,
-                                      LPCGUID aContext);
-  STDMETHODIMP OnDisplayNameChanged(LPCWSTR aDisplayName, LPCGUID aContext);
-  STDMETHODIMP OnGroupingParamChanged(LPCGUID aGroupingParam, LPCGUID aContext);
-  STDMETHODIMP OnIconPathChanged(LPCWSTR aIconPath, LPCGUID aContext);
-  STDMETHODIMP OnSessionDisconnected(AudioSessionDisconnectReason aReason);
-  STDMETHODIMP OnSimpleVolumeChanged(float aVolume,
-                                     BOOL aMute,
-                                     LPCGUID aContext);
-  STDMETHODIMP OnStateChanged(AudioSessionState aState);
-
-  nsresult Start();
-  nsresult Stop();
-  void StopInternal();
-
-  nsresult GetSessionData(nsID& aID,
-                          nsString& aSessionName,
-                          nsString& aIconPath);
-
-  nsresult SetSessionData(const nsID& aID,
-                          const nsString& aSessionName,
-                          const nsString& aIconPath);
-
-  enum SessionState {
-    UNINITIALIZED, // Has not been initialized yet
-    STARTED, // Started
-    CLONED, // SetSessionInfoCalled, Start not called
-    FAILED, // The autdio session failed to start
-    STOPPED // Stop called
-  };
-protected:
-  nsRefPtr<IAudioSessionControl> mAudioSessionControl;
-  nsString mDisplayName;
-  nsString mIconPath;
-  nsID mSessionGroupingParameter;
-  SessionState mState;
-
-  nsAutoRefCnt mRefCnt;
-  NS_DECL_OWNINGTHREAD
-
-  static AudioSession* sService;
-};
-
-nsresult
-StartAudioSession()
-{
-  return AudioSession::GetSingleton()->Start();
-}
-
-nsresult
-StopAudioSession()
-{
-  return AudioSession::GetSingleton()->Stop();
-}
-
-nsresult
-GetAudioSessionData(nsID& aID,
-                    nsString& aSessionName,
-                    nsString& aIconPath)
-{
-  return AudioSession::GetSingleton()->GetSessionData(aID,
-                                                      aSessionName,
-                                                      aIconPath);
-}
-
-nsresult
-RecvAudioSessionData(const nsID& aID,
-                     const nsString& aSessionName,
-                     const nsString& aIconPath)
-{
-  return AudioSession::GetSingleton()->SetSessionData(aID,
-                                                      aSessionName,
-                                                      aIconPath);
-}
-
-AudioSession* AudioSession::sService = NULL;
-
-AudioSession::AudioSession()
-{
-  mState = UNINITIALIZED;
-}
-
-AudioSession::~AudioSession()
-{
-
-}
-
-AudioSession*
-AudioSession::GetSingleton()
-{
-  if (!(AudioSession::sService)) {
-    nsRefPtr<AudioSession> service = new AudioSession();
-    service.forget(&AudioSession::sService);
-  }
-
-  // We don't refcount AudioSession on the Gecko side, we hold one single ref
-  // as long as the appshell is running.
-  return AudioSession::sService;
-}
-
-// It appears Windows will use us on a background thread ...
-NS_IMPL_THREADSAFE_ADDREF(AudioSession)
-NS_IMPL_THREADSAFE_RELEASE(AudioSession)
-
-STDMETHODIMP
-AudioSession::QueryInterface(REFIID iid, void **ppv)
-{
-  const IID IID_IAudioSessionEvents = __uuidof(IAudioSessionEvents);
-  if ((IID_IUnknown == iid) ||
-      (IID_IAudioSessionEvents == iid)) {
-    *ppv = static_cast<IAudioSessionEvents*>(this);
-    AddRef();
-    return S_OK;
-  }
-
-  return E_NOINTERFACE;
-}
-
-// Once we are started Windows will hold a reference to us through our
-// IAudioSessionEvents interface that will keep us alive until the appshell
-// calls Stop.
-nsresult
-AudioSession::Start()
-{
-  NS_ABORT_IF_FALSE(mState == UNINITIALIZED || mState == CLONED,
-                    "State invariants violated");
-
-  const CLSID CLSID_MMDeviceEnumerator = __uuidof(MMDeviceEnumerator);
-  const IID IID_IMMDeviceEnumerator = __uuidof(IMMDeviceEnumerator);
-  const IID IID_IAudioSessionManager = __uuidof(IAudioSessionManager);
-
-  HRESULT hr;
-
-  if (FAILED(::CoInitialize(NULL)))
-    return NS_ERROR_FAILURE;
-
-  if (mState == UNINITIALIZED) {
-    mState = FAILED;
-
-    // XXXkhuey implement this for content processes
-    if (XRE_GetProcessType() == GeckoProcessType_Content)
-      return NS_ERROR_FAILURE;
-
-    NS_ABORT_IF_FALSE(XRE_GetProcessType() == GeckoProcessType_Default,
-                      "Should only get here in a chrome process!");
-
-    nsCOMPtr<nsIStringBundleService> bundleService = 
-      do_GetService(NS_STRINGBUNDLE_CONTRACTID);
-    NS_ENSURE_TRUE(bundleService, NS_ERROR_FAILURE);
-
-    nsCOMPtr<nsIStringBundle> bundle;
-    bundleService->CreateBundle("chrome://branding/locale/brand.properties",
-                                getter_AddRefs(bundle));
-    NS_ENSURE_TRUE(bundle, NS_ERROR_FAILURE);
-
-    bundle->GetStringFromName(NS_LITERAL_STRING("brandFullName").get(),
-                              getter_Copies(mDisplayName));
-
-    PRUnichar *buffer;
-    mIconPath.GetMutableData(&buffer, MAX_PATH);
-
-    // XXXkhuey we should provide a way for a xulrunner app to specify an icon
-    // that's not in the product binary.
-    ::GetModuleFileNameW(NULL, buffer, MAX_PATH);
-
-    nsCOMPtr<nsIUUIDGenerator> uuidgen =
-      do_GetService("@mozilla.org/uuid-generator;1");
-    NS_ASSERTION(uuidgen, "No UUID-Generator?!?");
-
-    uuidgen->GenerateUUIDInPlace(&mSessionGroupingParameter);
-  }
-
-  mState = FAILED;
-
-  NS_ABORT_IF_FALSE(!mDisplayName.IsEmpty() || !mIconPath.IsEmpty(),
-                    "Should never happen ...");
-
-  nsRefPtr<IMMDeviceEnumerator> enumerator;
-  hr = ::CoCreateInstance(CLSID_MMDeviceEnumerator,
-                          NULL,
-                          CLSCTX_ALL,
-                          IID_IMMDeviceEnumerator,
-                          getter_AddRefs(enumerator));
-  if (FAILED(hr))
-    return NS_ERROR_NOT_AVAILABLE;
-
-  nsRefPtr<IMMDevice> device;
-  hr = enumerator->GetDefaultAudioEndpoint(EDataFlow::eRender,
-                                           ERole::eMultimedia,
-                                           getter_AddRefs(device));
-  if (FAILED(hr)) {
-    if (hr == E_NOTFOUND)
-      return NS_ERROR_NOT_AVAILABLE;
-    return NS_ERROR_FAILURE;
-  }
-
-  nsRefPtr<IAudioSessionManager> manager;
-  hr = device->Activate(IID_IAudioSessionManager,
-                        CLSCTX_ALL,
-                        NULL,
-                        getter_AddRefs(manager));
-  if (FAILED(hr))
-    return NS_ERROR_FAILURE;
-
-  hr = manager->GetAudioSessionControl(NULL,
-                                       FALSE,
-                                       getter_AddRefs(mAudioSessionControl));
-  if (FAILED(hr))
-    return NS_ERROR_FAILURE;
-
-  hr = mAudioSessionControl->SetGroupingParam((LPCGUID)&mSessionGroupingParameter,
-                                              NULL);
-  if (FAILED(hr)) {
-    StopInternal();
-    return NS_ERROR_FAILURE;
-  }
-
-  hr = mAudioSessionControl->SetDisplayName(mDisplayName.get(), NULL);
-  if (FAILED(hr)) {
-    StopInternal();
-    return NS_ERROR_FAILURE;
-  }
-
-  hr = mAudioSessionControl->SetIconPath(mIconPath.get(), NULL);
-  if (FAILED(hr)) {
-    StopInternal();
-    return NS_ERROR_FAILURE;
-  }
-
-  hr = mAudioSessionControl->RegisterAudioSessionNotification(this);
-  if (FAILED(hr)) {
-    StopInternal();
-    return NS_ERROR_FAILURE;
-  }
-
-  mState = STARTED;
-
-  return NS_OK;
-}
-
-void
-AudioSession::StopInternal()
-{
-  static const nsID blankId = {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0} };
-
-  if (mAudioSessionControl) {
-    mAudioSessionControl->SetGroupingParam((LPCGUID)&blankId, NULL);
-    mAudioSessionControl->UnregisterAudioSessionNotification(this);
-    mAudioSessionControl = nsnull;
-  }
-}
-
-nsresult
-AudioSession::Stop()
-{
-  NS_ABORT_IF_FALSE(mState == STARTED ||
-                    mState == UNINITIALIZED || // XXXremove this
-                    mState == FAILED,
-                    "State invariants violated");
-  mState = STOPPED;
-
-  nsRefPtr<AudioSession> kungFuDeathGrip;
-  kungFuDeathGrip.swap(sService);
-
-  if (XRE_GetProcessType() != GeckoProcessType_Content)
-    StopInternal();
-
-  // At this point kungFuDeathGrip should be the only reference to AudioSession
-
-  ::CoUninitialize();
-
-  return NS_OK;
-}
-
-void CopynsID(nsID& lhs, const nsID& rhs)
-{
-  lhs.m0 = rhs.m0;
-  lhs.m1 = rhs.m1;
-  lhs.m2 = rhs.m2;
-  for (int i = 0; i < 8; i++ ) {
-    lhs.m3[i] = rhs.m3[i];
-  }
-}
-
-nsresult
-AudioSession::GetSessionData(nsID& aID,
-                             nsString& aSessionName,
-                             nsString& aIconPath)
-{
-  NS_ABORT_IF_FALSE(mState == FAILED ||
-                    mState == STARTED ||
-                    mState == CLONED,
-                    "State invariants violated");
-
-  CopynsID(aID, mSessionGroupingParameter);
-  aSessionName = mDisplayName;
-  aIconPath = mIconPath;
-
-  if (mState == FAILED)
-    return NS_ERROR_FAILURE;
-
-  return NS_OK;
-}
-
-nsresult
-AudioSession::SetSessionData(const nsID& aID,
-                             const nsString& aSessionName,
-                             const nsString& aIconPath)
-{
-  NS_ABORT_IF_FALSE(mState == UNINITIALIZED,
-                    "State invariants violated");
-  NS_ABORT_IF_FALSE(XRE_GetProcessType() != GeckoProcessType_Default,
-                    "Should never get here in a chrome process!");
-  mState = CLONED;
-
-  CopynsID(mSessionGroupingParameter, aID);
-  mDisplayName = aSessionName;
-  mIconPath = aIconPath;
-  return NS_OK;
-}
-
-STDMETHODIMP
-AudioSession::OnChannelVolumeChanged(DWORD aChannelCount,
-                                     float aChannelVolumeArray[],
-                                     DWORD aChangedChannel,
-                                     LPCGUID aContext)
-{
-  return S_OK; // NOOP
-}
-
-STDMETHODIMP
-AudioSession::OnDisplayNameChanged(LPCWSTR aDisplayName,
-                                   LPCGUID aContext)
-{
-  return S_OK; // NOOP
-}
-
-STDMETHODIMP
-AudioSession::OnGroupingParamChanged(LPCGUID aGroupingParam,
-                                     LPCGUID aContext)
-{
-  return S_OK; // NOOP
-}
-
-STDMETHODIMP
-AudioSession::OnIconPathChanged(LPCWSTR aIconPath,
-                                LPCGUID aContext)
-{
-  return S_OK; // NOOP
-}
-
-STDMETHODIMP
-AudioSession::OnSessionDisconnected(AudioSessionDisconnectReason aReason)
-{
-  if (!mAudioSessionControl)
-    return S_OK;
-
-  mAudioSessionControl->UnregisterAudioSessionNotification(this);
-  mAudioSessionControl = nsnull;
-  Start(); // If it fails there's not much we can do
-  return S_OK;
-}
-
-STDMETHODIMP
-AudioSession::OnSimpleVolumeChanged(float aVolume,
-                                    BOOL aMute,
-                                    LPCGUID aContext)
-{
-  return S_OK; // NOOP
-}
-
-STDMETHODIMP
-AudioSession::OnStateChanged(AudioSessionState aState)
-{
-  return S_OK; // NOOP
-}
-
-} // namespace widget
-} // namespace mozilla
-
-#endif // MOZ_NTDDI_LONGHORN
deleted file mode 100644
--- a/widget/src/windows/AudioSession.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- *   Kyle Huey <me@kylehuey.com>
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
-
-namespace mozilla {
-namespace widget {
-
-// Start the audio session in the current process
-nsresult StartAudioSession();
-
-// Pass the information necessary to start an audio session in another process
-nsresult GetAudioSessionData(nsID& aID,
-                             nsString& aSessionName,
-                             nsString& aIconPath);
-
-// Receive the information necessary to start an audio session in a non-chrome
-// process
-nsresult RecvAudioSessionData(const nsID& aID,
-                              const nsString& aSessionName,
-                              const nsString& aIconPath);
-
-// Stop the audio session in the current process
-nsresult StopAudioSession();
-
-} // namespace widget
-} // namespace mozilla
-
-#endif // MOZ_WINSK_TARGETVER >= MOZ_NTDDI_LONGHORN
--- a/xpcom/base/nsTraceRefcntImpl.cpp
+++ b/xpcom/base/nsTraceRefcntImpl.cpp
@@ -1281,36 +1281,16 @@ nsTraceRefcntImpl::Shutdown()
   if (gObjectsToLog) {
     PL_HashTableDestroy(gObjectsToLog);
     gObjectsToLog = nsnull;
   }
   if (gSerialNumbers) {
     PL_HashTableDestroy(gSerialNumbers);
     gSerialNumbers = nsnull;
   }
-  if (gBloatLog) {
-    fclose(gBloatLog);
-    gBloatLog = nsnull;
-  }
-  if (gRefcntsLog) {
-    fclose(gRefcntsLog);
-    gRefcntsLog = nsnull;
-  }
-  if (gAllocLog) {
-    fclose(gAllocLog);
-    gAllocLog = nsnull;
-  }
-  if (gLeakyLog) {
-    fclose(gLeakyLog);
-    gLeakyLog = nsnull;
-  }
-  if (gCOMPtrLog) {
-    fclose(gCOMPtrLog);
-    gCOMPtrLog = nsnull;
-  }
 #endif
 }
 
 NS_COM void
 nsTraceRefcntImpl::SetActivityIsLegal(PRBool aLegal)
 {
 #ifdef NS_IMPL_REFCNT_LOGGING
   if (gActivityTLS == BAD_TLS_INDEX)
--- a/xpcom/ds/nsCRT.cpp
+++ b/xpcom/ds/nsCRT.cpp
@@ -158,38 +158,16 @@ PRInt32 nsCRT::strncmp(const PRUnichar* 
           return 1;
         }
       } while (--n != 0);
     }
   }
   return 0;
 }
 
-const char* nsCRT::memmem(const char* haystack, PRUint32 haystackLen,
-                          const char* needle, PRUint32 needleLen)
-{
-  // Sanity checking
-  if (!(haystack && needle && haystackLen && needleLen &&
-        needleLen <= haystackLen))
-    return NULL;
-
-#ifdef HAVE_MEMMEM
-  return (const char*)::memmem(haystack, haystackLen, needle, needleLen);
-#else
-  // No memmem means we need to roll our own.  This isn't really optimized
-  // for performance ... if that becomes an issue we can take some inspiration
-  // from the js string compare code in jsstr.cpp
-  for (PRInt32 i = 0; i < haystackLen - needleLen; i++) {
-    if (!memcmp(haystack + i, needle, needleLen))
-      return haystack + i;
-  }
-#endif
-  return NULL;
-}
-
 PRUnichar* nsCRT::strdup(const PRUnichar* str)
 {
   PRUint32 len = nsCRT::strlen(str);
   return strndup(str, len);
 }
 
 PRUnichar* nsCRT::strndup(const PRUnichar* str, PRUint32 len)
 {
--- a/xpcom/ds/nsCRT.h
+++ b/xpcom/ds/nsCRT.h
@@ -205,22 +205,16 @@ public:
   }
 
   /// Like strcmp except for ucs2 strings
   static PRInt32 strcmp(const PRUnichar* s1, const PRUnichar* s2);
   /// Like strcmp except for ucs2 strings
   static PRInt32 strncmp(const PRUnichar* s1, const PRUnichar* s2,
                          PRUint32 aMaxLen);
 
-  // The GNU libc has memmem, which is strstr except for binary data
-  // This is our own implementation that uses memmem on platforms
-  // where it's available.
-  static const char* memmem(const char* haystack, PRUint32 haystackLen,
-                            const char* needle, PRUint32 needleLen);
-
   // You must use nsCRT::free(PRUnichar*) to free memory allocated
   // by nsCRT::strdup(PRUnichar*).
   static PRUnichar* strdup(const PRUnichar* str);
 
   // You must use nsCRT::free(PRUnichar*) to free memory allocated
   // by strndup(PRUnichar*, PRUint32).
   static PRUnichar* strndup(const PRUnichar* str, PRUint32 len);