Kill overloaded cast operators in CJS_Value.
authorTom Sepez <tsepez@chromium.org>
Thu, 23 Apr 2015 18:23:10 +0000 (11:23 -0700)
committerTom Sepez <tsepez@chromium.org>
Thu, 23 Apr 2015 18:23:10 +0000 (11:23 -0700)
commite4fde52cc2c827e637c96e8e1f76ba4644cf718a
tree01208f95d013429d2682a228577880a64ae1845b
parent4eeef1d776ce7368063f9a7698cfa736821d4186
Kill overloaded cast operators in CJS_Value.

The red-flag here is the explicit invocation of things like
    params[1].operator CFX_WideString()

rather than
    static_cast<CFX_WideString>(params[1])

to invoke the conversion.  Turns out the above won't compile due to
ambiguity given the number of implicit constructors for widestrings.
CJS_Value has both constructors and assignment operators for the
primitive types, which means that conversions can take place
unexpectedly in both directions, a second red flag.

We don't want the compiler invoking these at will since it may hide
bugs. In fact, when they are removed, three such places were
discovered.

Also rename ToJSValue to ToV8Value to match the other ToV8xxxxx
functions added.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1096813008
fpdfsdk/include/javascript/JS_Define.h
fpdfsdk/include/javascript/JS_Value.h
fpdfsdk/src/javascript/Document.cpp
fpdfsdk/src/javascript/Field.cpp
fpdfsdk/src/javascript/JS_Value.cpp
fpdfsdk/src/javascript/PublicMethods.cpp
fpdfsdk/src/javascript/app.cpp
fpdfsdk/src/javascript/color.cpp
fpdfsdk/src/javascript/event.cpp
fpdfsdk/src/javascript/global.cpp
fpdfsdk/src/javascript/util.cpp