author | Ryan VanderMeulen <ryanvm@gmail.com> |
Fri, 18 Aug 2017 11:56:44 -0400 | |
changeset 421250 | b25f3c5ec90497426da80de98f38d53282b835ba |
parent 421249 | 02e56d2e2c64d34976067ee52df34c15344be1de |
child 421258 | 05a4dc75c125a80cbaacd44c7b7937c77dc384a8 |
push id | 7637 |
push user | ryanvm@gmail.com |
push date | Fri, 18 Aug 2017 15:56:57 +0000 |
treeherder | mozilla-beta@b25f3c5ec904 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 1389300 |
milestone | 56.0 |
backs out | 84f048b7dca0169ed9d43009eac05a379a70b3cb c261040950bfb7d7e575a9b73684cb6d48fa9678 |
--- a/dom/base/DOMImplementation.cpp +++ b/dom/base/DOMImplementation.cpp @@ -118,18 +118,17 @@ DOMImplementation::CreateDocument(const nsCOMPtr<nsIDOMDocument> document; rv = NS_NewDOMDocument(getter_AddRefs(document), aNamespaceURI, aQualifiedName, aDoctype, mDocumentURI, mBaseURI, mOwner->NodePrincipal(), true, scriptHandlingObject, - DocumentFlavorLegacyGuess, - mOwner->GetStyleBackendType()); + DocumentFlavorLegacyGuess); NS_ENSURE_SUCCESS(rv, rv); // When DOMImplementation's createDocument method is invoked with // namespace set to HTML Namespace use the registry of the associated // document to the new instance. nsCOMPtr<nsIDocument> doc = do_QueryInterface(document); if (aNamespaceURI.EqualsLiteral("http://www.w3.org/1999/xhtml")) { @@ -198,18 +197,17 @@ DOMImplementation::CreateHTMLDocument(co NS_ENSURE_STATE(!mScriptObject || scriptHandlingObject); nsCOMPtr<nsIDOMDocument> document; rv = NS_NewDOMDocument(getter_AddRefs(document), EmptyString(), EmptyString(), doctype, mDocumentURI, mBaseURI, mOwner->NodePrincipal(), true, scriptHandlingObject, - DocumentFlavorLegacyGuess, - mOwner->GetStyleBackendType()); + DocumentFlavorLegacyGuess); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr<nsIDocument> doc = do_QueryInterface(document); nsCOMPtr<Element> root = doc->CreateElem(NS_LITERAL_STRING("html"), nullptr, kNameSpaceID_XHTML); rv = doc->AppendChildTo(root, false); NS_ENSURE_SUCCESS(rv, rv);
--- a/dom/base/DOMParser.cpp +++ b/dom/base/DOMParser.cpp @@ -456,26 +456,18 @@ DOMParser::SetUpDocument(DocumentFlavor NS_ENSURE_TRUE(!mAttemptedInit, NS_ERROR_NOT_INITIALIZED); AttemptedInitMarker marker(&mAttemptedInit); nsCOMPtr<nsIPrincipal> prin = NullPrincipal::Create(); rv = Init(prin, nullptr, nullptr, scriptHandlingObject); NS_ENSURE_SUCCESS(rv, rv); } - // Try to inherit a style backend. - auto styleBackend = StyleBackendType::None; - nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(mScriptHandlingObject); - if (window && window->GetExtantDoc()) { - styleBackend = window->GetExtantDoc()->GetStyleBackendType(); - } - NS_ASSERTION(mPrincipal, "Must have principal by now"); NS_ASSERTION(mDocumentURI, "Must have document URI by now"); return NS_NewDOMDocument(aResult, EmptyString(), EmptyString(), nullptr, mDocumentURI, mBaseURI, mPrincipal, true, scriptHandlingObject, - aFlavor, - styleBackend); + aFlavor); }
--- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -5162,18 +5162,17 @@ nsContentUtils::ConvertToPlainText(const EmptyString(), EmptyString(), nullptr, uri, uri, principal, true, nullptr, - DocumentFlavorHTML, - StyleBackendType::None); + DocumentFlavorHTML); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr<nsIDocument> document = do_QueryInterface(domDocument); rv = nsContentUtils::ParseDocumentHTML(aSourceBuffer, document, !(aFlags & nsIDocumentEncoder::OutputNoScriptContent)); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr<nsIDocumentEncoder> encoder = do_CreateInstance(
--- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -9847,18 +9847,17 @@ nsDocument::GetTemplateContentsOwner() EmptyString(), // aNamespaceURI EmptyString(), // aQualifiedName nullptr, // aDoctype nsIDocument::GetDocumentURI(), nsIDocument::GetDocBaseURI(), NodePrincipal(), true, // aLoadedAsData scriptObject, // aEventObject - DocumentFlavorHTML, - mStyleBackendType); + DocumentFlavorHTML); NS_ENSURE_SUCCESS(rv, nullptr); mTemplateContentsOwner = do_QueryInterface(domDocument); NS_ENSURE_TRUE(mTemplateContentsOwner, nullptr); nsDocument* doc = static_cast<nsDocument*>(mTemplateContentsOwner.get()); if (!scriptObject) { @@ -12493,22 +12492,16 @@ nsIDocument::Constructor(const GlobalObj ErrorResult& rv) { nsCOMPtr<nsIScriptGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports()); if (!global) { rv.Throw(NS_ERROR_UNEXPECTED); return nullptr; } - auto styleBackend = StyleBackendType::None; - nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(global); - if (window && window->GetExtantDoc()) { - styleBackend = window->GetExtantDoc()->GetStyleBackendType(); - } - nsCOMPtr<nsIScriptObjectPrincipal> prin = do_QueryInterface(aGlobal.GetAsSupports()); if (!prin) { rv.Throw(NS_ERROR_UNEXPECTED); return nullptr; } nsCOMPtr<nsIURI> uri; NS_NewURI(getter_AddRefs(uri), "about:blank"); @@ -12523,18 +12516,17 @@ nsIDocument::Constructor(const GlobalObj NullString(), EmptyString(), nullptr, uri, uri, prin->GetPrincipal(), true, global, - DocumentFlavorPlain, - styleBackend); + DocumentFlavorPlain); if (NS_FAILED(res)) { rv.Throw(res); return nullptr; } nsCOMPtr<nsIDocument> doc = do_QueryInterface(document); doc->SetReadyStateInternal(nsIDocument::READYSTATE_COMPLETE);
--- a/dom/base/nsIDocument.h +++ b/dom/base/nsIDocument.h @@ -3623,27 +3623,25 @@ NS_NewDOMDocument(nsIDOMDocument** aInst const nsAString& aNamespaceURI, const nsAString& aQualifiedName, nsIDOMDocumentType* aDoctype, nsIURI* aDocumentURI, nsIURI* aBaseURI, nsIPrincipal* aPrincipal, bool aLoadedAsData, nsIGlobalObject* aEventObject, - DocumentFlavor aFlavor, - mozilla::StyleBackendType aStyleBackend); + DocumentFlavor aFlavor); // This is used only for xbl documents created from the startup cache. // Non-cached documents are created in the same manner as xml documents. nsresult NS_NewXBLDocument(nsIDOMDocument** aInstancePtrResult, nsIURI* aDocumentURI, nsIURI* aBaseURI, - nsIPrincipal* aPrincipal, - mozilla::StyleBackendType aStyleBackend); + nsIPrincipal* aPrincipal); nsresult NS_NewPluginDocument(nsIDocument** aInstancePtrResult); inline nsIDocument* nsINode::GetOwnerDocument() const { nsIDocument* ownerDoc = OwnerDoc();
--- a/dom/xbl/nsXBLDocumentInfo.cpp +++ b/dom/xbl/nsXBLDocumentInfo.cpp @@ -221,25 +221,28 @@ nsXBLDocumentInfo::ReadPrototypeBindings startupCache->InvalidateCache(); return NS_ERROR_NOT_AVAILABLE; } nsCOMPtr<nsIPrincipal> principal; nsContentUtils::GetSecurityManager()-> GetSystemPrincipal(getter_AddRefs(principal)); - auto styleBackend = aBoundDocument ? aBoundDocument->GetStyleBackendType() - : StyleBackendType::Gecko; nsCOMPtr<nsIDOMDocument> domdoc; - rv = NS_NewXBLDocument(getter_AddRefs(domdoc), aURI, nullptr, principal, styleBackend); + rv = NS_NewXBLDocument(getter_AddRefs(domdoc), aURI, nullptr, principal); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr<nsIDocument> doc = do_QueryInterface(domdoc); NS_ASSERTION(doc, "Must have a document!"); + // Set the style backend type immediately after creating the XBL document. + // Assume gecko if there's no bound document. + doc->SetStyleBackendType(aBoundDocument ? aBoundDocument->GetStyleBackendType() + : StyleBackendType::Gecko); + RefPtr<nsXBLDocumentInfo> docInfo = new nsXBLDocumentInfo(doc); while (1) { uint8_t flags; nsresult rv = stream->Read8(&flags); NS_ENSURE_SUCCESS(rv, rv); if (flags == XBLBinding_Serialize_NoMoreBindings) break;
--- a/dom/xhr/XMLHttpRequestMainThread.cpp +++ b/dom/xhr/XMLHttpRequestMainThread.cpp @@ -181,17 +181,16 @@ bool XMLHttpRequestMainThread::sDontWarnAboutSyncXHR = false; XMLHttpRequestMainThread::XMLHttpRequestMainThread() : mResponseBodyDecodedPos(0), mResponseCharset(nullptr), mResponseType(XMLHttpRequestResponseType::_empty), mRequestObserver(nullptr), mState(State::unsent), - mStyleBackend(StyleBackendType::None), mFlagSynchronous(false), mFlagAborted(false), mFlagParseBody(false), mFlagSyncLooping(false), mFlagBackgroundRequest(false), mFlagHadUploadListenersOnSend(false), mFlagACwithCredentials(false), mFlagTimedOut(false), mFlagDeleted(false), mFlagSend(false), mUploadTransferred(0), mUploadTotal(0), mUploadComplete(true), mProgressSinceLastProgressEvent(false), mRequestSentTime(0), mTimeoutMilliseconds(0), mErrorLoad(ErrorType::eOK), mErrorParsingXML(false), @@ -2158,18 +2157,17 @@ XMLHttpRequestMainThread::OnStartRequest rv = nsContentUtils::GetSecurityManager()-> GetChannelResultPrincipal(channel, getter_AddRefs(requestingPrincipal)); NS_ENSURE_SUCCESS(rv, rv); rv = NS_NewDOMDocument(getter_AddRefs(responseDoc), emptyStr, emptyStr, nullptr, docURI, baseURI, requestingPrincipal, true, global, mIsHtml ? DocumentFlavorHTML : - DocumentFlavorLegacyGuess, - mStyleBackend); + DocumentFlavorLegacyGuess); NS_ENSURE_SUCCESS(rv, rv); mResponseXML = do_QueryInterface(responseDoc); mResponseXML->SetChromeXHRDocURI(chromeXHRDocURI); mResponseXML->SetChromeXHRDocBaseURI(chromeXHRDocBaseURI); // suppress parsing failure messages to console for statuses which // can have empty bodies (see bug 884693). uint32_t responseStatus;
--- a/dom/xhr/XMLHttpRequestMainThread.h +++ b/dom/xhr/XMLHttpRequestMainThread.h @@ -196,23 +196,18 @@ public: XMLHttpRequestMainThread(); void Construct(nsIPrincipal* aPrincipal, nsIGlobalObject* aGlobalObject, nsIURI* aBaseURI = nullptr, nsILoadGroup* aLoadGroup = nullptr) { MOZ_ASSERT(aPrincipal); - nsCOMPtr<nsPIDOMWindowInner> win = do_QueryInterface(aGlobalObject); - if (win) { - MOZ_ASSERT(win->IsInnerWindow()); - if (win->GetExtantDoc()) { - mStyleBackend = win->GetExtantDoc()->GetStyleBackendType(); - } - } + MOZ_ASSERT_IF(nsCOMPtr<nsPIDOMWindowInner> win = do_QueryInterface( + aGlobalObject), win->IsInnerWindow()); mPrincipal = aPrincipal; BindToOwner(aGlobalObject); mBaseURI = aBaseURI; mLoadGroup = aLoadGroup; } void InitParameters(bool aAnon, bool aSystem); @@ -744,18 +739,16 @@ protected: nsIRequestObserver* mRequestObserver; nsCOMPtr<nsIURI> mBaseURI; nsCOMPtr<nsILoadGroup> mLoadGroup; State mState; - StyleBackendType mStyleBackend; - bool mFlagSynchronous; bool mFlagAborted; bool mFlagParseBody; bool mFlagSyncLooping; bool mFlagBackgroundRequest; bool mFlagHadUploadListenersOnSend; bool mFlagACwithCredentials; bool mFlagTimedOut;
--- a/dom/xml/XMLDocument.cpp +++ b/dom/xml/XMLDocument.cpp @@ -64,18 +64,17 @@ NS_NewDOMDocument(nsIDOMDocument** aInst const nsAString& aNamespaceURI, const nsAString& aQualifiedName, nsIDOMDocumentType* aDoctype, nsIURI* aDocumentURI, nsIURI* aBaseURI, nsIPrincipal* aPrincipal, bool aLoadedAsData, nsIGlobalObject* aEventObject, - DocumentFlavor aFlavor, - StyleBackendType aStyleBackend) + DocumentFlavor aFlavor) { // Note: can't require that aDocumentURI/aBaseURI/aPrincipal be non-null, // since at least one caller (XMLHttpRequest) doesn't have decent args to // pass in. nsresult rv; *aInstancePtrResult = nullptr; @@ -124,22 +123,16 @@ NS_NewDOMDocument(nsIDOMDocument** aInst MOZ_ASSERT(aFlavor == DocumentFlavorLegacyGuess); rv = NS_NewXMLDocument(getter_AddRefs(d)); } if (NS_FAILED(rv)) { return rv; } - // If we were passed an explicit style backend for this document set it - // immediately after creation, before any content is inserted. - if (aStyleBackend != StyleBackendType::None) { - d->SetStyleBackendType(aStyleBackend); - } - if (isHTML) { nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(d); NS_ASSERTION(htmlDoc, "HTML Document doesn't implement nsIHTMLDocument?"); htmlDoc->SetCompatibilityMode(eCompatibility_FullStandards); htmlDoc->SetIsXHTML(isXHTML); } nsDocument* doc = static_cast<nsDocument*>(d.get()); doc->SetLoadedAsData(aLoadedAsData); @@ -211,25 +204,23 @@ NS_NewXMLDocument(nsIDocument** aInstanc return NS_OK; } nsresult NS_NewXBLDocument(nsIDOMDocument** aInstancePtrResult, nsIURI* aDocumentURI, nsIURI* aBaseURI, - nsIPrincipal* aPrincipal, - StyleBackendType aStyleBackend) + nsIPrincipal* aPrincipal) { nsresult rv = NS_NewDOMDocument(aInstancePtrResult, NS_LITERAL_STRING("http://www.mozilla.org/xbl"), NS_LITERAL_STRING("bindings"), nullptr, aDocumentURI, aBaseURI, aPrincipal, false, - nullptr, DocumentFlavorLegacyGuess, - aStyleBackend); + nullptr, DocumentFlavorLegacyGuess); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr<nsIDocument> idoc = do_QueryInterface(*aInstancePtrResult); nsDocument* doc = static_cast<nsDocument*>(idoc.get()); doc->SetLoadedAsInteractiveData(true); doc->SetReadyStateInternal(nsIDocument::READYSTATE_COMPLETE); return NS_OK;
--- a/gfx/thebes/gfxSVGGlyphs.cpp +++ b/gfx/thebes/gfxSVGGlyphs.cpp @@ -356,28 +356,25 @@ gfxSVGGlyphsDocument::ParseDocument(cons nullptr, mSVGGlyphsDocumentURI); rv = NS_NewURI(getter_AddRefs(uri), mSVGGlyphsDocumentURI); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr<nsIPrincipal> principal = NullPrincipal::Create(); - auto styleBackend = nsLayoutUtils::StyloEnabled() ? StyleBackendType::Servo - : StyleBackendType::Gecko; nsCOMPtr<nsIDOMDocument> domDoc; rv = NS_NewDOMDocument(getter_AddRefs(domDoc), EmptyString(), // aNamespaceURI EmptyString(), // aQualifiedName nullptr, // aDoctype uri, uri, principal, false, // aLoadedAsData nullptr, // aEventObject - DocumentFlavorSVG, - styleBackend); + DocumentFlavorSVG); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr<nsIDocument> document(do_QueryInterface(domDoc)); if (!document) { return NS_ERROR_FAILURE; } nsCOMPtr<nsIChannel> channel;
--- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -590,26 +590,16 @@ nsComputedDOMStyle::DoGetStyleContextNoF // correct document. nsIPresShell *presShell = GetPresShellForContent(aElement); bool inDocWithShell = true; if (!presShell) { inDocWithShell = false; presShell = aPresShell; if (!presShell) return nullptr; - - // In some edge cases, the caller document might be using a different style - // backend than the callee. This causes problems because the cached parsed - // style attributes in the callee document will be a different format than - // the caller expects. Supporting this would be a pain, and we're already - // in edge-case-squared, so we just return. - if (presShell->GetDocument()->GetStyleBackendType() != - aElement->OwnerDoc()->GetStyleBackendType()) { - return nullptr; - } } // We do this check to avoid having to add too much special casing of // Servo functions we call to explicitly ignore any element data in // the tree. (See comment in ServoStyleSet::ResolveStyleLazily.) MOZ_RELEASE_ASSERT((aStyleType == eAll && aAnimationFlag == eWithAnimation) || !aElement->OwnerDoc()->GetBFCacheEntry(), "nsComputedDOMStyle doesn't support getting styles without "
--- a/parser/html/nsParserUtils.cpp +++ b/parser/html/nsParserUtils.cpp @@ -82,18 +82,17 @@ nsParserUtils::Sanitize(const nsAString& EmptyString(), EmptyString(), nullptr, uri, uri, principal, true, nullptr, - DocumentFlavorHTML, - mozilla::StyleBackendType::None); + DocumentFlavorHTML); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr<nsIDocument> document = do_QueryInterface(domDocument); rv = nsContentUtils::ParseDocumentHTML(aFromStr, document, false); NS_ENSURE_SUCCESS(rv, rv); nsTreeSanitizer sanitizer(aFlags); sanitizer.Sanitize(document);