Bug 1941128 - Turn off network.dns.native_https_query on Mac again
[gecko.git] / js / xpconnect / loader / PrecompiledScript.h
blob7c0c258a69916d63480110813e8348f414d20a58
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/. */
6 #ifndef mozilla_dom_PrecompiledScript_h
7 #define mozilla_dom_PrecompiledScript_h
9 #include "mozilla/dom/BindingDeclarations.h"
10 #include "mozilla/dom/PrecompiledScriptBinding.h"
11 #include "mozilla/RefPtr.h"
13 #include "js/experimental/JSStencil.h"
14 #include "js/TypeDecls.h"
16 #include "nsCOMPtr.h"
17 #include "nsCycleCollectionParticipant.h"
18 #include "nsISupports.h"
19 #include "nsWrapperCache.h"
21 namespace JS {
22 class ReadOnlyCompileOptions;
25 namespace mozilla {
26 namespace dom {
27 class PrecompiledScript : public nsISupports, public nsWrapperCache {
28 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
29 NS_DECL_CYCLE_COLLECTION_SKIPPABLE_WRAPPERCACHE_CLASS(PrecompiledScript)
31 explicit PrecompiledScript(nsISupports* aParent, RefPtr<JS::Stencil> aStencil,
32 JS::ReadOnlyCompileOptions& aOptions);
34 void ExecuteInGlobal(JSContext* aCx, JS::Handle<JSObject*> aGlobal,
35 const ExecuteInGlobalOptions& aOptions,
36 JS::MutableHandle<JS::Value> aRval, ErrorResult& aRv);
38 void GetUrl(nsAString& aUrl);
40 bool HasReturnValue();
42 nsISupports* GetParentObject() const { return mParent; }
44 virtual JSObject* WrapObject(JSContext* aCx,
45 JS::Handle<JSObject*> aGivenProto) override;
47 protected:
48 virtual ~PrecompiledScript() = default;
50 private:
51 bool IsBlackForCC(bool aTracingNeeded);
53 nsCOMPtr<nsISupports> mParent;
55 RefPtr<JS::Stencil> mStencil;
56 nsCString mPublicURL;
57 const bool mHasReturnValue;
60 } // namespace dom
61 } // namespace mozilla
63 #endif // mozilla_dom_PrecompiledScript_h