Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(217)

Issue 1096813008: Kill overloaded cast operators in CJS_Value. (Closed)

Created:
5 years, 8 months ago by Tom Sepez
Modified:
5 years, 8 months ago
Reviewers:
Lei Zhang
CC:
pdfium-reviews_googlegroups.com
Base URL:
https://pdfium.googlesource.com/pdfium.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

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 Committed: https://pdfium.googlesource.com/pdfium/+/e4fde52cc2c827e637c96e8e1f76ba4644cf718a

Patch Set 1 #

Patch Set 2 : Remove stray file. #

Patch Set 3 : Tabify. #

Patch Set 4 : More Tabify. #

Total comments: 2

Patch Set 5 : fix nit. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+305 lines, -362 lines) Patch
M fpdfsdk/include/javascript/JS_Define.h View 3 chunks +3 lines, -3 lines 0 comments Download
M fpdfsdk/include/javascript/JS_Value.h View 1 chunk +10 lines, -10 lines 0 comments Download
M fpdfsdk/src/javascript/Document.cpp View 1 2 3 4 17 chunks +72 lines, -67 lines 0 comments Download
M fpdfsdk/src/javascript/Field.cpp View 1 2 13 chunks +32 lines, -39 lines 0 comments Download
M fpdfsdk/src/javascript/JS_Value.cpp View 12 chunks +23 lines, -34 lines 0 comments Download
M fpdfsdk/src/javascript/PublicMethods.cpp View 1 2 3 27 chunks +66 lines, -82 lines 0 comments Download
M fpdfsdk/src/javascript/app.cpp View 1 2 3 16 chunks +73 lines, -86 lines 0 comments Download
M fpdfsdk/src/javascript/color.cpp View 1 2 3 chunks +7 lines, -9 lines 0 comments Download
M fpdfsdk/src/javascript/event.cpp View 1 chunk +1 line, -1 line 0 comments Download
M fpdfsdk/src/javascript/global.cpp View 1 2 4 chunks +6 lines, -17 lines 0 comments Download
M fpdfsdk/src/javascript/util.cpp View 7 chunks +12 lines, -14 lines 0 comments Download

Messages

Total messages: 5 (1 generated)
Tom Sepez
Lei, for review.
5 years, 8 months ago (2015-04-22 20:44:34 UTC) #2
Lei Zhang
lgtm https://codereview.chromium.org/1096813008/diff/20002/fpdfsdk/src/javascript/Document.cpp File fpdfsdk/src/javascript/Document.cpp (right): https://codereview.chromium.org/1096813008/diff/20002/fpdfsdk/src/javascript/Document.cpp#newcode776 fpdfsdk/src/javascript/Document.cpp:776: v8::Isolate* isolate = GetIsolate(cc); nit: what was wrong ...
5 years, 8 months ago (2015-04-22 22:53:42 UTC) #3
Tom Sepez
https://codereview.chromium.org/1096813008/diff/20002/fpdfsdk/src/javascript/Document.cpp File fpdfsdk/src/javascript/Document.cpp (right): https://codereview.chromium.org/1096813008/diff/20002/fpdfsdk/src/javascript/Document.cpp#newcode776 fpdfsdk/src/javascript/Document.cpp:776: v8::Isolate* isolate = GetIsolate(cc); On 2015/04/22 22:53:42, Lei Zhang ...
5 years, 8 months ago (2015-04-23 16:10:22 UTC) #4
Tom Sepez
5 years, 8 months ago (2015-04-23 18:23:14 UTC) #5
Message was sent while issue was closed.
Committed patchset #5 (id:60001) manually as
e4fde52cc2c827e637c96e8e1f76ba4644cf718a (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698