File tree 1 file changed +18
-7
lines changed
1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change 4
4
var highLighter = require ( '../modules/content/highLighter.js' ) ;
5
5
var port = utils . getPort ( ) ;
6
6
7
+ function confirmScriptInjectionDone ( ) {
8
+ // Add this action to the Q
9
+ // This is needed when the devtools are undocked from the current inspected window
10
+ setTimeout ( function ( ) {
11
+ port . postMessage ( {
12
+ action : 'on-main-script-injection'
13
+ } ) ;
14
+ } , 0 ) ;
15
+ }
16
+
17
+ var DONE_FLAG = 'MAIN_SCRIPT_INJECTION_DONE' ;
18
+ if ( window [ DONE_FLAG ] === true ) {
19
+ confirmScriptInjectionDone ( ) ;
20
+ return ;
21
+ }
22
+
7
23
// Inject needed scripts into the inspected page
8
24
// ================================================================================
9
25
31
47
32
48
injectScript ( 'vendor/ToolsAPI.js' , function ( ) {
33
49
injectScript ( 'scripts/injected/main.js' , function ( ) {
34
- // Add this action to the Q
35
- // This is needed when the devtools are undocked from the current inspected window
36
- setTimeout ( function ( ) {
37
- port . postMessage ( {
38
- action : 'on-main-script-injection'
39
- } ) ;
40
- } , 0 ) ;
50
+ window [ DONE_FLAG ] = true ;
51
+ confirmScriptInjectionDone ( ) ;
41
52
} ) ;
42
53
} ) ;
43
54
You can’t perform that action at this time.
0 commit comments