Bug 994335 - Null-check aProtoDoc in nsXULPrototypeScript::Serialize. r=smaug, a=sledru
authorBobby Holley <bobbyholley@gmail.com>
Mon, 14 Apr 2014 14:40:49 -0700
changeset 183795 7f0030f9aac0
parent 183794 0add478cf3b4
child 183796 9ce31b9cd02d
push id3488
push userryanvm@gmail.com
push date2014-04-17 19:49 +0000
treeherdermozilla-beta@7f0030f9aac0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, sledru
bugs994335
milestone29.0
Bug 994335 - Null-check aProtoDoc in nsXULPrototypeScript::Serialize. r=smaug, a=sledru
content/xul/content/src/nsXULElement.cpp
--- a/content/xul/content/src/nsXULElement.cpp
+++ b/content/xul/content/src/nsXULElement.cpp
@@ -2387,16 +2387,17 @@ nsXULPrototypeScript::~nsXULPrototypeScr
     UnlinkJSObjects();
 }
 
 nsresult
 nsXULPrototypeScript::Serialize(nsIObjectOutputStream* aStream,
                                 nsXULPrototypeDocument* aProtoDoc,
                                 const nsCOMArray<nsINodeInfo> *aNodeInfos)
 {
+    NS_ENSURE_TRUE(aProtoDoc, NS_ERROR_UNEXPECTED);
     AutoSafeJSContext cx;
     JS::Rooted<JSObject*> global(cx, aProtoDoc->GetCompilationGlobal());
     NS_ENSURE_TRUE(global, NS_ERROR_UNEXPECTED);
     JSAutoCompartment ac(cx, global);
 
     NS_ASSERTION(!mSrcLoading || mSrcLoadWaiters != nullptr ||
                  !mScriptObject,
                  "script source still loading when serializing?!");