Bug 1325351 part 1 - Remove workaround for VC in Maybe. r=froydnj
authorXidorn Quan <me@upsuper.org>
Thu, 29 Dec 2016 10:58:01 +1100
changeset 327517 a5917e9614e49308f6e9963ee6c38517fef48416
parent 327516 aa940ccb1d9f19bcbc8eed23b185a35fe5bb2c4e
child 327518 134d3abde30cabf888b1e8b9a4dadd94cd872482
push id85215
push userkwierso@gmail.com
push dateThu, 29 Dec 2016 20:22:31 +0000
treeherdermozilla-inbound@1539be3e8e5b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1325351
milestone53.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 1325351 part 1 - Remove workaround for VC in Maybe. r=froydnj MozReview-Commit-ID: Anlrf3D2WtN
js/public/Proxy.h
mfbt/Maybe.h
--- a/js/public/Proxy.h
+++ b/js/public/Proxy.h
@@ -588,16 +588,25 @@ class JS_FRIEND_API(AutoEnterPolicy)
     void recordLeave();
 
     friend JS_FRIEND_API(void) assertEnteredPolicy(JSContext* cx, JSObject* proxy, jsid id, Action act);
 #else
     inline void recordEnter(JSContext* cx, JSObject* proxy, jsid id, Action act) {}
     inline void recordLeave() {}
 #endif
 
+  private:
+    // This operator needs to be deleted explicitly, otherwise Visual C++ will
+    // create it automatically when it is part of the export JS API. In that
+    // case, compile would fail because HandleId is not allowed to be assigned
+    // and consequently instantiation of assign operator of mozilla::Maybe
+    // would fail. See bug 1325351 comment 16. Copy constructor is removed at
+    // the same time for consistency.
+    AutoEnterPolicy(const AutoEnterPolicy&) = delete;
+    AutoEnterPolicy& operator=(const AutoEnterPolicy&) = delete;
 };
 
 #ifdef JS_DEBUG
 class JS_FRIEND_API(AutoWaivePolicy) : public AutoEnterPolicy {
 public:
     AutoWaivePolicy(JSContext* cx, HandleObject proxy, HandleId id,
                     BaseProxyHandler::Action act)
     {
--- a/mfbt/Maybe.h
+++ b/mfbt/Maybe.h
@@ -152,23 +152,17 @@ public:
     }
   }
 
   Maybe& operator=(const Maybe& aOther)
   {
     if (&aOther != this) {
       if (aOther.mIsSome) {
         if (mIsSome) {
-          // XXX(seth): The correct code for this branch, below, can't be used
-          // due to a bug in Visual Studio 2010. See bug 1052940.
-          /*
           ref() = aOther.ref();
-          */
-          reset();
-          emplace(*aOther);
         } else {
           emplace(*aOther);
         }
       } else {
         reset();
       }
     }
     return *this;