@@ -84,7 +84,7 @@ pub const Page = struct {
8484
8585 // Our JavaScript context for this specific page. This is what we use to
8686 // execute any JavaScript
87- scope : * Env.Scope ,
87+ main_context : * Env.JsContext ,
8888
8989 // List of modules currently fetched/loaded.
9090 module_map : std .StringHashMapUnmanaged ([]const u8 ),
@@ -116,13 +116,13 @@ pub const Page = struct {
116116 .request_factory = browser .http_client .requestFactory (.{
117117 .notification = browser .notification ,
118118 }),
119- .scope = undefined ,
119+ .main_context = undefined ,
120120 .module_map = .empty ,
121121 };
122- self .scope = try session .executor .startScope (& self .window , self , self , true );
122+ self .main_context = try session .executor .createJsContext (& self .window , self , self , true );
123123
124124 // load polyfills
125- try polyfill .load (self .arena , self .scope );
125+ try polyfill .load (self .arena , self .main_context );
126126
127127 _ = try session .browser .app .loop .timeout (1 * std .time .ns_per_ms , & self .microtask_node );
128128 }
@@ -164,7 +164,7 @@ pub const Page = struct {
164164
165165 pub fn wait (self : * Page ) ! void {
166166 var try_catch : Env.TryCatch = undefined ;
167- try_catch .init (self .scope );
167+ try_catch .init (self .main_context );
168168 defer try_catch .deinit ();
169169
170170 try self .session .browser .app .loop .run ();
@@ -691,7 +691,7 @@ pub const Page = struct {
691691
692692 pub fn stackTrace (self : * Page ) ! ? []const u8 {
693693 if (comptime builtin .mode == .Debug ) {
694- return self .scope .stackTrace ();
694+ return self .main_context .stackTrace ();
695695 }
696696 return null ;
697697 }
@@ -808,14 +808,14 @@ const Script = struct {
808808
809809 fn eval (self : * const Script , page : * Page , body : []const u8 ) ! void {
810810 var try_catch : Env.TryCatch = undefined ;
811- try_catch .init (page .scope );
811+ try_catch .init (page .main_context );
812812 defer try_catch .deinit ();
813813
814814 const src = self .src orelse "inline" ;
815815 _ = switch (self .kind ) {
816- .javascript = > page .scope .exec (body , src ),
816+ .javascript = > page .main_context .exec (body , src ),
817817 .module = > blk : {
818- switch (try page .scope .module (body , src )) {
818+ switch (try page .main_context .module (body , src )) {
819819 .value = > | v | break :blk v ,
820820 .exception = > | e | {
821821 log .warn (.user_script , "eval module" , .{
@@ -841,9 +841,9 @@ const Script = struct {
841841 switch (callback ) {
842842 .string = > | str | {
843843 var try_catch : Env.TryCatch = undefined ;
844- try_catch .init (page .scope );
844+ try_catch .init (page .main_context );
845845 defer try_catch .deinit ();
846- _ = page .scope .exec (str , typ ) catch {
846+ _ = page .main_context .exec (str , typ ) catch {
847847 if (try try_catch .err (page .arena )) | msg | {
848848 log .warn (.user_script , "script callback" , .{
849849 .src = self .src ,
0 commit comments