@@ -85,7 +85,7 @@ pub const Page = struct {
8585
8686 // Our JavaScript context for this specific page. This is what we use to
8787 // execute any JavaScript
88- scope : * Env.Scope ,
88+ main_context : * Env.JsContext ,
8989
9090 // List of modules currently fetched/loaded.
9191 module_map : std .StringHashMapUnmanaged ([]const u8 ),
@@ -118,13 +118,13 @@ pub const Page = struct {
118118 .request_factory = browser .http_client .requestFactory (.{
119119 .notification = browser .notification ,
120120 }),
121- .scope = undefined ,
121+ .main_context = undefined ,
122122 .module_map = .empty ,
123123 };
124- self .scope = try session .executor .startScope (& self .window , self , self , true );
124+ self .main_context = try session .executor .createJsContext (& self .window , self , self , true );
125125
126126 // load polyfills
127- try polyfill .load (self .arena , self .scope );
127+ try polyfill .load (self .arena , self .main_context );
128128
129129 _ = try session .browser .app .loop .timeout (1 * std .time .ns_per_ms , & self .microtask_node );
130130 }
@@ -166,7 +166,7 @@ pub const Page = struct {
166166
167167 pub fn wait (self : * Page ) ! void {
168168 var try_catch : Env.TryCatch = undefined ;
169- try_catch .init (self .scope );
169+ try_catch .init (self .main_context );
170170 defer try_catch .deinit ();
171171
172172 try self .session .browser .app .loop .run ();
@@ -798,7 +798,7 @@ pub const Page = struct {
798798
799799 pub fn stackTrace (self : * Page ) ! ? []const u8 {
800800 if (comptime builtin .mode == .Debug ) {
801- return self .scope .stackTrace ();
801+ return self .main_context .stackTrace ();
802802 }
803803 return null ;
804804 }
@@ -818,7 +818,7 @@ const DelayedNavigation = struct {
818818 //
819819 // In the first phase, when self.initial == true, we'll shutdown the page
820820 // and create a new one. The shutdown is important, because it resets the
821- // loop ctx_id and closes the scope. Closing the scope calls our XHR
821+ // loop ctx_id and removes the JsContext. Removing the context calls our XHR
822822 // destructors which aborts requests. This is necessary to make sure our
823823 // [blocking] navigate won't block.
824824 //
@@ -982,14 +982,14 @@ const Script = struct {
982982
983983 fn eval (self : * const Script , page : * Page , body : []const u8 ) ! void {
984984 var try_catch : Env.TryCatch = undefined ;
985- try_catch .init (page .scope );
985+ try_catch .init (page .main_context );
986986 defer try_catch .deinit ();
987987
988988 const src = self .src orelse "inline" ;
989989 _ = switch (self .kind ) {
990- .javascript = > page .scope .exec (body , src ),
990+ .javascript = > page .main_context .exec (body , src ),
991991 .module = > blk : {
992- switch (try page .scope .module (body , src )) {
992+ switch (try page .main_context .module (body , src )) {
993993 .value = > | v | break :blk v ,
994994 .exception = > | e | {
995995 log .warn (.user_script , "eval module" , .{
@@ -1023,9 +1023,9 @@ const Script = struct {
10231023 switch (callback ) {
10241024 .string = > | str | {
10251025 var try_catch : Env.TryCatch = undefined ;
1026- try_catch .init (page .scope );
1026+ try_catch .init (page .main_context );
10271027 defer try_catch .deinit ();
1028- _ = page .scope .exec (str , typ ) catch {
1028+ _ = page .main_context .exec (str , typ ) catch {
10291029 if (try try_catch .err (page .arena )) | msg | {
10301030 log .warn (.user_script , "script callback" , .{
10311031 .src = self .src ,
0 commit comments