You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: frontend/src/Tab.tsx
+22-17Lines changed: 22 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ export class Tab extends StatefulClass {
17
17
id: number;
18
18
title: string|null;
19
19
frame: ScramjetFrame;
20
-
devtoolsFrame: HTMLIFrameElement|null=null;
20
+
devtoolsFrame: ScramjetFrame;
21
21
screenshot: string|null=null;
22
22
23
23
dragoffset: number;
@@ -60,12 +60,17 @@ export class Tab extends StatefulClass {
60
60
constframe=scramjet.createFrame();
61
61
addHistoryListeners(frame,this);
62
62
frame.addEventListener("contextInit",(ctx)=>{
63
-
injectHistoryEmulation(ctx.client,this);
64
63
injectContextMenu(ctx.client,this);
65
-
injectDevtools(ctx.client,this);
64
+
65
+
// make sure it's top level, ctxInit calls for all frames too
66
+
if(ctx.window==frame.frame.contentWindow){
67
+
injectHistoryEmulation(ctx.client,this);
68
+
injectDevtools(ctx.client,this);
69
+
}
66
70
});
67
71
68
72
this.frame=frame;
73
+
this.devtoolsFrame=scramjet.createFrame();
69
74
}
70
75
71
76
// only caller should be history.ts for this
@@ -122,34 +127,34 @@ function injectDevtools(client: ScramjetClient, tab: Tab) {
122
127
// then we set up communication between the devtools frame and the page frame
123
128
// then, hand off the devtools frame to the page frame so that it can inject itself into it, but cannot use the globals to escape
124
129
130
+
letdevtoolsFrameClient: ScramjetClient;
131
+
132
+
// listen to the *page's* beforeunload, so we can get rid of the previous scramjet client (and associated devtools frame) in time for the new site to load
0 commit comments