Line data Source code
1 : /* THIS FILE IS AUTOGENERATED FROM Location.webidl BY Codegen.py - DO NOT EDIT */
2 :
3 : #ifndef mozilla_dom_LocationBinding_h
4 : #define mozilla_dom_LocationBinding_h
5 :
6 : #include "jsapi.h"
7 : #include "mozilla/ErrorResult.h"
8 : #include "mozilla/dom/BindingDeclarations.h"
9 : #include "mozilla/dom/Nullable.h"
10 :
11 : namespace mozilla {
12 : namespace dom {
13 :
14 : class Location;
15 : struct LocationAtoms;
16 : struct NativePropertyHooks;
17 : class ProtoAndIfaceCache;
18 :
19 : } // namespace dom
20 : } // namespace mozilla
21 :
22 : namespace mozilla {
23 : namespace dom {
24 :
25 : namespace LocationBinding {
26 :
27 : typedef mozilla::dom::Location NativeType;
28 :
29 : JSObject*
30 : DefineDOMInterface(JSContext* aCx, JS::Handle<JSObject*> aGlobal, JS::Handle<jsid> id, bool aDefineOnGlobal);
31 :
32 : bool
33 : Wrap(JSContext* aCx, mozilla::dom::Location* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
34 :
35 : template <class T>
36 3 : inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
37 : {
38 6 : JS::Rooted<JSObject*> reflector(aCx);
39 6 : return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
40 : }
41 :
42 : // We declare this as an array so that retrieving a pointer to this
43 : // binding's property hooks only requires compile/link-time resolvable
44 : // address arithmetic. Declaring it as a pointer instead would require
45 : // doing a run-time load to fetch a pointer to this binding's property
46 : // hooks. And then structures which embedded a pointer to this structure
47 : // would require a run-time load for proper initialization, which would
48 : // then induce static constructors. Lots of static constructors.
49 : extern const NativePropertyHooks sNativePropertyHooks[];
50 :
51 : void
52 : CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
53 :
54 : JS::Handle<JSObject*>
55 : GetProtoObjectHandle(JSContext* aCx);
56 :
57 : JS::Handle<JSObject*>
58 : GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true);
59 :
60 : JSObject*
61 : GetConstructorObject(JSContext* aCx);
62 :
63 0 : inline bool IsPermitted(JSFlatString* prop, char16_t propFirstChar, bool set)
64 : {
65 0 : switch (propFirstChar) {
66 : case 'h': {
67 0 : if (set && JS_FlatStringEqualsAscii(prop, "href")) {
68 0 : return true;
69 : }
70 0 : break;
71 : }
72 : case 'r': {
73 0 : if (!set && JS_FlatStringEqualsAscii(prop, "replace")) {
74 0 : return true;
75 : }
76 0 : break;
77 : }
78 : }
79 :
80 0 : return false;
81 : }
82 :
83 : } // namespace LocationBinding
84 :
85 :
86 :
87 : } // namespace dom
88 : } // namespace mozilla
89 :
90 : #endif // mozilla_dom_LocationBinding_h
|