summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript/global.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-02-17 13:21:34 -0800
committerTom Sepez <tsepez@chromium.org>2015-02-17 13:21:34 -0800
commit2da7bd4d78897bed52fe1304694f4e970db65e58 (patch)
treecf3f87f8808b908510a3cb80860e712e80c7266f /fpdfsdk/src/javascript/global.cpp
parent7435e8e5c2f1163ec5eca79a3ac6c3920d490578 (diff)
downloadpdfium-2da7bd4d78897bed52fe1304694f4e970db65e58.tar.xz
Tidy up JS_Defines.h
This is a purely mechanical change, no new functionality. - Expand some macros which were merely a short-cut to save typing but reduced transparency. - Put GET_VALUE_TYPE() implementation into a .cpp file. This is a portion of the patch from issue 908033002 at patchset 40001 (http://crrev.com/908033002#ps40001) R=brucedawson@chromium.org Review URL: https://codereview.chromium.org/927263003
Diffstat (limited to 'fpdfsdk/src/javascript/global.cpp')
-rw-r--r--fpdfsdk/src/javascript/global.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/fpdfsdk/src/javascript/global.cpp b/fpdfsdk/src/javascript/global.cpp
index b45fd04558..587ba85219 100644
--- a/fpdfsdk/src/javascript/global.cpp
+++ b/fpdfsdk/src/javascript/global.cpp
@@ -268,7 +268,7 @@ FX_BOOL global_alternate::DoProperty(IFXJS_Context* cc, FX_LPCWSTR propname, CJS
return FALSE;
}
-FX_BOOL global_alternate::setPersistent(OBJ_METHOD_PARAMS)
+FX_BOOL global_alternate::setPersistent(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, JS_ErrorString& sError)
{
if (params.size() != 2)
{
@@ -615,3 +615,28 @@ FX_BOOL global_alternate::SetGlobalVariables(FX_LPCSTR propname, int nType,
return TRUE;
}
+
+FXJSVALUETYPE GET_VALUE_TYPE(v8::Handle<v8::Value> p)
+{
+ const unsigned int nHash = JS_CalcHash(JS_GetTypeof(p));
+
+ if (nHash == JSCONST_nUndefHash)
+ return VT_undefined;
+ if (nHash == JSCONST_nNullHash)
+ return VT_null;
+ if (nHash == JSCONST_nStringHash)
+ return VT_string;
+ if (nHash == JSCONST_nNumberHash)
+ return VT_number;
+ if (nHash == JSCONST_nBoolHash)
+ return VT_boolean;
+ if (nHash == JSCONST_nDateHash)
+ return VT_date;
+ if (nHash == JSCONST_nObjectHash)
+ return VT_object;
+ if (nHash == JSCONST_nFXobjHash)
+ return VT_fxobject;
+
+ return VT_unknown;
+}
+