/src/mozilla-central/dom/script/ModuleScript.h
Line | Count | Source (jump to first uncovered line) |
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_ModuleScript_h |
8 | | #define mozilla_dom_ModuleScript_h |
9 | | |
10 | | #include "nsCOMPtr.h" |
11 | | #include "nsCycleCollectionParticipant.h" |
12 | | #include "jsapi.h" |
13 | | |
14 | | class nsIURI; |
15 | | |
16 | | namespace mozilla { |
17 | | namespace dom { |
18 | | |
19 | | class ScriptLoader; |
20 | | |
21 | | class ModuleScript final : public nsISupports |
22 | | { |
23 | | RefPtr<ScriptLoader> mLoader; |
24 | | nsCOMPtr<nsIURI> mBaseURL; |
25 | | JS::Heap<JSScript*> mScript; |
26 | | JS::Heap<JS::Value> mParseError; |
27 | | JS::Heap<JS::Value> mErrorToRethrow; |
28 | | bool mSourceElementAssociated; |
29 | | |
30 | | ~ModuleScript(); |
31 | | |
32 | | public: |
33 | | NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
34 | | NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ModuleScript) |
35 | | |
36 | | ModuleScript(ScriptLoader* aLoader, |
37 | | nsIURI* aBaseURL); |
38 | | |
39 | | void SetScript(JS::Handle<JSScript*> aScript); |
40 | | void SetParseError(const JS::Value& aError); |
41 | | void SetErrorToRethrow(const JS::Value& aError); |
42 | | void SetSourceElementAssociated(); |
43 | | |
44 | 0 | ScriptLoader* Loader() const { return mLoader; } |
45 | 0 | JSScript* Script() const { return mScript; } |
46 | 0 | nsIURI* BaseURL() const { return mBaseURL; } |
47 | 0 | JS::Value ParseError() const { return mParseError; } |
48 | 0 | JS::Value ErrorToRethrow() const { return mErrorToRethrow; } |
49 | 0 | bool HasParseError() const { return !mParseError.isUndefined(); } |
50 | 0 | bool HasErrorToRethrow() const { return !mErrorToRethrow.isUndefined(); } |
51 | 0 | bool SourceElementAssociated() const { return mSourceElementAssociated; } |
52 | | |
53 | | void UnlinkScript(); |
54 | | }; |
55 | | |
56 | | } // dom namespace |
57 | | } // mozilla namespace |
58 | | |
59 | | #endif // mozilla_dom_ModuleScript_h |