Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 : * vim: set ts=8 sts=4 et sw=4 tw=99:
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 : #include "js/Realm.h"
8 :
9 : #include "jscntxt.h"
10 : #include "jscompartment.h" // For JSContext::global
11 :
12 : #include "vm/GlobalObject.h"
13 :
14 : using namespace js;
15 :
16 : JS_PUBLIC_API(JSObject*)
17 235 : JS::GetRealmObjectPrototype(JSContext* cx)
18 : {
19 470 : CHECK_REQUEST(cx);
20 470 : return GlobalObject::getOrCreateObjectPrototype(cx, cx->global());
21 : }
22 :
23 : JS_PUBLIC_API(JSObject*)
24 219 : JS::GetRealmFunctionPrototype(JSContext* cx)
25 : {
26 438 : CHECK_REQUEST(cx);
27 438 : return GlobalObject::getOrCreateFunctionPrototype(cx, cx->global());
28 : }
29 :
30 : JS_PUBLIC_API(JSObject*)
31 1 : JS::GetRealmArrayPrototype(JSContext* cx)
32 : {
33 2 : CHECK_REQUEST(cx);
34 2 : return GlobalObject::getOrCreateArrayPrototype(cx, cx->global());
35 : }
36 :
37 : JS_PUBLIC_API(JSObject*)
38 1 : JS::GetRealmErrorPrototype(JSContext* cx)
39 : {
40 2 : CHECK_REQUEST(cx);
41 2 : return GlobalObject::getOrCreateCustomErrorPrototype(cx, cx->global(), JSEXN_ERR);
42 : }
43 :
44 : JS_PUBLIC_API(JSObject*)
45 0 : JS::GetRealmIteratorPrototype(JSContext* cx)
46 : {
47 0 : CHECK_REQUEST(cx);
48 0 : return GlobalObject::getOrCreateIteratorPrototype(cx, cx->global());
49 : }
|