mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 06:22:46 +00:00 
			
		
		
		
	 50428ea8d2
			
		
	
	
		50428ea8d2
		
	
	
	
	
		
			
			Intrinsics, i.e. mostly constructor and prototype objects, but also things like empty and new object shape now live on a new heap-allocated JS::Intrinsics object, thus completing the long journey of taking all the magic away from the global object. This represents the Realm's [[Intrinsics]] slot in the spec and matches its existing [[GlobalObject]] / [[GlobalEnv]] slots in terms of architecture. In the majority of cases it should now be possibly to fully allocate a regular object without the global object existing, and in fact that's what we do now - the realm is allocated before the global object, and the intrinsics between both :^)
		
			
				
	
	
		
			32 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2021-2022, Linus Groh <linusg@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include <LibJS/Contrib/Test262/IsHTMLDDA.h>
 | |
| #include <LibJS/Runtime/GlobalObject.h>
 | |
| 
 | |
| namespace JS::Test262 {
 | |
| 
 | |
| IsHTMLDDA::IsHTMLDDA(Realm& realm)
 | |
|     // NativeFunction without prototype is currently not possible (only due to the lack of a ctor that supports it)
 | |
|     : NativeFunction("IsHTMLDDA", *realm.intrinsics().function_prototype())
 | |
| {
 | |
| }
 | |
| 
 | |
| ThrowCompletionOr<Value> IsHTMLDDA::call()
 | |
| {
 | |
|     auto& vm = this->vm();
 | |
|     if (vm.argument_count() == 0)
 | |
|         return js_null();
 | |
|     if (vm.argument(0).is_string() && vm.argument(0).as_string().string().is_empty())
 | |
|         return js_null();
 | |
|     // Not sure if this really matters, INTERPRETING.md simply says:
 | |
|     // * IsHTMLDDA - (present only in implementations that can provide it) an object that:
 | |
|     //   a. has an [[IsHTMLDDA]] internal slot, and
 | |
|     //   b. when called with no arguments or with the first argument "" (an empty string) returns null.
 | |
|     return js_undefined();
 | |
| }
 | |
| 
 | |
| }
 |