Extensions compared to Firefox source code, if possible

Hello, I have something of an unusual question, perhaps, and from the perspective of a novice. I’ve been working with extensions for a little while and have a larger project in mind that I doubt an extension alone can handle, at least not as efficiently as I’d like. I was reading about Firefox source code and the MPL license and that is what led me to this question. I also do not want to pursue any of the tools available that package stripped-down browsers and local servers together as a desktop application, although my question may sound like a stripped down browser less the local server.

Is it permissible and possible to use Firefox as a “base” to build a separate stand-alone tool for a specific purpose, apart from internet browsing alone; and make it such that it can be updated as Firefox is updated? Sort of like those Linux distributions that write about their upstream resources, meaning they’re built on top of someone else’s base distribution.

The purpose of the tool is to aid study in a particular area; and it’s value is in the content more so than what it does programmatically. I thought about using native messaging and a middle program to get the content from a database into the browser for display through an extension, but would like to consider this other option in comparison. By content I mean several GBs of text, audio, and perhaps a small amount of video, all stored locally. My goal is to give it away to those interested in the area of study; but it would be nice to be able to protect the content from being altered and users need to be able to add thier work to the database as they study.

Of course, this is nothing new in itself, for I purchased a birding software that is somewhat similar; but it’s built within each operating system. If possible, I’d like to build it in Firefox.

Instead of using extension pages to build a user interface to request and display content, can that code be built into the browser itself and used to retrieve the content directly from SQLite files?

Can the browser menus be changed and features that won’t be used removed to reduce the file size?

I guess it would sort of be as if one’s extension was built directly into the source code and everything else in the browser built around that one purpose. The goal would be to be able to update the tool by adding more content as it becomes avalilable and modifying the HTML/CSS/JS of the UI as features are added, without requiring the user to do much; and backing up the users’ work. It appears that it would be better to keep the content stored within the browsers storage area.

Is Thunderbird built from Firefox?

I’d appreciate any direction you may be able to provide. It may be a ridiculous question and, even if possible, would require a team of people rather than just one.

Thank you.

First off, Firefox is based on what used to be called XULRunner, and is now no longer officially distributed on its own. Other applications like Thunderbird still rely on it, however. It’d kind of a predecessor of Electron, but using Gecko and not Blink.

The technologies the Firefox UI and backend use are still quite a bit different from what you get from within an extension. Extensions get an API to interact with all the internals that looks very different, and they only see HTML, which isn’t really the truth either.

I’m mostly wondering if you wouldn’t be better off instead writing a webpage and maybe running Firefox in kiosk mode? That way any of the loading would happen via normal HTTP and you’d just write a web app and a normal server backend.

Thank you for responding to my question. I thought Firefox source code was C, C++, JS, and now RUST. I didn’t know about the kiosk mode. I don’t think it’ll work for this though because it seems to limit a number of things.

The extensions are great for my small purposes. The main hurdle is how to give the user a large database (likely over 10GB) and make it easy to update it as new material becomes available. IndexedDB would work fine for the type of data used but there is only 2GB of space maximum for the extension. Or, does the “unlimitedStorage” permission remove this size limit? The note here at this MDN document on permissions, under the heading “Unlimited Storage,” states it removes the need for requesting user permission to have an indexedDB database persist , but I wasn’t sure if the removal of the local storage API limit applied to indexedDB also.

I’m pretty sure (from reading only though, at this point) that if I used SQLite and a native C file, an extension could work well using native messaging. But it makes more work for the user to set up and update even though the extension could handle updating the database through native messaging and the native C file.

Is there any way to make the database more “internal” to the browser, such that it could exceed the 2GB limit and be easily updated (through the extension only) for the user as more content becomes available, not requiring native messaging; or as users choose to share their own study content with one another?

Thank you.

Would simply including unlimitedStorage work for what you’re trying to do?

I’d still be nervous about my data being “““evicted””” if I exceeded 50% of diskspace—it’s unclear (to me) whether unlimitedStorage grants immunity from this, but (based on reading your use-case) it sounds like that’s absolutely worth testing; if it works, it would (I think) trivially solve what you’re trying to do.

Thank you. I don’t think the unlimitedStorage permission gives indexedDB any more than the normal 2GB limit. After creating a database in the extension through the background script and using navigator.storage.estimate(), it shows 2GB. Do you know it to be more? Perhaps, I’m doing something wrong.

I think the unlimited applies to storage.local only.

1 Like