Bug 708431 - Video controls fail to initialize if an extension implementing nsIContentPolicy is present. r=roc r=bz

This commit is contained in:
Jared Wein 2012-01-07 18:43:48 -08:00
parent 141e63752d
commit cfa04bcd7d
2 changed files with 17 additions and 4 deletions

View File

@ -381,6 +381,10 @@ ImageDocument::SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObject)
target = do_QueryInterface(aScriptGlobalObject);
target->AddEventListener(NS_LITERAL_STRING("resize"), this, false);
target->AddEventListener(NS_LITERAL_STRING("keypress"), this, false);
if (!nsContentUtils::IsChildOfSameType(this)) {
LinkStylesheet(NS_LITERAL_STRING("resource://gre/res/TopLevelImageDocument.css"));
}
}
}
@ -665,8 +669,6 @@ ImageDocument::CreateSyntheticDocument()
styleContent->SetTextContent(NS_LITERAL_STRING("img { display: block; }"));
head->AppendChildTo(styleContent, false);
} else {
LinkStylesheet(NS_LITERAL_STRING("resource://gre/res/TopLevelImageDocument.css"));
}
// Add the image element

View File

@ -57,6 +57,7 @@ public:
nsIStreamListener** aDocListener,
bool aReset = true,
nsIContentSink* aSink = nsnull);
virtual void SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObject);
protected:
@ -94,6 +95,18 @@ VideoDocument::StartDocumentLoad(const char* aCommand,
return rv;
}
void
VideoDocument::SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObject)
{
// Set the script global object on the superclass before doing
// anything that might require it....
MediaDocument::SetScriptGlobalObject(aScriptGlobalObject);
if (aScriptGlobalObject && !nsContentUtils::IsChildOfSameType(this)) {
LinkStylesheet(NS_LITERAL_STRING("resource://gre/res/TopLevelVideoDocument.css"));
}
}
nsresult
VideoDocument::CreateSyntheticVideoDocument(nsIChannel* aChannel,
nsIStreamListener** aListener)
@ -131,8 +144,6 @@ VideoDocument::CreateSyntheticVideoDocument(nsIChannel* aChannel,
element->SetAttr(kNameSpaceID_None, nsGkAtoms::style,
NS_LITERAL_STRING("position:absolute; top:0; left:0; width:100%; height:100%"),
true);
} else {
LinkStylesheet(NS_LITERAL_STRING("resource://gre/res/TopLevelVideoDocument.css"));
}
return body->AppendChildTo(element, false);