Skip to content

Instantly share code, notes, and snippets.

@samwilson
Created December 12, 2019 23:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samwilson/9dc005fa5e4fe38f0eb4c65ec6609755 to your computer and use it in GitHub Desktop.
Save samwilson/9dc005fa5e4fe38f0eb4c65ec6609755 to your computer and use it in GitHub Desktop.
ResourceLoader queue weirdness
console.log( 'Start of content_script.js' );
const script = document.createElement( 'script' ),
body = document.getElementsByTagName( 'body' )[ 0 ];
script.src = browser.extension.getURL( 'injected_script.js' );
body.appendChild( script );
console.log( 'End of content_script.js' );
console.log('About to add to RLQ');
(RLQ = window.RLQ || [])
.push( [ [ 'mediawiki.base' ], () => {
console.log('Loaded with RL dependencies');
mw.notify( 'This is a notification.' );
} ] );
console.log('Finished adding to RLQ');
{
"manifest_version": 2,
"name": "WWT bug",
"description": "",
"author": "Sam Wilson",
"homepage_url": "https://example.com/",
"version": "0.1.0.0",
"browser_specific_settings": {
"gecko": {
"id": "wwt-test@wikimedia"
}
},
"content_scripts": [ {
"matches": [
"*://*.wikipedia.org/*"
],
"js": [ "content_script.js" ]
} ],
"web_accessible_resources": [ "injected_script.js" ],
"permissions": [ "tabs", "activeTab", "storage" ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment