зеркало из https://github.com/mozilla/pjs.git
68008 - After evaluating the external JS content make sure to that the parser is not blocked before resumeparsing.
r=jst sr=vidur a=blizzard 68160 - Set stream listener state to eOnStop only on the final context. r=nisheeth sr=vidur a=blizzard.
This commit is contained in:
Родитель
41c983e09c
Коммит
7bc76a76cc
|
@ -4619,7 +4619,7 @@ HTMLContentSink::ResumeParsing()
|
|||
{
|
||||
nsresult result=NS_OK;
|
||||
if (mParser) {
|
||||
result=mParser->ResumeParsing();
|
||||
result=mParser->ContinueParsing();
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -4820,7 +4820,10 @@ HTMLContentSink::OnStreamComplete(nsIStreamLoader* aLoader,
|
|||
}
|
||||
}
|
||||
|
||||
rv = ResumeParsing();
|
||||
if(mParser && mParser->IsParserEnabled()){
|
||||
rv=mParser->ContinueParsing();
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
//invalidate Xfer buffer content
|
||||
|
|
|
@ -703,7 +703,7 @@ CSSLoaderImpl::Cleanup(URLKey& aKey, SheetLoadData* aLoadData)
|
|||
if (data->mParserToUnblock) {
|
||||
if (!done && data->mDidBlockParser) {
|
||||
done = PR_TRUE;
|
||||
data->mParserToUnblock->ResumeParsing(); // this may result in re-entrant calls to loader
|
||||
data->mParserToUnblock->ContinueParsing(); // this may result in re-entrant calls to loader
|
||||
}
|
||||
// To reduce the risk of leaking a parser if we leak a SheetLoadData,
|
||||
// release the parser here.
|
||||
|
|
|
@ -1561,7 +1561,7 @@ NS_IMETHODIMP
|
|||
nsXMLContentSink::ResumeParsing()
|
||||
{
|
||||
if (mParser) {
|
||||
mParser->ResumeParsing();
|
||||
mParser->ContinueParsing();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -1684,7 +1684,10 @@ nsXMLContentSink::OnStreamComplete(nsIStreamLoader* aLoader,
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
rv = ResumeParsing();
|
||||
if(mParser && mParser->IsParserEnabled()){
|
||||
rv=mParser->ContinueParsing();
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return rv;
|
||||
|
|
|
@ -220,8 +220,8 @@ class nsIParser : public nsISupports {
|
|||
* be a proxy for the NGLayout content model).
|
||||
******************************************************************************************/
|
||||
|
||||
// This method enables the parser ( by calling UnblockParser() ) and resumes parsing.
|
||||
virtual nsresult ResumeParsing() =0;
|
||||
// Call this method to resume the parser from the blocked state..
|
||||
virtual nsresult ContinueParsing() =0;
|
||||
|
||||
// Stops parsing temporarily.
|
||||
virtual void BlockParser() =0;
|
||||
|
|
|
@ -1500,13 +1500,12 @@ nsresult nsParser::Terminate(void){
|
|||
|
||||
|
||||
/**
|
||||
* Call this when you want to toggle from the blocked state and resume parsing
|
||||
*
|
||||
* @update gess 1/29/99
|
||||
* @param aState determines whether we parse/tokenize or just cache.
|
||||
* @return current state
|
||||
*/
|
||||
nsresult nsParser::ResumeParsing(){
|
||||
nsresult nsParser::ContinueParsing(){
|
||||
|
||||
// If the stream has already finished, there's a good chance
|
||||
// that we might start closing things down when the parser
|
||||
|
@ -1515,8 +1514,7 @@ nsresult nsParser::ResumeParsing(){
|
|||
nsresult result=NS_OK;
|
||||
nsCOMPtr<nsIParser> kungFuDeathGrip(this);
|
||||
|
||||
// Enable the parser
|
||||
UnblockParser();
|
||||
mParserEnabled=PR_TRUE;
|
||||
|
||||
PRBool isFinalChunk=(mParserContext && mParserContext->mStreamListenerState==eOnStop)? PR_TRUE:PR_FALSE;
|
||||
|
||||
|
@ -1724,9 +1722,13 @@ aMimeType,PRBool aVerifyEnabled,PRBool aLastCall,nsDTDMode aMode){
|
|||
NS_IF_RELEASE(theDTD);
|
||||
}
|
||||
else {
|
||||
mParserContext->mStreamListenerState = (aLastCall) ? eOnStop:eOnDataAvail; // Fix 36148
|
||||
mParserContext->mScanner->Append(aSourceBuffer);
|
||||
if(!mParserContext->mPrevContext) {
|
||||
// Set stream listener state to eOnStop, on the final context - Fix 68160,
|
||||
// to guarantee DidBuildModel() call - Fix 36148
|
||||
if(aLastCall) {
|
||||
mParserContext->mStreamListenerState=eOnStop;
|
||||
}
|
||||
ResumeParse(PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -213,7 +213,7 @@ class nsParser : public nsIParser,
|
|||
* @param aState determines whether we parse/tokenize or just cache.
|
||||
* @return current state
|
||||
*/
|
||||
virtual nsresult ResumeParsing();
|
||||
virtual nsresult ContinueParsing();
|
||||
virtual void BlockParser();
|
||||
virtual void UnblockParser();
|
||||
virtual nsresult Terminate(void);
|
||||
|
|
|
@ -4619,7 +4619,7 @@ HTMLContentSink::ResumeParsing()
|
|||
{
|
||||
nsresult result=NS_OK;
|
||||
if (mParser) {
|
||||
result=mParser->ResumeParsing();
|
||||
result=mParser->ContinueParsing();
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -4820,7 +4820,10 @@ HTMLContentSink::OnStreamComplete(nsIStreamLoader* aLoader,
|
|||
}
|
||||
}
|
||||
|
||||
rv = ResumeParsing();
|
||||
if(mParser && mParser->IsParserEnabled()){
|
||||
rv=mParser->ContinueParsing();
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
//invalidate Xfer buffer content
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -703,7 +703,7 @@ CSSLoaderImpl::Cleanup(URLKey& aKey, SheetLoadData* aLoadData)
|
|||
if (data->mParserToUnblock) {
|
||||
if (!done && data->mDidBlockParser) {
|
||||
done = PR_TRUE;
|
||||
data->mParserToUnblock->ResumeParsing(); // this may result in re-entrant calls to loader
|
||||
data->mParserToUnblock->ContinueParsing(); // this may result in re-entrant calls to loader
|
||||
}
|
||||
// To reduce the risk of leaking a parser if we leak a SheetLoadData,
|
||||
// release the parser here.
|
||||
|
|
|
@ -1561,7 +1561,7 @@ NS_IMETHODIMP
|
|||
nsXMLContentSink::ResumeParsing()
|
||||
{
|
||||
if (mParser) {
|
||||
mParser->ResumeParsing();
|
||||
mParser->ContinueParsing();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -1684,7 +1684,10 @@ nsXMLContentSink::OnStreamComplete(nsIStreamLoader* aLoader,
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
rv = ResumeParsing();
|
||||
if(mParser && mParser->IsParserEnabled()){
|
||||
rv=mParser->ContinueParsing();
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return rv;
|
||||
|
|
|
@ -220,8 +220,8 @@ class nsIParser : public nsISupports {
|
|||
* be a proxy for the NGLayout content model).
|
||||
******************************************************************************************/
|
||||
|
||||
// This method enables the parser ( by calling UnblockParser() ) and resumes parsing.
|
||||
virtual nsresult ResumeParsing() =0;
|
||||
// Call this method to resume the parser from the blocked state..
|
||||
virtual nsresult ContinueParsing() =0;
|
||||
|
||||
// Stops parsing temporarily.
|
||||
virtual void BlockParser() =0;
|
||||
|
|
|
@ -1500,13 +1500,12 @@ nsresult nsParser::Terminate(void){
|
|||
|
||||
|
||||
/**
|
||||
* Call this when you want to toggle from the blocked state and resume parsing
|
||||
*
|
||||
* @update gess 1/29/99
|
||||
* @param aState determines whether we parse/tokenize or just cache.
|
||||
* @return current state
|
||||
*/
|
||||
nsresult nsParser::ResumeParsing(){
|
||||
nsresult nsParser::ContinueParsing(){
|
||||
|
||||
// If the stream has already finished, there's a good chance
|
||||
// that we might start closing things down when the parser
|
||||
|
@ -1515,8 +1514,7 @@ nsresult nsParser::ResumeParsing(){
|
|||
nsresult result=NS_OK;
|
||||
nsCOMPtr<nsIParser> kungFuDeathGrip(this);
|
||||
|
||||
// Enable the parser
|
||||
UnblockParser();
|
||||
mParserEnabled=PR_TRUE;
|
||||
|
||||
PRBool isFinalChunk=(mParserContext && mParserContext->mStreamListenerState==eOnStop)? PR_TRUE:PR_FALSE;
|
||||
|
||||
|
@ -1724,9 +1722,13 @@ aMimeType,PRBool aVerifyEnabled,PRBool aLastCall,nsDTDMode aMode){
|
|||
NS_IF_RELEASE(theDTD);
|
||||
}
|
||||
else {
|
||||
mParserContext->mStreamListenerState = (aLastCall) ? eOnStop:eOnDataAvail; // Fix 36148
|
||||
mParserContext->mScanner->Append(aSourceBuffer);
|
||||
if(!mParserContext->mPrevContext) {
|
||||
// Set stream listener state to eOnStop, on the final context - Fix 68160,
|
||||
// to guarantee DidBuildModel() call - Fix 36148
|
||||
if(aLastCall) {
|
||||
mParserContext->mStreamListenerState=eOnStop;
|
||||
}
|
||||
ResumeParse(PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -213,7 +213,7 @@ class nsParser : public nsIParser,
|
|||
* @param aState determines whether we parse/tokenize or just cache.
|
||||
* @return current state
|
||||
*/
|
||||
virtual nsresult ResumeParsing();
|
||||
virtual nsresult ContinueParsing();
|
||||
virtual void BlockParser();
|
||||
virtual void UnblockParser();
|
||||
virtual nsresult Terminate(void);
|
||||
|
|
Загрузка…
Ссылка в новой задаче