LCOV - code coverage report
Current view: top level - dom/base - nsIScriptContext.h (source / functions) Hit Total Coverage
Test: output.info Lines: 2 2 100.0 %
Date: 2017-07-14 16:53:18 Functions: 2 2 100.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 nsIScriptContext_h__
       8             : #define nsIScriptContext_h__
       9             : 
      10             : #include "nscore.h"
      11             : #include "nsStringGlue.h"
      12             : #include "nsISupports.h"
      13             : #include "nsCOMPtr.h"
      14             : #include "jspubtd.h"
      15             : #include "js/GCAPI.h"
      16             : 
      17             : class nsIScriptGlobalObject;
      18             : 
      19             : #define NS_ISCRIPTCONTEXT_IID \
      20             : { 0x54cbe9cf, 0x7282, 0x421a, \
      21             :  { 0x91, 0x6f, 0xd0, 0x70, 0x73, 0xde, 0xb8, 0xc0 } }
      22             : 
      23             : class nsIOffThreadScriptReceiver;
      24             : 
      25             : /**
      26             :  * It is used by the application to initialize a runtime and run scripts.
      27             :  * A script runtime would implement this interface.
      28             :  */
      29           5 : class nsIScriptContext : public nsISupports
      30             : {
      31             : public:
      32             :   NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISCRIPTCONTEXT_IID)
      33             : 
      34             :   /**
      35             :    * Return the global object.
      36             :    *
      37             :    **/
      38             :   virtual nsIScriptGlobalObject *GetGlobalObject() = 0;
      39             : 
      40             :   /**
      41             :    * Initialize the context generally. Does not create a global object.
      42             :    **/
      43             :   virtual nsresult InitContext() = 0;
      44             : 
      45             :   /**
      46             :    * Check to see if context is as yet intialized. Used to prevent
      47             :    * reentrancy issues during the initialization process.
      48             :    *
      49             :    * @return true if initialized, false if not
      50             :    *
      51             :    */
      52             :   virtual bool IsContextInitialized() = 0;
      53             : 
      54             :   // SetProperty is suspect and jst believes should not be needed.  Currenly
      55             :   // used only for "arguments".
      56             :   virtual nsresult SetProperty(JS::Handle<JSObject*> aTarget,
      57             :                                const char* aPropName, nsISupports* aVal) = 0;
      58             :   /**
      59             :    * Called to set/get information if the script context is
      60             :    * currently processing a script tag
      61             :    */
      62             :   virtual bool GetProcessingScriptTag() = 0;
      63             :   virtual void SetProcessingScriptTag(bool aResult) = 0;
      64             : 
      65             :   /**
      66             :    * Initialize DOM classes on aGlobalObj, always call
      67             :    * WillInitializeContext() before calling InitContext(), and always
      68             :    * call DidInitializeContext() when a context is fully
      69             :    * (successfully) initialized.
      70             :    */
      71             :   virtual nsresult InitClasses(JS::Handle<JSObject*> aGlobalObj) = 0;
      72             : 
      73             :   /**
      74             :    * Tell the context we're about to be reinitialize it.
      75             :    */
      76             :   virtual void WillInitializeContext() = 0;
      77             : 
      78             :   /**
      79             :    * Tell the context we're done reinitializing it.
      80             :    */
      81             :   virtual void DidInitializeContext() = 0;
      82             : 
      83             :   /**
      84             :    * Access the Window Proxy. The setter should only be called by nsGlobalWindow.
      85             :    */
      86             :   virtual void SetWindowProxy(JS::Handle<JSObject*> aWindowProxy) = 0;
      87             :   virtual JSObject* GetWindowProxy() = 0;
      88             : };
      89             : 
      90             : NS_DEFINE_STATIC_IID_ACCESSOR(nsIScriptContext, NS_ISCRIPTCONTEXT_IID)
      91             : 
      92             : #define NS_IOFFTHREADSCRIPTRECEIVER_IID \
      93             : {0x3a980010, 0x878d, 0x46a9,            \
      94             :   {0x93, 0xad, 0xbc, 0xfd, 0xd3, 0x8e, 0xa0, 0xc2}}
      95             : 
      96           1 : class nsIOffThreadScriptReceiver : public nsISupports
      97             : {
      98             : public:
      99             :   NS_DECLARE_STATIC_IID_ACCESSOR(NS_IOFFTHREADSCRIPTRECEIVER_IID)
     100             : 
     101             :   /**
     102             :    * Notify this object that a previous CompileScript call specifying this as
     103             :    * aOffThreadReceiver has completed. The script being passed in must be
     104             :    * rooted before any call which could trigger GC.
     105             :    */
     106             :   NS_IMETHOD OnScriptCompileComplete(JSScript* aScript, nsresult aStatus) = 0;
     107             : };
     108             : 
     109             : NS_DEFINE_STATIC_IID_ACCESSOR(nsIOffThreadScriptReceiver, NS_IOFFTHREADSCRIPTRECEIVER_IID)
     110             : 
     111             : #endif // nsIScriptContext_h__

Generated by: LCOV version 1.13