diff options
author | Matt A. Tobin <email@mattatobin.com> | 2022-02-17 01:41:18 -0600 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2022-02-17 11:45:57 +0000 |
commit | 3ae79065285aab43b93cb615a307e115a84b15f1 (patch) | |
tree | 3c669e8e4298b93b46abd1531c43e778cf00bb68 | |
parent | 4fc1666d84e704159ff9f7d44c623a2b89f073ec (diff) | |
download | uxp-3ae79065285aab43b93cb615a307e115a84b15f1.tar.gz |
Manually Revert "[DOM XSLT] Use a request to stop transforming."RC_20220219
Causes a hang on Windows and simply a blank page on unix when viewing XML
-rw-r--r-- | dom/xslt/xslt/txExecutionState.cpp | 21 | ||||
-rw-r--r-- | dom/xslt/xslt/txExecutionState.h | 4 | ||||
-rw-r--r-- | dom/xslt/xslt/txMozillaXSLTProcessor.cpp | 85 | ||||
-rw-r--r-- | dom/xslt/xslt/txXSLTProcessor.cpp | 19 |
4 files changed, 15 insertions, 114 deletions
diff --git a/dom/xslt/xslt/txExecutionState.cpp b/dom/xslt/xslt/txExecutionState.cpp index 0ca6143a95..5caaf77f0c 100644 --- a/dom/xslt/xslt/txExecutionState.cpp +++ b/dom/xslt/xslt/txExecutionState.cpp @@ -480,18 +480,15 @@ txExecutionState::getCurrentTemplateRule() return &mTemplateRules[mTemplateRules.Length() - 1]; } -nsresult -txExecutionState::getNextInstruction(txInstruction* aInstruction) { - if (mStopProcessing) { - return NS_ERROR_FAILURE; - } - - aInstruction = mNextInstruction; - if (aInstruction) { - mNextInstruction = aInstruction->mNext; - } - - return NS_OK; +txInstruction* +txExecutionState::getNextInstruction() +{ + txInstruction* instr = mNextInstruction; + if (instr) { + mNextInstruction = instr->mNext; + } + + return instr; } nsresult diff --git a/dom/xslt/xslt/txExecutionState.h b/dom/xslt/xslt/txExecutionState.h index 68436424f2..cd54671791 100644 --- a/dom/xslt/xslt/txExecutionState.h +++ b/dom/xslt/xslt/txExecutionState.h @@ -131,7 +131,7 @@ public: } // state-modification functions - nsresult getNextInstruction(txInstruction* aInstruction); + txInstruction* getNextInstruction(); nsresult runTemplate(txInstruction* aInstruction); nsresult runTemplate(txInstruction* aInstruction, txInstruction* aReturnTo); @@ -140,7 +140,6 @@ public: nsresult bindVariable(const txExpandedName& aName, txAExprResult* aValue); void removeVariable(const txExpandedName& aName); - void stopProcessing() { mStopProcessing = true; } txAXMLEventHandler* mOutputHandler; txAXMLEventHandler* mResultHandler; @@ -175,7 +174,6 @@ private: txKeyHash mKeyHash; RefPtr<txResultRecycler> mRecycler; bool mDisableLoads; - bool mStopProcessing = false; static const int32_t kMaxRecursionDepth; }; diff --git a/dom/xslt/xslt/txMozillaXSLTProcessor.cpp b/dom/xslt/xslt/txMozillaXSLTProcessor.cpp index 18e86f45ae..6aec6052f4 100644 --- a/dom/xslt/xslt/txMozillaXSLTProcessor.cpp +++ b/dom/xslt/xslt/txMozillaXSLTProcessor.cpp @@ -653,69 +653,6 @@ txMozillaXSLTProcessor::TransformToDocument(nsIDOMNode *aSource, return TransformToDoc(aResult, true); } -class XSLTProcessRequest final : public nsIRequest { - public: - explicit XSLTProcessRequest(txExecutionState* aState) : mState(aState) {} - - NS_DECL_ISUPPORTS - NS_DECL_NSIREQUEST - - void Done() { mState = nullptr; } - - private: - ~XSLTProcessRequest() {} - txExecutionState* mState; -}; -NS_IMPL_ISUPPORTS(XSLTProcessRequest, nsIRequest) - -NS_IMETHODIMP -XSLTProcessRequest::GetName(nsACString& aResult) { - aResult.AssignLiteral("about:xslt-load-blocker"); - return NS_OK; -} - -NS_IMETHODIMP -XSLTProcessRequest::IsPending(bool* _retval) { - *_retval = true; - return NS_OK; -} - -NS_IMETHODIMP -XSLTProcessRequest::GetStatus(nsresult* status) { - *status = NS_OK; - return NS_OK; -} - -NS_IMETHODIMP -XSLTProcessRequest::Cancel(nsresult status) { - mState->stopProcessing(); - return NS_OK; -} - -NS_IMETHODIMP -XSLTProcessRequest::Suspend(void) { return NS_OK; } - -NS_IMETHODIMP -XSLTProcessRequest::Resume(void) { return NS_OK; } - -NS_IMETHODIMP -XSLTProcessRequest::GetLoadGroup(nsILoadGroup** aLoadGroup) { - *aLoadGroup = nullptr; - return NS_OK; -} - -NS_IMETHODIMP -XSLTProcessRequest::SetLoadGroup(nsILoadGroup* aLoadGroup) { return NS_OK; } - -NS_IMETHODIMP -XSLTProcessRequest::GetLoadFlags(nsLoadFlags* aLoadFlags) { - *aLoadFlags = nsIRequest::LOAD_NORMAL; - return NS_OK; -} - -NS_IMETHODIMP -XSLTProcessRequest::SetLoadFlags(nsLoadFlags aLoadFlags) { return NS_OK; } - nsresult txMozillaXSLTProcessor::TransformToDoc(nsIDOMDocument **aResult, bool aCreateDataDocument) @@ -729,25 +666,6 @@ txMozillaXSLTProcessor::TransformToDoc(nsIDOMDocument **aResult, txExecutionState es(mStylesheet, IsLoadDisabled()); - nsIDocument* sourceDoc = mSource->OwnerDoc(); - nsCOMPtr<nsILoadGroup> loadGroup = sourceDoc->GetDocumentLoadGroup(); - if (!loadGroup) { - nsCOMPtr<nsPIDOMWindowInner> win = do_QueryInterface(mOwner); - if (win && win->IsCurrentInnerWindow()) { - nsIDocument* doc = win->GetDoc(); - if (doc) { - loadGroup = doc->GetDocumentLoadGroup(); - } - } - - if (!loadGroup) { - return NS_ERROR_FAILURE; - } - } - - RefPtr<XSLTProcessRequest> xsltProcessRequest = new XSLTProcessRequest(&es); - loadGroup->AddRequest(xsltProcessRequest, nullptr); - // XXX Need to add error observers // If aResult is non-null, we're a data document @@ -762,9 +680,6 @@ txMozillaXSLTProcessor::TransformToDoc(nsIDOMDocument **aResult, rv = txXSLTProcessor::execute(es); } - xsltProcessRequest->Done(); - loadGroup->RemoveRequest(xsltProcessRequest, nullptr, NS_OK); - nsresult endRv = es.end(rv); if (NS_SUCCEEDED(rv)) { rv = endRv; diff --git a/dom/xslt/xslt/txXSLTProcessor.cpp b/dom/xslt/xslt/txXSLTProcessor.cpp index cd1030de49..7335d7b844 100644 --- a/dom/xslt/xslt/txXSLTProcessor.cpp +++ b/dom/xslt/xslt/txXSLTProcessor.cpp @@ -43,21 +43,12 @@ txXSLTProcessor::shutdown() nsresult txXSLTProcessor::execute(txExecutionState& aEs) { - nsresult rv; - do { + nsresult rv = NS_OK; txInstruction* instr; - nsresult rv = aEs.getNextInstruction(instr); - if (NS_FAILED(rv)) { - return rv; + while ((instr = aEs.getNextInstruction())) { + rv = instr->execute(aEs); + NS_ENSURE_SUCCESS(rv, rv); } - if (!instr) { - // reached null, no more instructions. - return NS_OK; - } - - rv = instr->execute(aEs); - } while (NS_SUCCEEDED(rv)); - - return rv; + return NS_OK; } |