LCOV - code coverage report
Current view: top level - js/xpconnect/wrappers - FilteringWrapper.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 3 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 9 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /* vim: set ts=8 sts=4 et sw=4 tw=99: */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #ifndef __FilteringWrapper_h__
       8             : #define __FilteringWrapper_h__
       9             : 
      10             : #include "XrayWrapper.h"
      11             : #include "mozilla/Attributes.h"
      12             : #include "jswrapper.h"
      13             : #include "js/CallNonGenericMethod.h"
      14             : 
      15             : namespace JS {
      16             : class AutoIdVector;
      17             : } // namespace JS
      18             : 
      19             : namespace xpc {
      20             : 
      21             : template <typename Base, typename Policy>
      22             : class FilteringWrapper : public Base {
      23             :   public:
      24           0 :     constexpr explicit FilteringWrapper(unsigned flags) : Base(flags) {}
      25             : 
      26             :     virtual bool enter(JSContext* cx, JS::Handle<JSObject*> wrapper, JS::Handle<jsid> id,
      27             :                        js::Wrapper::Action act, bool mayThrow, bool* bp) const override;
      28             : 
      29             :     virtual bool getOwnPropertyDescriptor(JSContext* cx, JS::Handle<JSObject*> wrapper,
      30             :                                           JS::Handle<jsid> id,
      31             :                                           JS::MutableHandle<JS::PropertyDescriptor> desc) const override;
      32             :     virtual bool ownPropertyKeys(JSContext* cx, JS::Handle<JSObject*> wrapper,
      33             :                                  JS::AutoIdVector& props) const override;
      34             : 
      35             :     virtual bool getPropertyDescriptor(JSContext* cx, JS::Handle<JSObject*> wrapper,
      36             :                                        JS::Handle<jsid> id,
      37             :                                        JS::MutableHandle<JS::PropertyDescriptor> desc) const override;
      38             :     virtual bool getOwnEnumerablePropertyKeys(JSContext* cx, JS::Handle<JSObject*> wrapper,
      39             :                                               JS::AutoIdVector& props) const override;
      40             :     virtual JSObject* enumerate(JSContext* cx, JS::Handle<JSObject*> wrapper) const override;
      41             : 
      42             :     virtual bool call(JSContext* cx, JS::Handle<JSObject*> wrapper,
      43             :                       const JS::CallArgs& args) const override;
      44             :     virtual bool construct(JSContext* cx, JS::Handle<JSObject*> wrapper,
      45             :                            const JS::CallArgs& args) const override;
      46             : 
      47             :     virtual bool nativeCall(JSContext* cx, JS::IsAcceptableThis test, JS::NativeImpl impl,
      48             :                             const JS::CallArgs& args) const override;
      49             : 
      50             :     virtual bool getPrototype(JSContext* cx, JS::HandleObject wrapper,
      51             :                               JS::MutableHandleObject protop) const override;
      52             : 
      53             :     static const FilteringWrapper singleton;
      54             : };
      55             : 
      56             : /*
      57             :  * The HTML5 spec mandates very particular object behavior for cross-origin DOM
      58             :  * objects (Window and Location), some of which runs contrary to the way that
      59             :  * other XrayWrappers behave. We use this class to implement those semantics.
      60             :  */
      61             : class CrossOriginXrayWrapper : public SecurityXrayDOM {
      62             :   public:
      63           0 :     constexpr explicit CrossOriginXrayWrapper(unsigned flags) :
      64           0 :       SecurityXrayDOM(flags) {}
      65             : 
      66             : 
      67             :     virtual bool getOwnPropertyDescriptor(JSContext* cx, JS::Handle<JSObject*> wrapper,
      68             :                                           JS::Handle<jsid> id,
      69             :                                           JS::MutableHandle<JS::PropertyDescriptor> desc) const override;
      70             :     virtual bool defineProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
      71             :                                 JS::Handle<jsid> id,
      72             :                                 JS::Handle<JS::PropertyDescriptor> desc,
      73             :                                 JS::ObjectOpResult& result) const override;
      74             :     virtual bool ownPropertyKeys(JSContext* cx, JS::Handle<JSObject*> wrapper,
      75             :                                  JS::AutoIdVector& props) const override;
      76             :     virtual bool delete_(JSContext* cx, JS::Handle<JSObject*> wrapper,
      77             :                          JS::Handle<jsid> id, JS::ObjectOpResult& result) const override;
      78             : 
      79             :     virtual bool getPropertyDescriptor(JSContext* cx, JS::Handle<JSObject*> wrapper,
      80             :                                        JS::Handle<jsid> id,
      81             :                                        JS::MutableHandle<JS::PropertyDescriptor> desc) const override;
      82             : 
      83             :     virtual bool setPrototype(JSContext* cx, JS::HandleObject wrapper,
      84             :                               JS::HandleObject proto,
      85             :                               JS::ObjectOpResult& result) const override;
      86             : };
      87             : 
      88             : // Check whether the given jsid is a symbol whose value can be gotten
      89             : // cross-origin.  Cross-origin gets always return undefined as the value.
      90             : bool IsCrossOriginWhitelistedSymbol(JSContext* cx, JS::HandleId id);
      91             : 
      92             : } // namespace xpc
      93             : 
      94             : #endif /* __FilteringWrapper_h__ */

Generated by: LCOV version 1.13