mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 22:12:44 +00:00 
			
		
		
		
	 8f9ed415a0
			
		
	
	
		8f9ed415a0
		
	
	
	
	
		
			
			This allows the garbage collector to keep HTML::Script objects alive and fixes a bug where a HTMLScriptElement could get GC'd while its code was executing.
		
			
				
	
	
		
			36 lines
		
	
	
	
		
			831 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
	
		
			831 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <AK/URL.h>
 | |
| #include <LibJS/Heap/Cell.h>
 | |
| #include <LibWeb/Forward.h>
 | |
| 
 | |
| namespace Web::HTML {
 | |
| 
 | |
| // https://html.spec.whatwg.org/multipage/webappapis.html#concept-script
 | |
| class Script : public JS::Cell {
 | |
|     JS_CELL(Script, JS::Cell);
 | |
| 
 | |
| public:
 | |
|     virtual ~Script() override;
 | |
| 
 | |
|     AK::URL const& base_url() const { return m_base_url; }
 | |
|     String const& filename() const { return m_filename; }
 | |
| 
 | |
|     EnvironmentSettingsObject& settings_object() { return m_settings_object; }
 | |
| 
 | |
| protected:
 | |
|     Script(AK::URL base_url, String filename, EnvironmentSettingsObject& environment_settings_object);
 | |
| 
 | |
| private:
 | |
|     AK::URL m_base_url;
 | |
|     String m_filename;
 | |
|     EnvironmentSettingsObject& m_settings_object;
 | |
| };
 | |
| 
 | |
| }
 |