Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
2 : /* This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : #ifndef mozilla_dom_PrecompiledScript_h
7 : #define mozilla_dom_PrecompiledScript_h
8 :
9 : #include "mozilla/dom/BindingDeclarations.h"
10 : #include "mozilla/dom/PrecompiledScriptBinding.h"
11 :
12 : #include "jsapi.h"
13 :
14 : #include "nsCOMPtr.h"
15 : #include "nsCycleCollectionParticipant.h"
16 : #include "nsISupports.h"
17 : #include "nsWrapperCache.h"
18 :
19 : namespace mozilla {
20 : namespace dom {
21 : class PrecompiledScript : public nsISupports
22 : , public nsWrapperCache
23 : {
24 : NS_DECL_CYCLE_COLLECTING_ISUPPORTS
25 0 : NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(PrecompiledScript)
26 :
27 : explicit PrecompiledScript(nsISupports* aParent, JS::Handle<JSScript*> aScript, JS::ReadOnlyCompileOptions& aOptions);
28 :
29 : void ExecuteInGlobal(JSContext* aCx, JS::HandleObject aGlobal,
30 : JS::MutableHandleValue aRval,
31 : ErrorResult& aRv);
32 :
33 : void GetUrl(nsAString& aUrl);
34 :
35 : bool HasReturnValue();
36 :
37 0 : nsISupports* GetParentObject() const { return mParent; }
38 :
39 : virtual JSObject* WrapObject(JSContext* aCx,
40 : JS::Handle<JSObject*> aGivenProto) override;
41 :
42 : protected:
43 : virtual ~PrecompiledScript();
44 :
45 : private:
46 : nsCOMPtr<nsISupports> mParent;
47 :
48 : JS::Heap<JSScript*> mScript;
49 : nsCString mURL;
50 : const bool mHasReturnValue;
51 : };
52 :
53 : } // namespace dom
54 : } // namespace mozilla
55 :
56 : #endif // mozilla_dom_PrecompiledScript_h
|