mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 18:22:45 +00:00 
			
		
		
		
	LibWeb: Make factory method of CSS::CSSStyleSheet fallible
This commit is contained in:
		
							parent
							
								
									4f4a908e5f
								
							
						
					
					
						commit
						a49ea467ad
					
				
					 3 changed files with 5 additions and 5 deletions
				
			
		|  | @ -14,9 +14,9 @@ | |||
| 
 | ||||
| namespace Web::CSS { | ||||
| 
 | ||||
| CSSStyleSheet* CSSStyleSheet::create(JS::Realm& realm, CSSRuleList& rules, MediaList& media, Optional<AK::URL> location) | ||||
| WebIDL::ExceptionOr<JS::NonnullGCPtr<CSSStyleSheet>> CSSStyleSheet::create(JS::Realm& realm, CSSRuleList& rules, MediaList& media, Optional<AK::URL> location) | ||||
| { | ||||
|     return realm.heap().allocate<CSSStyleSheet>(realm, realm, rules, media, move(location)).release_allocated_value_but_fixme_should_propagate_errors(); | ||||
|     return MUST_OR_THROW_OOM(realm.heap().allocate<CSSStyleSheet>(realm, realm, rules, media, move(location))); | ||||
| } | ||||
| 
 | ||||
| CSSStyleSheet::CSSStyleSheet(JS::Realm& realm, CSSRuleList& rules, MediaList& media, Optional<AK::URL> location) | ||||
|  |  | |||
|  | @ -24,7 +24,7 @@ class CSSStyleSheet final | |||
|     WEB_PLATFORM_OBJECT(CSSStyleSheet, StyleSheet); | ||||
| 
 | ||||
| public: | ||||
|     static CSSStyleSheet* create(JS::Realm&, CSSRuleList& rules, MediaList& media, Optional<AK::URL> location); | ||||
|     static WebIDL::ExceptionOr<JS::NonnullGCPtr<CSSStyleSheet>> create(JS::Realm&, CSSRuleList& rules, MediaList& media, Optional<AK::URL> location); | ||||
| 
 | ||||
|     virtual ~CSSStyleSheet() override = default; | ||||
| 
 | ||||
|  |  | |||
|  | @ -128,7 +128,7 @@ CSSStyleSheet* Parser::parse_as_css_stylesheet(Optional<AK::URL> location) | |||
|     } | ||||
| 
 | ||||
|     auto rule_list = CSSRuleList::create(m_context.realm(), rules).release_value_but_fixme_should_propagate_errors(); | ||||
|     return CSSStyleSheet::create(m_context.realm(), rule_list, *MediaList::create(m_context.realm(), {}), move(location)); | ||||
|     return CSSStyleSheet::create(m_context.realm(), rule_list, *MediaList::create(m_context.realm(), {}), move(location)).release_value_but_fixme_should_propagate_errors(); | ||||
| } | ||||
| 
 | ||||
| Optional<SelectorList> Parser::parse_as_selector(SelectorParsingMode parsing_mode) | ||||
|  | @ -7398,7 +7398,7 @@ CSS::CSSStyleSheet* parse_css_stylesheet(CSS::Parser::ParsingContext const& cont | |||
| { | ||||
|     if (css.is_empty()) { | ||||
|         auto rule_list = CSS::CSSRuleList::create_empty(context.realm()).release_value_but_fixme_should_propagate_errors(); | ||||
|         return CSS::CSSStyleSheet::create(context.realm(), rule_list, *CSS::MediaList::create(context.realm(), {}), location); | ||||
|         return CSS::CSSStyleSheet::create(context.realm(), rule_list, *CSS::MediaList::create(context.realm(), {}), location).release_value_but_fixme_should_propagate_errors(); | ||||
|     } | ||||
|     CSS::Parser::Parser parser(context, css); | ||||
|     return parser.parse_as_css_stylesheet(location); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Kenneth Myhra
						Kenneth Myhra