@@ -70,7 +70,7 @@ function courier(tabId, changed) {
70
70
// because `detail` in the dispatched custom events is `null`
71
71
const script = document . createElement ( 'script' ) ;
72
72
script . setAttribute ( 'src' , source ) ;
73
- document . documentElement . appendChild ( script ) ;
73
+ document . head . appendChild ( script ) ;
74
74
75
75
// // TODO: reenable profiler
76
76
// if (message.type === 'bridge::ext/profiler' && message.payload) {
@@ -108,7 +108,7 @@ function courier(tabId, changed) {
108
108
109
109
chrome . tabs . onActivated . addListener ( ( { tabId } ) => sensor ( tabId ) ) ;
110
110
chrome . tabs . onUpdated . addListener (
111
- ( tabId , changed ) => changed . status === 'loading ' && sensor ( tabId ) ,
111
+ ( tabId , changed ) => changed . status === 'unloaded ' && sensor ( tabId ) ,
112
112
) ;
113
113
114
114
/** @param {number } tabId */
@@ -122,7 +122,7 @@ async function sensor(tabId) {
122
122
document . querySelector ( `script[src="${ source } "]` ) ?. remove ( ) ;
123
123
const script = document . createElement ( 'script' ) ;
124
124
script . setAttribute ( 'src' , source ) ;
125
- document . documentElement . appendChild ( script ) ;
125
+ document . head . appendChild ( script ) ;
126
126
127
127
document . addEventListener ( 'SvelteDevTools' , ( { detail } ) => {
128
128
chrome . runtime . sendMessage ( detail ) ;
0 commit comments