diff --git a/dom/system/OSFileConstants.cpp b/dom/system/OSFileConstants.cpp index ad290fa2c..d0ae18c6d 100644 --- a/dom/system/OSFileConstants.cpp +++ b/dom/system/OSFileConstants.cpp @@ -350,6 +350,7 @@ void CleanupOSFileConstants() gInitialized = false; delete gPaths; + gPaths = nullptr; } @@ -848,9 +849,7 @@ bool SetStringProperty(JSContext *cx, JS::Handle aObject, const char */ bool DefineOSFileConstants(JSContext *cx, JS::Handle global) { - MOZ_ASSERT(gInitialized); - - if (gPaths == nullptr) { + if (!gInitialized || gPaths == nullptr) { // If an initialization error was ignored, we may end up with // |gInitialized == true| but |gPaths == nullptr|. We cannot // |MOZ_ASSERT| this, as this would kill precompile_cache.js, diff --git a/gfx/layers/composite/ContainerLayerComposite.cpp b/gfx/layers/composite/ContainerLayerComposite.cpp index f3f65a786..ab1de0952 100755 --- a/gfx/layers/composite/ContainerLayerComposite.cpp +++ b/gfx/layers/composite/ContainerLayerComposite.cpp @@ -127,9 +127,9 @@ static void PrintUniformityInfo(Layer* aLayer) /* all of the per-layer prepared data we need to maintain */ struct PreparedLayer { - PreparedLayer(LayerComposite *aLayer, RenderTargetIntRect aClipRect) : + PreparedLayer(Layer *aLayer, RenderTargetIntRect aClipRect) : mLayer(aLayer), mClipRect(aClipRect) {} - LayerComposite* mLayer; + RefPtr mLayer; RenderTargetIntRect mClipRect; }; @@ -374,7 +374,8 @@ ContainerPrepare(ContainerT* aContainer, CULLING_LOG("Preparing sublayer %p\n", layerToRender->GetLayer()); layerToRender->Prepare(clipRect); - aContainer->mPrepared->mLayers.AppendElement(PreparedLayer(layerToRender, clipRect)); + aContainer->mPrepared->mLayers.AppendElement(PreparedLayer(layerToRender->GetLayer(), + clipRect)); } CULLING_LOG("Preparing container layer %p\n", aContainer->GetLayer()); @@ -520,7 +521,7 @@ RenderLayers(ContainerT* aContainer, for (size_t i = 0u; i < aContainer->mPrepared->mLayers.Length(); i++) { PreparedLayer& preparedData = aContainer->mPrepared->mLayers[i]; - LayerComposite* layerToRender = preparedData.mLayer; + LayerComposite* layerToRender = static_cast(preparedData.mLayer->ImplData()); const RenderTargetIntRect& clipRect = preparedData.mClipRect; Layer* layer = layerToRender->GetLayer(); diff --git a/js/public/RootingAPI.h b/js/public/RootingAPI.h index 4e925cba0..e58596756 100644 --- a/js/public/RootingAPI.h +++ b/js/public/RootingAPI.h @@ -215,7 +215,7 @@ AssertGCThingIsNotAnObjectSubclass(js::gc::Cell* cell) {} * Type T must be one of: JS::Value, jsid, JSObject*, JSString*, JSScript* */ template -class Heap : public js::HeapBase +class MOZ_NON_MEMMOVABLE Heap : public js::HeapBase { public: Heap() { @@ -1119,6 +1119,14 @@ class JS_PUBLIC_API(ObjectPtr) explicit ObjectPtr(JSObject* obj) : value(obj) {} + ObjectPtr(const ObjectPtr& other) : value(other.value) {} + + ObjectPtr(ObjectPtr&& other) + : value(other.value) + { + other.value = nullptr; + } + /* Always call finalize before the destructor. */ ~ObjectPtr() { MOZ_ASSERT(!value); } diff --git a/js/src/gc/Barrier.h b/js/src/gc/Barrier.h index 8618eb0ab..55c33188f 100644 --- a/js/src/gc/Barrier.h +++ b/js/src/gc/Barrier.h @@ -325,8 +325,11 @@ template class BarrieredBaseMixins {}; // Base class of all barrier types. +// +// This is marked non-memmovable since post barriers added by derived classes +// can add pointers to class instances to the store buffer. template -class BarrieredBase : public BarrieredBaseMixins +class MOZ_NON_MEMMOVABLE BarrieredBase : public BarrieredBaseMixins { protected: // BarrieredBase is not directly instantiable. diff --git a/netwerk/protocol/http/TunnelUtils.cpp b/netwerk/protocol/http/TunnelUtils.cpp index 74d186092..eda509004 100644 --- a/netwerk/protocol/http/TunnelUtils.cpp +++ b/netwerk/protocol/http/TunnelUtils.cpp @@ -123,6 +123,10 @@ TLSFilterTransaction::Close(nsresult aReason) return; } + if (mTimer) { + mTimer->Cancel(); + mTimer = nullptr; + } mTransaction->Close(aReason); mTransaction = nullptr; } diff --git a/view/nsViewManager.cpp b/view/nsViewManager.cpp index 1b3b70d6f..e58f344fa 100644 --- a/view/nsViewManager.cpp +++ b/view/nsViewManager.cpp @@ -101,7 +101,7 @@ nsViewManager::~nsViewManager() gViewManagers = nullptr; } - mPresShell = nullptr; + MOZ_RELEASE_ASSERT(!mPresShell, "Releasing nsViewManager without having called Destroy on the PresShell!"); } // We don't hold a reference to the presentation context because it diff --git a/xpcom/glue/nsTArray.h b/xpcom/glue/nsTArray.h index 10465ea82..efae00283 100644 --- a/xpcom/glue/nsTArray.h +++ b/xpcom/glue/nsTArray.h @@ -33,6 +33,7 @@ namespace JS { template class Heap; +class ObjectPtr; } /* namespace JS */ class nsRegion; @@ -659,7 +660,7 @@ struct nsTArray_CopyWithConstructors template struct MOZ_NEEDS_MEMMOVABLE_TYPE nsTArray_CopyChooser { - typedef nsTArray_CopyWithMemutils Type; + using Type = nsTArray_CopyWithMemutils; }; // @@ -669,25 +670,31 @@ struct MOZ_NEEDS_MEMMOVABLE_TYPE nsTArray_CopyChooser template struct nsTArray_CopyChooser> { - typedef nsTArray_CopyWithConstructors> Type; + using Type = nsTArray_CopyWithConstructors>; +}; + +template<> +struct nsTArray_CopyChooser +{ + using Type = nsTArray_CopyWithConstructors; }; template<> struct nsTArray_CopyChooser { - typedef nsTArray_CopyWithConstructors Type; + using Type = nsTArray_CopyWithConstructors; }; template<> struct nsTArray_CopyChooser { - typedef nsTArray_CopyWithConstructors Type; + using Type = nsTArray_CopyWithConstructors; }; template<> struct nsTArray_CopyChooser { - typedef nsTArray_CopyWithConstructors Type; + using Type = nsTArray_CopyWithConstructors; };