Bug 1504464 - Part 7: Stop using GetPropertyPure in Streams.cpp. r=jwalden
authorJason Orendorff <jorendorff@mozilla.com>
Mon, 14 Jan 2019 20:35:08 +0000
changeset 510921 8a450893e90a2b4fb9e8fdc5328e6622026ad6eb
parent 510920 7afcd486bdc615bbdca8a9afd432c61299441a4b
child 510922 3ff6421bac545fc4abd1fbe35f20e521c9fd4ec2
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwalden
bugs1504464
milestone66.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 1504464 - Part 7: Stop using GetPropertyPure in Streams.cpp. r=jwalden No change in behavior that I'm aware of. It should be correct either way, since the object is guaranteed to be an object created just so by code elsewhere in the Streams implementation. But the intended purpose of GetPropertyPure is in a fast path, backstopped by an actual GetProperty, not for cases like this. Differential Revision: https://phabricator.services.mozilla.com/D14505
js/src/builtin/Stream.cpp
--- a/js/src/builtin/Stream.cpp
+++ b/js/src/builtin/Stream.cpp
@@ -945,26 +945,25 @@ static bool TeeReaderReadHandler(JSConte
   Rooted<TeeState*> unwrappedTeeState(cx,
                                       UnwrapCalleeSlot<TeeState>(cx, args, 0));
   HandleValue resultVal = args.get(0);
 
   // Step i: Assert: Type(result) is Object.
   RootedObject result(cx, &resultVal.toObject());
 
   // Step ii: Let value be ? Get(result, "value").
+  // (This can fail only if `result` was nuked.)
   RootedValue value(cx);
-  if (!GetPropertyPure(cx, result, NameToId(cx->names().value),
-                       value.address())) {
+  if (!GetProperty(cx, result, result, cx->names().value, &value)) {
     return false;
   }
 
   // Step iii: Let done be ? Get(result, "done").
   RootedValue doneVal(cx);
-  if (!GetPropertyPure(cx, result, NameToId(cx->names().done),
-                       doneVal.address())) {
+  if (!GetProperty(cx, result, result, cx->names().done, &doneVal)) {
     return false;
   }
 
   // Step iv: Assert: Type(done) is Boolean.
   bool done = doneVal.toBoolean();
 
   // Step v: If done is true and closedOrErrored is false,
   if (done && !unwrappedTeeState->closedOrErrored()) {