File tree Expand file tree Collapse file tree 1 file changed +18
-11
lines changed Expand file tree Collapse file tree 1 file changed +18
-11
lines changed Original file line number Diff line number Diff line change 11function injectScriptFile ( filePathOrUrl , isExternal = false ) {
2- var s = document . createElement ( "script" ) ;
3- s . src = isExternal ? filePathOrUrl : chrome . runtime . getURL ( filePathOrUrl ) ;
4- s . onload = function ( ) {
5- console . log ( "Useful-scripts injected " + s . src ) ;
6- this . remove ( ) ;
7- } ;
8- s . onerror = function ( ) {
9- console . warn ( "ERROR: Useful-scripts inject script FAILED " + s . src ) ;
10- this . remove ( ) ;
11- } ;
12- ( document . head || document . documentElement ) . appendChild ( s ) ;
2+ try {
3+ var s = document . createElement ( "script" ) ;
4+ s . src = isExternal ? filePathOrUrl : chrome . runtime . getURL ( filePathOrUrl ) ;
5+ s . onload = function ( ) {
6+ console . log ( "Useful-scripts injected " + s . src ) ;
7+ this . remove ( ) ;
8+ } ;
9+ s . onerror = function ( e ) {
10+ console . log ( "ERROR: Useful-scripts inject script FAILED " + s . src , e ) ;
11+ this . remove ( ) ;
12+ } ;
13+ ( document . head || document . documentElement ) . appendChild ( s ) ;
14+ } catch ( e ) {
15+ console . log (
16+ "ERROR: Useful-scripts inject script FAILED " + filePathOrUrl ,
17+ e
18+ ) ;
19+ }
1320}
1421
1522injectScriptFile ( "/content-scripts/globals_debugger.js" ) ;
You can’t perform that action at this time.
0 commit comments