2023-03-05 23:58:47 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								/*
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  Copyright  ( c )  2023 ,  Linus  Groh  < linusg @ serenityos . org > 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-22 19:12:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								 *  Copyright  ( c )  2023 ,  Luke  Wilde  < lukew @ serenityos . org > 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-05 23:58:47 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  SPDX - License - Identifier :  BSD - 2 - Clause 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# pragma once 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-03-22 19:12:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <AK/FlyString.h> 
  
						 
					
						
							
								
									
										
										
										
											2023-03-05 23:58:47 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  <AK/Forward.h> 
  
						 
					
						
							
								
									
										
										
										
											2023-03-14 06:59:23 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <AK/HashMap.h> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  <AK/IDAllocator.h> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  <AK/Variant.h> 
  
						 
					
						
							
								
									
										
										
										
											2023-03-05 23:58:47 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  <LibWeb/Bindings/PlatformObject.h> 
  
						 
					
						
							
								
									
										
										
										
											2023-03-07 18:15:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <LibWeb/Fetch/Request.h> 
  
						 
					
						
							
								
									
										
										
										
											2023-03-05 23:58:47 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  <LibWeb/Forward.h> 
  
						 
					
						
							
								
									
										
										
										
											2024-04-04 21:48:58 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <LibWeb/HTML/ImageBitmap.h> 
  
						 
					
						
							
								
									
										
										
										
											2023-03-22 19:12:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <LibWeb/PerformanceTimeline/PerformanceEntry.h> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  <LibWeb/PerformanceTimeline/PerformanceEntryTuple.h> 
  
						 
					
						
							
								
									
										
										
										
											2023-03-05 23:58:47 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								namespace  Web : : HTML  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-03-14 06:59:23 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// https://html.spec.whatwg.org/#timerhandler
  
						 
					
						
							
								
									
										
										
										
											2023-09-27 14:55:47 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								using  TimerHandler  =  Variant < JS : : NonnullGCPtr < WebIDL : : CallbackType > ,  String > ;  
						 
					
						
							
								
									
										
										
										
											2023-03-14 06:59:23 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-03-05 23:58:47 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// https://html.spec.whatwg.org/multipage/webappapis.html#windoworworkerglobalscope
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								class  WindowOrWorkerGlobalScopeMixin  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								public :  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    virtual  ~ WindowOrWorkerGlobalScopeMixin ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    virtual  Bindings : : PlatformObject &  this_impl ( )  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    virtual  Bindings : : PlatformObject  const &  this_impl ( )  const  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // JS API functions
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    WebIDL : : ExceptionOr < String >  origin ( )  const ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    bool  is_secure_context ( )  const ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    bool  cross_origin_isolated ( )  const ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    WebIDL : : ExceptionOr < String >  btoa ( String  const &  data )  const ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    WebIDL : : ExceptionOr < String >  atob ( String  const &  data )  const ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 18:25:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    void  queue_microtask ( WebIDL : : CallbackType & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-04 21:48:58 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    JS : : NonnullGCPtr < JS : : Promise >  create_image_bitmap ( ImageBitmapSource  image ,  Optional < ImageBitmapOptions >  options  =  { } )  const ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    JS : : NonnullGCPtr < JS : : Promise >  create_image_bitmap ( ImageBitmapSource  image ,  WebIDL : : Long  sx ,  WebIDL : : Long  sy ,  WebIDL : : Long  sw ,  WebIDL : : Long  sh ,  Optional < ImageBitmapOptions >  options  =  { } )  const ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 18:21:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    WebIDL : : ExceptionOr < JS : : Value >  structured_clone ( JS : : Value ,  StructuredSerializeOptions  const & )  const ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-07 18:15:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    JS : : NonnullGCPtr < JS : : Promise >  fetch ( Fetch : : RequestInfo  const & ,  Fetch : : RequestInit  const & )  const ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-14 06:59:23 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    i32  set_timeout ( TimerHandler ,  i32  timeout ,  JS : : MarkedVector < JS : : Value >  arguments ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    i32  set_interval ( TimerHandler ,  i32  timeout ,  JS : : MarkedVector < JS : : Value >  arguments ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    void  clear_timeout ( i32 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    void  clear_interval ( i32 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-26 11:44:56 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    void  clear_map_of_active_timers ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-14 06:59:23 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-03-23 17:07:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    PerformanceTimeline : : PerformanceEntryTuple &  relevant_performance_entry_tuple ( FlyString  const &  entry_type ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-25 01:26:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    void  queue_performance_entry ( JS : : NonnullGCPtr < PerformanceTimeline : : PerformanceEntry >  new_entry ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-23 17:07:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    void  clear_performance_entry_buffer ( Badge < HighResolutionTime : : Performance > ,  FlyString  const &  entry_type ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    void  remove_entries_from_performance_entry_buffer ( Badge < HighResolutionTime : : Performance > ,  FlyString  const &  entry_type ,  String  entry_name ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-03-22 19:12:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ErrorOr < Vector < JS : : Handle < PerformanceTimeline : : PerformanceEntry > > >  filter_buffer_map_by_name_and_type ( Optional < String >  name ,  Optional < String >  type )  const ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-25 01:26:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    void  register_performance_observer ( Badge < PerformanceTimeline : : PerformanceObserver > ,  JS : : NonnullGCPtr < PerformanceTimeline : : PerformanceObserver > ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    void  unregister_performance_observer ( Badge < PerformanceTimeline : : PerformanceObserver > ,  JS : : NonnullGCPtr < PerformanceTimeline : : PerformanceObserver > ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    bool  has_registered_performance_observer ( JS : : NonnullGCPtr < PerformanceTimeline : : PerformanceObserver > ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    void  queue_the_performance_observer_task ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-04-05 13:33:41 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    void  register_event_source ( Badge < EventSource > ,  JS : : NonnullGCPtr < EventSource > ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    void  unregister_event_source ( Badge < EventSource > ,  JS : : NonnullGCPtr < EventSource > ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    void  forcibly_close_all_event_sources ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-02-26 17:52:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    void  run_steps_after_a_timeout ( i32  timeout ,  Function < void ( ) >  completion_step ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-03-30 10:04:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    [ [ nodiscard ] ]  JS : : NonnullGCPtr < HighResolutionTime : : Performance >  performance ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-04-01 14:03:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    JS : : NonnullGCPtr < JS : : Object >  supported_entry_types ( )  const ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-05-19 17:58:06 +12:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    JS : : NonnullGCPtr < IndexedDB : : IDBFactory >  indexed_db ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-07-04 00:28:49 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    void  report_error ( JS : : Value  e ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-26 15:40:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    void  report_an_exception ( JS : : Value  const &  e ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-07-04 00:28:49 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-09-17 16:44:42 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    [ [ nodiscard ] ]  JS : : NonnullGCPtr < Crypto : : Crypto >  crypto ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-03-14 06:59:23 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								protected :  
						 
					
						
							
								
									
										
										
										
											2023-08-07 08:41:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    void  initialize ( JS : : Realm & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-14 06:59:23 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    void  visit_edges ( JS : : Cell : : Visitor & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-03 10:10:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    void  finalize ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-14 06:59:23 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								private :  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    enum  class  Repeat  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        Yes , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        No , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-12 23:14:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    i32  run_timer_initialization_steps ( TimerHandler  handler ,  i32  timeout ,  JS : : MarkedVector < JS : : Value >  arguments ,  Repeat  repeat ,  Optional < i32 >  previous_id  =  { } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-02-26 17:52:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    void  run_steps_after_a_timeout_impl ( i32  timeout ,  Function < void ( ) >  completion_step ,  Optional < i32 >  timer_key  =  { } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-14 06:59:23 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-04-04 21:48:58 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    JS : : NonnullGCPtr < JS : : Promise >  create_image_bitmap_impl ( ImageBitmapSource &  image ,  Optional < WebIDL : : Long >  sx ,  Optional < WebIDL : : Long >  sy ,  Optional < WebIDL : : Long >  sw ,  Optional < WebIDL : : Long >  sh ,  Optional < ImageBitmapOptions > &  options )  const ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-03-14 06:59:23 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    IDAllocator  m_timer_id_allocator ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    HashMap < int ,  JS : : NonnullGCPtr < Timer > >  m_timers ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-22 19:12:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // https://www.w3.org/TR/performance-timeline/#performance-timeline
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // Each global object has:
 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-25 01:26:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    // - a performance observer task queued flag
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    bool  m_performance_observer_task_queued  {  false  } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // - a list of registered performance observer objects that is initially empty
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    OrderedHashTable < JS : : NonnullGCPtr < PerformanceTimeline : : PerformanceObserver > >  m_registered_performance_observer_objects ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-22 19:12:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // https://www.w3.org/TR/performance-timeline/#dfn-performance-entry-buffer-map
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // a performance entry buffer map map, keyed on a DOMString, representing the entry type to which the buffer belongs. The map's value is the following tuple:
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // NOTE: See the PerformanceEntryTuple struct above for the map's value tuple.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    OrderedHashMap < FlyString ,  PerformanceTimeline : : PerformanceEntryTuple >  m_performance_entry_buffer_map ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-03-30 10:04:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-04-05 13:33:41 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    HashTable < JS : : NonnullGCPtr < EventSource > >  m_registered_event_sources ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-03-30 10:04:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    JS : : GCPtr < HighResolutionTime : : Performance >  m_performance ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-01 14:03:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-05-19 17:58:06 +12:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    JS : : GCPtr < IndexedDB : : IDBFactory >  m_indexed_db ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-04-01 14:03:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    mutable  JS : : GCPtr < JS : : Object >  m_supported_entry_types_array ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-07-04 00:28:49 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-09-17 16:44:42 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    JS : : GCPtr < Crypto : : Crypto >  m_crypto ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-07-04 00:28:49 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    bool  m_error_reporting_mode  {  false  } ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-05 23:58:47 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								} ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}