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
treeherdermozilla-beta@dfcd5c18e0a8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley, sledru
Bug 1009624 - Startup crash in nsXULPrototypeDocument::GetCompilationGlobal(). r=bholley, a=sledru
--- 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(),
                                               uri, 1, this,
-                                              mCurrentPrototype,
+                                              mMasterPrototype,
             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;
                 return NS_OK;