mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 19:22:45 +00:00 
			
		
		
		
	LibJS/Bytecode: Do note coerce referenced values to an Object too early
Converting a base value to an Object is performed by Reference::delete_. Doing this early in the bytecode operator could be observable, although it would likely be the first observable step in Reference::delete_ anyways. This will just align these operators with upcoming operators for super references, where doing this coercion first will be observable (we need to throw an exception for deleting a super property before this coercion).
This commit is contained in:
		
							parent
							
								
									a2e245fa97
								
							
						
					
					
						commit
						621d55ad65
					
				
					 1 changed files with 4 additions and 4 deletions
				
			
		|  | @ -619,10 +619,10 @@ ThrowCompletionOr<void> PutPrivateById::execute_impl(Bytecode::Interpreter& inte | |||
| ThrowCompletionOr<void> DeleteById::execute_impl(Bytecode::Interpreter& interpreter) const | ||||
| { | ||||
|     auto& vm = interpreter.vm(); | ||||
|     auto object = TRY(interpreter.accumulator().to_object(vm)); | ||||
|     auto base_value = interpreter.accumulator(); | ||||
|     auto const& identifier = interpreter.current_executable().get_identifier(m_property); | ||||
|     bool strict = vm.in_strict_mode(); | ||||
|     auto reference = Reference { object, identifier, {}, strict }; | ||||
|     auto reference = Reference { base_value, identifier, {}, strict }; | ||||
|     interpreter.accumulator() = Value(TRY(reference.delete_(vm))); | ||||
|     return {}; | ||||
| }; | ||||
|  | @ -1107,10 +1107,10 @@ ThrowCompletionOr<void> DeleteByValue::execute_impl(Bytecode::Interpreter& inter | |||
|     // NOTE: Get the property key from the accumulator before side effects have a chance to overwrite it.
 | ||||
|     auto property_key_value = interpreter.accumulator(); | ||||
| 
 | ||||
|     auto object = TRY(interpreter.reg(m_base).to_object(vm)); | ||||
|     auto base_value = interpreter.reg(m_base); | ||||
|     auto property_key = TRY(property_key_value.to_property_key(vm)); | ||||
|     bool strict = vm.in_strict_mode(); | ||||
|     auto reference = Reference { object, property_key, {}, strict }; | ||||
|     auto reference = Reference { base_value, property_key, {}, strict }; | ||||
|     interpreter.accumulator() = Value(TRY(reference.delete_(vm))); | ||||
|     return {}; | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Timothy Flynn
						Timothy Flynn