OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights |
6 * reserved. | 6 * reserved. |
7 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> | 7 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 DCHECK(m_element); | 516 DCHECK(m_element); |
517 | 517 |
518 Document* elementDocument = &(m_element->document()); | 518 Document* elementDocument = &(m_element->document()); |
519 if (!m_element->isConnected() || m_element->document() != elementDocument) | 519 if (!m_element->isConnected() || m_element->document() != elementDocument) |
520 return false; | 520 return false; |
521 | 521 |
522 DCHECK(!m_resource); | 522 DCHECK(!m_resource); |
523 // 21. "If the element has a src content attribute, run these substeps:" | 523 // 21. "If the element has a src content attribute, run these substeps:" |
524 if (!stripLeadingAndTrailingHTMLSpaces(sourceUrl).isEmpty()) { | 524 if (!stripLeadingAndTrailingHTMLSpaces(sourceUrl).isEmpty()) { |
525 // 21.4. "Parse src relative to the element's node document." | 525 // 21.4. "Parse src relative to the element's node document." |
526 FetchRequest request( | 526 ResourceRequest resourceRequest(elementDocument->completeURL(sourceUrl)); |
527 ResourceRequest(elementDocument->completeURL(sourceUrl)), | 527 |
528 m_element->localName()); | 528 // [Intervention] |
| 529 if (m_documentWriteIntervention == |
| 530 DocumentWriteIntervention::FetchDocWrittenScriptDeferIdle) { |
| 531 resourceRequest.setHTTPHeaderField( |
| 532 "Intervention", |
| 533 "<https://www.chromestatus.com/feature/5718547946799104>"); |
| 534 } |
| 535 |
| 536 FetchRequest request(resourceRequest, m_element->localName()); |
529 | 537 |
530 // 15. "Let CORS setting be the current state of the element's | 538 // 15. "Let CORS setting be the current state of the element's |
531 // crossorigin content attribute." | 539 // crossorigin content attribute." |
532 CrossOriginAttributeValue crossOrigin = crossOriginAttributeValue( | 540 CrossOriginAttributeValue crossOrigin = crossOriginAttributeValue( |
533 m_element->fastGetAttribute(HTMLNames::crossoriginAttr)); | 541 m_element->fastGetAttribute(HTMLNames::crossoriginAttr)); |
534 | 542 |
535 // 16. "Let module script credentials mode be determined by switching | 543 // 16. "Let module script credentials mode be determined by switching |
536 // on CORS setting:" | 544 // on CORS setting:" |
537 // TODO(hiroshige): Implement this step for "module". | 545 // TODO(hiroshige): Implement this step for "module". |
538 | 546 |
(...skipping 24 matching lines...) Expand all Loading... |
563 // Otherwise, let integrity metadata be the empty string." | 571 // Otherwise, let integrity metadata be the empty string." |
564 String integrityAttr = | 572 String integrityAttr = |
565 m_element->fastGetAttribute(HTMLNames::integrityAttr); | 573 m_element->fastGetAttribute(HTMLNames::integrityAttr); |
566 if (!integrityAttr.isEmpty()) { | 574 if (!integrityAttr.isEmpty()) { |
567 IntegrityMetadataSet metadataSet; | 575 IntegrityMetadataSet metadataSet; |
568 SubresourceIntegrity::parseIntegrityAttribute(integrityAttr, metadataSet, | 576 SubresourceIntegrity::parseIntegrityAttribute(integrityAttr, metadataSet, |
569 elementDocument); | 577 elementDocument); |
570 request.setIntegrityMetadata(metadataSet); | 578 request.setIntegrityMetadata(metadataSet); |
571 } | 579 } |
572 | 580 |
573 // [Intervention] | |
574 if (m_documentWriteIntervention == | |
575 DocumentWriteIntervention::FetchDocWrittenScriptDeferIdle) { | |
576 request.mutableResourceRequest().setHTTPHeaderField( | |
577 "Intervention", | |
578 "<https://www.chromestatus.com/feature/5718547946799104>"); | |
579 } | |
580 | |
581 // 21.6. "Switch on the script's type:" | 581 // 21.6. "Switch on the script's type:" |
582 | 582 |
583 // - "classic": | 583 // - "classic": |
584 // "Fetch a classic script given url, settings, cryptographic nonce, | 584 // "Fetch a classic script given url, settings, cryptographic nonce, |
585 // integrity metadata, parser state, CORS setting, and encoding." | 585 // integrity metadata, parser state, CORS setting, and encoding." |
586 m_resource = ScriptResource::fetch(request, elementDocument->fetcher()); | 586 m_resource = ScriptResource::fetch(request, elementDocument->fetcher()); |
587 | 587 |
588 // - "module": | 588 // - "module": |
589 // "Fetch a module script graph given url, settings, "script", | 589 // "Fetch a module script graph given url, settings, "script", |
590 // cryptographic nonce, parser state, and | 590 // cryptographic nonce, parser state, and |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 if (isHTMLScriptLoader(element)) | 915 if (isHTMLScriptLoader(element)) |
916 return toHTMLScriptElement(element)->loader(); | 916 return toHTMLScriptElement(element)->loader(); |
917 | 917 |
918 if (isSVGScriptLoader(element)) | 918 if (isSVGScriptLoader(element)) |
919 return toSVGScriptElement(element)->loader(); | 919 return toSVGScriptElement(element)->loader(); |
920 | 920 |
921 return 0; | 921 return 0; |
922 } | 922 } |
923 | 923 |
924 } // namespace blink | 924 } // namespace blink |
OLD | NEW |