| 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 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 if (!context_document) | 650 if (!context_document) |
| 651 return true; | 651 return true; |
| 652 | 652 |
| 653 LocalFrame* frame = context_document->GetFrame(); | 653 LocalFrame* frame = context_document->GetFrame(); |
| 654 if (!frame) | 654 if (!frame) |
| 655 return true; | 655 return true; |
| 656 | 656 |
| 657 const ContentSecurityPolicy* csp = | 657 const ContentSecurityPolicy* csp = |
| 658 element_document->GetContentSecurityPolicy(); | 658 element_document->GetContentSecurityPolicy(); |
| 659 bool should_bypass_main_world_csp = | 659 bool should_bypass_main_world_csp = |
| 660 (frame->Script().ShouldBypassMainWorldCSP()) || | 660 (frame->GetScriptController().ShouldBypassMainWorldCSP()) || |
| 661 csp->AllowScriptWithHash(source_code.Source(), | 661 csp->AllowScriptWithHash(source_code.Source(), |
| 662 ContentSecurityPolicy::InlineType::kBlock); | 662 ContentSecurityPolicy::InlineType::kBlock); |
| 663 | 663 |
| 664 AtomicString nonce = | 664 AtomicString nonce = |
| 665 element_->IsNonceableElement() ? element_->nonce() : g_null_atom; | 665 element_->IsNonceableElement() ? element_->nonce() : g_null_atom; |
| 666 if (!is_external_script_ && !should_bypass_main_world_csp && | 666 if (!is_external_script_ && !should_bypass_main_world_csp && |
| 667 !element_->AllowInlineScriptForCSP(nonce, start_line_number_, | 667 !element_->AllowInlineScriptForCSP(nonce, start_line_number_, |
| 668 source_code.Source())) { | 668 source_code.Source())) { |
| 669 return false; | 669 return false; |
| 670 } | 670 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 | 733 |
| 734 // 5. "Switch on the script's type:" | 734 // 5. "Switch on the script's type:" |
| 735 // - "classic": | 735 // - "classic": |
| 736 // 1. "If the script element's root is not a shadow root, | 736 // 1. "If the script element's root is not a shadow root, |
| 737 // then set the script element's node document's currentScript | 737 // then set the script element's node document's currentScript |
| 738 // attribute to the script element. Otherwise, set it to null." | 738 // attribute to the script element. Otherwise, set it to null." |
| 739 context_document->PushCurrentScript(element_.Get()); | 739 context_document->PushCurrentScript(element_.Get()); |
| 740 | 740 |
| 741 // 2. "Run the classic script given by the script's script." | 741 // 2. "Run the classic script given by the script's script." |
| 742 // Note: This is where the script is compiled and actually executed. | 742 // Note: This is where the script is compiled and actually executed. |
| 743 frame->Script().ExecuteScriptInMainWorld(source_code, access_control_status); | 743 frame->GetScriptController().ExecuteScriptInMainWorld(source_code, |
| 744 access_control_status); |
| 744 | 745 |
| 745 // - "module": | 746 // - "module": |
| 746 // TODO(hiroshige): Implement this. | 747 // TODO(hiroshige): Implement this. |
| 747 | 748 |
| 748 // 6. "Set the script element's node document's currentScript attribute | 749 // 6. "Set the script element's node document's currentScript attribute |
| 749 // to old script element." | 750 // to old script element." |
| 750 context_document->PopCurrentScript(element_.Get()); | 751 context_document->PopCurrentScript(element_.Get()); |
| 751 | 752 |
| 752 return true; | 753 return true; |
| 753 | 754 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 // then abort these steps at this point. The script is not executed. | 842 // then abort these steps at this point. The script is not executed. |
| 842 return EqualIgnoringCase(event_attribute, "onload") || | 843 return EqualIgnoringCase(event_attribute, "onload") || |
| 843 EqualIgnoringCase(event_attribute, "onload()"); | 844 EqualIgnoringCase(event_attribute, "onload()"); |
| 844 } | 845 } |
| 845 | 846 |
| 846 String ScriptLoader::ScriptContent() const { | 847 String ScriptLoader::ScriptContent() const { |
| 847 return element_->TextFromChildren(); | 848 return element_->TextFromChildren(); |
| 848 } | 849 } |
| 849 | 850 |
| 850 } // namespace blink | 851 } // namespace blink |
| OLD | NEW |