File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 9595 allFrames : true ,
9696 runAt : "document_start" ,
9797 js : [ {
98- code : `(function(){
98+ code : `(function(settingsData ){
9999 if (typeof require !== "undefined"){
100100 const settings = require("./settings");
101101 const logging = require("./logging");
102- if (settings.init(${ JSON . stringify ( data ) } )){
102+ if (settings.init(settingsData )){
103103 logging.message("Initialized settings by dynamic content script.");
104104 }
105105 else {
106106 logging.error("Dynamic content script was too late to provide settings.");
107107 }
108108 }
109109 else {
110- console.error(
111- "[CanvasBlocker] invalid content scripts: require not defined at",
110+ if (!window.scope){
111+ window.scope = {};
112+ }
113+ window.scope.settingsData = settingsData;
114+ console.warn(
115+ "[CanvasBlocker] invalid content script order: require not defined at",
112116 window.location.href
113117 );
114118 }
115- }())`
119+ }(${ JSON . stringify ( data ) } ))`
116120 } ]
117121 } ) . then ( function ( api ) {
118122 logging . verbose ( "Content script registered." ) ;
Original file line number Diff line number Diff line change 44
55const require = function ( ) {
66 "use strict" ;
7- window . scope = { } ;
7+ if ( ! window . scope ) {
8+ window . scope = { } ;
9+ }
810 const scope = window . scope ;
911
1012 function getScopeName ( module ) {
Original file line number Diff line number Diff line change 415415 initEvents . forEach ( function ( callback ) { callback ( ) ; } ) ;
416416 return true ;
417417 } ;
418- scope . loaded = browser . storage . local . get ( ) . then ( scope . init ) ;
418+ if ( window . scope . settingsData ) {
419+ scope . init ( window . scope . settingsData ) ;
420+ scope . loaded = Promise . resolve ( false ) ;
421+ }
422+ else {
423+ scope . loaded = browser . storage . local . get ( ) . then ( scope . init ) ;
424+ }
419425 scope . onloaded = function ( callback ) {
420426 if ( scope . isStillDefault ) {
421427 initEvents . push ( callback ) ;
You can’t perform that action at this time.
0 commit comments