@@ -71,46 +71,47 @@ JSLinearString* AtomToLinearString(JSAtom* atom) {
71
71
72
72
// Wrappers around UniquePtr functions
73
73
/* *
74
- * Create a new ArrayBuffer with the given contents. The contents must not be
75
- * modified by any other code, internal or external.
76
- *
77
- * !!! IMPORTANT !!!
78
- * If and only if an ArrayBuffer is successfully created and returned,
79
- * ownership of |contents| is transferred to the new ArrayBuffer.
80
- *
81
- * When the ArrayBuffer is ready to be disposed of, `freeFunc(contents,
82
- * freeUserData)` will be called to release the ArrayBuffer's reference on the
83
- * contents.
84
- *
85
- * `freeFunc()` must not call any JSAPI functions that could cause a garbage
86
- * collection.
87
- *
88
- * The caller must keep the buffer alive until `freeFunc()` is called, or, if
89
- * `freeFunc` is null, until the JSRuntime is destroyed.
90
- *
91
- * The caller must not access the buffer on other threads. The JS engine will
92
- * not allow the buffer to be transferred to other threads. If you try to
93
- * transfer an external ArrayBuffer to another thread, the data is copied to a
94
- * new malloc buffer. `freeFunc()` must be threadsafe, and may be called from
95
- * any thread.
96
- *
97
- * This allows ArrayBuffers to be used with embedder objects that use reference
98
- * counting, for example. In that case the caller is responsible
99
- * for incrementing the reference count before passing the contents to this
100
- * function. This also allows using non-reference-counted contents that must be
101
- * freed with some function other than free().
102
- */
103
- JSObject* NewExternalArrayBuffer (
104
- JSContext* cx, size_t nbytes, void * contents,
105
- JS::BufferContentsFreeFunc freeFunc, void * freeUserData) {
106
- js::UniquePtr<void , JS::BufferContentsDeleter> dataPtr{contents, {freeFunc, freeUserData}};
74
+ * Create a new ArrayBuffer with the given contents. The contents must not be
75
+ * modified by any other code, internal or external.
76
+ *
77
+ * !!! IMPORTANT !!!
78
+ * If and only if an ArrayBuffer is successfully created and returned,
79
+ * ownership of |contents| is transferred to the new ArrayBuffer.
80
+ *
81
+ * When the ArrayBuffer is ready to be disposed of, `freeFunc(contents,
82
+ * freeUserData)` will be called to release the ArrayBuffer's reference on the
83
+ * contents.
84
+ *
85
+ * `freeFunc()` must not call any JSAPI functions that could cause a garbage
86
+ * collection.
87
+ *
88
+ * The caller must keep the buffer alive until `freeFunc()` is called, or, if
89
+ * `freeFunc` is null, until the JSRuntime is destroyed.
90
+ *
91
+ * The caller must not access the buffer on other threads. The JS engine will
92
+ * not allow the buffer to be transferred to other threads. If you try to
93
+ * transfer an external ArrayBuffer to another thread, the data is copied to a
94
+ * new malloc buffer. `freeFunc()` must be threadsafe, and may be called from
95
+ * any thread.
96
+ *
97
+ * This allows ArrayBuffers to be used with embedder objects that use reference
98
+ * counting, for example. In that case the caller is responsible
99
+ * for incrementing the reference count before passing the contents to this
100
+ * function. This also allows using non-reference-counted contents that must be
101
+ * freed with some function other than free().
102
+ */
103
+ JSObject* NewExternalArrayBuffer (JSContext* cx, size_t nbytes, void * contents,
104
+ JS::BufferContentsFreeFunc freeFunc,
105
+ void * freeUserData) {
106
+ js::UniquePtr<void , JS::BufferContentsDeleter> dataPtr{
107
+ contents, {freeFunc, freeUserData}};
107
108
return NewExternalArrayBuffer (cx, nbytes, std::move (dataPtr));
108
109
}
109
110
110
- JSObject* NewArrayBufferWithContents (
111
- JSContext* cx, size_t nbytes, void * contents) {
112
- js::UniquePtr<void , JS::FreePolicy> dataPtr{contents};
113
- return NewArrayBufferWithContents (cx, nbytes, contents);
111
+ JSObject* NewArrayBufferWithContents (JSContext* cx, size_t nbytes,
112
+ void * contents) {
113
+ js::UniquePtr<void , JS::FreePolicy> dataPtr{contents};
114
+ return NewArrayBufferWithContents (cx, nbytes, contents);
114
115
}
115
116
116
117
// Reexport some methods
@@ -269,8 +270,7 @@ bool CreateError(JSContext* cx, JSExnType type, JS::HandleObject stack,
269
270
JS::MutableHandleValue rval) {
270
271
return JS::CreateError (
271
272
cx, type, stack, fileName, lineNumber,
272
- JS::ColumnNumberOneOrigin (columnNumber),
273
- report, message,
273
+ JS::ColumnNumberOneOrigin (columnNumber), report, message,
274
274
JS::Rooted<mozilla::Maybe<JS::Value>>(cx, mozilla::ToMaybe (&cause)),
275
275
rval);
276
276
}
0 commit comments