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(pending_script->Url().GetString(), | 342 EmitWarningForDocWriteScripts( |
343 *document_); | 343 pending_script->UrlForClassicScript().GetString(), *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->Url().GetString(), *document_); | 351 EmitErrorForDocWriteScripts(pending_script->UrlForClassicScript().GetString(), |
| 352 *document_); |
352 TextPosition starting_position = ParserBlockingScript()->StartingPosition(); | 353 TextPosition starting_position = ParserBlockingScript()->StartingPosition(); |
353 bool is_parser_inserted = script_loader->IsParserInserted(); | 354 bool is_parser_inserted = script_loader->IsParserInserted(); |
354 // Remove this resource entry from memory cache as the new request | 355 // Remove this resource entry from memory cache as the new request |
355 // should not join onto this existing entry. | 356 // should not join onto this existing entry. |
356 pending_script->RemoveFromMemoryCache(); | 357 pending_script->RemoveFromMemoryCache(); |
357 FetchBlockedDocWriteScript(element, is_parser_inserted, starting_position); | 358 FetchBlockedDocWriteScript(element, is_parser_inserted, starting_position); |
358 } | 359 } |
359 | 360 |
360 void HTMLParserScriptRunner::PendingScriptFinished( | 361 void HTMLParserScriptRunner::PendingScriptFinished( |
361 PendingScript* pending_script) { | 362 PendingScript* pending_script) { |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 | 680 |
680 DEFINE_TRACE(HTMLParserScriptRunner) { | 681 DEFINE_TRACE(HTMLParserScriptRunner) { |
681 visitor->Trace(document_); | 682 visitor->Trace(document_); |
682 visitor->Trace(host_); | 683 visitor->Trace(host_); |
683 visitor->Trace(parser_blocking_script_); | 684 visitor->Trace(parser_blocking_script_); |
684 visitor->Trace(scripts_to_execute_after_parsing_); | 685 visitor->Trace(scripts_to_execute_after_parsing_); |
685 PendingScriptClient::Trace(visitor); | 686 PendingScriptClient::Trace(visitor); |
686 } | 687 } |
687 | 688 |
688 } // namespace blink | 689 } // namespace blink |
OLD | NEW |