mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-11-04 07:10:57 +00:00 
			
		
		
		
	LibJS+LibWeb: Port interned bytecode strings to UTF-16
This was almost a no-op, except we intern JS exception messages. So the bulk of this patch is porting exception messages to UTF-16.
This commit is contained in:
		
							parent
							
								
									cf61171864
								
							
						
					
					
						commit
						70db474cf0
					
				
				
				Notes:
				
					github-actions[bot]
				
				2025-08-14 08:28:16 +00:00 
				
			
			Author: https://github.com/trflynn89
Commit: 70db474cf0
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5845
Reviewed-by: https://github.com/gmta ✅
			
					 162 changed files with 1405 additions and 1422 deletions
				
			
		| 
						 | 
				
			
			@ -35,18 +35,18 @@ WebIDL::ExceptionOr<GC::Ref<ScriptProcessorNode>> ScriptProcessorNode::create(JS
 | 
			
		|||
    // IndexSizeError MUST be thrown.
 | 
			
		||||
    if (number_of_input_channels == 0 && number_of_output_channels == 0) {
 | 
			
		||||
        return WebIDL::IndexSizeError::create(realm,
 | 
			
		||||
            "Number of input and output channels cannot both be zero in a ScriptProcessorNode"_string);
 | 
			
		||||
            "Number of input and output channels cannot both be zero in a ScriptProcessorNode"_utf16);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // This parameter determines the number of channels for this node’s input. The default value is 2. Values of up to
 | 
			
		||||
    // 32 must be supported. A NotSupportedError must be thrown if the number of channels is not supported.
 | 
			
		||||
    if (number_of_input_channels > BaseAudioContext::MAX_NUMBER_OF_CHANNELS)
 | 
			
		||||
        return WebIDL::NotSupportedError::create(realm, "Invalid number of input channels"_string);
 | 
			
		||||
        return WebIDL::NotSupportedError::create(realm, "Invalid number of input channels"_utf16);
 | 
			
		||||
 | 
			
		||||
    // This parameter determines the number of channels for this node’s output. The default value is 2. Values of up to
 | 
			
		||||
    // 32 must be supported. A NotSupportedError must be thrown if the number of channels is not supported.
 | 
			
		||||
    if (number_of_output_channels > BaseAudioContext::MAX_NUMBER_OF_CHANNELS)
 | 
			
		||||
        return WebIDL::NotSupportedError::create(realm, "Invalid number of output channels"_string);
 | 
			
		||||
        return WebIDL::NotSupportedError::create(realm, "Invalid number of output channels"_utf16);
 | 
			
		||||
 | 
			
		||||
    auto script_processor_node = realm.create<ScriptProcessorNode>(realm, context,
 | 
			
		||||
        number_of_input_channels, number_of_output_channels);
 | 
			
		||||
| 
						 | 
				
			
			@ -79,8 +79,7 @@ WebIDL::ExceptionOr<void> ScriptProcessorNode::set_channel_count(WebIDL::Unsigne
 | 
			
		|||
{
 | 
			
		||||
    // ScriptProcessorNode: The channel count cannot be changed, and an NotSupportedError exception MUST be thrown for
 | 
			
		||||
    // any attempt to change the value.
 | 
			
		||||
    return WebIDL::InvalidStateError::create(realm(),
 | 
			
		||||
        "Cannot modify channel count in a ScriptProcessorNode"_string);
 | 
			
		||||
    return WebIDL::InvalidStateError::create(realm(), "Cannot modify channel count in a ScriptProcessorNode"_utf16);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
WebIDL::ExceptionOr<void> ScriptProcessorNode::set_channel_count_mode(Bindings::ChannelCountMode channel_count_mode)
 | 
			
		||||
| 
						 | 
				
			
			@ -89,7 +88,7 @@ WebIDL::ExceptionOr<void> ScriptProcessorNode::set_channel_count_mode(Bindings::
 | 
			
		|||
    // ScriptProcessorNode: The channel count mode cannot be changed from "explicit" and an NotSupportedError exception
 | 
			
		||||
    // MUST be thrown for any attempt to change the value.
 | 
			
		||||
    if (channel_count_mode != Bindings::ChannelCountMode::Explicit)
 | 
			
		||||
        return WebIDL::InvalidStateError::create(realm(), "Channel count mode must be 'explicit'"_string);
 | 
			
		||||
        return WebIDL::InvalidStateError::create(realm(), "Channel count mode must be 'explicit'"_utf16);
 | 
			
		||||
 | 
			
		||||
    return AudioNode::set_channel_count_mode(channel_count_mode);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -116,7 +115,7 @@ WebIDL::ExceptionOr<void> ScriptProcessorNode::set_buffer_size(WebIDL::Long buff
 | 
			
		|||
    // If the value of this parameter is not one of the allowed power-of-2 values listed above, an IndexSizeError MUST
 | 
			
		||||
    // be thrown.
 | 
			
		||||
    if (!first_is_one_of(buffer_size, 256, 512, 1024, 2048, 4096, 8192, 16384))
 | 
			
		||||
        return WebIDL::IndexSizeError::create(realm(), "Unsupported buffer size for a ScriptProcessorNode"_string);
 | 
			
		||||
        return WebIDL::IndexSizeError::create(realm(), "Unsupported buffer size for a ScriptProcessorNode"_utf16);
 | 
			
		||||
 | 
			
		||||
    m_buffer_size = buffer_size;
 | 
			
		||||
    return {};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue