js/xpconnect/src/xpcpublic.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
michael@0 2 /* vim: set ts=8 sts=4 et sw=4 tw=99: */
michael@0 3 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #ifndef xpcpublic_h
michael@0 8 #define xpcpublic_h
michael@0 9
michael@0 10 #include "jsapi.h"
michael@0 11 #include "jsproxy.h"
michael@0 12 #include "js/HeapAPI.h"
michael@0 13 #include "js/GCAPI.h"
michael@0 14
michael@0 15 #include "nsISupports.h"
michael@0 16 #include "nsIURI.h"
michael@0 17 #include "nsIPrincipal.h"
michael@0 18 #include "nsWrapperCache.h"
michael@0 19 #include "nsStringGlue.h"
michael@0 20 #include "nsTArray.h"
michael@0 21 #include "mozilla/dom/JSSlots.h"
michael@0 22 #include "nsMathUtils.h"
michael@0 23 #include "nsStringBuffer.h"
michael@0 24 #include "mozilla/dom/BindingDeclarations.h"
michael@0 25
michael@0 26 class nsGlobalWindow;
michael@0 27 class nsIPrincipal;
michael@0 28 class nsScriptNameSpaceManager;
michael@0 29 class nsIGlobalObject;
michael@0 30 class nsIMemoryReporterCallback;
michael@0 31
michael@0 32 #ifndef BAD_TLS_INDEX
michael@0 33 #define BAD_TLS_INDEX ((uint32_t) -1)
michael@0 34 #endif
michael@0 35
michael@0 36 namespace xpc {
michael@0 37
michael@0 38 class Scriptability {
michael@0 39 public:
michael@0 40 Scriptability(JSCompartment *c);
michael@0 41 bool Allowed();
michael@0 42 bool IsImmuneToScriptPolicy();
michael@0 43
michael@0 44 void Block();
michael@0 45 void Unblock();
michael@0 46 void SetDocShellAllowsScript(bool aAllowed);
michael@0 47
michael@0 48 static Scriptability& Get(JSObject *aScope);
michael@0 49
michael@0 50 private:
michael@0 51 // Whenever a consumer wishes to prevent script from running on a global,
michael@0 52 // it increments this value with a call to Block(). When it wishes to
michael@0 53 // re-enable it (if ever), it decrements this value with a call to Unblock().
michael@0 54 // Script may not run if this value is non-zero.
michael@0 55 uint32_t mScriptBlocks;
michael@0 56
michael@0 57 // Whether the docshell allows javascript in this scope. If this scope
michael@0 58 // doesn't have a docshell, this value is always true.
michael@0 59 bool mDocShellAllowsScript;
michael@0 60
michael@0 61 // Whether this scope is immune to user-defined or addon-defined script
michael@0 62 // policy.
michael@0 63 bool mImmuneToScriptPolicy;
michael@0 64
michael@0 65 // Whether the new-style domain policy when this compartment was created
michael@0 66 // forbids script execution.
michael@0 67 bool mScriptBlockedByPolicy;
michael@0 68 };
michael@0 69
michael@0 70 JSObject *
michael@0 71 TransplantObject(JSContext *cx, JS::HandleObject origobj, JS::HandleObject target);
michael@0 72
michael@0 73 bool IsXBLScope(JSCompartment *compartment);
michael@0 74 bool IsInXBLScope(JSObject *obj);
michael@0 75
michael@0 76 // Return a raw XBL scope object corresponding to contentScope, which must
michael@0 77 // be an object whose global is a DOM window.
michael@0 78 //
michael@0 79 // The return value is not wrapped into cx->compartment, so be sure to enter
michael@0 80 // its compartment before doing anything meaningful.
michael@0 81 //
michael@0 82 // Also note that XBL scopes are lazily created, so the return-value should be
michael@0 83 // null-checked unless the caller can ensure that the scope must already
michael@0 84 // exist.
michael@0 85 //
michael@0 86 // This function asserts if |contentScope| is itself in an XBL scope to catch
michael@0 87 // sloppy consumers. Conversely, GetXBLScopeOrGlobal will handle objects that
michael@0 88 // are in XBL scope (by just returning the global).
michael@0 89 JSObject *
michael@0 90 GetXBLScope(JSContext *cx, JSObject *contentScope);
michael@0 91
michael@0 92 inline JSObject *
michael@0 93 GetXBLScopeOrGlobal(JSContext *cx, JSObject *obj) {
michael@0 94 if (IsInXBLScope(obj))
michael@0 95 return js::GetGlobalForObjectCrossCompartment(obj);
michael@0 96 return GetXBLScope(cx, obj);
michael@0 97 }
michael@0 98
michael@0 99 // Returns whether XBL scopes have been explicitly disabled for code running
michael@0 100 // in this compartment. See the comment around mAllowXBLScope.
michael@0 101 bool
michael@0 102 AllowXBLScope(JSCompartment *c);
michael@0 103
michael@0 104 // Returns whether we will use an XBL scope for this compartment. This is
michael@0 105 // semantically equivalent to comparing global != GetXBLScope(global), but it
michael@0 106 // does not have the side-effect of eagerly creating the XBL scope if it does
michael@0 107 // not already exist.
michael@0 108 bool
michael@0 109 UseXBLScope(JSCompartment *c);
michael@0 110
michael@0 111 bool
michael@0 112 IsSandboxPrototypeProxy(JSObject *obj);
michael@0 113
michael@0 114 bool
michael@0 115 IsReflector(JSObject *obj);
michael@0 116
michael@0 117 bool
michael@0 118 IsXrayWrapper(JSObject *obj);
michael@0 119
michael@0 120 // If this function was created for a given XrayWrapper, returns the global of
michael@0 121 // the Xrayed object. Otherwise, returns the global of the function.
michael@0 122 //
michael@0 123 // To emphasize the obvious: the return value here is not necessarily same-
michael@0 124 // compartment with the argument.
michael@0 125 JSObject *
michael@0 126 XrayAwareCalleeGlobal(JSObject *fun);
michael@0 127
michael@0 128 void
michael@0 129 TraceXPCGlobal(JSTracer *trc, JSObject *obj);
michael@0 130
michael@0 131 } /* namespace xpc */
michael@0 132
michael@0 133 namespace JS {
michael@0 134
michael@0 135 struct RuntimeStats;
michael@0 136
michael@0 137 }
michael@0 138
michael@0 139 #define XPCONNECT_GLOBAL_FLAGS_WITH_EXTRA_SLOTS(n) \
michael@0 140 JSCLASS_DOM_GLOBAL | JSCLASS_HAS_PRIVATE | \
michael@0 141 JSCLASS_PRIVATE_IS_NSISUPPORTS | JSCLASS_IMPLEMENTS_BARRIERS | \
michael@0 142 JSCLASS_GLOBAL_FLAGS_WITH_SLOTS(DOM_GLOBAL_SLOTS + n)
michael@0 143
michael@0 144 #define XPCONNECT_GLOBAL_EXTRA_SLOT_OFFSET (JSCLASS_GLOBAL_SLOT_COUNT + DOM_GLOBAL_SLOTS)
michael@0 145
michael@0 146 #define XPCONNECT_GLOBAL_FLAGS XPCONNECT_GLOBAL_FLAGS_WITH_EXTRA_SLOTS(0)
michael@0 147
michael@0 148 inline JSObject*
michael@0 149 xpc_FastGetCachedWrapper(JSContext *cx, nsWrapperCache *cache, JS::MutableHandleValue vp)
michael@0 150 {
michael@0 151 if (cache) {
michael@0 152 JSObject* wrapper = cache->GetWrapper();
michael@0 153 if (wrapper &&
michael@0 154 js::GetObjectCompartment(wrapper) == js::GetContextCompartment(cx))
michael@0 155 {
michael@0 156 vp.setObject(*wrapper);
michael@0 157 return wrapper;
michael@0 158 }
michael@0 159 }
michael@0 160
michael@0 161 return nullptr;
michael@0 162 }
michael@0 163
michael@0 164 // The JS GC marks objects gray that are held alive directly or
michael@0 165 // indirectly by an XPConnect root. The cycle collector explores only
michael@0 166 // this subset of the JS heap.
michael@0 167 inline bool
michael@0 168 xpc_IsGrayGCThing(void *thing)
michael@0 169 {
michael@0 170 return JS::GCThingIsMarkedGray(thing);
michael@0 171 }
michael@0 172
michael@0 173 // The cycle collector only cares about some kinds of GCthings that are
michael@0 174 // reachable from an XPConnect root. Implemented in nsXPConnect.cpp.
michael@0 175 extern bool
michael@0 176 xpc_GCThingIsGrayCCThing(void *thing);
michael@0 177
michael@0 178 inline JSScript *
michael@0 179 xpc_UnmarkGrayScript(JSScript *script)
michael@0 180 {
michael@0 181 if (script)
michael@0 182 JS::ExposeGCThingToActiveJS(script, JSTRACE_SCRIPT);
michael@0 183
michael@0 184 return script;
michael@0 185 }
michael@0 186
michael@0 187 // If aVariant is an XPCVariant, this marks the object to be in aGeneration.
michael@0 188 // This also unmarks the gray JSObject.
michael@0 189 extern void
michael@0 190 xpc_MarkInCCGeneration(nsISupports* aVariant, uint32_t aGeneration);
michael@0 191
michael@0 192 // If aWrappedJS is a JS wrapper, unmark its JSObject.
michael@0 193 extern void
michael@0 194 xpc_TryUnmarkWrappedGrayObject(nsISupports* aWrappedJS);
michael@0 195
michael@0 196 extern void
michael@0 197 xpc_UnmarkSkippableJSHolders();
michael@0 198
michael@0 199 // No JS can be on the stack when this is called. Probably only useful from
michael@0 200 // xpcshell.
michael@0 201 void
michael@0 202 xpc_ActivateDebugMode();
michael@0 203
michael@0 204 // readable string conversions, static methods and members only
michael@0 205 class XPCStringConvert
michael@0 206 {
michael@0 207 // One-slot cache, because it turns out it's common for web pages to
michael@0 208 // get the same string a few times in a row. We get about a 40% cache
michael@0 209 // hit rate on this cache last it was measured. We'd get about 70%
michael@0 210 // hit rate with a hashtable with removal on finalization, but that
michael@0 211 // would take a lot more machinery.
michael@0 212 struct ZoneStringCache
michael@0 213 {
michael@0 214 nsStringBuffer* mBuffer;
michael@0 215 JSString* mString;
michael@0 216 };
michael@0 217
michael@0 218 public:
michael@0 219
michael@0 220 // If the string shares the readable's buffer, that buffer will
michael@0 221 // get assigned to *sharedBuffer. Otherwise null will be
michael@0 222 // assigned.
michael@0 223 static bool ReadableToJSVal(JSContext *cx, const nsAString &readable,
michael@0 224 nsStringBuffer** sharedBuffer,
michael@0 225 JS::MutableHandleValue vp);
michael@0 226
michael@0 227 // Convert the given stringbuffer/length pair to a jsval
michael@0 228 static MOZ_ALWAYS_INLINE bool
michael@0 229 StringBufferToJSVal(JSContext* cx, nsStringBuffer* buf, uint32_t length,
michael@0 230 JS::MutableHandleValue rval, bool* sharedBuffer)
michael@0 231 {
michael@0 232 JS::Zone *zone = js::GetContextZone(cx);
michael@0 233 ZoneStringCache *cache = static_cast<ZoneStringCache*>(JS_GetZoneUserData(zone));
michael@0 234 if (cache && buf == cache->mBuffer) {
michael@0 235 MOZ_ASSERT(JS::GetGCThingZone(cache->mString) == zone);
michael@0 236 JS::MarkStringAsLive(zone, cache->mString);
michael@0 237 rval.setString(cache->mString);
michael@0 238 *sharedBuffer = false;
michael@0 239 return true;
michael@0 240 }
michael@0 241
michael@0 242 JSString *str = JS_NewExternalString(cx,
michael@0 243 static_cast<jschar*>(buf->Data()),
michael@0 244 length, &sDOMStringFinalizer);
michael@0 245 if (!str) {
michael@0 246 return false;
michael@0 247 }
michael@0 248 rval.setString(str);
michael@0 249 if (!cache) {
michael@0 250 cache = new ZoneStringCache();
michael@0 251 JS_SetZoneUserData(zone, cache);
michael@0 252 }
michael@0 253 cache->mBuffer = buf;
michael@0 254 cache->mString = str;
michael@0 255 *sharedBuffer = true;
michael@0 256 return true;
michael@0 257 }
michael@0 258
michael@0 259 static void FreeZoneCache(JS::Zone *zone);
michael@0 260 static void ClearZoneCache(JS::Zone *zone);
michael@0 261
michael@0 262 static MOZ_ALWAYS_INLINE bool IsLiteral(JSString *str)
michael@0 263 {
michael@0 264 return JS_IsExternalString(str) &&
michael@0 265 JS_GetExternalStringFinalizer(str) == &sLiteralFinalizer;
michael@0 266 }
michael@0 267
michael@0 268 static MOZ_ALWAYS_INLINE bool IsDOMString(JSString *str)
michael@0 269 {
michael@0 270 return JS_IsExternalString(str) &&
michael@0 271 JS_GetExternalStringFinalizer(str) == &sDOMStringFinalizer;
michael@0 272 }
michael@0 273
michael@0 274 private:
michael@0 275 static const JSStringFinalizer sLiteralFinalizer, sDOMStringFinalizer;
michael@0 276
michael@0 277 static void FinalizeLiteral(const JSStringFinalizer *fin, jschar *chars);
michael@0 278
michael@0 279 static void FinalizeDOMString(const JSStringFinalizer *fin, jschar *chars);
michael@0 280
michael@0 281 XPCStringConvert(); // not implemented
michael@0 282 };
michael@0 283
michael@0 284 namespace xpc {
michael@0 285
michael@0 286 // If these functions return false, then an exception will be set on cx.
michael@0 287 bool Base64Encode(JSContext *cx, JS::HandleValue val, JS::MutableHandleValue out);
michael@0 288 bool Base64Decode(JSContext *cx, JS::HandleValue val, JS::MutableHandleValue out);
michael@0 289
michael@0 290 /**
michael@0 291 * Convert an nsString to jsval, returning true on success.
michael@0 292 * Note, the ownership of the string buffer may be moved from str to rval.
michael@0 293 * If that happens, str will point to an empty string after this call.
michael@0 294 */
michael@0 295 bool NonVoidStringToJsval(JSContext *cx, nsAString &str, JS::MutableHandleValue rval);
michael@0 296 inline bool StringToJsval(JSContext *cx, nsAString &str, JS::MutableHandleValue rval)
michael@0 297 {
michael@0 298 // From the T_DOMSTRING case in XPCConvert::NativeData2JS.
michael@0 299 if (str.IsVoid()) {
michael@0 300 rval.setNull();
michael@0 301 return true;
michael@0 302 }
michael@0 303 return NonVoidStringToJsval(cx, str, rval);
michael@0 304 }
michael@0 305
michael@0 306 inline bool
michael@0 307 NonVoidStringToJsval(JSContext* cx, const nsAString& str, JS::MutableHandleValue rval)
michael@0 308 {
michael@0 309 nsString mutableCopy(str);
michael@0 310 return NonVoidStringToJsval(cx, mutableCopy, rval);
michael@0 311 }
michael@0 312
michael@0 313 inline bool
michael@0 314 StringToJsval(JSContext* cx, const nsAString& str, JS::MutableHandleValue rval)
michael@0 315 {
michael@0 316 nsString mutableCopy(str);
michael@0 317 return StringToJsval(cx, mutableCopy, rval);
michael@0 318 }
michael@0 319
michael@0 320 /**
michael@0 321 * As above, but for mozilla::dom::DOMString.
michael@0 322 */
michael@0 323 MOZ_ALWAYS_INLINE
michael@0 324 bool NonVoidStringToJsval(JSContext* cx, mozilla::dom::DOMString& str,
michael@0 325 JS::MutableHandleValue rval)
michael@0 326 {
michael@0 327 if (!str.HasStringBuffer()) {
michael@0 328 // It's an actual XPCOM string
michael@0 329 return NonVoidStringToJsval(cx, str.AsAString(), rval);
michael@0 330 }
michael@0 331
michael@0 332 uint32_t length = str.StringBufferLength();
michael@0 333 if (length == 0) {
michael@0 334 rval.set(JS_GetEmptyStringValue(cx));
michael@0 335 return true;
michael@0 336 }
michael@0 337
michael@0 338 nsStringBuffer* buf = str.StringBuffer();
michael@0 339 bool shared;
michael@0 340 if (!XPCStringConvert::StringBufferToJSVal(cx, buf, length, rval,
michael@0 341 &shared)) {
michael@0 342 return false;
michael@0 343 }
michael@0 344 if (shared) {
michael@0 345 // JS now needs to hold a reference to the buffer
michael@0 346 buf->AddRef();
michael@0 347 }
michael@0 348 return true;
michael@0 349 }
michael@0 350
michael@0 351 MOZ_ALWAYS_INLINE
michael@0 352 bool StringToJsval(JSContext* cx, mozilla::dom::DOMString& str,
michael@0 353 JS::MutableHandleValue rval)
michael@0 354 {
michael@0 355 if (str.IsNull()) {
michael@0 356 rval.setNull();
michael@0 357 return true;
michael@0 358 }
michael@0 359 return NonVoidStringToJsval(cx, str, rval);
michael@0 360 }
michael@0 361
michael@0 362 nsIPrincipal *GetCompartmentPrincipal(JSCompartment *compartment);
michael@0 363
michael@0 364 void SetLocationForGlobal(JSObject *global, const nsACString& location);
michael@0 365 void SetLocationForGlobal(JSObject *global, nsIURI *locationURI);
michael@0 366
michael@0 367 // ReportJSRuntimeExplicitTreeStats will expect this in the |extra| member
michael@0 368 // of JS::ZoneStats.
michael@0 369 class ZoneStatsExtras {
michael@0 370 public:
michael@0 371 ZoneStatsExtras()
michael@0 372 {}
michael@0 373
michael@0 374 nsAutoCString pathPrefix;
michael@0 375
michael@0 376 private:
michael@0 377 ZoneStatsExtras(const ZoneStatsExtras &other) MOZ_DELETE;
michael@0 378 ZoneStatsExtras& operator=(const ZoneStatsExtras &other) MOZ_DELETE;
michael@0 379 };
michael@0 380
michael@0 381 // ReportJSRuntimeExplicitTreeStats will expect this in the |extra| member
michael@0 382 // of JS::CompartmentStats.
michael@0 383 class CompartmentStatsExtras {
michael@0 384 public:
michael@0 385 CompartmentStatsExtras()
michael@0 386 {}
michael@0 387
michael@0 388 nsAutoCString jsPathPrefix;
michael@0 389 nsAutoCString domPathPrefix;
michael@0 390 nsCOMPtr<nsIURI> location;
michael@0 391
michael@0 392 private:
michael@0 393 CompartmentStatsExtras(const CompartmentStatsExtras &other) MOZ_DELETE;
michael@0 394 CompartmentStatsExtras& operator=(const CompartmentStatsExtras &other) MOZ_DELETE;
michael@0 395 };
michael@0 396
michael@0 397 // This reports all the stats in |rtStats| that belong in the "explicit" tree,
michael@0 398 // (which isn't all of them).
michael@0 399 // @see ZoneStatsExtras
michael@0 400 // @see CompartmentStatsExtras
michael@0 401 nsresult
michael@0 402 ReportJSRuntimeExplicitTreeStats(const JS::RuntimeStats &rtStats,
michael@0 403 const nsACString &rtPath,
michael@0 404 nsIMemoryReporterCallback *cb,
michael@0 405 nsISupports *closure, size_t *rtTotal = nullptr);
michael@0 406
michael@0 407 /**
michael@0 408 * Throws an exception on cx and returns false.
michael@0 409 */
michael@0 410 bool
michael@0 411 Throw(JSContext *cx, nsresult rv);
michael@0 412
michael@0 413 /**
michael@0 414 * Every global should hold a native that implements the nsIGlobalObject interface.
michael@0 415 */
michael@0 416 nsIGlobalObject *
michael@0 417 GetNativeForGlobal(JSObject *global);
michael@0 418
michael@0 419 /**
michael@0 420 * In some cases a native object does not really belong to any compartment (XBL,
michael@0 421 * document created from by XHR of a worker, etc.). But when for some reason we
michael@0 422 * have to wrap these natives (because of an event for example) instead of just
michael@0 423 * wrapping them into some random compartment we find on the context stack (like
michael@0 424 * we did previously) a default compartment is used. This function returns that
michael@0 425 * compartment's global. It is a singleton on the runtime.
michael@0 426 * If you find yourself wanting to use this compartment, you're probably doing
michael@0 427 * something wrong. Callers MUST consult with the XPConnect module owner before
michael@0 428 * using this compartment. If you don't, bholley will hunt you down.
michael@0 429 */
michael@0 430 JSObject *
michael@0 431 GetJunkScope();
michael@0 432
michael@0 433 /**
michael@0 434 * Returns the native global of the junk scope. See comment of GetJunkScope
michael@0 435 * about the conditions of using it.
michael@0 436 */
michael@0 437 nsIGlobalObject *
michael@0 438 GetJunkScopeGlobal();
michael@0 439
michael@0 440 /**
michael@0 441 * Shared compilation scope for XUL prototype documents and XBL
michael@0 442 * precompilation. This compartment has a null principal. No code may run, and
michael@0 443 * it is invisible to the debugger.
michael@0 444 */
michael@0 445 JSObject *
michael@0 446 GetCompilationScope();
michael@0 447
michael@0 448 /**
michael@0 449 * If |aObj| is a window, returns the associated nsGlobalWindow.
michael@0 450 * Otherwise, returns null.
michael@0 451 */
michael@0 452 nsGlobalWindow*
michael@0 453 WindowOrNull(JSObject *aObj);
michael@0 454
michael@0 455 /*
michael@0 456 * Returns the dummy global associated with the SafeJSContext. Callers MUST
michael@0 457 * consult with the XPConnect module owner before using this function.
michael@0 458 */
michael@0 459 JSObject *
michael@0 460 GetSafeJSContextGlobal();
michael@0 461
michael@0 462 /**
michael@0 463 * If |aObj| has a window for a global, returns the associated nsGlobalWindow.
michael@0 464 * Otherwise, returns null.
michael@0 465 */
michael@0 466 nsGlobalWindow*
michael@0 467 WindowGlobalOrNull(JSObject *aObj);
michael@0 468
michael@0 469 // Error reporter used when there is no associated DOM window on to which to
michael@0 470 // report errors and warnings.
michael@0 471 void
michael@0 472 SystemErrorReporter(JSContext *cx, const char *message, JSErrorReport *rep);
michael@0 473
michael@0 474 void
michael@0 475 SimulateActivityCallback(bool aActive);
michael@0 476
michael@0 477 void
michael@0 478 RecordAdoptedNode(JSCompartment *c);
michael@0 479
michael@0 480 void
michael@0 481 RecordDonatedNode(JSCompartment *c);
michael@0 482
michael@0 483 // This function may be used off-main-thread, in which case it is benignly
michael@0 484 // racey.
michael@0 485 bool
michael@0 486 ShouldDiscardSystemSource();
michael@0 487
michael@0 488 } // namespace xpc
michael@0 489
michael@0 490 namespace mozilla {
michael@0 491 namespace dom {
michael@0 492
michael@0 493 typedef JSObject*
michael@0 494 (*DefineInterface)(JSContext *cx, JS::Handle<JSObject*> global,
michael@0 495 JS::Handle<jsid> id, bool defineOnGlobal);
michael@0 496
michael@0 497 typedef JSObject*
michael@0 498 (*ConstructNavigatorProperty)(JSContext *cx, JS::Handle<JSObject*> naviObj);
michael@0 499
michael@0 500 // Check whether a constructor should be enabled for the given object.
michael@0 501 // Note that the object should NOT be an Xray, since Xrays will end up
michael@0 502 // defining constructors on the underlying object.
michael@0 503 // This is a typedef for the function type itself, not the function
michael@0 504 // pointer, so it's more obvious that pointers to a ConstructorEnabled
michael@0 505 // can be null.
michael@0 506 typedef bool
michael@0 507 (ConstructorEnabled)(JSContext* cx, JS::Handle<JSObject*> obj);
michael@0 508
michael@0 509 void
michael@0 510 Register(nsScriptNameSpaceManager* aNameSpaceManager);
michael@0 511
michael@0 512 /**
michael@0 513 * A test for whether WebIDL methods that should only be visible to
michael@0 514 * chrome or XBL scopes should be exposed.
michael@0 515 */
michael@0 516 bool IsChromeOrXBL(JSContext* cx, JSObject* /* unused */);
michael@0 517
michael@0 518 } // namespace dom
michael@0 519 } // namespace mozilla
michael@0 520
michael@0 521 #endif

mercurial