Bug 1530362 - Do Not Use The Forbidden API. r=jandem
authorLars T Hansen <lhansen@mozilla.com>
Mon, 25 Feb 2019 15:46:31 +0100
changeset 519518 b299e2b9886134da1abdc0d58459bd59d3ab0a88
parent 519517 f5580a62e4e64030319bda7dec10bff4bc1d38c2
child 519519 8eb14440dc5b45373528a2feb57e03a45254fcc8
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1530362
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 1530362 - Do Not Use The Forbidden API. r=jandem Avoid using the leaky API, use a non-leaky one instead. Differential Revision: https://phabricator.services.mozilla.com/D21018
js/src/wasm/WasmModule.cpp
--- a/js/src/wasm/WasmModule.cpp
+++ b/js/src/wasm/WasmModule.cpp
@@ -1170,20 +1170,22 @@ static bool CreateExportObject(JSContext
 
 #ifdef ENABLE_WASM_GC
 static bool MakeStructField(JSContext* cx, const ValType& v, bool isMutable,
                             const char* format, uint32_t fieldNo,
                             AutoIdVector* ids, AutoValueVector* fieldTypeObjs,
                             Vector<StructFieldProps>* fieldProps) {
   char buf[20];
   sprintf(buf, format, fieldNo);
-  RootedString str(cx, JS_AtomizeAndPinString(cx, buf));
-  if (!str) {
+
+  JSAtom* atom = Atomize(cx, buf, strlen(buf));
+  if (!atom) {
     return false;
   }
+  RootedId id(cx, AtomToId(atom));
 
   StructFieldProps props;
   props.isMutable = isMutable;
 
   Rooted<TypeDescr*> t(cx);
   switch (v.code()) {
     case ValType::I32:
       t = GlobalObject::getOrCreateScalarTypeDescr(cx, cx->global(),
@@ -1213,17 +1215,17 @@ static bool MakeStructField(JSContext* c
       t = GlobalObject::getOrCreateReferenceTypeDescr(
           cx, cx->global(), ReferenceType::TYPE_WASM_ANYREF);
       break;
     default:
       MOZ_CRASH("Bad field type");
   }
   MOZ_ASSERT(t != nullptr);
 
-  if (!ids->append(INTERNED_STRING_TO_JSID(cx, str))) {
+  if (!ids->append(id)) {
     return false;
   }
 
   if (!fieldTypeObjs->append(ObjectValue(*t))) {
     return false;
   }
 
   if (!fieldProps->append(props)) {