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 /* describes principals by their orginating uris*/
7 #ifndef nsJSPrincipals_h__
8 #define nsJSPrincipals_h__
10 #include "nsIPrincipal.h"
14 struct nsJSPrincipals
: nsIPrincipal
, JSPrincipals
16 static bool Subsume(JSPrincipals
*jsprin
, JSPrincipals
*other
);
17 static void Destroy(JSPrincipals
*jsprin
);
20 * Get a weak reference to nsIPrincipal associated with the given JS
23 static nsJSPrincipals
* get(JSPrincipals
*principals
) {
24 nsJSPrincipals
*self
= static_cast<nsJSPrincipals
*>(principals
);
25 MOZ_ASSERT_IF(self
, self
->debugToken
== DEBUG_TOKEN
);
29 static nsJSPrincipals
* get(nsIPrincipal
*principal
) {
30 nsJSPrincipals
*self
= static_cast<nsJSPrincipals
*>(principal
);
31 MOZ_ASSERT_IF(self
, self
->debugToken
== DEBUG_TOKEN
);
37 setDebugToken(DEBUG_TOKEN
);
40 virtual ~nsJSPrincipals() {
45 * Return a string that can be used as JS script filename in error reports.
47 virtual void GetScriptLocation(nsACString
&aStr
) = 0;
50 virtual void dumpImpl() = 0;
53 static const uint32_t DEBUG_TOKEN
= 0x0bf41760;
56 #endif /* nsJSPrincipals_h__ */