@@ -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 ();
@@ -685,7 +685,7 @@ pub const Page = struct {
685685
686686 pub fn stackTrace (self : * Page ) ! ? []const u8 {
687687 if (comptime builtin .mode == .Debug ) {
688- return self .scope .stackTrace ();
688+ return self .main_context .stackTrace ();
689689 }
690690 return null ;
691691 }
@@ -802,14 +802,14 @@ const Script = struct {
802802
803803 fn eval (self : * const Script , page : * Page , body : []const u8 ) ! void {
804804 var try_catch : Env.TryCatch = undefined ;
805- try_catch .init (page .scope );
805+ try_catch .init (page .main_context );
806806 defer try_catch .deinit ();
807807
808808 const src = self .src orelse "inline" ;
809809 _ = switch (self .kind ) {
810- .javascript = > page .scope .exec (body , src ),
810+ .javascript = > page .main_context .exec (body , src ),
811811 .module = > blk : {
812- switch (try page .scope .module (body , src )) {
812+ switch (try page .main_context .module (body , src )) {
813813 .value = > | v | break :blk v ,
814814 .exception = > | e | {
815815 log .warn (.user_script , "eval module" , .{
@@ -835,9 +835,9 @@ const Script = struct {
835835 switch (callback ) {
836836 .string = > | str | {
837837 var try_catch : Env.TryCatch = undefined ;
838- try_catch .init (page .scope );
838+ try_catch .init (page .main_context );
839839 defer try_catch .deinit ();
840- _ = page .scope .exec (str , typ ) catch {
840+ _ = page .main_context .exec (str , typ ) catch {
841841 if (try try_catch .err (page .arena )) | msg | {
842842 log .warn (.user_script , "script callback" , .{
843843 .src = self .src ,
0 commit comments