Backed out changeset 7c3ddf34fc42 (bug 1377158) for stylo failures

This commit is contained in:
Carsten "Tomcat" Book 2017-07-25 14:34:14 +02:00
parent 5a0eb76631
commit 1c55d9468a
7 changed files with 19 additions and 67 deletions

View File

@ -9367,15 +9367,13 @@ nsDocShell::NewContentViewerObj(const nsACString& aContentType,
// Now create an instance of the content viewer nsLayoutDLF makes the
// determination if it should be a "view-source" instead of "view"
nsresult rv =
docLoaderFactory->CreateInstance("view",
aOpenedChannel,
aLoadGroup, aContentType,
this,
nullptr,
nsIDocumentLoaderFactory::STYLE_BACKEND_TYPE_NONE,
aContentHandler,
aViewer);
nsresult rv = docLoaderFactory->CreateInstance("view",
aOpenedChannel,
aLoadGroup, aContentType,
this,
nullptr,
aContentHandler,
aViewer);
NS_ENSURE_SUCCESS(rv, rv);
(*aViewer)->SetContainer(this);

View File

@ -24,19 +24,12 @@ interface nsIPrincipal;
[scriptable, uuid(e795239e-9d3c-47c4-b063-9e600fb3b287)]
interface nsIDocumentLoaderFactory : nsISupports {
// StyleBackendType is used to choose the style backend type for the created
// document. Use STYLE_BACKEND_TYPE_NONE as the default.
const short STYLE_BACKEND_TYPE_NONE = 0;
const short STYLE_BACKEND_TYPE_GECKO = 1;
const short STYLE_BACKEND_TYPE_SERVO = 2;
nsIContentViewer createInstance(in string aCommand,
in nsIChannel aChannel,
in nsILoadGroup aLoadGroup,
in ACString aContentType,
in nsIDocShell aContainer,
in nsISupports aExtraInfo,
in short aStyleBackendType,
out nsIStreamListener aDocListenerResult);
nsIContentViewer createInstanceForDocument(in nsISupports aContainer,

View File

@ -1019,7 +1019,6 @@ nsExternalResourceMap::PendingLoad::SetupViewer(nsIRequest* aRequest,
nsCOMPtr<nsIStreamListener> listener;
rv = docLoaderFactory->CreateInstance("external-resource", chan, newLoadGroup,
type, nullptr, nullptr,
nsIDocumentLoaderFactory::STYLE_BACKEND_TYPE_NONE,
getter_AddRefs(listener),
getter_AddRefs(viewer));
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -345,7 +345,6 @@ SVGDocumentWrapper::SetupViewer(nsIRequest* aRequest,
newLoadGroup,
NS_LITERAL_CSTRING(IMAGE_SVG_XML),
nullptr, nullptr,
nsIDocumentLoaderFactory::STYLE_BACKEND_TYPE_NONE,
getter_AddRefs(listener),
getter_AddRefs(viewer));
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -22,7 +22,6 @@
#include "nsIScriptSecurityManager.h"
#include "nsString.h"
#include "nsContentCID.h"
#include "nsLayoutUtils.h"
#include "nsNetUtil.h"
#include "nsCRT.h"
#include "nsIViewSourceChannel.h"
@ -32,7 +31,6 @@
#include "nsMimeTypes.h"
#include "DecoderTraits.h"
using mozilla::StyleBackendType;
// plugins
#include "nsIPluginHost.h"
@ -142,14 +140,9 @@ nsContentDLF::CreateInstance(const char* aCommand,
const nsACString& aContentType,
nsIDocShell* aContainer,
nsISupports* aExtraInfo,
int16_t aStyleBackendType,
nsIStreamListener** aDocListener,
nsIContentViewer** aDocViewer)
{
MOZ_ASSERT(aStyleBackendType == nsIDocumentLoaderFactory::STYLE_BACKEND_TYPE_NONE ||
aStyleBackendType == nsIDocumentLoaderFactory::STYLE_BACKEND_TYPE_GECKO ||
aStyleBackendType == nsIDocumentLoaderFactory::STYLE_BACKEND_TYPE_SERVO);
// Make a copy of aContentType, because we're possibly going to change it.
nsAutoCString contentType(aContentType);
@ -193,8 +186,7 @@ nsContentDLF::CreateInstance(const char* aCommand,
return CreateDocument(aCommand,
aChannel, aLoadGroup,
aContainer, kHTMLDocumentCID,
aDocListener, aDocViewer,
(StyleBackendType)aStyleBackendType);
aDocListener, aDocViewer);
}
// Try XML
@ -202,8 +194,7 @@ nsContentDLF::CreateInstance(const char* aCommand,
return CreateDocument(aCommand,
aChannel, aLoadGroup,
aContainer, kXMLDocumentCID,
aDocListener, aDocViewer,
(StyleBackendType)aStyleBackendType);
aDocListener, aDocViewer);
}
// Try SVG
@ -211,8 +202,7 @@ nsContentDLF::CreateInstance(const char* aCommand,
return CreateDocument(aCommand,
aChannel, aLoadGroup,
aContainer, kSVGDocumentCID,
aDocListener, aDocViewer,
(StyleBackendType)aStyleBackendType);
aDocListener, aDocViewer);
}
// Try XUL
@ -230,8 +220,7 @@ nsContentDLF::CreateInstance(const char* aCommand,
return CreateDocument(aCommand,
aChannel, aLoadGroup,
aContainer, kVideoDocumentCID,
aDocListener, aDocViewer,
(StyleBackendType)aStyleBackendType);
aDocListener, aDocViewer);
}
// Try image types
@ -239,8 +228,7 @@ nsContentDLF::CreateInstance(const char* aCommand,
return CreateDocument(aCommand,
aChannel, aLoadGroup,
aContainer, kImageDocumentCID,
aDocListener, aDocViewer,
(StyleBackendType)aStyleBackendType);
aDocListener, aDocViewer);
}
RefPtr<nsPluginHost> pluginHost = nsPluginHost::GetInst();
@ -251,8 +239,7 @@ nsContentDLF::CreateInstance(const char* aCommand,
return CreateDocument(aCommand,
aChannel, aLoadGroup,
aContainer, kPluginDocumentCID,
aDocListener, aDocViewer,
(StyleBackendType)aStyleBackendType);
aDocListener, aDocViewer);
}
// If we get here, then we weren't able to create anything. Sorry!
@ -358,8 +345,7 @@ nsContentDLF::CreateDocument(const char* aCommand,
nsIDocShell* aContainer,
const nsCID& aDocumentCID,
nsIStreamListener** aDocListener,
nsIContentViewer** aContentViewer,
StyleBackendType aStyleBackendType /* = StyleBackendType::None */)
nsIContentViewer** aContentViewer)
{
nsresult rv = NS_ERROR_FAILURE;
@ -380,17 +366,6 @@ nsContentDLF::CreateDocument(const char* aCommand,
nsCOMPtr<nsIDocument> doc = do_CreateInstance(aDocumentCID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
// Set style backend type before document loading. Can't set None as the
// backend type, it would hit an assertion.
if (aStyleBackendType != StyleBackendType::None) {
// To dynamically switch the backend type, check stylo is enabled or not
// before setting the backend type. If stylo is not enabled, we always set
// backend type to gecko.
doc->SetStyleBackendType(
nsLayoutUtils::StyloEnabled() ? aStyleBackendType
: StyleBackendType::Gecko);
}
// Create the content viewer XXX: could reuse content viewer here!
nsCOMPtr<nsIContentViewer> contentViewer = NS_NewContentViewer();

View File

@ -8,7 +8,6 @@
#include "nsIDocumentLoaderFactory.h"
#include "nsMimeTypes.h"
#include "mozilla/StyleBackendType.h"
class nsIChannel;
class nsIContentViewer;
@ -37,8 +36,7 @@ public:
nsIDocShell* aContainer,
const nsCID& aDocumentCID,
nsIStreamListener** aDocListener,
nsIContentViewer** aContentViewer,
mozilla::StyleBackendType aStyleBackendType = mozilla::StyleBackendType::None);
nsIContentViewer** aContentViewer);
nsresult CreateXULDocument(const char* aCommand,
nsIChannel* aChannel,
@ -92,3 +90,4 @@ NS_NewContentDocumentLoaderFactory(nsIDocumentLoaderFactory** aResult);
#endif

View File

@ -1261,14 +1261,9 @@ nsDirectoryViewerFactory::CreateInstance(const char *aCommand,
const nsACString& aContentType,
nsIDocShell* aContainer,
nsISupports* aExtraInfo,
int16_t aStyleBackendType,
nsIStreamListener** aDocListenerResult,
nsIContentViewer** aDocViewerResult)
{
MOZ_ASSERT(aStyleBackendType == nsIDocumentLoaderFactory::STYLE_BACKEND_TYPE_NONE ||
aStyleBackendType == nsIDocumentLoaderFactory::STYLE_BACKEND_TYPE_GECKO ||
aStyleBackendType == nsIDocumentLoaderFactory::STYLE_BACKEND_TYPE_SERVO);
nsresult rv;
bool viewSource = FindInReadable(NS_LITERAL_CSTRING("view-source"),
@ -1312,9 +1307,7 @@ nsDirectoryViewerFactory::CreateInstance(const char *aCommand,
nsCOMPtr<nsIStreamListener> listener;
rv = factory->CreateInstance(aCommand, channel, aLoadGroup,
NS_LITERAL_CSTRING("application/vnd.mozilla.xul+xml"),
aContainer, aExtraInfo,
nsIDocumentLoaderFactory::STYLE_BACKEND_TYPE_NONE,
getter_AddRefs(listener),
aContainer, aExtraInfo, getter_AddRefs(listener),
aDocViewerResult);
if (NS_FAILED(rv)) return rv;
@ -1363,16 +1356,12 @@ nsDirectoryViewerFactory::CreateInstance(const char *aCommand,
if (viewSource) {
rv = factory->CreateInstance("view-source", aChannel, aLoadGroup,
NS_LITERAL_CSTRING("text/html; x-view-type=view-source"),
aContainer, aExtraInfo,
nsIDocumentLoaderFactory::STYLE_BACKEND_TYPE_NONE,
getter_AddRefs(listener),
aContainer, aExtraInfo, getter_AddRefs(listener),
aDocViewerResult);
} else {
rv = factory->CreateInstance("view", aChannel, aLoadGroup,
NS_LITERAL_CSTRING("text/html"),
aContainer, aExtraInfo,
nsIDocumentLoaderFactory::STYLE_BACKEND_TYPE_NONE,
getter_AddRefs(listener),
aContainer, aExtraInfo, getter_AddRefs(listener),
aDocViewerResult);
}