зеркало из 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 545927.html
|
||||
load 601543.html
|
||||
load 603844.html
|
||||
|
|
|
@ -408,103 +408,122 @@ txResultBuffer::addTransaction(txOutputTransaction* aTransaction)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult
|
||||
flushTransaction(txOutputTransaction* aTransaction,
|
||||
txAXMLEventHandler* aHandler,
|
||||
nsAFlatString::const_char_iterator& aIter)
|
||||
struct Holder
|
||||
{
|
||||
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:
|
||||
{
|
||||
txAttributeAtomTransaction* transaction =
|
||||
static_cast<txAttributeAtomTransaction*>(aTransaction);
|
||||
return aHandler->attribute(transaction->mPrefix,
|
||||
transaction->mLocalName,
|
||||
transaction->mLowercaseLocalName,
|
||||
transaction->mNsID,
|
||||
transaction->mValue);
|
||||
static_cast<txAttributeAtomTransaction*>(aElement);
|
||||
rv = handler->attribute(transaction->mPrefix,
|
||||
transaction->mLocalName,
|
||||
transaction->mLowercaseLocalName,
|
||||
transaction->mNsID,
|
||||
transaction->mValue);
|
||||
break;
|
||||
}
|
||||
case txOutputTransaction::eAttributeTransaction:
|
||||
{
|
||||
txAttributeTransaction* attrTransaction =
|
||||
static_cast<txAttributeTransaction*>(aTransaction);
|
||||
return aHandler->attribute(attrTransaction->mPrefix,
|
||||
attrTransaction->mLocalName,
|
||||
attrTransaction->mNsID,
|
||||
attrTransaction->mValue);
|
||||
static_cast<txAttributeTransaction*>(aElement);
|
||||
rv = handler->attribute(attrTransaction->mPrefix,
|
||||
attrTransaction->mLocalName,
|
||||
attrTransaction->mNsID,
|
||||
attrTransaction->mValue);
|
||||
break;
|
||||
}
|
||||
case txOutputTransaction::eCharacterTransaction:
|
||||
case txOutputTransaction::eCharacterNoOETransaction:
|
||||
{
|
||||
txCharacterTransaction* charTransaction =
|
||||
static_cast<txCharacterTransaction*>(aTransaction);
|
||||
nsAFlatString::const_char_iterator& start = aIter;
|
||||
static_cast<txCharacterTransaction*>(aElement);
|
||||
nsAFlatString::const_char_iterator& start =
|
||||
holder->mIter;
|
||||
nsAFlatString::const_char_iterator end =
|
||||
start + charTransaction->mLength;
|
||||
aIter = end;
|
||||
return aHandler->characters(Substring(start, end),
|
||||
aTransaction->mType ==
|
||||
txOutputTransaction::eCharacterNoOETransaction);
|
||||
rv = handler->characters(Substring(start, end),
|
||||
transaction->mType ==
|
||||
txOutputTransaction::eCharacterNoOETransaction);
|
||||
start = end;
|
||||
break;
|
||||
}
|
||||
case txOutputTransaction::eCommentTransaction:
|
||||
{
|
||||
txCommentTransaction* commentTransaction =
|
||||
static_cast<txCommentTransaction*>(aTransaction);
|
||||
return aHandler->comment(commentTransaction->mValue);
|
||||
static_cast<txCommentTransaction*>(aElement);
|
||||
rv = handler->comment(commentTransaction->mValue);
|
||||
break;
|
||||
}
|
||||
case txOutputTransaction::eEndElementTransaction:
|
||||
{
|
||||
return aHandler->endElement();
|
||||
rv = handler->endElement();
|
||||
break;
|
||||
}
|
||||
case txOutputTransaction::ePITransaction:
|
||||
{
|
||||
txPITransaction* piTransaction =
|
||||
static_cast<txPITransaction*>(aTransaction);
|
||||
return aHandler->processingInstruction(piTransaction->mTarget,
|
||||
piTransaction->mData);
|
||||
static_cast<txPITransaction*>(aElement);
|
||||
rv = handler->processingInstruction(piTransaction->mTarget,
|
||||
piTransaction->mData);
|
||||
break;
|
||||
}
|
||||
case txOutputTransaction::eStartDocumentTransaction:
|
||||
{
|
||||
return aHandler->startDocument();
|
||||
rv = handler->startDocument();
|
||||
break;
|
||||
}
|
||||
case txOutputTransaction::eStartElementAtomTransaction:
|
||||
{
|
||||
txStartElementAtomTransaction* transaction =
|
||||
static_cast<txStartElementAtomTransaction*>(aTransaction);
|
||||
return aHandler->startElement(transaction->mPrefix,
|
||||
transaction->mLocalName,
|
||||
transaction->mLowercaseLocalName,
|
||||
transaction->mNsID);
|
||||
static_cast<txStartElementAtomTransaction*>(aElement);
|
||||
rv = handler->startElement(transaction->mPrefix,
|
||||
transaction->mLocalName,
|
||||
transaction->mLowercaseLocalName,
|
||||
transaction->mNsID);
|
||||
break;
|
||||
}
|
||||
case txOutputTransaction::eStartElementTransaction:
|
||||
{
|
||||
txStartElementTransaction* transaction =
|
||||
static_cast<txStartElementTransaction*>(aTransaction);
|
||||
return aHandler->startElement(transaction->mPrefix,
|
||||
transaction->mLocalName,
|
||||
transaction->mNsID);
|
||||
}
|
||||
default:
|
||||
{
|
||||
NS_NOTREACHED("Unexpected transaction type");
|
||||
static_cast<txStartElementTransaction*>(aElement);
|
||||
rv = handler->startElement(transaction->mPrefix,
|
||||
transaction->mLocalName,
|
||||
transaction->mNsID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
holder->mResult = rv;
|
||||
|
||||
return NS_SUCCEEDED(rv);
|
||||
}
|
||||
|
||||
nsresult
|
||||
txResultBuffer::flushToHandler(txAXMLEventHandler* aHandler)
|
||||
txResultBuffer::flushToHandler(txAXMLEventHandler** aHandler)
|
||||
{
|
||||
nsAFlatString::const_char_iterator iter;
|
||||
mStringValue.BeginReading(iter);
|
||||
Holder data = { aHandler, NS_OK };
|
||||
mStringValue.BeginReading(data.mIter);
|
||||
|
||||
for (PRUint32 i = 0, len = mTransactions.Length(); i < len; ++i) {
|
||||
nsresult rv = flushTransaction(mTransactions[i], aHandler, iter);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (!flushTransaction(mTransactions[i], &data)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return data.mResult;
|
||||
}
|
||||
|
||||
txOutputTransaction*
|
||||
|
|
|
@ -56,7 +56,12 @@ public:
|
|||
|
||||
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();
|
||||
|
||||
|
|
|
@ -88,7 +88,10 @@ convertRtfToNode(txIEvalContext *aContext, txResultTreeFragment *aRtf)
|
|||
txOutputFormat format;
|
||||
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);
|
||||
|
||||
rv = mozHandler.closePrevious(PR_TRUE);
|
||||
|
|
|
@ -432,7 +432,7 @@ txCopyOf::execute(txExecutionState& aEs)
|
|||
txResultTreeFragment* rtf =
|
||||
static_cast<txResultTreeFragment*>
|
||||
(static_cast<txAExprResult*>(exprRes));
|
||||
return rtf->flushToHandler(aEs.mResultHandler);
|
||||
return rtf->flushToHandler(&aEs.mResultHandler);
|
||||
}
|
||||
default:
|
||||
{
|
||||
|
|
|
@ -80,7 +80,7 @@ double txResultTreeFragment::numberValue()
|
|||
return Double::toDouble(mBuffer->mStringValue);
|
||||
}
|
||||
|
||||
nsresult txResultTreeFragment::flushToHandler(txAXMLEventHandler* aHandler)
|
||||
nsresult txResultTreeFragment::flushToHandler(txAXMLEventHandler** aHandler)
|
||||
{
|
||||
if (!mBuffer) {
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
|
||||
TX_DECL_EXPRRESULT
|
||||
|
||||
nsresult flushToHandler(txAXMLEventHandler* aHandler);
|
||||
nsresult flushToHandler(txAXMLEventHandler** aHandler);
|
||||
|
||||
void setNode(const txXPathNode* aNode)
|
||||
{
|
||||
|
|
|
@ -153,17 +153,14 @@ nsresult txUnknownHandler::createHandlerAndFlush(PRBool aHTMLRoot,
|
|||
format.mMethod = aHTMLRoot ? eHTMLOutput : eXMLOutput;
|
||||
}
|
||||
|
||||
nsAutoPtr<txAXMLEventHandler> handler;
|
||||
txAXMLEventHandler *handler = nsnull;
|
||||
nsresult rv = mEs->mOutputHandlerFactory->createHandlerWith(&format, aName,
|
||||
aNsID,
|
||||
getter_Transfers(handler));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = mBuffer->flushToHandler(handler);
|
||||
&handler);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mEs->mOutputHandler = handler;
|
||||
mEs->mResultHandler = handler.forget();
|
||||
mEs->mResultHandler = handler;
|
||||
|
||||
return NS_OK;
|
||||
return mBuffer->flushToHandler(&handler);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче