Skip to content

Commit 402ae42

Browse files
committed
Bug 1708739 - Move WeakMap APIs to new public header r=yulia
Differential Revision: https://phabricator.services.mozilla.com/D113994
1 parent 2d4dbf6 commit 402ae42

File tree

4 files changed

+37
-18
lines changed

4 files changed

+37
-18
lines changed

js/moz.build

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ for header in (
1313
"SweepingAPI.h",
1414
"TraceKind.h",
1515
"TracingAPI.h",
16+
"WeakMap.h",
1617
"WeakMapPtr.h",
1718
"GCHashTable.h",
1819
"GCPolicyAPI.h",

js/public/WeakMap.h

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2+
* vim: set ts=8 sts=2 et sw=2 tw=80:
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+
/*
8+
* Weak Maps.
9+
*/
10+
11+
#ifndef js_WeakMap_h
12+
#define js_WeakMap_h
13+
14+
#include "jspubtd.h"
15+
16+
namespace JS {
17+
18+
extern JS_PUBLIC_API JSObject* NewWeakMapObject(JSContext* cx);
19+
20+
extern JS_PUBLIC_API bool IsWeakMapObject(JSObject* obj);
21+
22+
extern JS_PUBLIC_API bool GetWeakMapEntry(JSContext* cx,
23+
JS::HandleObject mapObj,
24+
JS::HandleObject key,
25+
JS::MutableHandleValue val);
26+
27+
extern JS_PUBLIC_API bool SetWeakMapEntry(JSContext* cx,
28+
JS::HandleObject mapObj,
29+
JS::HandleObject key,
30+
JS::HandleValue val);
31+
32+
} // namespace JS
33+
34+
#endif // js_WeakMap_h

js/src/jsapi.h

+1-18
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
#include "js/Value.h"
5454
#include "js/ValueArray.h"
5555
#include "js/Vector.h"
56+
#include "js/WeakMap.h"
5657

5758
/************************************************************************/
5859

@@ -2054,24 +2055,6 @@ extern JS_PUBLIC_API bool CreateError(
20542055

20552056
/************************************************************************/
20562057

2057-
/*
2058-
* Weak Maps.
2059-
*/
2060-
2061-
extern JS_PUBLIC_API JSObject* NewWeakMapObject(JSContext* cx);
2062-
2063-
extern JS_PUBLIC_API bool IsWeakMapObject(JSObject* obj);
2064-
2065-
extern JS_PUBLIC_API bool GetWeakMapEntry(JSContext* cx,
2066-
JS::HandleObject mapObj,
2067-
JS::HandleObject key,
2068-
JS::MutableHandleValue val);
2069-
2070-
extern JS_PUBLIC_API bool SetWeakMapEntry(JSContext* cx,
2071-
JS::HandleObject mapObj,
2072-
JS::HandleObject key,
2073-
JS::HandleValue val);
2074-
20752058
/*
20762059
* Map
20772060
*/

js/src/moz.build

+1
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ EXPORTS.js += [
215215
"../public/Warnings.h",
216216
"../public/WasmFeatures.h",
217217
"../public/WasmModule.h",
218+
"../public/WeakMap.h",
218219
"../public/WeakMapPtr.h",
219220
"../public/Wrapper.h",
220221
]

0 commit comments

Comments
 (0)