diff --git a/dom/bindings/BindingDeclarations.h b/dom/bindings/BindingDeclarations.h index 1892c14ce1d7..d799db3fecf0 100644 --- a/dom/bindings/BindingDeclarations.h +++ b/dom/bindings/BindingDeclarations.h @@ -580,66 +580,6 @@ public: {} }; -class RootedJSValue -{ -public: - RootedJSValue() - : mCx(nullptr) - {} - - ~RootedJSValue() - { - if (mCx) { - JS_RemoveValueRoot(mCx, &mValue); - } - } - - bool SetValue(JSContext* aCx, JS::Value aValue) - { - // We don't go ahead and root if v is null, because we want to allow - // null-initialization even when there is no cx. - MOZ_ASSERT_IF(!aValue.isNull(), aCx); - - // Be careful to not clobber mCx if it's already set, just in case we're - // being null-initialized (with a null cx for some reason) after we have - // already been initialized properly with a non-null value. - if (!aValue.isNull() && !mCx) { - if (!JS_AddNamedValueRoot(aCx, &mValue, "RootedJSValue::mValue")) { - return false; - } - mCx = aCx; - } - - mValue = aValue; - return true; - } - - // Note: This operator can be const because we return by value, not - // by reference. - operator JS::Value() const - { - return mValue; - } - - JS::Value* operator&() - { - return &mValue; - } - - const JS::Value* operator&() const - { - return &mValue; - } - -private: - // Don't allow copy-construction of these objects, because it'll do the wrong - // thing with our flag mCx. - RootedJSValue(const RootedJSValue&) MOZ_DELETE; - - JS::Value mValue; - JSContext* mCx; -}; - inline nsWrapperCache* GetWrapperCache(nsWrapperCache* cache) {