Bug 1523525 - Delete unsafe JS_GetDataView* API functions. r=jandem
authorJason Orendorff <jorendorff@mozilla.com>
Sun, 10 Feb 2019 17:30:48 +0000
changeset 458558 d33cbdb821913bfb19eb5a613faaea90aeb26dcb
parent 458557 0361c4f078f2aa49786589345701547d19387113
child 458559 bb243f4edd8872e16feb81fc6e2f01a8833842c8
push id77913
push userjorendorff@mozilla.com
push dateMon, 11 Feb 2019 20:27:32 +0000
treeherderautoland@d33cbdb82191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1523525
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1523525 - Delete unsafe JS_GetDataView* API functions. r=jandem Differential Revision: https://phabricator.services.mozilla.com/D18999
js/src/builtin/DataViewObject.cpp
js/src/jsfriendapi.h
--- a/js/src/builtin/DataViewObject.cpp
+++ b/js/src/builtin/DataViewObject.cpp
@@ -898,43 +898,16 @@ const JSFunctionSpec DataViewObject::met
     JS_FS_END};
 
 const JSPropertySpec DataViewObject::properties[] = {
     JS_PSG("buffer", DataViewObject::bufferGetter, 0),
     JS_PSG("byteLength", DataViewObject::byteLengthGetter, 0),
     JS_PSG("byteOffset", DataViewObject::byteOffsetGetter, 0),
     JS_STRING_SYM_PS(toStringTag, "DataView", JSPROP_READONLY), JS_PS_END};
 
-JS_FRIEND_API uint32_t JS_GetDataViewByteOffset(JSObject* obj) {
-  obj = CheckedUnwrap(obj);
-  if (!obj) {
-    return 0;
-  }
-  return obj->as<DataViewObject>().byteOffset();
-}
-
-JS_FRIEND_API void* JS_GetDataViewData(JSObject* obj, bool* isSharedMemory,
-                                       const JS::AutoRequireNoGC&) {
-  obj = CheckedUnwrap(obj);
-  if (!obj) {
-    return nullptr;
-  }
-  DataViewObject& dv = obj->as<DataViewObject>();
-  *isSharedMemory = dv.isSharedMemory();
-  return dv.dataPointerEither().unwrap(/*safe - caller sees isSharedMemory*/);
-}
-
-JS_FRIEND_API uint32_t JS_GetDataViewByteLength(JSObject* obj) {
-  obj = CheckedUnwrap(obj);
-  if (!obj) {
-    return 0;
-  }
-  return obj->as<DataViewObject>().byteLength();
-}
-
 JS_FRIEND_API JSObject* JS_NewDataView(JSContext* cx, HandleObject buffer,
                                        uint32_t byteOffset,
                                        int32_t byteLength) {
   JSProtoKey key = JSProto_DataView;
   RootedObject constructor(cx, GlobalObject::getOrCreateConstructor(cx, key));
   if (!constructor) {
     return nullptr;
   }
--- a/js/src/jsfriendapi.h
+++ b/js/src/jsfriendapi.h
@@ -1956,50 +1956,16 @@ extern JS_FRIEND_API bool JS_IsDetachedA
  * must be an ArrayBuffer or SharedArrayBuffer (or a cross-compartment wrapper
  * of either type), and the offset and length must fit within the bounds of the
  * buffer. Currently, nullptr will be returned and an exception will be thrown
  * if these conditions do not hold, but do not depend on that behavior.
  */
 JS_FRIEND_API JSObject* JS_NewDataView(JSContext* cx, JS::HandleObject buffer,
                                        uint32_t byteOffset, int32_t byteLength);
 
-/**
- * Return the byte offset of a data view into its array buffer. |obj| must be a
- * DataView.
- *
- * |obj| must have passed a JS_IsDataViewObject test, or somehow be known that
- * it would pass such a test: it is a data view or a wrapper of a data view,
- * and the unwrapping will succeed.
- */
-JS_FRIEND_API uint32_t JS_GetDataViewByteOffset(JSObject* obj);
-
-/**
- * Return the byte length of a data view.
- *
- * |obj| must have passed a JS_IsDataViewObject test, or somehow be known that
- * it would pass such a test: it is a data view or a wrapper of a data view,
- * and the unwrapping will succeed. If cx is nullptr, then DEBUG builds may be
- * unable to assert when unwrapping should be disallowed.
- */
-JS_FRIEND_API uint32_t JS_GetDataViewByteLength(JSObject* obj);
-
-/**
- * Return a pointer to the beginning of the data referenced by a DataView.
- *
- * |obj| must have passed a JS_IsDataViewObject test, or somehow be known that
- * it would pass such a test: it is a data view or a wrapper of a data view,
- * and the unwrapping will succeed. If cx is nullptr, then DEBUG builds may be
- * unable to assert when unwrapping should be disallowed.
- *
- * |*isSharedMemory| will be set to true if the DataView maps a
- * SharedArrayBuffer, otherwise to false.
- */
-JS_FRIEND_API void* JS_GetDataViewData(JSObject* obj, bool* isSharedMemory,
-                                       const JS::AutoRequireNoGC&);
-
 namespace js {
 namespace jit {
 
 enum class InlinableNative : uint16_t;
 
 }  // namespace jit
 }  // namespace js