Bug 1009624 - Startup crash in nsXULPrototypeDocument::GetCompilationGlobal(). r=bholley, a=sledru
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Wed, 14 May 2014 21:00:33 +0300
changeset 192301 28cb773f6e23
parent 192300 859a8098cd8d
child 192302 dfcd5c18e0a8
push id3563
push userryanvm@gmail.com
push date2014-05-16 14:33 +0000
Treeherderresults
reviewersbholley, sledru
bugs1009624
milestone30.0
Bug 1009624 - Startup crash in nsXULPrototypeDocument::GetCompilationGlobal(). r=bholley, a=sledru
content/xul/content/src/nsXULElement.cpp
content/xul/document/src/XULDocument.cpp
--- a/content/xul/content/src/nsXULElement.cpp
+++ b/content/xul/content/src/nsXULElement.cpp
@@ -2632,17 +2632,17 @@ nsXULPrototypeScript::Compile(const char
     // with an uncollectable reference.
     //
     // Compiling it using (for example) the first document's global
     // object would cause JS to keep a reference via the __proto__ or
     // parent pointer to the first document's global. If that happened,
     // our script object would reference the first document, and the
     // first document would indirectly reference the prototype document
     // because it keeps the prototype cache alive. Circularity!
-    MOZ_ASSERT(aProtoDoc);
+    NS_ENSURE_STATE(aProtoDoc);
     NS_ENSURE_TRUE(aProtoDoc->GetCompilationGlobal(), NS_ERROR_UNEXPECTED);
     AutoSafeJSContext cx;
     JSAutoCompartment ac(cx, aProtoDoc->GetCompilationGlobal());
 
     nsAutoCString urlspec;
     nsContentUtils::GetWrapperSafeScriptFilename(aDocument, aURI, urlspec);
 
     // Ok, compile it to create a prototype script object!
--- a/content/xul/document/src/XULDocument.cpp
+++ b/content/xul/document/src/XULDocument.cpp
@@ -3530,17 +3530,17 @@ XULDocument::OnStreamComplete(nsIStreamL
                    "XULDocument can't load multiple scripts at once");
 
         rv = nsScriptLoader::ConvertToUTF16(channel, string, stringLen,
                                             EmptyString(), this, mOffThreadCompileString);
         if (NS_SUCCEEDED(rv)) {
             rv = mCurrentScriptProto->Compile(mOffThreadCompileString.get(),
                                               mOffThreadCompileString.Length(),
                                               uri, 1, this,
-                                              mCurrentPrototype,
+                                              mMasterPrototype,
                                               this);
             if (NS_SUCCEEDED(rv) && !mCurrentScriptProto->GetScriptObject()) {
                 // We will be notified via OnOffThreadCompileComplete when the
                 // compile finishes. Keep the contents of the compiled script
                 // alive until the compilation finishes.
                 mOffThreadCompiling = true;
                 BlockOnload();
                 return NS_OK;