зеркало из https://github.com/mozilla/pjs.git
Backing out Bug 603844 because of xslt test failures. a=orange
This commit is contained in:
Коммит
2ac086cb56
|
@ -1,32 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html class="reftest-wait">
|
|
||||||
<head>
|
|
||||||
<script>
|
|
||||||
|
|
||||||
function boom()
|
|
||||||
{
|
|
||||||
var frame = document.createElementNS("http://www.w3.org/1999/xhtml", "iframe");
|
|
||||||
frame.onload = y;
|
|
||||||
frame.src = "data:text/plain,0";
|
|
||||||
document.body.appendChild(frame);
|
|
||||||
frameDoc = frame.contentDocument;
|
|
||||||
|
|
||||||
function y()
|
|
||||||
{
|
|
||||||
frameDoc.removeChild(frameDoc.documentElement);
|
|
||||||
|
|
||||||
var xp = new XSLTProcessor;
|
|
||||||
xp.importStylesheet(frameDoc);
|
|
||||||
try {
|
|
||||||
xp.transformToDocument(frameDoc.createTextNode('x'));
|
|
||||||
} catch(e) { }
|
|
||||||
|
|
||||||
document.documentElement.removeAttribute("class");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body onload="boom();"></body>
|
|
||||||
</html>
|
|
|
@ -11,4 +11,3 @@ load 528488.xml
|
||||||
load 528963.xml
|
load 528963.xml
|
||||||
load 545927.html
|
load 545927.html
|
||||||
load 601543.html
|
load 601543.html
|
||||||
load 603844.html
|
|
||||||
|
|
|
@ -408,103 +408,122 @@ txResultBuffer::addTransaction(txOutputTransaction* aTransaction)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static nsresult
|
struct Holder
|
||||||
flushTransaction(txOutputTransaction* aTransaction,
|
|
||||||
txAXMLEventHandler* aHandler,
|
|
||||||
nsAFlatString::const_char_iterator& aIter)
|
|
||||||
{
|
{
|
||||||
switch (aTransaction->mType) {
|
txAXMLEventHandler** mHandler;
|
||||||
|
nsresult mResult;
|
||||||
|
nsAFlatString::const_char_iterator mIter;
|
||||||
|
};
|
||||||
|
|
||||||
|
static PRBool
|
||||||
|
flushTransaction(txOutputTransaction* aElement, Holder* aData)
|
||||||
|
{
|
||||||
|
Holder* holder = aData;
|
||||||
|
txAXMLEventHandler* handler = *holder->mHandler;
|
||||||
|
txOutputTransaction* transaction = aElement;
|
||||||
|
|
||||||
|
nsresult rv;
|
||||||
|
switch (transaction->mType) {
|
||||||
case txOutputTransaction::eAttributeAtomTransaction:
|
case txOutputTransaction::eAttributeAtomTransaction:
|
||||||
{
|
{
|
||||||
txAttributeAtomTransaction* transaction =
|
txAttributeAtomTransaction* transaction =
|
||||||
static_cast<txAttributeAtomTransaction*>(aTransaction);
|
static_cast<txAttributeAtomTransaction*>(aElement);
|
||||||
return aHandler->attribute(transaction->mPrefix,
|
rv = handler->attribute(transaction->mPrefix,
|
||||||
transaction->mLocalName,
|
transaction->mLocalName,
|
||||||
transaction->mLowercaseLocalName,
|
transaction->mLowercaseLocalName,
|
||||||
transaction->mNsID,
|
transaction->mNsID,
|
||||||
transaction->mValue);
|
transaction->mValue);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case txOutputTransaction::eAttributeTransaction:
|
case txOutputTransaction::eAttributeTransaction:
|
||||||
{
|
{
|
||||||
txAttributeTransaction* attrTransaction =
|
txAttributeTransaction* attrTransaction =
|
||||||
static_cast<txAttributeTransaction*>(aTransaction);
|
static_cast<txAttributeTransaction*>(aElement);
|
||||||
return aHandler->attribute(attrTransaction->mPrefix,
|
rv = handler->attribute(attrTransaction->mPrefix,
|
||||||
attrTransaction->mLocalName,
|
attrTransaction->mLocalName,
|
||||||
attrTransaction->mNsID,
|
attrTransaction->mNsID,
|
||||||
attrTransaction->mValue);
|
attrTransaction->mValue);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case txOutputTransaction::eCharacterTransaction:
|
case txOutputTransaction::eCharacterTransaction:
|
||||||
case txOutputTransaction::eCharacterNoOETransaction:
|
case txOutputTransaction::eCharacterNoOETransaction:
|
||||||
{
|
{
|
||||||
txCharacterTransaction* charTransaction =
|
txCharacterTransaction* charTransaction =
|
||||||
static_cast<txCharacterTransaction*>(aTransaction);
|
static_cast<txCharacterTransaction*>(aElement);
|
||||||
nsAFlatString::const_char_iterator& start = aIter;
|
nsAFlatString::const_char_iterator& start =
|
||||||
|
holder->mIter;
|
||||||
nsAFlatString::const_char_iterator end =
|
nsAFlatString::const_char_iterator end =
|
||||||
start + charTransaction->mLength;
|
start + charTransaction->mLength;
|
||||||
aIter = end;
|
rv = handler->characters(Substring(start, end),
|
||||||
return aHandler->characters(Substring(start, end),
|
transaction->mType ==
|
||||||
aTransaction->mType ==
|
txOutputTransaction::eCharacterNoOETransaction);
|
||||||
txOutputTransaction::eCharacterNoOETransaction);
|
start = end;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case txOutputTransaction::eCommentTransaction:
|
case txOutputTransaction::eCommentTransaction:
|
||||||
{
|
{
|
||||||
txCommentTransaction* commentTransaction =
|
txCommentTransaction* commentTransaction =
|
||||||
static_cast<txCommentTransaction*>(aTransaction);
|
static_cast<txCommentTransaction*>(aElement);
|
||||||
return aHandler->comment(commentTransaction->mValue);
|
rv = handler->comment(commentTransaction->mValue);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case txOutputTransaction::eEndElementTransaction:
|
case txOutputTransaction::eEndElementTransaction:
|
||||||
{
|
{
|
||||||
return aHandler->endElement();
|
rv = handler->endElement();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case txOutputTransaction::ePITransaction:
|
case txOutputTransaction::ePITransaction:
|
||||||
{
|
{
|
||||||
txPITransaction* piTransaction =
|
txPITransaction* piTransaction =
|
||||||
static_cast<txPITransaction*>(aTransaction);
|
static_cast<txPITransaction*>(aElement);
|
||||||
return aHandler->processingInstruction(piTransaction->mTarget,
|
rv = handler->processingInstruction(piTransaction->mTarget,
|
||||||
piTransaction->mData);
|
piTransaction->mData);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case txOutputTransaction::eStartDocumentTransaction:
|
case txOutputTransaction::eStartDocumentTransaction:
|
||||||
{
|
{
|
||||||
return aHandler->startDocument();
|
rv = handler->startDocument();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case txOutputTransaction::eStartElementAtomTransaction:
|
case txOutputTransaction::eStartElementAtomTransaction:
|
||||||
{
|
{
|
||||||
txStartElementAtomTransaction* transaction =
|
txStartElementAtomTransaction* transaction =
|
||||||
static_cast<txStartElementAtomTransaction*>(aTransaction);
|
static_cast<txStartElementAtomTransaction*>(aElement);
|
||||||
return aHandler->startElement(transaction->mPrefix,
|
rv = handler->startElement(transaction->mPrefix,
|
||||||
transaction->mLocalName,
|
transaction->mLocalName,
|
||||||
transaction->mLowercaseLocalName,
|
transaction->mLowercaseLocalName,
|
||||||
transaction->mNsID);
|
transaction->mNsID);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case txOutputTransaction::eStartElementTransaction:
|
case txOutputTransaction::eStartElementTransaction:
|
||||||
{
|
{
|
||||||
txStartElementTransaction* transaction =
|
txStartElementTransaction* transaction =
|
||||||
static_cast<txStartElementTransaction*>(aTransaction);
|
static_cast<txStartElementTransaction*>(aElement);
|
||||||
return aHandler->startElement(transaction->mPrefix,
|
rv = handler->startElement(transaction->mPrefix,
|
||||||
transaction->mLocalName,
|
transaction->mLocalName,
|
||||||
transaction->mNsID);
|
transaction->mNsID);
|
||||||
}
|
break;
|
||||||
default:
|
|
||||||
{
|
|
||||||
NS_NOTREACHED("Unexpected transaction type");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_ERROR_UNEXPECTED;
|
holder->mResult = rv;
|
||||||
|
|
||||||
|
return NS_SUCCEEDED(rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
txResultBuffer::flushToHandler(txAXMLEventHandler* aHandler)
|
txResultBuffer::flushToHandler(txAXMLEventHandler** aHandler)
|
||||||
{
|
{
|
||||||
nsAFlatString::const_char_iterator iter;
|
Holder data = { aHandler, NS_OK };
|
||||||
mStringValue.BeginReading(iter);
|
mStringValue.BeginReading(data.mIter);
|
||||||
|
|
||||||
for (PRUint32 i = 0, len = mTransactions.Length(); i < len; ++i) {
|
for (PRUint32 i = 0, len = mTransactions.Length(); i < len; ++i) {
|
||||||
nsresult rv = flushTransaction(mTransactions[i], aHandler, iter);
|
if (!flushTransaction(mTransactions[i], &data)) {
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return data.mResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
txOutputTransaction*
|
txOutputTransaction*
|
||||||
|
|
|
@ -56,7 +56,12 @@ public:
|
||||||
|
|
||||||
nsresult addTransaction(txOutputTransaction* aTransaction);
|
nsresult addTransaction(txOutputTransaction* aTransaction);
|
||||||
|
|
||||||
nsresult flushToHandler(txAXMLEventHandler* aHandler);
|
/**
|
||||||
|
* Flush the transactions to aHandler. Some handlers create a new handler
|
||||||
|
* and replace themselves with the new handler. The pointer that aHandler
|
||||||
|
* points to should be updated in that case.
|
||||||
|
*/
|
||||||
|
nsresult flushToHandler(txAXMLEventHandler** aHandler);
|
||||||
|
|
||||||
txOutputTransaction* getLastTransaction();
|
txOutputTransaction* getLastTransaction();
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,10 @@ convertRtfToNode(txIEvalContext *aContext, txResultTreeFragment *aRtf)
|
||||||
txOutputFormat format;
|
txOutputFormat format;
|
||||||
txMozillaXMLOutput mozHandler(&format, domFragment, PR_TRUE);
|
txMozillaXMLOutput mozHandler(&format, domFragment, PR_TRUE);
|
||||||
|
|
||||||
rv = aRtf->flushToHandler(&mozHandler);
|
txAXMLEventHandler* handler = &mozHandler;
|
||||||
|
rv = aRtf->flushToHandler(&handler);
|
||||||
|
NS_ASSERTION(handler == &mozHandler,
|
||||||
|
"This handler shouldn't have been replaced!");
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = mozHandler.closePrevious(PR_TRUE);
|
rv = mozHandler.closePrevious(PR_TRUE);
|
||||||
|
|
|
@ -432,7 +432,7 @@ txCopyOf::execute(txExecutionState& aEs)
|
||||||
txResultTreeFragment* rtf =
|
txResultTreeFragment* rtf =
|
||||||
static_cast<txResultTreeFragment*>
|
static_cast<txResultTreeFragment*>
|
||||||
(static_cast<txAExprResult*>(exprRes));
|
(static_cast<txAExprResult*>(exprRes));
|
||||||
return rtf->flushToHandler(aEs.mResultHandler);
|
return rtf->flushToHandler(&aEs.mResultHandler);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
|
|
|
@ -80,7 +80,7 @@ double txResultTreeFragment::numberValue()
|
||||||
return Double::toDouble(mBuffer->mStringValue);
|
return Double::toDouble(mBuffer->mStringValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult txResultTreeFragment::flushToHandler(txAXMLEventHandler* aHandler)
|
nsresult txResultTreeFragment::flushToHandler(txAXMLEventHandler** aHandler)
|
||||||
{
|
{
|
||||||
if (!mBuffer) {
|
if (!mBuffer) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
|
@ -51,7 +51,7 @@ public:
|
||||||
|
|
||||||
TX_DECL_EXPRRESULT
|
TX_DECL_EXPRRESULT
|
||||||
|
|
||||||
nsresult flushToHandler(txAXMLEventHandler* aHandler);
|
nsresult flushToHandler(txAXMLEventHandler** aHandler);
|
||||||
|
|
||||||
void setNode(const txXPathNode* aNode)
|
void setNode(const txXPathNode* aNode)
|
||||||
{
|
{
|
||||||
|
|
|
@ -153,17 +153,14 @@ nsresult txUnknownHandler::createHandlerAndFlush(PRBool aHTMLRoot,
|
||||||
format.mMethod = aHTMLRoot ? eHTMLOutput : eXMLOutput;
|
format.mMethod = aHTMLRoot ? eHTMLOutput : eXMLOutput;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsAutoPtr<txAXMLEventHandler> handler;
|
txAXMLEventHandler *handler = nsnull;
|
||||||
nsresult rv = mEs->mOutputHandlerFactory->createHandlerWith(&format, aName,
|
nsresult rv = mEs->mOutputHandlerFactory->createHandlerWith(&format, aName,
|
||||||
aNsID,
|
aNsID,
|
||||||
getter_Transfers(handler));
|
&handler);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
rv = mBuffer->flushToHandler(handler);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
mEs->mOutputHandler = handler;
|
mEs->mOutputHandler = handler;
|
||||||
mEs->mResultHandler = handler.forget();
|
mEs->mResultHandler = handler;
|
||||||
|
|
||||||
return NS_OK;
|
return mBuffer->flushToHandler(&handler);
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче