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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 ScriptElementBase* element = ParserBlockingScript()->GetElement(); | 332 ScriptElementBase* element = ParserBlockingScript()->GetElement(); |
333 | 333 |
334 ScriptLoader* script_loader = element->Loader(); | 334 ScriptLoader* script_loader = element->Loader(); |
335 if (!script_loader || !script_loader->DisallowedFetchForDocWrittenScript()) | 335 if (!script_loader || !script_loader->DisallowedFetchForDocWrittenScript()) |
336 return; | 336 return; |
337 | 337 |
338 // We don't allow document.write() and its intervention with module scripts. | 338 // We don't allow document.write() and its intervention with module scripts. |
339 CHECK_EQ(pending_script->GetScriptType(), ScriptType::kClassic); | 339 CHECK_EQ(pending_script->GetScriptType(), ScriptType::kClassic); |
340 | 340 |
341 if (!pending_script->ErrorOccurred()) { | 341 if (!pending_script->ErrorOccurred()) { |
342 EmitWarningForDocWriteScripts( | 342 EmitWarningForDocWriteScripts(pending_script->Url().GetString(), |
343 pending_script->UrlForClassicScript().GetString(), *document_); | 343 *document_); |
344 return; | 344 return; |
345 } | 345 } |
346 | 346 |
347 // Due to dependency violation, not able to check the exact error to be | 347 // Due to dependency violation, not able to check the exact error to be |
348 // ERR_CACHE_MISS but other errors are rare with | 348 // ERR_CACHE_MISS but other errors are rare with |
349 // WebCachePolicy::ReturnCacheDataDontLoad. | 349 // WebCachePolicy::ReturnCacheDataDontLoad. |
350 | 350 |
351 EmitErrorForDocWriteScripts(pending_script->UrlForClassicScript().GetString(), | 351 EmitErrorForDocWriteScripts(pending_script->Url().GetString(), *document_); |
352 *document_); | |
353 TextPosition starting_position = ParserBlockingScript()->StartingPosition(); | 352 TextPosition starting_position = ParserBlockingScript()->StartingPosition(); |
354 bool is_parser_inserted = script_loader->IsParserInserted(); | 353 bool is_parser_inserted = script_loader->IsParserInserted(); |
355 // Remove this resource entry from memory cache as the new request | 354 // Remove this resource entry from memory cache as the new request |
356 // should not join onto this existing entry. | 355 // should not join onto this existing entry. |
357 pending_script->RemoveFromMemoryCache(); | 356 pending_script->RemoveFromMemoryCache(); |
358 FetchBlockedDocWriteScript(element, is_parser_inserted, starting_position); | 357 FetchBlockedDocWriteScript(element, is_parser_inserted, starting_position); |
359 } | 358 } |
360 | 359 |
361 void HTMLParserScriptRunner::PendingScriptFinished( | 360 void HTMLParserScriptRunner::PendingScriptFinished( |
362 PendingScript* pending_script) { | 361 PendingScript* pending_script) { |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 | 679 |
681 DEFINE_TRACE(HTMLParserScriptRunner) { | 680 DEFINE_TRACE(HTMLParserScriptRunner) { |
682 visitor->Trace(document_); | 681 visitor->Trace(document_); |
683 visitor->Trace(host_); | 682 visitor->Trace(host_); |
684 visitor->Trace(parser_blocking_script_); | 683 visitor->Trace(parser_blocking_script_); |
685 visitor->Trace(scripts_to_execute_after_parsing_); | 684 visitor->Trace(scripts_to_execute_after_parsing_); |
686 PendingScriptClient::Trace(visitor); | 685 PendingScriptClient::Trace(visitor); |
687 } | 686 } |
688 | 687 |
689 } // namespace blink | 688 } // namespace blink |
OLD | NEW |