2
0

CrossSite.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. #pragma once
  6. class DOMFastPathInfo;
  7. namespace Js
  8. {
  9. class CrossSite
  10. {
  11. friend class ExternalType;
  12. friend class DOMFastPathInfo;
  13. public:
  14. static bool IsThunk(JavascriptMethod thunk);
  15. static BOOL NeedMarshalVar(Var instance, ScriptContext * requestContext);
  16. static Var DefaultThunk(RecyclableObject* function, CallInfo callInfo, ...);
  17. static Var ProfileThunk(RecyclableObject* function, CallInfo callInfo, ...);
  18. static Var MarshalVar(ScriptContext* scriptContext, Var value, bool fRequestWrapper = false);
  19. static Var MarshalEnumerator(ScriptContext* scriptContext, Var value);
  20. static void MarshalDynamicObjectAndPrototype(ScriptContext * scriptContext, DynamicObject * object);
  21. static void ForceCrossSiteThunkOnPrototypeChain(RecyclableObject* object);
  22. // If we know the type of the object, use this to do a virtual table check instead of a virtual call
  23. template <typename T>
  24. static BOOL IsCrossSiteObjectTyped(T * obj)
  25. {
  26. BOOL ret = VirtualTableInfo<CrossSiteObject<T>>::HasVirtualTable(obj);
  27. Assert(ret || VirtualTableInfo<T>::HasVirtualTable(obj));
  28. Assert(ret == obj->IsCrossSiteObject());
  29. return ret;
  30. }
  31. private:
  32. static Var MarshalVarInner(ScriptContext* scriptContext, __in Js::RecyclableObject* object, bool fRequestWrapper);
  33. static Var CommonThunk(RecyclableObject * function, JavascriptMethod entryPoint, Arguments args);
  34. static void MarshalDynamicObject(ScriptContext * scriptContext, DynamicObject * object);
  35. static void MarshalPrototypeChain(ScriptContext * scriptContext, DynamicObject * object);
  36. static Var MarshalFrameDisplay(ScriptContext* scriptContext, FrameDisplay *display);
  37. static bool DoRequestWrapper(Js::RecyclableObject* object, bool fRequestWrapper);
  38. };
  39. };