Advertisement
Guest User

Untitled

a guest
Jun 1st, 2015
360
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 10.29 KB | None | 0 0
  1. # HG changeset patch
  2. # User Trevor Saunders <trev.saunders@gmail.com>
  3. # Date 1402083090 14400
  4. # Node ID fc756706366d983e5d70345cab419fbf72db3d36
  5. # Parent  78c20dbe259e808fb58d65731efd4f05e8921820
  6. bug 1021171 - don't return nulllptr in functions returning bool r=bz,waldo
  7.  
  8. diff --git a/js/src/builtin/TypedObject.cpp b/js/src/builtin/TypedObject.cpp
  9. --- a/js/src/builtin/TypedObject.cpp
  10. +++ b/js/src/builtin/TypedObject.cpp
  11. @@ -705,35 +705,35 @@ ArrayMetaTypeDescr::construct(JSContext
  12.  
  13.      // Construct a canonical string `new ArrayType(<elementType>)`:
  14.      StringBuffer contents(cx);
  15.      contents.append("new ArrayType(");
  16.      contents.append(&elementType->stringRepr());
  17.      contents.append(")");
  18.      RootedAtom stringRepr(cx, contents.finishAtom());
  19.      if (!stringRepr)
  20. -        return nullptr;
  21. +        return false;
  22.  
  23.      // Extract ArrayType.prototype
  24.      RootedObject arrayTypePrototype(cx, GetPrototype(cx, arrayTypeGlobal));
  25.      if (!arrayTypePrototype)
  26. -        return nullptr;
  27. +        return false;
  28.  
  29.      // Create the instance of ArrayType
  30.      Rooted<UnsizedArrayTypeDescr *> obj(cx);
  31.      obj = create<UnsizedArrayTypeDescr>(cx, arrayTypePrototype, elementType,
  32.                                          stringRepr, 0);
  33.      if (!obj)
  34.          return false;
  35.  
  36.      // Add `length` property, which is undefined for an unsized array.
  37.      if (!JSObject::defineProperty(cx, obj, cx->names().length,
  38.                                    UndefinedHandleValue, nullptr, nullptr,
  39.                                    JSPROP_READONLY | JSPROP_PERMANENT))
  40. -        return nullptr;
  41. +        return false;
  42.  
  43.      args.rval().setObject(*obj);
  44.      return true;
  45.  }
  46.  
  47.  /*static*/ bool
  48.  UnsizedArrayTypeDescr::dimension(JSContext *cx, unsigned int argc, jsval *vp)
  49.  {
  50. @@ -757,30 +757,30 @@ UnsizedArrayTypeDescr::dimension(JSConte
  51.      int32_t length = args[0].toInt32();
  52.      Rooted<SizedTypeDescr*> elementType(cx, &unsizedTypeDescr->elementType());
  53.  
  54.      // Compute the size.
  55.      CheckedInt32 size = CheckedInt32(elementType->size()) * length;
  56.      if (!size.isValid()) {
  57.          JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
  58.                               JSMSG_TYPEDOBJECT_TOO_BIG);
  59. -        return nullptr;
  60. +        return false;
  61.      }
  62.  
  63.      // Construct a canonical string `new ArrayType(<elementType>).dimension(N)`:
  64.      StringBuffer contents(cx);
  65.      contents.append("new ArrayType(");
  66.      contents.append(&elementType->stringRepr());
  67.      contents.append(").dimension(");
  68.      if (!NumberValueToStringBuffer(cx, NumberValue(length), contents))
  69.          return false;
  70.      contents.append(")");
  71.      RootedAtom stringRepr(cx, contents.finishAtom());
  72.      if (!stringRepr)
  73. -        return nullptr;
  74. +        return false;
  75.  
  76.      // Create the sized type object.
  77.      Rooted<SizedArrayTypeDescr*> obj(cx);
  78.      obj = ArrayMetaTypeDescr::create<SizedArrayTypeDescr>(cx, unsizedTypeDescr,
  79.                                                            elementType,
  80.                                                            stringRepr, size.value());
  81.      if (!obj)
  82.          return false;
  83. @@ -788,25 +788,25 @@ UnsizedArrayTypeDescr::dimension(JSConte
  84.      obj->initReservedSlot(JS_DESCR_SLOT_SIZED_ARRAY_LENGTH,
  85.                            Int32Value(length));
  86.  
  87.      // Add `length` property.
  88.      RootedValue lengthVal(cx, Int32Value(length));
  89.      if (!JSObject::defineProperty(cx, obj, cx->names().length,
  90.                                    lengthVal, nullptr, nullptr,
  91.                                    JSPROP_READONLY | JSPROP_PERMANENT))
  92. -        return nullptr;
  93. +        return false;
  94.  
  95.      // Add `unsized` property, which is a link from the sized
  96.      // array to the unsized array.
  97.      RootedValue unsizedTypeDescrValue(cx, ObjectValue(*unsizedTypeDescr));
  98.      if (!JSObject::defineProperty(cx, obj, cx->names().unsized,
  99.                                    unsizedTypeDescrValue, nullptr, nullptr,
  100.                                    JSPROP_READONLY | JSPROP_PERMANENT))
  101. -        return nullptr;
  102. +        return false;
  103.  
  104.      args.rval().setObject(*obj);
  105.      return true;
  106.  }
  107.  
  108.  bool
  109.  js::IsTypedObjectArray(JSObject &obj)
  110.  {
  111. @@ -1248,17 +1248,17 @@ DefineSimpleTypeDescr(JSContext *cx,
  112.      if (!JS_DefineFunctions(cx, descr, T::typeObjectMethods))
  113.          return false;
  114.  
  115.      // Create the typed prototype for the scalar type. This winds up
  116.      // not being user accessible, but we still create one for consistency.
  117.      Rooted<TypedProto*> proto(cx);
  118.      proto = NewObjectWithProto<TypedProto>(cx, objProto, nullptr, TenuredObject);
  119.      if (!proto)
  120. -        return nullptr;
  121. +        return false;
  122.      proto->initTypeDescrSlot(*descr);
  123.      descr->initReservedSlot(JS_DESCR_SLOT_TYPROTO, ObjectValue(*proto));
  124.  
  125.      RootedValue descrValue(cx, ObjectValue(*descr));
  126.      if (!JSObject::defineProperty(cx, module, className,
  127.                                    descrValue, nullptr, nullptr, 0))
  128.      {
  129.          return false;
  130. @@ -1353,66 +1353,66 @@ GlobalObject::initTypedObjectModule(JSCo
  131.      if (!JS_DefineFunctions(cx, module, TypedObjectMethods))
  132.          return false;
  133.  
  134.      // uint8, uint16, any, etc
  135.  
  136.  #define BINARYDATA_SCALAR_DEFINE(constant_, type_, name_)                       \
  137.      if (!DefineSimpleTypeDescr<ScalarTypeDescr>(cx, global, module, constant_,      \
  138.                                              cx->names().name_))                 \
  139. -        return nullptr;
  140. +        return false;
  141.      JS_FOR_EACH_SCALAR_TYPE_REPR(BINARYDATA_SCALAR_DEFINE)
  142.  #undef BINARYDATA_SCALAR_DEFINE
  143.  
  144.  #define BINARYDATA_REFERENCE_DEFINE(constant_, type_, name_)                    \
  145.      if (!DefineSimpleTypeDescr<ReferenceTypeDescr>(cx, global, module, constant_,   \
  146.                                                 cx->names().name_))              \
  147. -        return nullptr;
  148. +        return false;
  149.      JS_FOR_EACH_REFERENCE_TYPE_REPR(BINARYDATA_REFERENCE_DEFINE)
  150.  #undef BINARYDATA_REFERENCE_DEFINE
  151.  
  152.      // ArrayType.
  153.  
  154.      RootedObject arrayType(cx);
  155.      arrayType = DefineMetaTypeDescr<ArrayMetaTypeDescr>(
  156.          cx, global, module, TypedObjectModuleObject::ArrayTypePrototype);
  157.      if (!arrayType)
  158. -        return nullptr;
  159. +        return false;
  160.  
  161.      RootedValue arrayTypeValue(cx, ObjectValue(*arrayType));
  162.      if (!JSObject::defineProperty(cx, module, cx->names().ArrayType,
  163.                                    arrayTypeValue,
  164.                                    nullptr, nullptr,
  165.                                    JSPROP_READONLY | JSPROP_PERMANENT))
  166. -        return nullptr;
  167. +        return false;
  168.  
  169.      // StructType.
  170.  
  171.      RootedObject structType(cx);
  172.      structType = DefineMetaTypeDescr<StructMetaTypeDescr>(
  173.          cx, global, module, TypedObjectModuleObject::StructTypePrototype);
  174.      if (!structType)
  175. -        return nullptr;
  176. +        return false;
  177.  
  178.      RootedValue structTypeValue(cx, ObjectValue(*structType));
  179.      if (!JSObject::defineProperty(cx, module, cx->names().StructType,
  180.                                    structTypeValue,
  181.                                    nullptr, nullptr,
  182.                                    JSPROP_READONLY | JSPROP_PERMANENT))
  183. -        return nullptr;
  184. +        return false;
  185.  
  186.      // Everything is setup, install module on the global object:
  187.      RootedValue moduleValue(cx, ObjectValue(*module));
  188.      global->setConstructor(JSProto_TypedObject, moduleValue);
  189.      if (!JSObject::defineProperty(cx, global, cx->names().TypedObject,
  190.                                    moduleValue,
  191.                                    nullptr, nullptr,
  192.                                    0))
  193.      {
  194. -        return nullptr;
  195. +        return false;
  196.      }
  197.  
  198.      return module;
  199.  }
  200.  
  201.  JSObject *
  202.  js_InitTypedObjectModuleObject(JSContext *cx, HandleObject obj)
  203.  {
  204. @@ -2444,17 +2444,17 @@ TypedObject::constructUnsized(JSContext
  205.      }
  206.  
  207.      // Length constructor.
  208.      if (args[0].isInt32()) {
  209.          int32_t length = args[0].toInt32();
  210.          if (length < 0) {
  211.              JS_ReportErrorNumber(cx, js_GetErrorMessage,
  212.                                   nullptr, JSMSG_TYPEDOBJECT_BAD_ARGS);
  213. -            return nullptr;
  214. +            return false;
  215.          }
  216.          Rooted<TypedObject*> obj(cx, createZeroed(cx, callee, length));
  217.          if (!obj)
  218.              return false;
  219.          args.rval().setObject(*obj);
  220.          return true;
  221.      }
  222.  
  223. diff --git a/js/src/frontend/BytecodeCompiler.cpp b/js/src/frontend/BytecodeCompiler.cpp
  224. --- a/js/src/frontend/BytecodeCompiler.cpp
  225. +++ b/js/src/frontend/BytecodeCompiler.cpp
  226. @@ -539,17 +539,17 @@ CompileFunctionBody(JSContext *cx, Mutab
  227.  
  228.      MaybeCallSourceHandler(cx, options, srcBuf);
  229.  
  230.      if (!CheckLength(cx, srcBuf))
  231.          return false;
  232.  
  233.      RootedScriptSource sourceObject(cx, CreateScriptSourceObject(cx, options));
  234.      if (!sourceObject)
  235. -        return nullptr;
  236. +        return false;
  237.      ScriptSource *ss = sourceObject->source();
  238.  
  239.      SourceCompressionTask sct(cx);
  240.      JS_ASSERT(!options.sourceIsLazy);
  241.      if (!cx->compartment()->options().discardSource()) {
  242.          if (!ss->setSourceCopy(cx, srcBuf, true, &sct))
  243.              return false;
  244.      }
  245. diff --git a/js/xpconnect/wrappers/XrayWrapper.cpp b/js/xpconnect/wrappers/XrayWrapper.cpp
  246. --- a/js/xpconnect/wrappers/XrayWrapper.cpp
  247. +++ b/js/xpconnect/wrappers/XrayWrapper.cpp
  248. @@ -351,7 +351,7 @@
  249.          {
  250.              JSAutoCompartment ac(cx, target);
  251.              if (!JS_GetClassPrototype(cx, key, protop))
  252. -                return nullptr;
  253. +                return false;
  254.          }
  255.          return JS_WrapObject(cx, protop);
  256.      }
  257. diff --git a/netwerk/ipc/NeckoParent.cpp b/netwerk/ipc/NeckoParent.cpp
  258. --- a/netwerk/ipc/NeckoParent.cpp
  259. +++ b/netwerk/ipc/NeckoParent.cpp
  260. @@ -360,17 +360,17 @@ bool
  261.  NeckoParent::RecvPRtspChannelConstructor(
  262.                        PRtspChannelParent* aActor,
  263.                        const RtspChannelConnectArgs& aConnectArgs)
  264.  {
  265.  #ifdef NECKO_PROTOCOL_rtsp
  266.    RtspChannelParent* p = static_cast<RtspChannelParent*>(aActor);
  267.    return p->Init(aConnectArgs);
  268.  #else
  269. -  return nullptr;
  270. +  return false;
  271.  #endif
  272.  }
  273.  
  274.  bool
  275.  NeckoParent::DeallocPRtspChannelParent(PRtspChannelParent* actor)
  276.  {
  277.  #ifdef NECKO_PROTOCOL_rtsp
  278.    RtspChannelParent* p = static_cast<RtspChannelParent*>(actor);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement