Merge m-c to inbound.

This commit is contained in:
Ryan VanderMeulen 2012-09-07 16:22:55 -04:00
commit 196079b734
3 changed files with 29 additions and 32 deletions

View File

@ -687,29 +687,21 @@ nsObjectLoadingContent::~nsObjectLoadingContent()
nsresult nsresult
nsObjectLoadingContent::InstantiatePluginInstance() nsObjectLoadingContent::InstantiatePluginInstance()
{ {
if (mInstanceOwner || mType != eType_Plugin || mIsLoading || mInstantiating) { if (mType != eType_Plugin || mIsLoading) {
return NS_OK; LOG(("OBJLC [%p]: Not instantiating loading or non-plugin object, type %u",
} this, mType));
nsCOMPtr<nsIContent> thisContent =
do_QueryInterface(static_cast<nsIImageLoadingContent *>(this));
// Flush layout so that the frame is created if possible and the plugin is
// initialized with the latest information.
nsIDocument* doc = thisContent->GetCurrentDoc();
if (!doc || !InActiveDocument(thisContent)) {
NS_ERROR("Shouldn't be calling "
"InstantiatePluginInstance without an active document");
return NS_ERROR_FAILURE;
}
doc->FlushPendingNotifications(Flush_Layout);
if (!thisContent->GetPrimaryFrame()) {
LOG(("OBJLC [%p]: Not instantiating plugin with no frame", this));
return NS_OK; return NS_OK;
} }
// Don't do anything if we already have an active instance.
if (mInstanceOwner) {
return NS_OK;
}
// Don't allow re-entry into initialization code.
if (mInstantiating) {
return NS_OK;
}
mInstantiating = true; mInstantiating = true;
AutoSetInstantiatingToFalse autoInstantiating(this); AutoSetInstantiatingToFalse autoInstantiating(this);
@ -718,6 +710,20 @@ nsObjectLoadingContent::InstantiatePluginInstance()
// of this method. // of this method.
nsCOMPtr<nsIObjectLoadingContent> kungFuDeathGrip = this; nsCOMPtr<nsIObjectLoadingContent> kungFuDeathGrip = this;
nsCOMPtr<nsIContent> thisContent =
do_QueryInterface(static_cast<nsIImageLoadingContent *>(this));
// Flush layout so that the plugin is initialized with the latest information.
nsIDocument* doc = thisContent->GetCurrentDoc();
if (!doc) {
return NS_ERROR_FAILURE;
}
if (!InActiveDocument(thisContent)) {
NS_ERROR("Shouldn't be calling "
"InstantiatePluginInstance in an inactive document");
return NS_ERROR_FAILURE;
}
doc->FlushPendingNotifications(Flush_Layout);
nsresult rv = NS_ERROR_FAILURE; nsresult rv = NS_ERROR_FAILURE;
nsRefPtr<nsPluginHost> pluginHost = nsRefPtr<nsPluginHost> pluginHost =
already_AddRefed<nsPluginHost>(nsPluginHost::GetInst()); already_AddRefed<nsPluginHost>(nsPluginHost::GetInst());
@ -1723,14 +1729,6 @@ nsObjectLoadingContent::LoadObject(bool aNotify,
oldType = mType; oldType = mType;
oldState = ObjectState(); oldState = ObjectState();
if (!thisContent->GetPrimaryFrame()) {
// We're un-rendered, and can't instantiate a plugin. HasNewFrame will
// re-start us when we can proceed.
LOG(("OBJLC [%p]: Aborting load - plugin-type, but no frame", this));
CloseChannel();
break;
}
rv = pluginHost->NewEmbeddedPluginStreamListener(mURI, this, nullptr, rv = pluginHost->NewEmbeddedPluginStreamListener(mURI, this, nullptr,
getter_AddRefs(mFinalListener)); getter_AddRefs(mFinalListener));
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {

View File

@ -3224,7 +3224,6 @@ nsresult nsPluginInstanceOwner::Init(nsIContent* aContent)
// document is destroyed before we try to create the new one. // document is destroyed before we try to create the new one.
objFrame->PresContext()->EnsureVisible(); objFrame->PresContext()->EnsureVisible();
} else { } else {
NS_NOTREACHED("Should not be initializing plugin without a frame");
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }

View File

@ -65,10 +65,10 @@ class MarionetteTestResult(unittest._TextTestResult):
def printLogs(self, test): def printLogs(self, test):
for testcase in test._tests: for testcase in test._tests:
if hasattr(testcase, 'loglines') and testcase.loglines: if hasattr(testcase, 'loglines') and testcase.loglines:
print 'START LOG:' self.stream.writeln('START LOG:')
for line in testcase.loglines: for line in testcase.loglines:
print ' '.join(line) self.stream.writeln(' '.join(line))
print 'END LOG:' self.stream.writeln('END LOG:')
def getPerfData(self, test): def getPerfData(self, test):
for testcase in test._tests: for testcase in test._tests: