Bug 961041 - Replace infallible allocation in DOMStorage::BroadcastChangeNotification with fallible allocation. r=smaug
authorPeiyong Lin <pylaurent1314@gmail.com>
Mon, 27 Jan 2014 08:25:19 -0500
changeset 181330 0783396d03423b0ffe1d1db11f2f2ab2c113ea14
parent 181329 63761c123ba41d4729e76bbc744a310c08226237
child 181331 ce887b4717857c03982ce895e6bf2df96d435d99
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs961041
milestone29.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 961041 - Replace infallible allocation in DOMStorage::BroadcastChangeNotification with fallible allocation. r=smaug
js/xpconnect/src/event_impl_gen.py
--- a/js/xpconnect/src/event_impl_gen.py
+++ b/js/xpconnect/src/event_impl_gen.py
@@ -76,17 +76,17 @@ def print_header_file(fd, conf):
     fd.write("class EventTarget;\n")
     fd.write("}\n");
     fd.write("}\n\n");
     for e in conf.simple_events:
         fd.write("nsresult\n")
         fd.write("NS_NewDOM%s(nsIDOMEvent** aInstance, " % e)
         fd.write("mozilla::dom::EventTarget* aOwner, ")
         fd.write("nsPresContext* aPresContext, mozilla::WidgetEvent* aEvent);\n")
- 
+
     fd.write("\n#endif\n")
 
 def print_classes_file(fd, conf):
     fd.write("#ifndef _gen_mozilla_idl_generated_event_declarations_h_\n")
     fd.write("#define _gen_mozilla_idl_generated_event_declarations_h_\n\n")
 
     fd.write("#include \"nsDOMEvent.h\"\n");
     includes = []
@@ -436,17 +436,22 @@ def write_cpp(eventname, iface, fd, conf
         writeAttributeParams(fd, a)
     fd.write(")\n{\n")
     fd.write("  nsresult rv = %s::Init%s(aType, aCanBubble, aCancelable" % (basename, ("%s" % iface.base[6:])))
     for a in baseattributes:
       fd.write(", a%s" % firstCap(a.name))
     fd.write(");\n");
     fd.write("  NS_ENSURE_SUCCESS(rv, rv);\n")
     for a in attributes:
-        fd.write("  m%s = a%s;\n" % (firstCap(a.name), firstCap(a.name)))
+        if a.realtype.nativeType("in").count("nsAString"):
+            fd.write("  if (!m%s.Assign(a%s, fallible_t())) {\n" % (firstCap(a.name), firstCap(a.name)))
+            fd.write("    return NS_ERROR_OUT_OF_MEMORY;\n")
+            fd.write("  }\n")
+        else:
+            fd.write("  m%s = a%s;\n" % (firstCap(a.name), firstCap(a.name)))
     fd.write("  return NS_OK;\n")
     fd.write("}\n\n")
 
     fd.write("void\n")
     fd.write("%s::Init%s(" % (classname, eventname))
     if hasVariant:
         fd.write("JSContext* aCx, ")
     fd.write("const nsAString& aType, bool aCanBubble, bool aCancelable")