Can one create a page modifying extension without any UI overlay in browser.xul?

Talk about code development, features, specific bugs, enhancements, patches, and similar things.
Forum rules
Please keep everything here strictly on-topic.
This board is meant for Pale Moon source code development related subjects only like code snippets, patches, specific bugs, git, the repositories, etc.

This is not for tech support! Please do not post tech support questions in the "Development" board!
Please make sure not to use this board for support questions. Please post issues with specific websites, extensions, etc. in the relevant boards for those topics.

Please keep things on-topic as this forum will be used for reference for Pale Moon development. Expect topics that aren't relevant as such to be moved or deleted.
User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 4981
Joined: 2015-12-09, 15:45
Contact:

Can one create a page modifying extension without any UI overlay in browser.xul?

Unread post by moonbat » 2020-07-03, 16:18

My extension PermissionsPlus overlays the PageInfo dialog and about:permissions, but originally had no reason to overlay browser.xul. The Javascript files for these 2 components are only loaded when the user accesses them, but I needed to perform some initialization at browser startup. Simply creating an empty overlay for the browser with a script tag referencing my script (that has a window.onload to do its stuff) doesn't work and gets logged as 'no chrome registered for script.js'.

So I was forced to add a toolbar button as well. Is it possible to make a traditional overlay extension that doesn't overlay the browser, or alternately, doesn't modify the UI at all?
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 21 Xfce x64 on HP i5-5200 laptop, 12 GB RAM.
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

JustOff

Re: Can one create a page modifying extension without any UI overlay in browser.xul?

Unread post by JustOff » 2020-07-03, 17:22

moonbat wrote:
2020-07-03, 16:18
Simply creating an empty overlay for the browser with a script tag referencing my script (that has a window.onload to do its stuff) doesn't work and gets logged as 'no chrome registered for script.js'.
That's weird, I guess you missed something very simple.
Is it possible to make a traditional overlay extension that doesn't overlay the browser, or alternately, doesn't modify the UI at all?
Yes, of course, here is an example of the second approach.

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 4981
Joined: 2015-12-09, 15:45
Contact:

Re: Can one create a page modifying extension without any UI overlay in browser.xul?

Unread post by moonbat » 2020-07-03, 18:46

I was doing more or less what you have done, my overlay is identical with just a stringbundleset, but for one thing -
Is there a difference between doing

Code: Select all

window.addEventListener('load', function() { activestopbutton.init(); }, false);
and simply calling

Code: Select all

window.addEventListener('load', activestopbutton.init, false);
as I've been doing?
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 21 Xfce x64 on HP i5-5200 laptop, 12 GB RAM.
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX


Locked