LCOV - code coverage report
Current view: top level - dom/base - WindowNamedPropertiesHandler.h (source / functions) Hit Total Coverage
Test: output.info Lines: 2 9 22.2 %
Date: 2017-07-14 16:53:18 Functions: 1 4 25.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
       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 mozilla_dom_WindowNamedPropertiesHandler_h
       8             : #define mozilla_dom_WindowNamedPropertiesHandler_h
       9             : 
      10             : #include "mozilla/dom/DOMJSProxyHandler.h"
      11             : 
      12             : namespace mozilla {
      13             : namespace dom {
      14             : 
      15             : class WindowNamedPropertiesHandler : public BaseDOMProxyHandler
      16             : {
      17             : public:
      18             :   constexpr WindowNamedPropertiesHandler()
      19             :     : BaseDOMProxyHandler(nullptr, /* hasPrototype = */ true)
      20             :   {
      21             :   }
      22             :   virtual bool
      23             :   getOwnPropDescriptor(JSContext* aCx, JS::Handle<JSObject*> aProxy,
      24             :                        JS::Handle<jsid> aId,
      25             :                        bool /* unused */,
      26             :                        JS::MutableHandle<JS::PropertyDescriptor> aDesc)
      27             :                        const override;
      28             :   virtual bool
      29             :   defineProperty(JSContext* aCx, JS::Handle<JSObject*> aProxy,
      30             :                  JS::Handle<jsid> aId,
      31             :                  JS::Handle<JS::PropertyDescriptor> aDesc,
      32             :                  JS::ObjectOpResult &result) const override;
      33             :   virtual bool
      34             :   ownPropNames(JSContext* aCx, JS::Handle<JSObject*> aProxy, unsigned flags,
      35             :                JS::AutoIdVector& aProps) const override;
      36             :   virtual bool
      37             :   delete_(JSContext* aCx, JS::Handle<JSObject*> aProxy, JS::Handle<jsid> aId,
      38             :           JS::ObjectOpResult &aResult) const override;
      39             : 
      40             :   // No need for getPrototypeIfOrdinary here: window named-properties objects
      41             :   // have static prototypes, so the version inherited from BaseDOMProxyHandler
      42             :   // will do the right thing.
      43             : 
      44             :   virtual bool
      45           0 :   preventExtensions(JSContext* aCx, JS::Handle<JSObject*> aProxy,
      46             :                     JS::ObjectOpResult& aResult) const override
      47             :   {
      48           0 :     return aResult.failCantPreventExtensions();
      49             :   }
      50             :   virtual bool
      51           0 :   isExtensible(JSContext* aCx, JS::Handle<JSObject*> aProxy,
      52             :                bool* aIsExtensible) const override
      53             :   {
      54           0 :     *aIsExtensible = true;
      55           0 :     return true;
      56             :   }
      57             :   virtual const char*
      58           0 :   className(JSContext *aCx, JS::Handle<JSObject*> aProxy) const override
      59             :   {
      60           0 :     return "WindowProperties";
      61             :   }
      62             : 
      63             :   static const WindowNamedPropertiesHandler*
      64           7 :   getInstance()
      65             :   {
      66             :     static const WindowNamedPropertiesHandler instance;
      67           7 :     return &instance;
      68             :   }
      69             : 
      70             :   // For Create, aProto is the parent of the interface prototype object of the
      71             :   // Window we're associated with.
      72             :   static JSObject*
      73             :   Create(JSContext *aCx, JS::Handle<JSObject*> aProto);
      74             : };
      75             : 
      76             : } // namespace dom
      77             : } // namespace mozilla
      78             : 
      79             : #endif /* mozilla_dom_WindowNamedPropertiesHandler_h */

Generated by: LCOV version 1.13