mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 02:02:45 +00:00 
			
		
		
		
	 1682f0b760
			
		
	
	
		1682f0b760
		
	
	
	
	
		
			
			SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
		
			
				
	
	
		
			62 lines
		
	
	
	
		
			1.7 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			62 lines
		
	
	
	
		
			1.7 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <AK/Function.h>
 | |
| #include <LibWeb/HTML/HTMLElement.h>
 | |
| 
 | |
| namespace Web::HTML {
 | |
| 
 | |
| class HTMLScriptElement final : public HTMLElement {
 | |
| public:
 | |
|     using WrapperType = Bindings::HTMLScriptElementWrapper;
 | |
| 
 | |
|     HTMLScriptElement(DOM::Document&, QualifiedName);
 | |
|     virtual ~HTMLScriptElement() override;
 | |
| 
 | |
|     bool is_non_blocking() const { return m_non_blocking; }
 | |
|     bool is_ready_to_be_parser_executed() const { return m_ready_to_be_parser_executed; }
 | |
|     bool failed_to_load() const { return m_failed_to_load; }
 | |
| 
 | |
|     void set_parser_document(Badge<HTMLDocumentParser>, DOM::Document&);
 | |
|     void set_non_blocking(Badge<HTMLDocumentParser>, bool);
 | |
|     void set_already_started(Badge<HTMLDocumentParser>, bool b) { m_already_started = b; }
 | |
|     void prepare_script(Badge<HTMLDocumentParser>) { prepare_script(); }
 | |
|     void execute_script();
 | |
| 
 | |
|     bool is_parser_inserted() const { return !!m_parser_document; }
 | |
| 
 | |
|     virtual void inserted() override;
 | |
| 
 | |
| private:
 | |
|     void prepare_script();
 | |
|     void script_became_ready();
 | |
|     void when_the_script_is_ready(Function<void()>);
 | |
| 
 | |
|     WeakPtr<DOM::Document> m_parser_document;
 | |
|     WeakPtr<DOM::Document> m_preparation_time_document;
 | |
|     bool m_non_blocking { false };
 | |
|     bool m_already_started { false };
 | |
|     bool m_from_an_external_file { false };
 | |
|     bool m_script_ready { false };
 | |
|     bool m_ready_to_be_parser_executed { false };
 | |
|     bool m_failed_to_load { false };
 | |
| 
 | |
|     enum class ScriptType {
 | |
|         Classic,
 | |
|         Module
 | |
|     };
 | |
| 
 | |
|     ScriptType m_script_type { ScriptType::Classic };
 | |
| 
 | |
|     Function<void()> m_script_ready_callback;
 | |
| 
 | |
|     String m_script_source;
 | |
|     String m_script_filename;
 | |
| };
 | |
| 
 | |
| }
 |