Commit d9d9276c authored by Jeff Walden's avatar Jeff Walden
Browse files

Bug 752737 - Delete the default and copy constructors and assignment operator...

Bug 752737 - Delete the default and copy constructors and assignment operator from JSString and JSObject to avoid errors.  r=luke

--HG--
extra : rebase_source : 37d8f094e917a097ac1b2ee0d4956f15e46c532c
parent b8ebb4ee
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -13,7 +13,8 @@ BEGIN_TEST(testConservativeGC)
    jsval v3;
    EVAL("String(Math.PI);", &v3);
    CHECK(JSVAL_IS_STRING(v3));
    JSString strCopy = *JSVAL_TO_STRING(v3);
    char strCopy[sizeof(JSString)];
    js_memcpy(&strCopy, JSVAL_TO_STRING(v3), sizeof(JSString));

    jsval tmp;
    EVAL("({foo2: 'bar2'});", &tmp);
@@ -25,7 +26,8 @@ BEGIN_TEST(testConservativeGC)
    EVAL("String(Math.sqrt(3));", &tmp);
    CHECK(JSVAL_IS_STRING(tmp));
    JSString *str2 = JSVAL_TO_STRING(tmp);
    JSString str2Copy = *str2;
    char str2Copy[sizeof(JSString)];
    js_memcpy(&str2Copy, str2, sizeof(JSString));

    tmp = JSVAL_NULL;

@@ -39,10 +41,10 @@ BEGIN_TEST(testConservativeGC)
    JS_GC(rt);

    checkObjectFields((JSObject *)objCopy, JSVAL_TO_OBJECT(v2));
    CHECK(!memcmp(&strCopy, JSVAL_TO_STRING(v3), sizeof(strCopy)));
    CHECK(!memcmp(strCopy, JSVAL_TO_STRING(v3), sizeof(strCopy)));

    checkObjectFields((JSObject *)obj2Copy, obj2);
    CHECK(!memcmp(&str2Copy, str2, sizeof(str2Copy)));
    CHECK(!memcmp(str2Copy, str2, sizeof(str2Copy)));

    return true;
}
+4 −0
Original line number Diff line number Diff line
@@ -998,6 +998,10 @@ struct JSObject : public js::ObjectImpl
        MOZ_STATIC_ASSERT(sizeof(JSObject) % sizeof(js::Value) == 0,
                          "fixed slots after an object must be aligned");
    }

    JSObject() MOZ_DELETE;
    JSObject(const JSObject &other) MOZ_DELETE;
    void operator=(const JSObject &other) MOZ_DELETE;
};

/*
+0 −6
Original line number Diff line number Diff line
@@ -41,8 +41,6 @@
#ifndef BooleanObject_h___
#define BooleanObject_h___

#include "mozilla/Attributes.h"

#include "jsbool.h"

namespace js {
@@ -79,10 +77,6 @@ class BooleanObject : public JSObject
    /* For access to init, as Boolean.prototype is special. */
    friend JSObject *
    ::js_InitBooleanClass(JSContext *cx, JSObject *global);

  private:
    BooleanObject() MOZ_DELETE;
    BooleanObject &operator=(const BooleanObject &bo) MOZ_DELETE;
};

} // namespace js
+2 −4
Original line number Diff line number Diff line
@@ -94,10 +94,8 @@ class Debugger;
 * even deletable) Object, Array, &c. properties (although a slot won't be used
 * again if its property is deleted and readded).
 */
class GlobalObject : public JSObject {
    GlobalObject(const GlobalObject &other) MOZ_DELETE;
    void operator=(const GlobalObject &other) MOZ_DELETE;

class GlobalObject : public JSObject
{
    /*
     * Count of slots to store built-in constructors, prototypes, and initial
     * visible properties for the constructors.
+0 −6
Original line number Diff line number Diff line
@@ -41,8 +41,6 @@
#ifndef NumberObject_h___
#define NumberObject_h___

#include "mozilla/Attributes.h"

#include "jsnum.h"

namespace js {
@@ -79,10 +77,6 @@ class NumberObject : public JSObject
    /* For access to init, as Number.prototype is special. */
    friend JSObject *
    ::js_InitNumberClass(JSContext *cx, JSObject *global);

  private:
    NumberObject() MOZ_DELETE;
    NumberObject &operator=(const NumberObject &so) MOZ_DELETE;
};

} // namespace js
Loading