Merge V8 API updates to xfa branch

Set pointers in internal fields directly instead of wrapping them
Review URL: https://codereview.chromium.org/1139853003

Use phantom handles instead of weak handles
Review URL: https://codereview.chromium.org/1129253004

Replace deprecated with non-deprecated V8 APIs
Review URL: https://codereview.chromium.org/1126203010

Add myself to OWNERS file
Review URL: https://codereview.chromium.org/1133333005

Replace v8::Handle with v8::Local and v8::Persistent with v8::Global
Review URL: https://codereview.chromium.org/1138823004

TBR=tsepez@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1140033004
diff --git a/OWNERS b/OWNERS
index 4b06587..47d804b 100644
--- a/OWNERS
+++ b/OWNERS
@@ -2,3 +2,5 @@
 jam@chromium.org
 thestig@chromium.org
 tsepez@chromium.org
+# For V8 related changes
+jochen@chromium.org
diff --git a/fpdfsdk/include/javascript/JS_Define.h b/fpdfsdk/include/javascript/JS_Define.h
index e9475a0..8310ae2 100644
--- a/fpdfsdk/include/javascript/JS_Define.h
+++ b/fpdfsdk/include/javascript/JS_Define.h
@@ -69,7 +69,7 @@
     JS_Error(isolate, JSFormatErrorString(class_name_string, prop_name_string, sError));
     return;
   }
-  info.GetReturnValue().Set((v8::Handle<v8::Value>)value);
+  info.GetReturnValue().Set((v8::Local<v8::Value>)value);
 }
 
 template <class C, FX_BOOL (C::*M)(IFXJS_Context*, CJS_PropValue&, CFX_WideString&)>
@@ -255,7 +255,7 @@
       JS_Error(isolate, JSFormatErrorString(class_name, "GetProperty", sError));
       return;
   }
-  info.GetReturnValue().Set((v8::Handle<v8::Value>)value);
+  info.GetReturnValue().Set((v8::Local<v8::Value>)value);
 }
 
 template <class Alt>
@@ -445,6 +445,6 @@
 #define VALUE_NAME_NULL			L"null"
 #define VALUE_NAME_UNDEFINED	L"undefined"
 
-FXJSVALUETYPE GET_VALUE_TYPE(v8::Handle<v8::Value> p);
+FXJSVALUETYPE GET_VALUE_TYPE(v8::Local<v8::Value> p);
 
 #endif //_JS_DEFINE_H_
diff --git a/fpdfsdk/include/javascript/JS_Object.h b/fpdfsdk/include/javascript/JS_Object.h
index 02d2f57..a9ad018 100644
--- a/fpdfsdk/include/javascript/JS_Object.h
+++ b/fpdfsdk/include/javascript/JS_Object.h
@@ -46,6 +46,7 @@
 	virtual ~CJS_Object(void);
 
 	void						MakeWeak();
+        void                                            Dispose();
 
 	virtual FX_BOOL				IsType(FX_LPCSTR sClassName){return TRUE;};
 	virtual CFX_ByteString		GetClassName(){return "";};
@@ -66,7 +67,7 @@
 	v8::Isolate*					GetIsolate() {return m_pIsolate;}
 protected:
 	CJS_EmbedObj *				m_pEmbedObj;
-	v8::Persistent<v8::Object>			m_pObject;
+	v8::Global<v8::Object>			m_pObject;
 	v8::Isolate*					m_pIsolate;
 };
 
diff --git a/fpdfsdk/include/javascript/JS_Runtime.h b/fpdfsdk/include/javascript/JS_Runtime.h
index 07e4e43..0e824f9 100644
--- a/fpdfsdk/include/javascript/JS_Runtime.h
+++ b/fpdfsdk/include/javascript/JS_Runtime.h
@@ -58,7 +58,7 @@
 	v8::Isolate*							GetIsolate(){return m_isolate;};
 	void									SetIsolate(v8::Isolate* isolate){m_isolate = isolate;}
 
-	v8::Handle<v8::Context>					NewJSContext();
+	v8::Local<v8::Context>					NewJSContext();
 
 
 	virtual	FX_BOOL							GetHValueByName(FX_BSTR utf8Name, FXJSE_HVALUE hValue);
@@ -73,7 +73,7 @@
 
 	v8::Isolate* m_isolate;
 	nonstd::unique_ptr<CJS_ArrayBufferAllocator> m_pArrayBufferAllocator;
-	v8::Persistent<v8::Context> m_context;
+	v8::Global<v8::Context> m_context;
 };
 
 #endif //_JS_RUNTIME_H_
diff --git a/fpdfsdk/include/javascript/JS_Value.h b/fpdfsdk/include/javascript/JS_Value.h
index ecd0f83..faa612d 100644
--- a/fpdfsdk/include/javascript/JS_Value.h
+++ b/fpdfsdk/include/javascript/JS_Value.h
@@ -19,7 +19,7 @@
 {
 public:
 	CJS_Value(v8::Isolate* isolate);
-	CJS_Value(v8::Isolate* isolate, v8::Handle<v8::Value> pValue,FXJSVALUETYPE t);
+	CJS_Value(v8::Isolate* isolate, v8::Local<v8::Value> pValue,FXJSVALUETYPE t);
 	CJS_Value(v8::Isolate* isolate, const int &iValue);
 	CJS_Value(v8::Isolate* isolate, const double &dValue);
 	CJS_Value(v8::Isolate* isolate, const float &fValue);
@@ -34,7 +34,7 @@
 	~CJS_Value();
 
 	void SetNull();
-    void Attach(v8::Handle<v8::Value> pValue,FXJSVALUETYPE t);
+    void Attach(v8::Local<v8::Value> pValue,FXJSVALUETYPE t);
 	void Attach(CJS_Value *pValue);
 	void Detach();
 
@@ -46,9 +46,9 @@
 	CJS_Object* ToCJSObject() const;
 	CFX_WideString ToCFXWideString() const;
 	CFX_ByteString ToCFXByteString() const;
-	v8::Handle<v8::Object> ToV8Object() const;
-	v8::Handle<v8::Array> ToV8Array() const;
-	v8::Handle<v8::Value> ToV8Value() const;
+	v8::Local<v8::Object> ToV8Object() const;
+	v8::Local<v8::Array> ToV8Array() const;
+	v8::Local<v8::Value> ToV8Value() const;
 
 	void operator = (int iValue);
 	void operator = (bool bValue);
@@ -56,7 +56,7 @@
 	void operator = (float);
 	void operator = (CJS_Object*);
 	void operator = (CJS_Document*);
-	void operator = (v8::Handle<v8::Object>);
+	void operator = (v8::Local<v8::Object>);
 	void operator = (CJS_Array &);
 	void operator = (CJS_Date &);
 	void operator = (FX_LPCWSTR pWstr);
@@ -72,7 +72,7 @@
 
 	v8::Isolate* GetIsolate() {return m_isolate;}
 protected:
-	v8::Handle<v8::Value> m_pValue;
+	v8::Local<v8::Value> m_pValue;
 	FXJSVALUETYPE m_eType;
 	v8::Isolate* m_isolate;
 };
@@ -118,7 +118,7 @@
 	void operator<<(CJS_Array& array);
 	void operator<<(CJS_Date& date);
 	void operator>>(CJS_Date& date) const;
-	operator v8::Handle<v8::Value>() const;
+	operator v8::Local<v8::Value>() const;
 	void StartSetting();
 	void StartGetting();
 private:
@@ -131,16 +131,16 @@
 	CJS_Array(v8::Isolate* isolate);
 	virtual ~CJS_Array();
 
-	void Attach(v8::Handle<v8::Array> pArray);
+	void Attach(v8::Local<v8::Array> pArray);
 	void GetElement(unsigned index,CJS_Value &value);
 	void SetElement(unsigned index,CJS_Value value);
     int GetLength();
 	FX_BOOL IsAttached();
-	operator v8::Handle<v8::Array>();
+	operator v8::Local<v8::Array>();
 
 	v8::Isolate* GetIsolate() {return m_isolate;}
 private:
-	v8::Handle<v8::Array> m_pArray;
+	v8::Local<v8::Array> m_pArray;
 	v8::Isolate* m_isolate;
 };
 
@@ -152,7 +152,7 @@
 	CJS_Date(v8::Isolate* isolate,double dMsec_time);
 	CJS_Date(v8::Isolate* isolate,int year, int mon, int day,int hour, int min, int sec);
 	virtual ~CJS_Date();
-	void Attach(v8::Handle<v8::Value> pDate);
+	void Attach(v8::Local<v8::Value> pDate);
 
 	int     GetYear();
 	void    SetYear(int iYear);
@@ -172,7 +172,7 @@
 	int     GetSeconds();
 	void    SetSeconds(int seconds);
 
-	operator v8::Handle<v8::Value>();
+	operator v8::Local<v8::Value>();
 	operator double() const;
 
 	CFX_WideString	ToString() const;
@@ -182,7 +182,7 @@
 	FX_BOOL	IsValidDate();
 
 protected:
-	v8::Handle<v8::Value> m_pDate;
+	v8::Local<v8::Value> m_pDate;
 	v8::Isolate* m_isolate;
 };
 
diff --git a/fpdfsdk/include/javascript/global.h b/fpdfsdk/include/javascript/global.h
index 9ee9f42..2690f68 100644
--- a/fpdfsdk/include/javascript/global.h
+++ b/fpdfsdk/include/javascript/global.h
@@ -33,7 +33,7 @@
 	double				dData;
 	bool				bData;
 	CFX_ByteString		sData;
-	v8::Persistent<v8::Object>  pData;
+	v8::Global<v8::Object>  pData;
 	bool				bPersistent;
 	bool				bDeleted;
 };
@@ -61,8 +61,8 @@
 	FX_BOOL						SetGlobalVariables(FX_LPCSTR propname, int nType, 
 									double dData, bool bData, const CFX_ByteString& sData, JSObject pData, bool bDefaultPersistent);
 
-	void						ObjectToArray(v8::Handle<v8::Object> pObj, CJS_GlobalVariableArray& array);
-	void						PutObjectProperty(v8::Handle<v8::Object> obj, CJS_KeyValue* pData);
+	void						ObjectToArray(v8::Local<v8::Object> pObj, CJS_GlobalVariableArray& array);
+	void						PutObjectProperty(v8::Local<v8::Object> obj, CJS_KeyValue* pData);
 
 private:
 	CFX_MapByteStringToPtr		m_mapGlobal;
diff --git a/fpdfsdk/include/jsapi/fxjs_v8.h b/fpdfsdk/include/jsapi/fxjs_v8.h
index a32ace6..cc1eb6b 100644
--- a/fpdfsdk/include/jsapi/fxjs_v8.h
+++ b/fpdfsdk/include/jsapi/fxjs_v8.h
@@ -14,8 +14,8 @@
 #include "../../../core/include/fxcrt/fx_string.h"  // For CFX_WideString
 
 typedef v8::Value			JSValue;
-typedef v8::Handle<v8::Object>	JSObject;
-typedef v8::Handle<v8::Object>	JSFXObject;
+typedef v8::Local<v8::Object>	JSObject;
+typedef v8::Local<v8::Object>	JSFXObject;
 
 enum FXJSOBJTYPE
 {
@@ -49,77 +49,78 @@
 class IFXJS_Context;
 class IFXJS_Runtime;
 
-typedef void (*LP_CONSTRUCTOR)(IFXJS_Context* cc, v8::Handle<v8::Object> obj, v8::Handle<v8::Object> global);
-typedef void (*LP_DESTRUCTOR)(v8::Handle<v8::Object> obj);
+typedef void (*LP_CONSTRUCTOR)(IFXJS_Context* cc, v8::Local<v8::Object> obj, v8::Local<v8::Object> global);
+typedef void (*LP_DESTRUCTOR)(v8::Local<v8::Object> obj);
 
 
 int								JS_DefineObj(IJS_Runtime* pJSRuntime, const wchar_t* sObjName, FXJSOBJTYPE eObjType, LP_CONSTRUCTOR pConstructor, LP_DESTRUCTOR pDestructor, unsigned bApplyNew);
 int								JS_DefineObjMethod(IJS_Runtime* pJSRuntime, int nObjDefnID, const wchar_t* sMethodName, v8::FunctionCallback pMethodCall);
 int								JS_DefineObjProperty(IJS_Runtime* pJSRuntime, int nObjDefnID, const wchar_t* sPropName, v8::AccessorGetterCallback pPropGet, v8::AccessorSetterCallback pPropPut);
 int								JS_DefineObjAllProperties(IJS_Runtime* pJSRuntime, int nObjDefnID, v8::NamedPropertyQueryCallback pPropQurey, v8::NamedPropertyGetterCallback pPropGet, v8::NamedPropertySetterCallback pPropPut, v8::NamedPropertyDeleterCallback pPropDel);
-int								JS_DefineObjConst(IJS_Runtime* pJSRuntime, int nObjDefnID, const wchar_t* sConstName, v8::Handle<v8::Value> pDefault);
+int								JS_DefineObjConst(IJS_Runtime* pJSRuntime, int nObjDefnID, const wchar_t* sConstName, v8::Local<v8::Value> pDefault);
 int								JS_DefineGlobalMethod(IJS_Runtime* pJSRuntime, const wchar_t* sMethodName, v8::FunctionCallback pMethodCall);
-int								JS_DefineGlobalConst(IJS_Runtime* pJSRuntime, const wchar_t* sConstName, v8::Handle<v8::Value> pDefault);
+int								JS_DefineGlobalConst(IJS_Runtime* pJSRuntime, const wchar_t* sConstName, v8::Local<v8::Value> pDefault);
 
-void							JS_InitialRuntime(IJS_Runtime* pJSRuntime,IFXJS_Runtime* pFXRuntime, IFXJS_Context* context, v8::Persistent<v8::Context>& v8PersistentContext);
-void							JS_ReleaseRuntime(IJS_Runtime* pJSRuntime, v8::Persistent<v8::Context>& v8PersistentContext);
+void							JS_InitialRuntime(IJS_Runtime* pJSRuntime,IFXJS_Runtime* pFXRuntime, IFXJS_Context* context, v8::Global<v8::Context>& v8PersistentContext);
+void							JS_ReleaseRuntime(IJS_Runtime* pJSRuntime, v8::Global<v8::Context>& v8PersistentContext);
 void							JS_Initial();
 void							JS_Release();
 int								JS_Parse(IJS_Runtime* pJSRuntime, IFXJS_Context* pJSContext, const wchar_t* script, long length, FXJSErr* perror);
 int								JS_Execute(IJS_Runtime* pJSRuntime, IFXJS_Context* pJSContext, const wchar_t* script, long length, FXJSErr* perror);
-v8::Handle<v8::Object>			JS_NewFxDynamicObj(IJS_Runtime* pJSRuntime, IFXJS_Context* pJSContext, int nObjDefnID);
-v8::Handle<v8::Object>			JS_GetStaticObj(IJS_Runtime* pJSRuntime, int nObjDefnID);
+v8::Local<v8::Object>			JS_NewFxDynamicObj(IJS_Runtime* pJSRuntime, IFXJS_Context* pJSContext, int nObjDefnID);
+v8::Local<v8::Object>			JS_GetStaticObj(IJS_Runtime* pJSRuntime, int nObjDefnID);
 void							JS_SetThisObj(IJS_Runtime* pJSRuntime, int nThisObjID);
-v8::Handle<v8::Object>			JS_GetThisObj(IJS_Runtime * pJSRuntime);
-int								JS_GetObjDefnID(v8::Handle<v8::Object> pObj);
-IJS_Runtime*					JS_GetRuntime(v8::Handle<v8::Object> pObj);
+v8::Local<v8::Object>			JS_GetThisObj(IJS_Runtime * pJSRuntime);
+int								JS_GetObjDefnID(v8::Local<v8::Object> pObj);
+IJS_Runtime*					JS_GetRuntime(v8::Local<v8::Object> pObj);
 int								JS_GetObjDefnID(IJS_Runtime * pJSRuntime, const wchar_t* pObjName);
 void							JS_Error(v8::Isolate* isolate, const CFX_WideString& message);
 unsigned						JS_CalcHash(const wchar_t* main, unsigned nLen);
 unsigned						JS_CalcHash(const wchar_t* main);
-const wchar_t*					JS_GetTypeof(v8::Handle<v8::Value> pObj);
-void							JS_SetPrivate(IJS_Runtime* pJSRuntime, v8::Handle<v8::Object> pObj, void* p);
-void*							JS_GetPrivate(IJS_Runtime* pJSRuntime, v8::Handle<v8::Object> pObj);
-void							JS_SetPrivate(v8::Handle<v8::Object> pObj, void* p);
-void*							JS_GetPrivate(v8::Handle<v8::Object> pObj);
-void							JS_FreePrivate(v8::Handle<v8::Object> pObj);
-v8::Handle<v8::Value>			JS_GetObjectValue(v8::Handle<v8::Object> pObj);
-v8::Handle<v8::Value>			JS_GetObjectElement(IJS_Runtime* pJSRuntime, v8::Handle<v8::Object> pObj,const wchar_t* PropertyName);
-v8::Handle<v8::Array>			JS_GetObjectElementNames(v8::Handle<v8::Object> pObj);
-void							JS_PutObjectString(IJS_Runtime* pJSRuntime,v8::Handle<v8::Object> pObj, const wchar_t* PropertyName, const wchar_t* sValue);
-void							JS_PutObjectNumber(IJS_Runtime* pJSRuntime,v8::Handle<v8::Object> pObj, const wchar_t* PropertyName, int nValue);
-void							JS_PutObjectNumber(IJS_Runtime* pJSRuntime,v8::Handle<v8::Object> pObj, const wchar_t* PropertyName, float fValue);
-void							JS_PutObjectNumber(IJS_Runtime* pJSRuntime,v8::Handle<v8::Object> pObj, const wchar_t* PropertyName, double dValue);
-void							JS_PutObjectBoolean(IJS_Runtime* pJSRuntime,v8::Handle<v8::Object> pObj, const wchar_t* PropertyName, bool bValue);
-void							JS_PutObjectObject(IJS_Runtime* pJSRuntime,v8::Handle<v8::Object> pObj, const wchar_t* PropertyName, v8::Handle<v8::Object> pPut);
-void							JS_PutObjectNull(IJS_Runtime* pJSRuntime,v8::Handle<v8::Object> pObj, const wchar_t* PropertyName);
-unsigned						JS_PutArrayElement(v8::Handle<v8::Array> pArray,unsigned index,v8::Handle<v8::Value> pValue,FXJSVALUETYPE eType);
-v8::Handle<v8::Value>			JS_GetArrayElemnet(v8::Handle<v8::Array> pArray,unsigned index);
-unsigned						JS_GetArrayLength(v8::Handle<v8::Array> pArray);
-v8::Handle<v8::Value>			JS_GetListValue(v8::Handle<v8::Value> pList, int index);
+const wchar_t*					JS_GetTypeof(v8::Local<v8::Value> pObj);
+void							JS_SetPrivate(IJS_Runtime* pJSRuntime, v8::Local<v8::Object> pObj, void* p);
+void*							JS_GetPrivate(IJS_Runtime* pJSRuntime, v8::Local<v8::Object> pObj);
+void							JS_SetPrivate(v8::Local<v8::Object> pObj, void* p);
+void*							JS_GetPrivate(v8::Local<v8::Object> pObj);
+void							JS_FreePrivate(void* p);
+void							JS_FreePrivate(v8::Local<v8::Object> pObj);
+v8::Local<v8::Value>			JS_GetObjectValue(v8::Local<v8::Object> pObj);
+v8::Local<v8::Value>			JS_GetObjectElement(IJS_Runtime* pJSRuntime, v8::Local<v8::Object> pObj,const wchar_t* PropertyName);
+v8::Local<v8::Array>			JS_GetObjectElementNames(IJS_Runtime* pJSRuntime, v8::Local<v8::Object> pObj);
+void							JS_PutObjectString(IJS_Runtime* pJSRuntime,v8::Local<v8::Object> pObj, const wchar_t* PropertyName, const wchar_t* sValue);
+void							JS_PutObjectNumber(IJS_Runtime* pJSRuntime,v8::Local<v8::Object> pObj, const wchar_t* PropertyName, int nValue);
+void							JS_PutObjectNumber(IJS_Runtime* pJSRuntime,v8::Local<v8::Object> pObj, const wchar_t* PropertyName, float fValue);
+void							JS_PutObjectNumber(IJS_Runtime* pJSRuntime,v8::Local<v8::Object> pObj, const wchar_t* PropertyName, double dValue);
+void							JS_PutObjectBoolean(IJS_Runtime* pJSRuntime,v8::Local<v8::Object> pObj, const wchar_t* PropertyName, bool bValue);
+void							JS_PutObjectObject(IJS_Runtime* pJSRuntime,v8::Local<v8::Object> pObj, const wchar_t* PropertyName, v8::Local<v8::Object> pPut);
+void							JS_PutObjectNull(IJS_Runtime* pJSRuntime,v8::Local<v8::Object> pObj, const wchar_t* PropertyName);
+unsigned						JS_PutArrayElement(IJS_Runtime* pJSRuntime, v8::Local<v8::Array> pArray,unsigned index,v8::Local<v8::Value> pValue,FXJSVALUETYPE eType);
+v8::Local<v8::Value>			JS_GetArrayElement(IJS_Runtime* pJSRuntime, v8::Local<v8::Array> pArray,unsigned index);
+unsigned						JS_GetArrayLength(v8::Local<v8::Array> pArray);
+v8::Local<v8::Value>			JS_GetListValue(IJS_Runtime* pJSRuntime, v8::Local<v8::Value> pList, int index);
 
 
-v8::Handle<v8::Array>			JS_NewArray(IJS_Runtime* pJSRuntime);
-v8::Handle<v8::Value>			JS_NewNumber(IJS_Runtime* pJSRuntime,int number);
-v8::Handle<v8::Value>			JS_NewNumber(IJS_Runtime* pJSRuntime,double number);
-v8::Handle<v8::Value>			JS_NewNumber(IJS_Runtime* pJSRuntime,float number);
-v8::Handle<v8::Value>			JS_NewBoolean(IJS_Runtime* pJSRuntime,bool b);
-v8::Handle<v8::Value>			JS_NewObject(IJS_Runtime* pJSRuntime,v8::Handle<v8::Object> pObj);
-v8::Handle<v8::Value>			JS_NewObject2(IJS_Runtime* pJSRuntime,v8::Handle<v8::Array> pObj);
-v8::Handle<v8::Value>			JS_NewString(IJS_Runtime* pJSRuntime,const wchar_t* string);
-v8::Handle<v8::Value>			JS_NewString(IJS_Runtime* pJSRuntime,const wchar_t* string, unsigned nLen);
-v8::Handle<v8::Value>			JS_NewNull();
-v8::Handle<v8::Value>			JS_NewDate(IJS_Runtime* pJSRuntime,double d);
-v8::Handle<v8::Value>			JS_NewValue(IJS_Runtime* pJSRuntime);
+v8::Local<v8::Array>			JS_NewArray(IJS_Runtime* pJSRuntime);
+v8::Local<v8::Value>			JS_NewNumber(IJS_Runtime* pJSRuntime,int number);
+v8::Local<v8::Value>			JS_NewNumber(IJS_Runtime* pJSRuntime,double number);
+v8::Local<v8::Value>			JS_NewNumber(IJS_Runtime* pJSRuntime,float number);
+v8::Local<v8::Value>			JS_NewBoolean(IJS_Runtime* pJSRuntime,bool b);
+v8::Local<v8::Value>			JS_NewObject(IJS_Runtime* pJSRuntime,v8::Local<v8::Object> pObj);
+v8::Local<v8::Value>			JS_NewObject2(IJS_Runtime* pJSRuntime,v8::Local<v8::Array> pObj);
+v8::Local<v8::Value>			JS_NewString(IJS_Runtime* pJSRuntime,const wchar_t* string);
+v8::Local<v8::Value>			JS_NewString(IJS_Runtime* pJSRuntime,const wchar_t* string, unsigned nLen);
+v8::Local<v8::Value>			JS_NewNull();
+v8::Local<v8::Value>			JS_NewDate(IJS_Runtime* pJSRuntime,double d);
+v8::Local<v8::Value>			JS_NewValue(IJS_Runtime* pJSRuntime);
 
 
-int								JS_ToInt32(v8::Handle<v8::Value> pValue);
-bool							JS_ToBoolean(v8::Handle<v8::Value> pValue);
-double							JS_ToNumber(v8::Handle<v8::Value> pValue);
-v8::Handle<v8::Object>			JS_ToObject(v8::Handle<v8::Value> pValue);
-CFX_WideString					JS_ToString(v8::Handle<v8::Value> pValue);
-v8::Handle<v8::Array>			JS_ToArray(v8::Handle<v8::Value> pValue);
-void							JS_ValueCopy(v8::Handle<v8::Value>& pTo, v8::Handle<v8::Value> pFrom);
+int								JS_ToInt32(IJS_Runtime* pJSRuntime, v8::Local<v8::Value> pValue);
+bool							JS_ToBoolean(IJS_Runtime* pJSRuntime, v8::Local<v8::Value> pValue);
+double							JS_ToNumber(IJS_Runtime* pJSRuntime, v8::Local<v8::Value> pValue);
+v8::Local<v8::Object>			JS_ToObject(IJS_Runtime* pJSRuntime, v8::Local<v8::Value> pValue);
+CFX_WideString					JS_ToString(IJS_Runtime* pJSRuntime, v8::Local<v8::Value> pValue);
+v8::Local<v8::Array>			JS_ToArray(IJS_Runtime* pJSRuntime, v8::Local<v8::Value> pValue);
+void							JS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom);
 
 double							JS_GetDateTime();
 int								JS_GetYearFromTime(double dt);
diff --git a/fpdfsdk/src/fpdfxfa/fpdfxfa_app.cpp b/fpdfsdk/src/fpdfxfa/fpdfxfa_app.cpp
index 94164f1..e8bd9d0 100644
--- a/fpdfsdk/src/fpdfxfa/fpdfxfa_app.cpp
+++ b/fpdfsdk/src/fpdfxfa/fpdfxfa_app.cpp
@@ -134,7 +134,7 @@
 }

 void CPDFXFA_App::ReleaseRuntime() 

 {

-	v8::Persistent<v8::Context> context;

+	v8::Global<v8::Context> context;

 	JS_ReleaseRuntime((IJS_Runtime*)m_hJSERuntime, context);

 }

 

diff --git a/fpdfsdk/src/javascript/Document.cpp b/fpdfsdk/src/javascript/Document.cpp
index 6396095..c4a93ed 100644
--- a/fpdfsdk/src/javascript/Document.cpp
+++ b/fpdfsdk/src/javascript/Document.cpp
@@ -663,7 +663,7 @@
 	else if (v.GetType() == VT_object)
 	{
 		JSObject pObj = params[0].ToV8Object();
-		v8::Handle<v8::Value> pValue = JS_GetObjectElement(isolate, pObj, L"cURL");
+		v8::Local<v8::Value> pValue = JS_GetObjectElement(isolate, pObj, L"cURL");
 		if (!pValue.IsEmpty())
 			strURL = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString();
 		pValue = JS_GetObjectElement(isolate, pObj, L"bFDF");
@@ -796,7 +796,7 @@
 	{
 		JSObject pObj = params[0].ToV8Object();
 
-		v8::Handle<v8::Value> pValue = JS_GetObjectElement(isolate,pObj, L"bUI");
+		v8::Local<v8::Value> pValue = JS_GetObjectElement(isolate,pObj, L"bUI");
 		bUI = CJS_Value(isolate,pValue,GET_VALUE_TYPE(pValue)).ToInt();
 
 		pValue = JS_GetObjectElement(isolate,pObj, L"cTo");
@@ -1863,7 +1863,7 @@
 		if (params[0].GetType() == VT_object)
 		{
 			JSObject pObj = params[0].ToV8Object();
-			v8::Handle<v8::Value> pValue = JS_GetObjectElement(isolate, pObj, L"nStart");
+			v8::Local<v8::Value> pValue = JS_GetObjectElement(isolate, pObj, L"nStart");
             nStart = CJS_Value(m_isolate, pValue, GET_VALUE_TYPE(pValue)).ToInt();
 
 			pValue = JS_GetObjectElement(isolate, pObj, L"nEnd");
diff --git a/fpdfsdk/src/javascript/JS_Object.cpp b/fpdfsdk/src/javascript/JS_Object.cpp
index 44978fa..96c5307 100644
--- a/fpdfsdk/src/javascript/JS_Object.cpp
+++ b/fpdfsdk/src/javascript/JS_Object.cpp
@@ -88,16 +88,19 @@
 }
 
 /* ---------------------------------  CJS_Object --------------------------------- */
-void  FreeObject(const v8::WeakCallbackData<v8::Object, CJS_Object>& data)
+void  FreeObject(const v8::WeakCallbackInfo<CJS_Object>& data)
 {
 	CJS_Object* pJSObj  = data.GetParameter();
-	if(pJSObj)
-	{
-		pJSObj->ExitInstance();
-		delete pJSObj;
-	}
-	v8::Local<v8::Object> obj = data.GetValue();
-	JS_FreePrivate(obj);
+        pJSObj->ExitInstance();
+        delete pJSObj;
+	JS_FreePrivate(data.GetInternalField(0));
+}
+
+void  DisposeObject(const v8::WeakCallbackInfo<CJS_Object>& data)
+{
+	CJS_Object* pJSObj  = data.GetParameter();
+        pJSObj->Dispose();
+        data.SetSecondPassCallback(FreeObject);
 }
 
 CJS_Object::CJS_Object(JSFXObject pObject) :m_pEmbedObj(NULL)
@@ -117,7 +120,13 @@
 
 void	CJS_Object::MakeWeak()
 {
-	m_pObject.SetWeak(this, FreeObject);
+	m_pObject.SetWeak(
+            this, DisposeObject, v8::WeakCallbackType::kInternalFields);
+}
+
+void    CJS_Object::Dispose()
+{
+        m_pObject.Reset();
 }
 
 CPDFSDK_PageView* CJS_Object::JSGetPageView(IFXJS_Context* cc)
diff --git a/fpdfsdk/src/javascript/JS_Runtime.cpp b/fpdfsdk/src/javascript/JS_Runtime.cpp
index 2ad5667..f3d7cf3 100644
--- a/fpdfsdk/src/javascript/JS_Runtime.cpp
+++ b/fpdfsdk/src/javascript/JS_Runtime.cpp
@@ -106,7 +106,7 @@
 }
 
 /* ------------------------------ CJS_Runtime ------------------------------ */
-extern v8::Persistent<v8::ObjectTemplate>& _getGlobalObjectTemplate(IJS_Runtime* pJSRuntime);
+extern v8::Global<v8::ObjectTemplate>& _getGlobalObjectTemplate(IJS_Runtime* pJSRuntime);
 CJS_Runtime::CJS_Runtime(CPDFDoc_Environment* pApp) :
 	m_pApp(pApp),
 	m_pDocument(NULL),
@@ -168,7 +168,7 @@
 	v8::Isolate::Scope isolate_scope(GetIsolate());
 	v8::Locker locker(GetIsolate());
 	v8::HandleScope handle_scope(GetIsolate());
-	v8::Handle<v8::Context> context = v8::Context::New(GetIsolate());
+	v8::Local<v8::Context> context = v8::Context::New(GetIsolate());
 	v8::Context::Scope context_scope(context);
 	//0 - 8
 	if (CJS_Border::Init(*this, JS_STATIC) < 0) return FALSE;
@@ -348,7 +348,7 @@
 	}
 }
 
-v8::Handle<v8::Context>	CJS_Runtime::NewJSContext()
+v8::Local<v8::Context>	CJS_Runtime::NewJSContext()
 {
 	return v8::Local<v8::Context>::New(m_isolate, m_context);
 }
diff --git a/fpdfsdk/src/javascript/JS_Value.cpp b/fpdfsdk/src/javascript/JS_Value.cpp
index 1b36f31..0943802 100644
--- a/fpdfsdk/src/javascript/JS_Value.cpp
+++ b/fpdfsdk/src/javascript/JS_Value.cpp
@@ -15,7 +15,7 @@
 CJS_Value::CJS_Value(v8::Isolate* isolate) : m_eType(VT_unknown),m_isolate(isolate)
 {
 }
-CJS_Value::CJS_Value(v8::Isolate* isolate, v8::Handle<v8::Value> pValue,FXJSVALUETYPE t) :
+CJS_Value::CJS_Value(v8::Isolate* isolate, v8::Local<v8::Value> pValue,FXJSVALUETYPE t) :
 	m_pValue(pValue), m_eType(t), m_isolate(isolate)
 {
 }
@@ -76,7 +76,7 @@
 {
 }
 
-void CJS_Value::Attach(v8::Handle<v8::Value> pValue,FXJSVALUETYPE t)
+void CJS_Value::Attach(v8::Local<v8::Value> pValue,FXJSVALUETYPE t)
 {
 	m_pValue = pValue;
 	m_eType = t;
@@ -90,7 +90,7 @@
 
 void CJS_Value::Detach()
 {
-	m_pValue = v8::Handle<v8::Value>();
+	m_pValue = v8::Local<v8::Value>();
 	m_eType = VT_unknown;
 }
 
@@ -98,17 +98,17 @@
 
 int CJS_Value::ToInt() const
 {
-	return JS_ToInt32(m_pValue);
+	return JS_ToInt32(m_isolate, m_pValue);
 }
 
 bool CJS_Value::ToBool() const
 {
-	return JS_ToBoolean(m_pValue);
+	return JS_ToBoolean(m_isolate, m_pValue);
 }
 
 double CJS_Value::ToDouble() const
 {
-	return JS_ToNumber(m_pValue);
+	return JS_ToNumber(m_isolate, m_pValue);
 }
 
 float CJS_Value::ToFloat() const
@@ -118,18 +118,18 @@
 
 CJS_Object* CJS_Value::ToCJSObject() const
 {
-	v8::Handle<v8::Object>	pObj = JS_ToObject(m_pValue);
+	v8::Local<v8::Object>	pObj = JS_ToObject(m_isolate, m_pValue);
 	return (CJS_Object*)JS_GetPrivate(m_isolate, pObj);
 }
 
-v8::Handle<v8::Object> CJS_Value::ToV8Object() const
+v8::Local<v8::Object> CJS_Value::ToV8Object() const
 {
-	return JS_ToObject(m_pValue);
+	return JS_ToObject(m_isolate, m_pValue);
 }
 
 CFX_WideString CJS_Value::ToCFXWideString() const
 {
-	return JS_ToString(m_pValue);
+	return JS_ToString(m_isolate, m_pValue);
 }
 
 CFX_ByteString CJS_Value::ToCFXByteString() const
@@ -137,16 +137,16 @@
 	return CFX_ByteString::FromUnicode(ToCFXWideString());
 }
 
-v8::Handle<v8::Value> CJS_Value::ToV8Value() const
+v8::Local<v8::Value> CJS_Value::ToV8Value() const
 {
 	return m_pValue;
 }
 
-v8::Handle<v8::Array>CJS_Value::ToV8Array() const
+v8::Local<v8::Array>CJS_Value::ToV8Array() const
 {
 	if (IsArrayObject())
-		return v8::Handle<v8::Array>::Cast(JS_ToObject(m_pValue));
-	return v8::Handle<v8::Array>();
+		return v8::Local<v8::Array>::Cast(JS_ToObject(m_isolate, m_pValue));
+	return v8::Local<v8::Array>();
 }
 
 /* ---------------------------------------------------------------------------------------- */
@@ -178,7 +178,7 @@
 	m_eType = VT_number;
 }
 
-void CJS_Value::operator =(v8::Handle<v8::Object> pObj)
+void CJS_Value::operator =(v8::Local<v8::Object> pObj)
 {
 
 	m_pValue = JS_NewObject(m_isolate,pObj);
@@ -221,7 +221,7 @@
 
 void CJS_Value::operator = (CJS_Array & array)
 {
-	m_pValue = JS_NewObject2(m_isolate,(v8::Handle<v8::Array>)array);
+	m_pValue = JS_NewObject2(m_isolate,(v8::Local<v8::Array>)array);
 
 	m_eType = VT_object;
 }
@@ -238,6 +238,7 @@
 	m_pValue = value.ToV8Value();
 
 	m_eType = value.m_eType;
+        m_isolate = value.m_isolate;
 }
 
 /* ---------------------------------------------------------------------------------------- */
@@ -272,7 +273,7 @@
 {
 	if (IsArrayObject())
 	{
-		array.Attach(JS_ToArray(m_pValue));
+		array.Attach(JS_ToArray(m_isolate, m_pValue));
 		return TRUE;
 	}
 
@@ -460,7 +461,7 @@
 	CJS_Value::operator=(date);
 }
 
-CJS_PropValue::operator v8::Handle<v8::Value>() const
+CJS_PropValue::operator v8::Local<v8::Value>() const
 {
 	return m_pValue;
 }
@@ -474,7 +475,7 @@
 {		
 }
 
-void CJS_Array::Attach(v8::Handle<v8::Array> pArray)
+void CJS_Array::Attach(v8::Local<v8::Array> pArray)
 {
 	m_pArray = pArray;
 }
@@ -488,7 +489,7 @@
 {
 	if (m_pArray.IsEmpty())
 		return;
-	v8::Handle<v8::Value>  p = JS_GetArrayElemnet(m_pArray,index);
+	v8::Local<v8::Value>  p = JS_GetArrayElement(m_isolate, m_pArray,index);
 	value.Attach(p,VT_object);
 }
 
@@ -497,7 +498,7 @@
 	if (m_pArray.IsEmpty())
 		m_pArray = JS_NewArray(m_isolate);
 
-	JS_PutArrayElement(m_pArray, index, value.ToV8Value(), value.GetType());
+	JS_PutArrayElement(m_isolate, m_pArray, index, value.ToV8Value(), value.GetType());
 }
 
 int CJS_Array::GetLength()
@@ -507,7 +508,7 @@
 	return JS_GetArrayLength(m_pArray);
 }
 
-CJS_Array:: operator v8::Handle<v8::Array>()
+CJS_Array:: operator v8::Local<v8::Array>()
 {
 	if (m_pArray.IsEmpty())
 		m_pArray = JS_NewArray(m_isolate);
@@ -545,10 +546,10 @@
 FX_BOOL	CJS_Date::IsValidDate()
 {
 	if(m_pDate.IsEmpty()) return FALSE;
-	return !JS_PortIsNan(JS_ToNumber(m_pDate));
+	return !JS_PortIsNan(JS_ToNumber(m_isolate, m_pDate));
 }
 
-void CJS_Date::Attach(v8::Handle<v8::Value> pDate)
+void CJS_Date::Attach(v8::Local<v8::Value> pDate)
 {
 	m_pDate = pDate;
 }
@@ -556,7 +557,7 @@
 int CJS_Date::GetYear()
 {
 	if (IsValidDate())
-		return JS_GetYearFromTime(JS_LocalTime(JS_ToNumber(m_pDate)));
+		return JS_GetYearFromTime(JS_LocalTime(JS_ToNumber(m_isolate, m_pDate)));
 
 	return 0;
 }
@@ -570,7 +571,7 @@
 int CJS_Date::GetMonth()
 {
 	if (IsValidDate())
-		return JS_GetMonthFromTime(JS_LocalTime(JS_ToNumber(m_pDate)));
+		return JS_GetMonthFromTime(JS_LocalTime(JS_ToNumber(m_isolate, m_pDate)));
 
 	return 0;
 }
@@ -586,7 +587,7 @@
 int CJS_Date::GetDay()
 {
 	if (IsValidDate())
-		return JS_GetDayFromTime(JS_LocalTime(JS_ToNumber(m_pDate)));
+		return JS_GetDayFromTime(JS_LocalTime(JS_ToNumber(m_isolate, m_pDate)));
 
 	return 0;
 }
@@ -602,7 +603,7 @@
 int CJS_Date::GetHours()
 {
 	if (IsValidDate())
-		return JS_GetHourFromTime(JS_LocalTime(JS_ToNumber(m_pDate)));
+		return JS_GetHourFromTime(JS_LocalTime(JS_ToNumber(m_isolate, m_pDate)));
 
 	return 0;
 }
@@ -616,7 +617,7 @@
 int CJS_Date::GetMinutes()
 {
 	if (IsValidDate())
-		return JS_GetMinFromTime(JS_LocalTime(JS_ToNumber(m_pDate)));
+		return JS_GetMinFromTime(JS_LocalTime(JS_ToNumber(m_isolate, m_pDate)));
 
 	return 0;
 }
@@ -630,7 +631,7 @@
 int CJS_Date::GetSeconds()
 {
 	if (IsValidDate())
-		return JS_GetSecFromTime(JS_LocalTime(JS_ToNumber(m_pDate)));
+		return JS_GetSecFromTime(JS_LocalTime(JS_ToNumber(m_isolate, m_pDate)));
 
 	return 0;
 }
@@ -641,7 +642,7 @@
 	JS_ValueCopy(m_pDate,JS_NewDate(m_isolate,date));
 }
 
-CJS_Date::operator v8::Handle<v8::Value>()
+CJS_Date::operator v8::Local<v8::Value>()
 {
 	return m_pDate;
 }
@@ -650,12 +651,12 @@
 {
 	if(m_pDate.IsEmpty())
 		return 0.0;
-	return JS_ToNumber(m_pDate);
+	return JS_ToNumber(m_isolate, m_pDate);
 }
 
 CFX_WideString CJS_Date::ToString() const
 {
 	if(m_pDate.IsEmpty())
 		return L"";
-	return JS_ToString(m_pDate);
+	return JS_ToString(m_isolate, m_pDate);
 }
diff --git a/fpdfsdk/src/javascript/app.cpp b/fpdfsdk/src/javascript/app.cpp
index f975238..adcb7c6 100644
--- a/fpdfsdk/src/javascript/app.cpp
+++ b/fpdfsdk/src/javascript/app.cpp
@@ -340,7 +340,7 @@
 		{
 			JSObject pObj = params[0].ToV8Object();
 			{
-				v8::Handle<v8::Value> pValue = JS_GetObjectElement(isolate, pObj, L"cMsg");
+				v8::Local<v8::Value> pValue = JS_GetObjectElement(isolate, pObj, L"cMsg");
 				swMsg = CJS_Value(isolate, pValue, VT_unknown).ToCFXWideString();
 
 				pValue = JS_GetObjectElement(isolate, pObj, L"cTitle");
@@ -728,7 +728,7 @@
 	{
 		JSObject pObj = params[0].ToV8Object();
 
-		v8::Handle<v8::Value> pValue = JS_GetObjectElement(isolate, pObj, L"bUI");
+		v8::Local<v8::Value> pValue = JS_GetObjectElement(isolate, pObj, L"bUI");
 		bUI = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToBool();
 
 		pValue = JS_GetObjectElement(isolate, pObj, L"cTo");
@@ -862,7 +862,7 @@
 	if (iLength > 0 && params[0].GetType() == VT_object)
 	{
 		JSObject pObj = params[0].ToV8Object();
-		v8::Handle<v8::Value> pValue = JS_GetObjectElement(isolate,pObj,L"cQuestion");
+		v8::Local<v8::Value> pValue = JS_GetObjectElement(isolate,pObj,L"cQuestion");
 		swQuestion = CJS_Value(isolate,pValue,GET_VALUE_TYPE(pValue)).ToCFXWideString();
 
 		pValue = JS_GetObjectElement(isolate,pObj,L"cTitle");
diff --git a/fpdfsdk/src/javascript/global.cpp b/fpdfsdk/src/javascript/global.cpp
index 45b9248..daf5a85 100644
--- a/fpdfsdk/src/javascript/global.cpp
+++ b/fpdfsdk/src/javascript/global.cpp
@@ -169,19 +169,19 @@
 			{
 				double dData;
 				vp >> dData;
-				return SetGlobalVariables(sPropName, JS_GLOBALDATA_TYPE_NUMBER, dData, false, "", v8::Handle<v8::Object>(), FALSE);
+				return SetGlobalVariables(sPropName, JS_GLOBALDATA_TYPE_NUMBER, dData, false, "", v8::Local<v8::Object>(), FALSE);
 			}
 		case VT_boolean:
 			{
 				bool bData;
 				vp >> bData;
-				return SetGlobalVariables(sPropName, JS_GLOBALDATA_TYPE_BOOLEAN, 0, bData, "", v8::Handle<v8::Object>(), FALSE);
+				return SetGlobalVariables(sPropName, JS_GLOBALDATA_TYPE_BOOLEAN, 0, bData, "", v8::Local<v8::Object>(), FALSE);
 			}
 		case VT_string:
 			{
 				CFX_ByteString sData;
 				vp >> sData;
-				return SetGlobalVariables(sPropName, JS_GLOBALDATA_TYPE_STRING, 0, false, sData, v8::Handle<v8::Object>(), FALSE);
+				return SetGlobalVariables(sPropName, JS_GLOBALDATA_TYPE_STRING, 0, false, sData, v8::Local<v8::Object>(), FALSE);
 			}
 		case VT_object:
 			{
@@ -191,7 +191,7 @@
 			}
 		case VT_null:
 			{
-				return SetGlobalVariables(sPropName, JS_GLOBALDATA_TYPE_NULL, 0, false, "", v8::Handle<v8::Object>(), FALSE);
+				return SetGlobalVariables(sPropName, JS_GLOBALDATA_TYPE_NULL, 0, false, "", v8::Local<v8::Object>(), FALSE);
 			}
 		case VT_undefined:
 			{
@@ -226,7 +226,7 @@
 						break;
 					case JS_GLOBALDATA_TYPE_OBJECT:
 						{
-							v8::Handle<v8::Object> obj = v8::Local<v8::Object>::New(vp.GetIsolate(),pData->pData);
+							v8::Local<v8::Object> obj = v8::Local<v8::Object>::New(vp.GetIsolate(),pData->pData);
 							vp << obj;
 							break;
 						}
@@ -296,17 +296,17 @@
 		switch (pData->data.nType)
 		{
 		case JS_GLOBALDATA_TYPE_NUMBER:
-			this->SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_NUMBER, pData->data.dData, false, "", v8::Handle<v8::Object>(), pData->bPersistent == 1);
+			this->SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_NUMBER, pData->data.dData, false, "", v8::Local<v8::Object>(), pData->bPersistent == 1);
 			JS_PutObjectNumber(NULL,(JSFXObject)(*m_pJSObject),
 							   pData->data.sKey.UTF8Decode().c_str(), pData->data.dData);
 			break;
 		case JS_GLOBALDATA_TYPE_BOOLEAN:
-			this->SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_BOOLEAN, 0, (bool)(pData->data.bData == 1), "", v8::Handle<v8::Object>(), pData->bPersistent == 1);
+			this->SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_BOOLEAN, 0, (bool)(pData->data.bData == 1), "", v8::Local<v8::Object>(), pData->bPersistent == 1);
 			JS_PutObjectBoolean(NULL,(JSFXObject)(*m_pJSObject),
 								pData->data.sKey.UTF8Decode().c_str(), (bool)(pData->data.bData == 1));
 			break;
 		case JS_GLOBALDATA_TYPE_STRING:
-			this->SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_STRING, 0, false, pData->data.sData, v8::Handle<v8::Object>(), pData->bPersistent == 1);
+			this->SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_STRING, 0, false, pData->data.sData, v8::Local<v8::Object>(), pData->bPersistent == 1);
 			JS_PutObjectString(NULL, (JSFXObject)(*m_pJSObject),
 							   pData->data.sKey.UTF8Decode().c_str(),
 							   pData->data.sData.UTF8Decode().c_str());
@@ -314,7 +314,7 @@
 		case JS_GLOBALDATA_TYPE_OBJECT:
 			{
 				IJS_Runtime* pRuntime = JS_GetRuntime((JSFXObject)(*m_pJSObject));
-				v8::Handle<v8::Object> pObj = JS_NewFxDynamicObj(pRuntime, NULL, -1);
+				v8::Local<v8::Object> pObj = JS_NewFxDynamicObj(pRuntime, NULL, -1);
 
 				PutObjectProperty(pObj, &pData->data);
 
@@ -325,7 +325,7 @@
 			}
 			break;
 		case JS_GLOBALDATA_TYPE_NULL:
-			this->SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_NULL, 0, false, "", v8::Handle<v8::Object>(), pData->bPersistent == 1);
+			this->SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_NULL, 0, false, "", v8::Local<v8::Object>(), pData->bPersistent == 1);
 			JS_PutObjectNull(NULL,(JSFXObject)(*m_pJSObject),
 							 pData->data.sKey.UTF8Decode().c_str());
 			break;
@@ -370,7 +370,7 @@
 					//if (pData->pData)
 					{
 						CJS_GlobalVariableArray array;
-						v8::Handle<v8::Object> obj = v8::Local<v8::Object>::New(GetJSObject()->GetIsolate(),pData->pData);
+						v8::Local<v8::Object> obj = v8::Local<v8::Object>::New(GetJSObject()->GetIsolate(),pData->pData);
 						ObjectToArray(obj, array);
 						m_pGlobalData->SetGlobalVariableObject(name, array);
 						m_pGlobalData->SetGlobalVariablePersistent(name, pData->bPersistent);
@@ -386,21 +386,20 @@
 	}
 }
 
-void global_alternate::ObjectToArray(v8::Handle<v8::Object> pObj, CJS_GlobalVariableArray& array)
+void global_alternate::ObjectToArray(v8::Local<v8::Object> pObj, CJS_GlobalVariableArray& array)
 {
-	v8::Handle<v8::Array> pKeyList = JS_GetObjectElementNames(pObj);
-	int	nObjElements = pKeyList->Length();
-
 	v8::Local<v8::Context> context = pObj->CreationContext();
 	v8::Isolate* isolate = context->GetIsolate();
+	v8::Local<v8::Array> pKeyList = JS_GetObjectElementNames(isolate, pObj);
+	int	nObjElements = pKeyList->Length();
 
 	for (int i=0; i<nObjElements; i++)
 	{
 		
-		CFX_WideString ws = JS_ToString(JS_GetArrayElemnet(pKeyList, i));
+		CFX_WideString ws = JS_ToString(isolate, JS_GetArrayElement(isolate, pKeyList, i));
 		CFX_ByteString sKey = ws.UTF8Encode();
 
-		v8::Handle<v8::Value> v = JS_GetObjectElement(isolate, pObj, ws.c_str());
+		v8::Local<v8::Value> v = JS_GetObjectElement(isolate, pObj, ws.c_str());
 		FXJSVALUETYPE vt = GET_VALUE_TYPE(v);
 		switch (vt)
 		{
@@ -409,7 +408,7 @@
 				CJS_KeyValue* pObjElement = new CJS_KeyValue;
 				pObjElement->nType = JS_GLOBALDATA_TYPE_NUMBER;
 				pObjElement->sKey = sKey;
-				pObjElement->dData = JS_ToNumber(v);
+				pObjElement->dData = JS_ToNumber(isolate, v);
 				array.Add(pObjElement);
 			}
 			break;
@@ -418,7 +417,7 @@
 				CJS_KeyValue* pObjElement = new CJS_KeyValue;
 				pObjElement->nType = JS_GLOBALDATA_TYPE_BOOLEAN;
 				pObjElement->sKey = sKey;
-				pObjElement->dData = JS_ToBoolean(v);
+				pObjElement->dData = JS_ToBoolean(isolate, v);
 				array.Add(pObjElement);
 			}
 			break;
@@ -437,7 +436,7 @@
 				CJS_KeyValue* pObjElement = new CJS_KeyValue;
 				pObjElement->nType = JS_GLOBALDATA_TYPE_OBJECT;
 				pObjElement->sKey = sKey;
-				ObjectToArray(JS_ToObject(v), pObjElement->objData);
+				ObjectToArray(JS_ToObject(isolate, v), pObjElement->objData);
 				array.Add(pObjElement);
 			}
 			break;
@@ -455,7 +454,7 @@
 	}
 }
 
-void global_alternate::PutObjectProperty(v8::Handle<v8::Object> pObj, CJS_KeyValue* pData)
+void global_alternate::PutObjectProperty(v8::Local<v8::Object> pObj, CJS_KeyValue* pData)
 {
 	ASSERT(pData != NULL);
 
@@ -478,7 +477,7 @@
 		case JS_GLOBALDATA_TYPE_OBJECT:
 			{
 				IJS_Runtime* pRuntime = JS_GetRuntime((JSFXObject)(*m_pJSObject));
-				v8::Handle<v8::Object> pNewObj = JS_NewFxDynamicObj(pRuntime, NULL, -1);
+				v8::Local<v8::Object> pNewObj = JS_NewFxDynamicObj(pRuntime, NULL, -1);
 				PutObjectProperty(pNewObj, pObjData);
 				JS_PutObjectObject(NULL, (JSObject)pObj, pObjData->sKey.UTF8Decode().c_str(), (JSObject)pNewObj);
 			}
@@ -608,7 +607,7 @@
 	return TRUE;
 }
 
-FXJSVALUETYPE GET_VALUE_TYPE(v8::Handle<v8::Value> p)
+FXJSVALUETYPE GET_VALUE_TYPE(v8::Local<v8::Value> p)
 {
   const unsigned int nHash = JS_CalcHash(JS_GetTypeof(p));
 
diff --git a/fpdfsdk/src/jsapi/fxjs_v8.cpp b/fpdfsdk/src/jsapi/fxjs_v8.cpp
index 93c7042..c03c84b 100644
--- a/fpdfsdk/src/jsapi/fxjs_v8.cpp
+++ b/fpdfsdk/src/jsapi/fxjs_v8.cpp
@@ -46,8 +46,8 @@
 		  v8::Isolate::Scope isolate_scope(isolate);
 		  v8::HandleScope handle_scope(isolate);
 
-		  v8::Handle<v8::ObjectTemplate> objTemplate = v8::ObjectTemplate::New(isolate);
-		  objTemplate->SetInternalFieldCount(1);
+		  v8::Local<v8::ObjectTemplate> objTemplate = v8::ObjectTemplate::New(isolate);
+		  objTemplate->SetInternalFieldCount(2);
 		  m_objTemplate.Reset(isolate, objTemplate);
 
 		 //Document as the global object.
@@ -70,8 +70,8 @@
 	unsigned m_bApplyNew;
 	FX_BOOL	m_bSetAsGlobalObject;
 
-	v8::Persistent<v8::ObjectTemplate> m_objTemplate;
-	v8::Persistent<v8::Object> m_StaticObj;
+	v8::Global<v8::ObjectTemplate> m_objTemplate;
+	v8::Global<v8::Object> m_StaticObj;
 };
 
 int JS_DefineObj(IJS_Runtime* pJSRuntime, const wchar_t* sObjName, FXJSOBJTYPE eObjType, LP_CONSTRUCTOR pConstructor, LP_DESTRUCTOR pDestructor, unsigned bApplyNew)
@@ -105,7 +105,7 @@
 	if(nObjDefnID<0 || nObjDefnID>= pArray->GetSize()) return 0;
 	CJS_ObjDefintion* pObjDef = (CJS_ObjDefintion*)pArray->GetAt(nObjDefnID);
 	v8::Local<v8::ObjectTemplate> objTemp = v8::Local<v8::ObjectTemplate>::New(isolate, pObjDef->m_objTemplate);
-	objTemp->Set(v8::String::NewFromUtf8(isolate, FX_LPCSTR(bsMethodName)), v8::FunctionTemplate::New(isolate, pMethodCall), v8::ReadOnly);
+	objTemp->Set(v8::String::NewFromUtf8(isolate, FX_LPCSTR(bsMethodName), v8::NewStringType::kNormal).ToLocalChecked(), v8::FunctionTemplate::New(isolate, pMethodCall), v8::ReadOnly);
 	pObjDef->m_objTemplate.Reset(isolate,objTemp);
 	return 0;
 }
@@ -125,7 +125,7 @@
 	if(nObjDefnID<0 || nObjDefnID>= pArray->GetSize()) return 0;
 	CJS_ObjDefintion* pObjDef = (CJS_ObjDefintion*)pArray->GetAt(nObjDefnID);
 	v8::Local<v8::ObjectTemplate> objTemp = v8::Local<v8::ObjectTemplate>::New(isolate, pObjDef->m_objTemplate);
-	objTemp->SetAccessor(v8::String::NewFromUtf8(isolate, FX_LPCSTR(bsPropertyName)), pPropGet, pPropPut);
+	objTemp->SetAccessor(v8::String::NewFromUtf8(isolate, FX_LPCSTR(bsPropertyName), v8::NewStringType::kNormal).ToLocalChecked(), pPropGet, pPropPut);
 	pObjDef->m_objTemplate.Reset(isolate,objTemp);
 	return 0;
 }
@@ -147,7 +147,7 @@
 	return 0;
 }
 
-int JS_DefineObjConst(IJS_Runtime* pJSRuntime, int nObjDefnID, const wchar_t* sConstName, v8::Handle<v8::Value> pDefault)
+int JS_DefineObjConst(IJS_Runtime* pJSRuntime, int nObjDefnID, const wchar_t* sConstName, v8::Local<v8::Value> pDefault)
 {
 	v8::Isolate* isolate = (v8::Isolate*)pJSRuntime;
 	v8::Isolate::Scope isolate_scope(isolate);
@@ -167,7 +167,7 @@
 	return 0;
 }
 
-static v8::Persistent<v8::ObjectTemplate>& _getGlobalObjectTemplate(IJS_Runtime* pJSRuntime)
+static v8::Global<v8::ObjectTemplate>& _getGlobalObjectTemplate(IJS_Runtime* pJSRuntime)
 {
 	v8::Isolate* isolate = (v8::Isolate*)pJSRuntime;
 	v8::Isolate::Scope isolate_scope(isolate);
@@ -181,7 +181,7 @@
 		if(pObjDef->m_bSetAsGlobalObject)
 			return pObjDef->m_objTemplate;
 	}
-	static v8::Persistent<v8::ObjectTemplate> gloabalObjectTemplate;
+	static v8::Global<v8::ObjectTemplate> gloabalObjectTemplate;
 	return gloabalObjectTemplate;
 }
 
@@ -197,19 +197,19 @@
 	v8::Local<v8::FunctionTemplate> funTempl = v8::FunctionTemplate::New(isolate, pMethodCall);
 	v8::Local<v8::ObjectTemplate> objTemp;
 
-	v8::Persistent<v8::ObjectTemplate>& globalObjTemp = _getGlobalObjectTemplate(pJSRuntime);
+	v8::Global<v8::ObjectTemplate>& globalObjTemp = _getGlobalObjectTemplate(pJSRuntime);
 	if(globalObjTemp.IsEmpty())
 		objTemp = v8::ObjectTemplate::New(isolate);
 	else
 		objTemp = v8::Local<v8::ObjectTemplate>::New(isolate, globalObjTemp);
-	objTemp->Set(v8::String::NewFromUtf8(isolate, FX_LPCSTR(bsMethodName)), funTempl, v8::ReadOnly);
+	objTemp->Set(v8::String::NewFromUtf8(isolate, FX_LPCSTR(bsMethodName), v8::NewStringType::kNormal).ToLocalChecked(), funTempl, v8::ReadOnly);
 
 	globalObjTemp.Reset(isolate,objTemp);
 
 	return 0;
 }
 
-int JS_DefineGlobalConst(IJS_Runtime* pJSRuntime, const wchar_t* sConstName, v8::Handle<v8::Value> pDefault)
+int JS_DefineGlobalConst(IJS_Runtime* pJSRuntime, const wchar_t* sConstName, v8::Local<v8::Value> pDefault)
 {
 	v8::Isolate* isolate = (v8::Isolate*)pJSRuntime;
 	v8::Isolate::Scope isolate_scope(isolate);
@@ -220,12 +220,12 @@
 
 	v8::Local<v8::ObjectTemplate> objTemp;
 
-	v8::Persistent<v8::ObjectTemplate>& globalObjTemp = _getGlobalObjectTemplate(pJSRuntime);
+	v8::Global<v8::ObjectTemplate>& globalObjTemp = _getGlobalObjectTemplate(pJSRuntime);
 	if(globalObjTemp.IsEmpty())
 		objTemp = v8::ObjectTemplate::New(isolate);
 	else
 		objTemp = v8::Local<v8::ObjectTemplate>::New(isolate, globalObjTemp);
-	objTemp->Set(v8::String::NewFromUtf8(isolate, FX_LPCSTR(bsConst)), pDefault, v8::ReadOnly);
+	objTemp->Set(v8::String::NewFromUtf8(isolate, FX_LPCSTR(bsConst), v8::NewStringType::kNormal).ToLocalChecked(), pDefault, v8::ReadOnly);
 
 	globalObjTemp.Reset(isolate,objTemp);
 
@@ -233,18 +233,18 @@
 }
 
 
-void JS_InitialRuntime(IJS_Runtime* pJSRuntime,IFXJS_Runtime* pFXRuntime, IFXJS_Context* context, v8::Persistent<v8::Context>& v8PersistentContext)
+void JS_InitialRuntime(IJS_Runtime* pJSRuntime,IFXJS_Runtime* pFXRuntime, IFXJS_Context* context, v8::Global<v8::Context>& v8PersistentContext)
 {
 	v8::Isolate* isolate = (v8::Isolate*)pJSRuntime;
 	v8::Isolate::Scope isolate_scope(isolate);
 	v8::Locker locker(isolate);
 	v8::HandleScope handle_scope(isolate);
 
-	v8::Persistent<v8::ObjectTemplate>& globalObjTemp = _getGlobalObjectTemplate(pJSRuntime);
-	v8::Handle<v8::Context> v8Context = v8::Context::New(isolate, NULL, v8::Local<v8::ObjectTemplate>::New(isolate, globalObjTemp));
+	v8::Global<v8::ObjectTemplate>& globalObjTemp = _getGlobalObjectTemplate(pJSRuntime);
+	v8::Local<v8::Context> v8Context = v8::Context::New(isolate, NULL, v8::Local<v8::ObjectTemplate>::New(isolate, globalObjTemp));
 	v8::Context::Scope context_scope(v8Context);
 
-	//v8::Handle<External> ptr = External::New(isolate, pFXRuntime);
+	//v8::Local<External> ptr = External::New(isolate, pFXRuntime);
 	//v8Context->SetEmbedderData(1, ptr);
 	isolate->SetData(2, pFXRuntime);
 
@@ -256,7 +256,7 @@
 		CJS_ObjDefintion* pObjDef = (CJS_ObjDefintion*)pArray->GetAt(i);
 		CFX_WideString ws = CFX_WideString(pObjDef->objName);
 		CFX_ByteString bs = ws.UTF8Encode();
-		v8::Handle<v8::String> objName = v8::String::NewFromUtf8(isolate, bs.c_str(), v8::String::kNormalString, bs.GetLength());
+		v8::Local<v8::String> objName = v8::String::NewFromUtf8(isolate, bs.c_str(), v8::NewStringType::kNormal, bs.GetLength()).ToLocalChecked();
 
 
 		if(pObjDef->objType == JS_DYNAMIC)
@@ -268,25 +268,24 @@
 
 				CJS_PrivateData* pPrivateData = FX_NEW CJS_PrivateData;
 				pPrivateData->ObjDefID = i;
-				v8::Handle<v8::External> ptr = v8::External::New(isolate, pPrivateData);
 
-				v8Context->Global()->GetPrototype()->ToObject()->SetInternalField(0, ptr); 
+				v8Context->Global()->GetPrototype()->ToObject(v8Context).ToLocalChecked()->SetAlignedPointerInInternalField(0, pPrivateData);
 
 				if(pObjDef->m_pConstructor)
-					pObjDef->m_pConstructor(context, v8Context->Global()->GetPrototype()->ToObject(), v8Context->Global()->GetPrototype()->ToObject());
+					pObjDef->m_pConstructor(context, v8Context->Global()->GetPrototype()->ToObject(v8Context).ToLocalChecked(), v8Context->Global()->GetPrototype()->ToObject(v8Context).ToLocalChecked());
 			}
 		}
 		else
 		{
-			v8::Handle<v8::Object> obj = JS_NewFxDynamicObj(pJSRuntime, context, i);
-			v8Context->Global()->Set(objName, obj);
+			v8::Local<v8::Object> obj = JS_NewFxDynamicObj(pJSRuntime, context, i);
+			v8Context->Global()->Set(v8Context, objName, obj).FromJust();
 			pObjDef->m_StaticObj.Reset(isolate, obj);
 		}
 	}
 	v8PersistentContext.Reset(isolate, v8Context);
 }
 
-void JS_ReleaseRuntime(IJS_Runtime* pJSRuntime, v8::Persistent<v8::Context>& v8PersistentContext)
+void JS_ReleaseRuntime(IJS_Runtime* pJSRuntime, v8::Global<v8::Context>& v8PersistentContext)
 {
 	v8::Isolate* isolate = (v8::Isolate*)pJSRuntime;
 	v8::Isolate::Scope isolate_scope(isolate);
@@ -324,14 +323,15 @@
 {
 	v8::Isolate* isolate = (v8::Isolate*)pJSRuntime;
 	v8::Isolate::Scope isolate_scope(isolate);
-	v8::TryCatch try_catch;
+	v8::TryCatch try_catch(isolate);
 
 	CFX_WideString wsScript(script);
 	CFX_ByteString bsScript = wsScript.UTF8Encode();
 
 
-	v8::Handle<v8::Script> compiled_script = v8::Script::Compile(v8::String::NewFromUtf8(isolate, bsScript.c_str(), v8::String::kNormalString, bsScript.GetLength()));
-	if (compiled_script.IsEmpty()) {
+        v8::Local<v8::Context> context = isolate->GetCurrentContext();
+	v8::Local<v8::Script> compiled_script;
+        if (!v8::Script::Compile(context, v8::String::NewFromUtf8(isolate, bsScript.c_str(), v8::NewStringType::kNormal, bsScript.GetLength()).ToLocalChecked()).ToLocal(&compiled_script)) {
 		v8::String::Utf8Value error(try_catch.Exception());
 		return -1;
 	}
@@ -342,67 +342,68 @@
 {
 	v8::Isolate* isolate = (v8::Isolate*)pJSRuntime;
 	v8::Isolate::Scope isolate_scope(isolate);
-	v8::TryCatch try_catch;
+	v8::TryCatch try_catch(isolate);
 
 	CFX_WideString wsScript(script);
 	CFX_ByteString bsScript = wsScript.UTF8Encode();
 
-    v8::Handle<v8::Script> compiled_script = v8::Script::Compile(v8::String::NewFromUtf8(isolate, bsScript.c_str(), v8::String::kNormalString, bsScript.GetLength()));
-	if (compiled_script.IsEmpty()) {
+        v8::Local<v8::Context> context = isolate->GetCurrentContext();
+        v8::Local<v8::Script> compiled_script;
+        if (!v8::Script::Compile(context, v8::String::NewFromUtf8(isolate, bsScript.c_str(), v8::NewStringType::kNormal, bsScript.GetLength()).ToLocalChecked()).ToLocal(&compiled_script)) {
 		v8::String::Utf8Value error(try_catch.Exception());
 		return -1;
 	}
 
-	v8::Handle<v8::Value> result = compiled_script->Run();
-	if (result.IsEmpty()) {
+	v8::Local<v8::Value> result;
+        if (!compiled_script->Run(context).ToLocal(&result)) {
 		v8::String::Utf8Value error(try_catch.Exception());
 		return -1;
 	}
 	return 0;
 }
 
-v8::Handle<v8::Object> JS_NewFxDynamicObj(IJS_Runtime* pJSRuntime, IFXJS_Context* pJSContext, int nObjDefnID)
+v8::Local<v8::Object> JS_NewFxDynamicObj(IJS_Runtime* pJSRuntime, IFXJS_Context* pJSContext, int nObjDefnID)
 {
 	v8::Isolate* isolate = (v8::Isolate*)pJSRuntime;
 	v8::Isolate::Scope isolate_scope(isolate);
+        v8::Local<v8::Context> context = isolate->GetCurrentContext();
 	if(-1 == nObjDefnID)
 	{
 		v8::Local<v8::ObjectTemplate> objTempl = v8::ObjectTemplate::New(isolate);
-		return objTempl->NewInstance();
+                v8::Local<v8::Object> obj;
+                if (objTempl->NewInstance(context).ToLocal(&obj)) return obj;
+                return v8::Local<v8::Object>();
 	}
 
 	CFX_PtrArray* pArray = (CFX_PtrArray*)isolate->GetData(1);
-	if(!pArray) return v8::Handle<v8::Object>();
+	if(!pArray) return v8::Local<v8::Object>();
 
 
-	if(nObjDefnID<0 || nObjDefnID>= pArray->GetSize()) return v8::Handle<v8::Object>();
+	if(nObjDefnID<0 || nObjDefnID>= pArray->GetSize()) return v8::Local<v8::Object>();
 	CJS_ObjDefintion* pObjDef = (CJS_ObjDefintion*)pArray->GetAt(nObjDefnID);
 
-	v8::Local<v8::Context> context = isolate->GetCurrentContext();
 	v8::Local<v8::ObjectTemplate> objTemp = v8::Local<v8::ObjectTemplate>::New(isolate, pObjDef->m_objTemplate);
-
-	v8::Local<v8::Object> obj = objTemp->NewInstance();
-	
+	v8::Local<v8::Object> obj;
+        if (!objTemp->NewInstance(context).ToLocal(&obj)) return v8::Local<v8::Object>();
 	CJS_PrivateData* pPrivateData = FX_NEW CJS_PrivateData;
 	pPrivateData->ObjDefID = nObjDefnID;
-	v8::Handle<v8::External> ptr = v8::External::New(isolate, pPrivateData);
-	obj->SetInternalField(0, ptr); 
 
+	obj->SetAlignedPointerInInternalField(0, pPrivateData);
 	if(pObjDef->m_pConstructor)
-		pObjDef->m_pConstructor(pJSContext, obj, context->Global()->GetPrototype()->ToObject());
+		pObjDef->m_pConstructor(pJSContext, obj, context->Global()->GetPrototype()->ToObject(context).ToLocalChecked());
 
 	return obj;
 }
 
-v8::Handle<v8::Object> JS_GetStaticObj(IJS_Runtime* pJSRuntime, int nObjDefnID)
+v8::Local<v8::Object> JS_GetStaticObj(IJS_Runtime* pJSRuntime, int nObjDefnID)
 {
 	v8::Isolate* isolate = (v8::Isolate*)pJSRuntime;
 	v8::Isolate::Scope isolate_scope(isolate);
 
 	CFX_PtrArray* pArray = (CFX_PtrArray*)isolate->GetData(1);
-	if(!pArray) return v8::Handle<v8::Object>();
+	if(!pArray) return v8::Local<v8::Object>();
 
-	if(nObjDefnID<0 || nObjDefnID>= pArray->GetSize()) return v8::Handle<v8::Object>();
+	if(nObjDefnID<0 || nObjDefnID>= pArray->GetSize()) return v8::Local<v8::Object>();
 	CJS_ObjDefintion* pObjDef = (CJS_ObjDefintion*)pArray->GetAt(nObjDefnID);
 	v8::Local<v8::Object> obj = v8::Local<v8::Object>::New(isolate,pObjDef->m_StaticObj);
 	return obj;
@@ -412,30 +413,29 @@
 {
 	//Do nothing.
 }
-v8::Handle<v8::Object>	JS_GetThisObj(IJS_Runtime * pJSRuntime)
+v8::Local<v8::Object>	JS_GetThisObj(IJS_Runtime * pJSRuntime)
 {
 	//Return the global object.
 	v8::Isolate* isolate = (v8::Isolate*)pJSRuntime;
 	v8::Isolate::Scope isolate_scope(isolate);
 
 	CFX_PtrArray* pArray = (CFX_PtrArray*)isolate->GetData(1);
-	if(!pArray) return v8::Handle<v8::Object>();
+	if(!pArray) return v8::Local<v8::Object>();
 
 	v8::Local<v8::Context> context = isolate->GetCurrentContext();
-	return context->Global()->GetPrototype()->ToObject();
+	return context->Global()->GetPrototype()->ToObject(context).ToLocalChecked();
 }
 
-int	JS_GetObjDefnID(v8::Handle<v8::Object> pObj)
+int	JS_GetObjDefnID(v8::Local<v8::Object> pObj)
 {
 	if(pObj.IsEmpty() || !pObj->InternalFieldCount()) return -1;
-	v8::Handle<v8::External> field = v8::Handle<v8::External>::Cast(pObj->GetInternalField(0));
-	CJS_PrivateData* pPrivateData = (CJS_PrivateData*)field->Value();
+	CJS_PrivateData* pPrivateData = (CJS_PrivateData*)pObj->GetAlignedPointerFromInternalField(0);
 	if(pPrivateData)
 		return pPrivateData->ObjDefID;
 	return -1;
 }
 
-IJS_Runtime* JS_GetRuntime(v8::Handle<v8::Object> pObj)
+IJS_Runtime* JS_GetRuntime(v8::Local<v8::Object> pObj)
 {
 	if(pObj.IsEmpty()) return NULL;
 	v8::Local<v8::Context> context = pObj->CreationContext();
@@ -467,7 +467,8 @@
     // intermediate format.
     CFX_ByteString utf8_message = message.UTF8Encode();
     isolate->ThrowException(v8::String::NewFromUtf8(isolate,
-                                                    utf8_message.c_str()));
+                                                    utf8_message.c_str(),
+                                                    v8::NewStringType::kNormal).ToLocalChecked());
 }
 
 unsigned JS_CalcHash(const wchar_t* main, unsigned nLen)
@@ -479,7 +480,7 @@
 {
 	return (unsigned)FX_HashCode_String_GetW((FX_LPCWSTR)main, FXSYS_wcslen(main));
 }
-const wchar_t*	JS_GetTypeof(v8::Handle<v8::Value> pObj)
+const wchar_t*	JS_GetTypeof(v8::Local<v8::Value> pObj)
 {
 	if(pObj.IsEmpty()) return NULL;
 	if(pObj->IsString())
@@ -499,254 +500,271 @@
 	return NULL;
 
 }
-void JS_SetPrivate(v8::Handle<v8::Object> pObj, void* p)
+void JS_SetPrivate(v8::Local<v8::Object> pObj, void* p)
 {
 	JS_SetPrivate(NULL, pObj, p);
 }
 
-void* JS_GetPrivate(v8::Handle<v8::Object> pObj)
+void* JS_GetPrivate(v8::Local<v8::Object> pObj)
 {
 	return JS_GetPrivate(NULL,pObj);
 }
 
-void JS_SetPrivate(IJS_Runtime* pJSRuntime, v8::Handle<v8::Object> pObj, void* p)
+void JS_SetPrivate(IJS_Runtime* pJSRuntime, v8::Local<v8::Object> pObj, void* p)
 {
 	if(pObj.IsEmpty() || !pObj->InternalFieldCount()) return;
-	v8::Handle<v8::External> ptr = v8::Handle<v8::External>::Cast(pObj->GetInternalField(0));
-	CJS_PrivateData* pPrivateData  = (CJS_PrivateData*)ptr->Value();
+	CJS_PrivateData* pPrivateData  = (CJS_PrivateData*)pObj->GetAlignedPointerFromInternalField(0);
 	if(!pPrivateData) return;
 	pPrivateData->pPrivate = p;
 }
 
-void* JS_GetPrivate(IJS_Runtime* pJSRuntime, v8::Handle<v8::Object> pObj)
+void* JS_GetPrivate(IJS_Runtime* pJSRuntime, v8::Local<v8::Object> pObj)
 {
 	if(pObj.IsEmpty()) return NULL;
-	v8::Local<v8::Value> value;
+	CJS_PrivateData* pPrivateData  = NULL;
 	if(pObj->InternalFieldCount())
-		value = pObj->GetInternalField(0); 
+                pPrivateData = (CJS_PrivateData*)pObj->GetAlignedPointerFromInternalField(0);
 	else
 	{
 		//It could be a global proxy object.
 		v8::Local<v8::Value> v = pObj->GetPrototype();
+                v8::Isolate* isolate = (v8::Isolate*)pJSRuntime;
+                v8::Local<v8::Context> context = isolate->GetCurrentContext();
 		if(v->IsObject())
-			value = v->ToObject()->GetInternalField(0);
+                        pPrivateData = (CJS_PrivateData*)v->ToObject(context).ToLocalChecked()->GetAlignedPointerFromInternalField(0);
 	}
-	if(value.IsEmpty() || value->IsUndefined()) return NULL;
-	v8::Handle<v8::External> ptr = v8::Handle<v8::External>::Cast(value);
-	CJS_PrivateData* pPrivateData  = (CJS_PrivateData*)ptr->Value();
 	if(!pPrivateData) return NULL;
 	return pPrivateData->pPrivate;
 }
 
-void JS_FreePrivate(v8::Handle<v8::Object> pObj)
+void JS_FreePrivate(void* pPrivateData)
+{
+        delete (CJS_PrivateData*)pPrivateData;
+}
+
+void JS_FreePrivate(v8::Local<v8::Object> pObj)
 {
 	if(pObj.IsEmpty() || !pObj->InternalFieldCount()) return;
-	v8::Handle<v8::External> ptr = v8::Handle<v8::External>::Cast(pObj->GetInternalField(0));
-	delete (CJS_PrivateData*)ptr->Value();
-	v8::Local<v8::Context> context = pObj->CreationContext();
-
-	pObj->SetInternalField(0, v8::External::New(context->GetIsolate(), NULL));
+	JS_FreePrivate(pObj->GetAlignedPointerFromInternalField(0));
+	pObj->SetAlignedPointerInInternalField(0, NULL);
 }
 
 
-v8::Handle<v8::Value> JS_GetObjectValue(v8::Handle<v8::Object> pObj)
+v8::Local<v8::Value> JS_GetObjectValue(v8::Local<v8::Object> pObj)
 {
 	return pObj;
 }
 
-v8::Handle<v8::String> WSToJSString(IJS_Runtime* pJSRuntime, const wchar_t* PropertyName, int Len = -1)
+v8::Local<v8::String> WSToJSString(IJS_Runtime* pJSRuntime, const wchar_t* PropertyName, int Len = -1)
 {
 	CFX_WideString ws = CFX_WideString(PropertyName,Len);
 	CFX_ByteString bs = ws.UTF8Encode();
 	if(!pJSRuntime) pJSRuntime = v8::Isolate::GetCurrent();
-	return v8::String::NewFromUtf8(pJSRuntime, bs.c_str());
+	return v8::String::NewFromUtf8(pJSRuntime, bs.c_str(), v8::NewStringType::kNormal).ToLocalChecked();
 }
 
-v8::Handle<v8::Value> JS_GetObjectElement(IJS_Runtime* pJSRuntime, v8::Handle<v8::Object> pObj,const wchar_t* PropertyName)
+v8::Local<v8::Value> JS_GetObjectElement(IJS_Runtime* pJSRuntime, v8::Local<v8::Object> pObj,const wchar_t* PropertyName)
 {
-	if(pObj.IsEmpty()) return v8::Handle<v8::Value>();
-	return pObj->Get(WSToJSString(pJSRuntime,PropertyName));
+	if(pObj.IsEmpty()) return v8::Local<v8::Value>();
+        v8::Local<v8::Value> val;
+	if (!pObj->Get(pJSRuntime->GetCurrentContext(), WSToJSString(pJSRuntime,PropertyName)).ToLocal(&val)) return v8::Local<v8::Value>();
+        return val;
 }
 
-v8::Handle<v8::Array> JS_GetObjectElementNames(v8::Handle<v8::Object> pObj)
+v8::Local<v8::Array> JS_GetObjectElementNames(IJS_Runtime* pJSRuntime, v8::Local<v8::Object> pObj)
 {
-	if(pObj.IsEmpty()) return v8::Handle<v8::Array>();
-	return pObj->GetPropertyNames();
+	if(pObj.IsEmpty()) return v8::Local<v8::Array>();
+        v8::Local<v8::Array> val;
+	if (!pObj->GetPropertyNames(pJSRuntime->GetCurrentContext()).ToLocal(&val)) return v8::Local<v8::Array>();
+        return val;
 }
 
-void JS_PutObjectString(IJS_Runtime* pJSRuntime,v8::Handle<v8::Object> pObj, const wchar_t* PropertyName, const wchar_t* sValue) //VT_string
+void JS_PutObjectString(IJS_Runtime* pJSRuntime,v8::Local<v8::Object> pObj, const wchar_t* PropertyName, const wchar_t* sValue) //VT_string
 {
 	if(pObj.IsEmpty()) return;
-	pObj->Set(WSToJSString(pJSRuntime, PropertyName), WSToJSString(pJSRuntime, sValue));
+	pObj->Set(pJSRuntime->GetCurrentContext(), WSToJSString(pJSRuntime, PropertyName), WSToJSString(pJSRuntime, sValue)).FromJust();
 }
 
-void JS_PutObjectNumber(IJS_Runtime* pJSRuntime,v8::Handle<v8::Object> pObj, const wchar_t* PropertyName, int nValue)
+void JS_PutObjectNumber(IJS_Runtime* pJSRuntime,v8::Local<v8::Object> pObj, const wchar_t* PropertyName, int nValue)
 {
 	if(pObj.IsEmpty()) return;
-	pObj->Set(WSToJSString(pJSRuntime,PropertyName),v8::Int32::New(pJSRuntime, nValue));
+	pObj->Set(pJSRuntime->GetCurrentContext(), WSToJSString(pJSRuntime,PropertyName),v8::Int32::New(pJSRuntime, nValue)).FromJust();
 }
 
-void JS_PutObjectNumber(IJS_Runtime* pJSRuntime,v8::Handle<v8::Object> pObj, const wchar_t* PropertyName, float fValue)
+void JS_PutObjectNumber(IJS_Runtime* pJSRuntime,v8::Local<v8::Object> pObj, const wchar_t* PropertyName, float fValue)
 {
 	if(pObj.IsEmpty()) return;
-	pObj->Set(WSToJSString(pJSRuntime,PropertyName),v8::Number::New(pJSRuntime, (double)fValue));
+	pObj->Set(pJSRuntime->GetCurrentContext(), WSToJSString(pJSRuntime,PropertyName),v8::Number::New(pJSRuntime, (double)fValue)).FromJust();
 }
 
-void JS_PutObjectNumber(IJS_Runtime* pJSRuntime,v8::Handle<v8::Object> pObj, const wchar_t* PropertyName, double dValue)
+void JS_PutObjectNumber(IJS_Runtime* pJSRuntime,v8::Local<v8::Object> pObj, const wchar_t* PropertyName, double dValue)
 {
 	if(pObj.IsEmpty()) return;
-	pObj->Set(WSToJSString(pJSRuntime,PropertyName),v8::Number::New(pJSRuntime, (double)dValue));
+	pObj->Set(pJSRuntime->GetCurrentContext(), WSToJSString(pJSRuntime,PropertyName),v8::Number::New(pJSRuntime, (double)dValue)).FromJust();
 }
 
-void JS_PutObjectBoolean(IJS_Runtime* pJSRuntime,v8::Handle<v8::Object> pObj, const wchar_t* PropertyName, bool bValue)
+void JS_PutObjectBoolean(IJS_Runtime* pJSRuntime,v8::Local<v8::Object> pObj, const wchar_t* PropertyName, bool bValue)
 {
 	if(pObj.IsEmpty()) return;
-	pObj->Set(WSToJSString(pJSRuntime,PropertyName),v8::Boolean::New(pJSRuntime, bValue));
+	pObj->Set(pJSRuntime->GetCurrentContext(), WSToJSString(pJSRuntime,PropertyName),v8::Boolean::New(pJSRuntime, bValue)).FromJust();
 }
 
-void JS_PutObjectObject(IJS_Runtime* pJSRuntime,v8::Handle<v8::Object> pObj, const wchar_t* PropertyName, v8::Handle<v8::Object> pPut)
+void JS_PutObjectObject(IJS_Runtime* pJSRuntime,v8::Local<v8::Object> pObj, const wchar_t* PropertyName, v8::Local<v8::Object> pPut)
 {
 	if(pObj.IsEmpty()) return;
-	pObj->Set(WSToJSString(pJSRuntime,PropertyName),pPut);
+	pObj->Set(pJSRuntime->GetCurrentContext(), WSToJSString(pJSRuntime,PropertyName),pPut).FromJust();
 }
 
-void JS_PutObjectNull(IJS_Runtime* pJSRuntime,v8::Handle<v8::Object> pObj, const wchar_t* PropertyName)
+void JS_PutObjectNull(IJS_Runtime* pJSRuntime,v8::Local<v8::Object> pObj, const wchar_t* PropertyName)
 {
 	if(pObj.IsEmpty()) return;
-	pObj->Set(WSToJSString(pJSRuntime,PropertyName),v8::Handle<v8::Object>());
+	pObj->Set(pJSRuntime->GetCurrentContext(), WSToJSString(pJSRuntime,PropertyName),v8::Local<v8::Object>()).FromJust();
 }
 
-v8::Handle<v8::Array> JS_NewArray(IJS_Runtime* pJSRuntime)
+v8::Local<v8::Array> JS_NewArray(IJS_Runtime* pJSRuntime)
 {
 	return v8::Array::New(pJSRuntime);
 }
 
-unsigned JS_PutArrayElement(v8::Handle<v8::Array> pArray,unsigned index,v8::Handle<v8::Value> pValue,FXJSVALUETYPE eType)
+unsigned JS_PutArrayElement(IJS_Runtime* pJSRuntime, v8::Local<v8::Array> pArray,unsigned index,v8::Local<v8::Value> pValue,FXJSVALUETYPE eType)
 {	
 	if(pArray.IsEmpty()) return 0;
-	pArray->Set(index, pValue);
+	if (pArray->Set(pJSRuntime->GetCurrentContext(), index, pValue).IsNothing()) return 0;
 	return 1;
 }
 
-v8::Handle<v8::Value> JS_GetArrayElemnet(v8::Handle<v8::Array> pArray,unsigned index)
+v8::Local<v8::Value> JS_GetArrayElement(IJS_Runtime* pJSRuntime, v8::Local<v8::Array> pArray,unsigned index)
 {
-	if(pArray.IsEmpty()) return v8::Handle<v8::Value>();
-	return pArray->Get(index);
+	if(pArray.IsEmpty()) return v8::Local<v8::Value>();
+        v8::Local<v8::Value> val;
+	if (pArray->Get(pJSRuntime->GetCurrentContext(), index).ToLocal(&val)) return v8::Local<v8::Value>();
+        return val;
 }
 
-unsigned JS_GetArrayLength(v8::Handle<v8::Array> pArray)
+unsigned JS_GetArrayLength(v8::Local<v8::Array> pArray)
 {
 	if(pArray.IsEmpty()) return 0;
 	return pArray->Length();
 }
 
-v8::Handle<v8::Value> JS_NewNumber(IJS_Runtime* pJSRuntime,int number)
+v8::Local<v8::Value> JS_NewNumber(IJS_Runtime* pJSRuntime,int number)
 {
 	return v8::Int32::New(pJSRuntime, number);
 }
 
-v8::Handle<v8::Value> JS_NewNumber(IJS_Runtime* pJSRuntime,double number)
+v8::Local<v8::Value> JS_NewNumber(IJS_Runtime* pJSRuntime,double number)
 {
 	return v8::Number::New(pJSRuntime, number);
 }
 
-v8::Handle<v8::Value> JS_NewNumber(IJS_Runtime* pJSRuntime,float number)
+v8::Local<v8::Value> JS_NewNumber(IJS_Runtime* pJSRuntime,float number)
 {
 	return v8::Number::New(pJSRuntime, (float)number);
 }
 
-v8::Handle<v8::Value> JS_NewBoolean(IJS_Runtime* pJSRuntime,bool b)
+v8::Local<v8::Value> JS_NewBoolean(IJS_Runtime* pJSRuntime,bool b)
 {
 	return v8::Boolean::New(pJSRuntime, b);
 }
 
-v8::Handle<v8::Value> JS_NewObject(IJS_Runtime* pJSRuntime,v8::Handle<v8::Object> pObj)
+v8::Local<v8::Value> JS_NewObject(IJS_Runtime* pJSRuntime,v8::Local<v8::Object> pObj)
 {
-	if(pObj.IsEmpty()) return v8::Handle<v8::Value>();
+	if(pObj.IsEmpty()) return v8::Local<v8::Value>();
 	return pObj->Clone();
 }
 
-v8::Handle<v8::Value> JS_NewObject2(IJS_Runtime* pJSRuntime,v8::Handle<v8::Array> pObj)
+v8::Local<v8::Value> JS_NewObject2(IJS_Runtime* pJSRuntime,v8::Local<v8::Array> pObj)
 {
-	if(pObj.IsEmpty()) return v8::Handle<v8::Value>();
+	if(pObj.IsEmpty()) return v8::Local<v8::Value>();
 	return pObj->Clone();
 }
 
 
-v8::Handle<v8::Value> JS_NewString(IJS_Runtime* pJSRuntime,const wchar_t* string)
+v8::Local<v8::Value> JS_NewString(IJS_Runtime* pJSRuntime,const wchar_t* string)
 {
 	return WSToJSString(pJSRuntime, string);
 }
 
-v8::Handle<v8::Value> JS_NewString(IJS_Runtime* pJSRuntime,const wchar_t* string, unsigned nLen)
+v8::Local<v8::Value> JS_NewString(IJS_Runtime* pJSRuntime,const wchar_t* string, unsigned nLen)
 {
 	return WSToJSString(pJSRuntime, string, nLen);
 }
 
-v8::Handle<v8::Value> JS_NewNull()
+v8::Local<v8::Value> JS_NewNull()
 {
-	return v8::Handle<v8::Value>();
+	return v8::Local<v8::Value>();
 }
 
-v8::Handle<v8::Value> JS_NewDate(IJS_Runtime* pJSRuntime,double d)
+v8::Local<v8::Value> JS_NewDate(IJS_Runtime* pJSRuntime,double d)
 {
-	return v8::Date::New(pJSRuntime, d);
+	return v8::Date::New(pJSRuntime->GetCurrentContext(), d).ToLocalChecked();
 }
 
-v8::Handle<v8::Value> JS_NewValue(IJS_Runtime* pJSRuntime)
+v8::Local<v8::Value> JS_NewValue(IJS_Runtime* pJSRuntime)
 {
-	return v8::Handle<v8::Value>();
+	return v8::Local<v8::Value>();
 }
 
-v8::Handle<v8::Value> JS_GetListValue(v8::Handle<v8::Value> pList, int index)
+v8::Local<v8::Value> JS_GetListValue(IJS_Runtime* pJSRuntime, v8::Local<v8::Value> pList, int index)
 {
 
+        v8::Local<v8::Context> context = pJSRuntime->GetCurrentContext();
 	if(!pList.IsEmpty() && pList->IsObject())
 	{
-		v8::Local<v8::Object> obj = pList->ToObject();
-		return obj->Get(index);
+		v8::Local<v8::Object> obj;
+                if (pList->ToObject(context).ToLocal(&obj))
+                {
+                        v8::Local<v8::Value> val;
+                        if (obj->Get(context, index).ToLocal(&val)) return val;
+                }
 	}
-	return v8::Handle<v8::Value>();
+	return v8::Local<v8::Value>();
 }
 
-int	JS_ToInt32(v8::Handle<v8::Value> pValue)
+int	JS_ToInt32(IJS_Runtime* pJSRuntime, v8::Local<v8::Value> pValue)
 {
 	if(pValue.IsEmpty()) return 0;
-	return pValue->ToInt32()->Value();
+        v8::Local<v8::Context> context = pJSRuntime->GetCurrentContext();
+	return pValue->ToInt32(context).ToLocalChecked()->Value();
 }
 
-bool JS_ToBoolean(v8::Handle<v8::Value> pValue)
+bool JS_ToBoolean(IJS_Runtime* pJSRuntime, v8::Local<v8::Value> pValue)
 {
 	if(pValue.IsEmpty()) return false;
-	return pValue->ToBoolean()->Value();
+        v8::Local<v8::Context> context = pJSRuntime->GetCurrentContext();
+	return pValue->ToBoolean(context).ToLocalChecked()->Value();
 }
 
-double JS_ToNumber(v8::Handle<v8::Value> pValue)
+double JS_ToNumber(IJS_Runtime* pJSRuntime, v8::Local<v8::Value> pValue)
 {
 	if(pValue.IsEmpty()) return 0.0;
-	return pValue->ToNumber()->Value();
+        v8::Local<v8::Context> context = pJSRuntime->GetCurrentContext();
+	return pValue->ToNumber(context).ToLocalChecked()->Value();
 }
 
-v8::Handle<v8::Object> JS_ToObject(v8::Handle<v8::Value> pValue)
+v8::Local<v8::Object> JS_ToObject(IJS_Runtime* pJSRuntime, v8::Local<v8::Value> pValue)
 {
-	if(pValue.IsEmpty()) return v8::Handle<v8::Object>();
-	return pValue->ToObject();
+	if(pValue.IsEmpty()) return v8::Local<v8::Object>();
+        v8::Local<v8::Context> context = pJSRuntime->GetCurrentContext();
+	return pValue->ToObject(context).ToLocalChecked();
 }
 
-CFX_WideString	JS_ToString(v8::Handle<v8::Value> pValue)
+CFX_WideString	JS_ToString(IJS_Runtime* pJSRuntime, v8::Local<v8::Value> pValue)
 {
 	if(pValue.IsEmpty()) return L"";
-	v8::String::Utf8Value s(pValue->ToString());
+        v8::Local<v8::Context> context = pJSRuntime->GetCurrentContext();
+	v8::String::Utf8Value s(pValue->ToString(context).ToLocalChecked());
 	return CFX_WideString::FromUTF8(*s, s.length());
 }
 
-v8::Handle<v8::Array> JS_ToArray(v8::Handle<v8::Value> pValue)
+v8::Local<v8::Array> JS_ToArray(IJS_Runtime* pJSRuntime, v8::Local<v8::Value> pValue)
 {
-	if(pValue.IsEmpty()) return v8::Handle<v8::Array>();
-	return v8::Handle<v8::Array>::Cast(pValue->ToObject());
+	if(pValue.IsEmpty()) return v8::Local<v8::Array>();
+        v8::Local<v8::Context> context = pJSRuntime->GetCurrentContext();
+	return v8::Local<v8::Array>::Cast(pValue->ToObject(context).ToLocalChecked());
 }
 
-void JS_ValueCopy(v8::Handle<v8::Value>& pTo, v8::Handle<v8::Value> pFrom)
+void JS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom)
 {
 	pTo = pFrom;
 }
@@ -977,22 +995,22 @@
 	v8::Local<v8::Context> context = pIsolate->GetCurrentContext();
 	
 	//Use the built-in object method.
-	v8::Local<v8::Value> v = context->Global()->Get(v8::String::NewFromUtf8(pIsolate, "Date"));
+	v8::Local<v8::Value> v = context->Global()->Get(context, v8::String::NewFromUtf8(pIsolate, "Date", v8::NewStringType::kNormal).ToLocalChecked()).ToLocalChecked();
 	if(v->IsObject())
 	{
-		v8::Local<v8::Object> o = v->ToObject();
-		v = o->Get(v8::String::NewFromUtf8(pIsolate, "parse"));
+		v8::Local<v8::Object> o = v->ToObject(context).ToLocalChecked();
+		v = o->Get(context,v8::String::NewFromUtf8(pIsolate, "parse", v8::NewStringType::kNormal).ToLocalChecked()).ToLocalChecked();
 		if(v->IsFunction())
 		{
-			v8::Local<v8::Function> funC = v8::Handle<v8::Function>::Cast(v);
+			v8::Local<v8::Function> funC = v8::Local<v8::Function>::Cast(v);
 
 			const int argc = 1;
 			v8::Local<v8::String> timeStr = WSToJSString(pIsolate, string);
-			v8::Handle<v8::Value> argv[argc] = {timeStr};
-			v = funC->Call(context->Global(), argc, argv);
+			v8::Local<v8::Value> argv[argc] = {timeStr};
+			v = funC->Call(context, context->Global(), argc, argv).ToLocalChecked();
 			if(v->IsNumber())
 			{
-				double date =  v->ToNumber()->Value();
+				double date =  v->ToNumber(context).ToLocalChecked()->Value();
 				if(!_isfinite(date)) return date;
 				return date + _getLocalTZA() + _getDaylightSavingTA(date);
 			}
diff --git a/xfa/src/fxjse/src/class.cpp b/xfa/src/fxjse/src/class.cpp
index 326e8d4..e29d4ce 100644
--- a/xfa/src/fxjse/src/class.cpp
+++ b/xfa/src/fxjse/src/class.cpp
@@ -21,7 +21,7 @@
     ASSERT(lpContext);

     CFXJSE_ScopeUtil_IsolateHandleContext scope(lpContext);

     v8::Isolate *pIsolate = lpContext->GetRuntime();

-    v8::Handle<v8::Object>  hGlobalObject = FXJSE_GetGlobalObjectFromContext(scope.GetLocalContext());

+    v8::Local<v8::Object>  hGlobalObject = FXJSE_GetGlobalObjectFromContext(scope.GetLocalContext());

     for(FX_INT32 i = 0; i < nNum; i++) {

         hGlobalObject->ForceSet(v8::String::NewFromUtf8(pIsolate, lpFunctions[i].name),

                                 v8::Function::New(pIsolate, FXJSE_V8FunctionCallback_Wrapper, v8::External::New(pIsolate, const_cast<FXJSE_FUNCTION*>(lpFunctions + i))),

@@ -164,14 +164,14 @@
 CFX_ByteString	CFXJSE_Arguments::GetUTF8String(FX_INT32 index) const

 {

     const CFXJSE_ArgumentsImpl* lpArguments = reinterpret_cast<const CFXJSE_ArgumentsImpl* const>(this);

-    v8::Handle<v8::String> hString = (*lpArguments->m_pInfo)[index]->ToString();

+    v8::Local<v8::String> hString = (*lpArguments->m_pInfo)[index]->ToString();

     v8::String::Utf8Value  szStringVal(hString);

     return CFX_ByteString(*szStringVal);

 }

 FX_LPVOID		CFXJSE_Arguments::GetObject(FX_INT32 index, FXJSE_HCLASS hClass ) const

 {

     const CFXJSE_ArgumentsImpl* lpArguments = reinterpret_cast<const CFXJSE_ArgumentsImpl* const>(this);

-    v8::Handle<v8::Value> hValue = (*lpArguments->m_pInfo)[index];

+    v8::Local<v8::Value> hValue = (*lpArguments->m_pInfo)[index];

     ASSERT(!hValue.IsEmpty());

     if(!hValue->IsObject()) {

         return NULL;

diff --git a/xfa/src/fxjse/src/class.h b/xfa/src/fxjse/src/class.h
index 26ebb91..f8cdc34 100644
--- a/xfa/src/fxjse/src/class.h
+++ b/xfa/src/fxjse/src/class.h
@@ -17,7 +17,7 @@
     {

         return m_pContext;

     }

-    inline v8::Persistent<v8::FunctionTemplate>& GetTemplate()

+    inline v8::Global<v8::FunctionTemplate>& GetTemplate()

     {

         return m_hTemplate;

     }

@@ -29,7 +29,7 @@
 protected:

     CFX_ByteString							m_szClassName;

     CFXJSE_Context*							m_pContext;

-    v8::Persistent<v8::FunctionTemplate>	m_hTemplate;

+    v8::Global<v8::FunctionTemplate>	m_hTemplate;

     friend class CFXJSE_Context;

     friend class CFXJSE_Value;

 };

diff --git a/xfa/src/fxjse/src/context.cpp b/xfa/src/fxjse/src/context.cpp
index f2d979e..d78729f 100644
--- a/xfa/src/fxjse/src/context.cpp
+++ b/xfa/src/fxjse/src/context.cpp
@@ -63,12 +63,12 @@
     ASSERT(pContext);

     return pContext->ExecuteScript(szScript, reinterpret_cast<CFXJSE_Value*>(hRetValue), reinterpret_cast<CFXJSE_Value*>(hNewThisObject));

 }

-v8::Handle<v8::Object> FXJSE_CreateReturnValue(v8::Isolate* pIsolate, v8::TryCatch& trycatch)

+v8::Local<v8::Object> FXJSE_CreateReturnValue(v8::Isolate* pIsolate, v8::TryCatch& trycatch)

 {

-    v8::Handle<v8::Object> hReturnValue = v8::Object::New(pIsolate);

+    v8::Local<v8::Object> hReturnValue = v8::Object::New(pIsolate);

     if (trycatch.HasCaught()) {

-        v8::Handle<v8::Value> hException = trycatch.Exception();

-        v8::Handle<v8::Message> hMessage = trycatch.Message();

+        v8::Local<v8::Value> hException = trycatch.Exception();

+        v8::Local<v8::Message> hMessage = trycatch.Message();

         if (hException->IsObject()) {

             v8::Local<v8::Value> hValue;

             hValue = hException.As<v8::Object>()->Get(v8::String::NewFromUtf8(pIsolate, "name"));

@@ -207,7 +207,7 @@
         ASSERT(hWrapperValue->IsFunction());

         v8::Local<v8::Function>	hWrapperFn    = hWrapperValue.As<v8::Function>();

         if(!trycatch.HasCaught()) {

-            v8::Handle<v8::Value> rgArgs[] = {hScriptString};

+            v8::Local<v8::Value> rgArgs[] = {hScriptString};

             v8::Local<v8::Value> hValue = hWrapperFn->Call(hNewThis.As<v8::Object>(), 1, rgArgs);

             if(!trycatch.HasCaught()) {

                 if(lpRetValue) {

diff --git a/xfa/src/fxjse/src/context.h b/xfa/src/fxjse/src/context.h
index 8d33001..9735369 100644
--- a/xfa/src/fxjse/src/context.h
+++ b/xfa/src/fxjse/src/context.h
@@ -26,12 +26,12 @@
     CFXJSE_Context(const CFXJSE_Context&);

     CFXJSE_Context& operator = (const CFXJSE_Context&);

 protected:

-    v8::Persistent<v8::Context>			m_hContext;

+    v8::Global<v8::Context>			m_hContext;

     v8::Isolate*						m_pIsolate;

     CFX_ArrayTemplate<CFXJSE_Class*>	m_rgClasses;

     friend class CFXJSE_Class;

     friend class CFXJSE_ScopeUtil_IsolateHandleContext;

     friend class CFXJSE_ScopeUtil_IsolateHandleRootOrNormalContext;

 };

-v8::Handle<v8::Object> FXJSE_CreateReturnValue(v8::Isolate* pIsolate, v8::TryCatch& trycatch);

+v8::Local<v8::Object> FXJSE_CreateReturnValue(v8::Isolate* pIsolate, v8::TryCatch& trycatch);

 #endif

diff --git a/xfa/src/fxjse/src/dynprop.cpp b/xfa/src/fxjse/src/dynprop.cpp
index fd03dcf..ddc3e20 100644
--- a/xfa/src/fxjse/src/dynprop.cpp
+++ b/xfa/src/fxjse/src/dynprop.cpp
@@ -146,7 +146,7 @@
     v8::Local<v8::Script> fnSource = v8::Script::Compile(v8::String::NewFromUtf8(pIsolate,

                                      "(function (o, name) { var fn, x, d; fn = Object.getOwnPropertyDescriptor; x = o; while(x && !(d = fn(x, name))){x = x.__proto__;} return d; })"));

     v8::Local<v8::Function> fn = fnSource->Run().As<v8::Function>();

-    v8::Handle<v8::Value> rgArgs[] = {hChainObj, info[0]};

+    v8::Local<v8::Value> rgArgs[] = {hChainObj, info[0]};

     v8::Local<v8::Value> hChainDescriptor = fn->Call(info.This(), 2, rgArgs);

     if(!hChainDescriptor.IsEmpty() && hChainDescriptor->IsObject()) {

         info.GetReturnValue().Set(hChainDescriptor);

@@ -270,7 +270,7 @@
     hTrapper->ForceSet(v8::String::NewFromUtf8(pIsolate, "delete"),						v8::Function::New(pIsolate, FXJSE_V8ProxyCallback_delete,					v8::External::New(pIsolate, const_cast<FXJSE_CLASS*>(lpClassDefinition))));

     hTrapper->ForceSet(v8::String::NewFromUtf8(pIsolate, "defineProperty"),				v8::Function::New(pIsolate, FXJSE_V8ProxyCallback_defineProperty,			v8::External::New(pIsolate, const_cast<FXJSE_CLASS*>(lpClassDefinition))));

     hTrapper->ForceSet(v8::String::NewFromUtf8(pIsolate, "fix"),						v8::Function::New(pIsolate, FXJSE_V8ProxyCallback_fix,						v8::External::New(pIsolate, const_cast<FXJSE_CLASS*>(lpClassDefinition))));

-    v8::Handle<v8::Value> rgArgs[] = {hTrapper, hOldPrototype};

+    v8::Local<v8::Value> rgArgs[] = {hTrapper, hOldPrototype};

     v8::Local<v8::Value> hNewPrototype = hHarmonyProxyCreateFn->Call(hHarmonyProxyObj, 2, rgArgs);

     hObject->SetPrototype(hNewPrototype);

 }

diff --git a/xfa/src/fxjse/src/runtime.h b/xfa/src/fxjse/src/runtime.h
index 87d540e..a51dc8f 100644
--- a/xfa/src/fxjse/src/runtime.h
+++ b/xfa/src/fxjse/src/runtime.h
@@ -16,8 +16,8 @@
     static CFXJSE_RuntimeData* Get(v8::Isolate* pIsolate);

 public:

     v8::Isolate*							m_pIsolate;

-    v8::Persistent<v8::FunctionTemplate>	m_hRootContextGlobalTemplate;

-    v8::Persistent<v8::Context>				m_hRootContext;

+    v8::Global<v8::FunctionTemplate>	m_hRootContextGlobalTemplate;

+    v8::Global<v8::Context>				m_hRootContext;

 public:

     static CFXJSE_RuntimeList*	g_RuntimeList;

 protected:

diff --git a/xfa/src/fxjse/src/util_inline.h b/xfa/src/fxjse/src/util_inline.h
index dddcab3..517b554 100644
--- a/xfa/src/fxjse/src/util_inline.h
+++ b/xfa/src/fxjse/src/util_inline.h
@@ -24,7 +24,7 @@
     }

     v8::Local<v8::Object> hObject = hJSObject;

     if(hObject->InternalFieldCount() == 0) {

-        v8::Handle<v8::Value> hProtoObject = hObject->GetPrototype();

+        v8::Local<v8::Value> hProtoObject = hObject->GetPrototype();

         if(hProtoObject.IsEmpty() || !hProtoObject->IsObject()) {

             return NULL;

         }

diff --git a/xfa/src/fxjse/src/value.cpp b/xfa/src/fxjse/src/value.cpp
index de7e054..21939e8 100644
--- a/xfa/src/fxjse/src/value.cpp
+++ b/xfa/src/fxjse/src/value.cpp
@@ -254,8 +254,8 @@
     v8::Isolate* pIsolate = v8::Isolate::GetCurrent();

     ASSERT(pIsolate);

     CFXJSE_ScopeUtil_IsolateHandleRootContext scope(pIsolate);

-    v8::Handle<v8::String> hMessage = v8::String::NewFromUtf8(pIsolate, utf8Message.GetCStr(), v8::String::kNormalString, utf8Message.GetLength());

-    v8::Handle<v8::Value> hError;

+    v8::Local<v8::String> hMessage = v8::String::NewFromUtf8(pIsolate, utf8Message.GetCStr(), v8::String::kNormalString, utf8Message.GetLength());

+    v8::Local<v8::Value> hError;

     if(utf8Name == "RangeError") {

         hError = v8::Exception::RangeError(hMessage);

     } else if(utf8Name == "ReferenceError") {

@@ -433,7 +433,7 @@
 FX_BOOL CFXJSE_Value::SetFunctionBind(CFXJSE_Value* lpOldFunction, CFXJSE_Value* lpNewThis)

 {

     CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate);

-    v8::Handle<v8::Value> rgArgs[2];

+    v8::Local<v8::Value> rgArgs[2];

     v8::Local<v8::Value> hOldFunction = v8::Local<v8::Value>::New(m_pIsolate, lpOldFunction->DirectGetValue());

     if(hOldFunction.IsEmpty() || !hOldFunction->IsFunction()) {

         return FALSE;

@@ -467,14 +467,14 @@
         return FALSE;

     }

     v8::Local<v8::Value> hReturnValue;

-    v8::Handle<v8::Value>* lpLocalArgs = NULL;

+    v8::Local<v8::Value>* lpLocalArgs = NULL;

     if(nArgCount) {

-        lpLocalArgs = FX_Alloc(v8::Handle<v8::Value>, nArgCount);

+        lpLocalArgs = FX_Alloc(v8::Local<v8::Value>, nArgCount);

         if (!lpLocalArgs) {

             return FALSE;

         }

         for (FX_UINT32 i = 0; i < nArgCount; i++) {

-            new (lpLocalArgs + i) v8::Handle<v8::Value>;

+            new (lpLocalArgs + i) v8::Local<v8::Value>;

             CFXJSE_Value* lpArg = (CFXJSE_Value*)lpArgs[i];

             if(lpArg) {

                 lpLocalArgs[i] = v8::Local<v8::Value>::New(m_pIsolate, lpArg->DirectGetValue());

diff --git a/xfa/src/fxjse/src/value.h b/xfa/src/fxjse/src/value.h
index eb118fd..547ae92 100644
--- a/xfa/src/fxjse/src/value.h
+++ b/xfa/src/fxjse/src/value.h
@@ -209,7 +209,7 @@
     {

         return m_pIsolate;

     }

-    V8_INLINE const v8::Persistent<v8::Value>& DirectGetValue() const

+    V8_INLINE const v8::Global<v8::Value>& DirectGetValue() const

     {

         return m_hValue;

     }

@@ -229,7 +229,7 @@
     static CFXJSE_Value* Create(v8::Isolate* pIsolate);

 protected:

     v8::Isolate*				m_pIsolate;

-    v8::Persistent<v8::Value>	m_hValue;

+    v8::Global<v8::Value>	m_hValue;

     friend class CFXJSE_Context;

     friend class CFXJSE_Class;

 };