Bug 987111 - Add an assign() method to MutablePropertyDescriptorOperations. r=terrence
authorBobby Holley <bobbyholley@gmail.com>
Thu, 05 Jun 2014 22:32:37 -0700
changeset 206241 0e0a7e21a765ec1c54ba380b77bb59643a04976d
parent 206240 500b82107c1886866b5e34fb71979bdae5e4e9dd
child 206242 7133191966b6991f021ca22204d4afe71629ced7
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersterrence
bugs987111
milestone32.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 987111 - Add an assign() method to MutablePropertyDescriptorOperations. r=terrence It's unfortunate the we need to operate on the raw JSPropertyDescriptor for |other|, but the specialization that makes Handle<JSPropertyDescriptor> work is declared later in the file, which isn't kosher.
js/src/jsapi.h
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -2969,16 +2969,24 @@ class MutablePropertyDescriptorOperation
     void clear() {
         object().set(nullptr);
         setAttributes(0);
         setGetter(nullptr);
         setSetter(nullptr);
         value().setUndefined();
     }
 
+    void assign(JSPropertyDescriptor &other) {
+        object().set(other.obj);
+        setAttributes(other.attrs);
+        setGetter(other.getter);
+        setSetter(other.setter);
+        value().set(other.value);
+    }
+
     JS::MutableHandleObject object() {
         return JS::MutableHandleObject::fromMarkedLocation(&desc()->obj);
     }
     unsigned &attributesRef() { return desc()->attrs; }
     JSPropertyOp &getter() { return desc()->getter; }
     JSStrictPropertyOp &setter() { return desc()->setter; }
     JS::MutableHandleValue value() {
         return JS::MutableHandleValue::fromMarkedLocation(&desc()->value);