OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. | 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 return false; | 281 return false; |
282 } | 282 } |
283 | 283 |
284 // FIXME: It's wrong for the HTMLDocumentParser to reach back to the | 284 // FIXME: It's wrong for the HTMLDocumentParser to reach back to the |
285 // Frame, but this approach is how the old parser handled | 285 // Frame, but this approach is how the old parser handled |
286 // stopping when the page assigns window.location. What really | 286 // stopping when the page assigns window.location. What really |
287 // should happen is that assigning window.location causes the | 287 // should happen is that assigning window.location causes the |
288 // parser to stop parsing cleanly. The problem is we're not | 288 // parser to stop parsing cleanly. The problem is we're not |
289 // perpared to do that at every point where we run JavaScript. | 289 // perpared to do that at every point where we run JavaScript. |
290 if (!isParsingFragment() | 290 if (!isParsingFragment() |
291 && document()->frame() && document()->frame()->navigationScheduler()->lo
cationChangePending()) | 291 && document()->frame() && document()->frame()->navigationScheduler().loc
ationChangePending()) |
292 return false; | 292 return false; |
293 | 293 |
294 if (mode == AllowYield) | 294 if (mode == AllowYield) |
295 m_parserScheduler->checkForYieldBeforeToken(session); | 295 m_parserScheduler->checkForYieldBeforeToken(session); |
296 | 296 |
297 return true; | 297 return true; |
298 } | 298 } |
299 | 299 |
300 void HTMLDocumentParser::didReceiveParsedChunkFromBackgroundParser(PassOwnPtr<Pa
rsedChunk> chunk) | 300 void HTMLDocumentParser::didReceiveParsedChunkFromBackgroundParser(PassOwnPtr<Pa
rsedChunk> chunk) |
301 { | 301 { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 m_textPosition = (*it)->m_textPosition; | 404 m_textPosition = (*it)->m_textPosition; |
405 m_xssAuditorDelegate.didBlockScript(**it); | 405 m_xssAuditorDelegate.didBlockScript(**it); |
406 if (isStopped()) | 406 if (isStopped()) |
407 break; | 407 break; |
408 } | 408 } |
409 | 409 |
410 for (Vector<CompactHTMLToken>::const_iterator it = tokens->begin(); it != to
kens->end(); ++it) { | 410 for (Vector<CompactHTMLToken>::const_iterator it = tokens->begin(); it != to
kens->end(); ++it) { |
411 ASSERT(!isWaitingForScripts()); | 411 ASSERT(!isWaitingForScripts()); |
412 | 412 |
413 if (!isParsingFragment() | 413 if (!isParsingFragment() |
414 && document()->frame() && document()->frame()->navigationScheduler()
->locationChangePending()) { | 414 && document()->frame() && document()->frame()->navigationScheduler()
.locationChangePending()) { |
415 | 415 |
416 // To match main-thread parser behavior (which never checks location
ChangePending on the EOF path) | 416 // To match main-thread parser behavior (which never checks location
ChangePending on the EOF path) |
417 // we peek to see if this chunk has an EOF and process it anyway. | 417 // we peek to see if this chunk has an EOF and process it anyway. |
418 if (tokens->last().type() == HTMLToken::EndOfFile) { | 418 if (tokens->last().type() == HTMLToken::EndOfFile) { |
419 ASSERT(m_speculations.isEmpty()); // There should never be any c
hunks after the EOF. | 419 ASSERT(m_speculations.isEmpty()); // There should never be any c
hunks after the EOF. |
420 prepareToStopParsing(); | 420 prepareToStopParsing(); |
421 } | 421 } |
422 break; | 422 break; |
423 } | 423 } |
424 | 424 |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
959 m_parserScheduler->suspend(); | 959 m_parserScheduler->suspend(); |
960 } | 960 } |
961 | 961 |
962 void HTMLDocumentParser::resumeScheduledTasks() | 962 void HTMLDocumentParser::resumeScheduledTasks() |
963 { | 963 { |
964 if (m_parserScheduler) | 964 if (m_parserScheduler) |
965 m_parserScheduler->resume(); | 965 m_parserScheduler->resume(); |
966 } | 966 } |
967 | 967 |
968 } | 968 } |
OLD | NEW |