Testing Chrome Extensions in Brave
A while back, I wrote a walk-through showing how developers can test their extensions in Brave. That approach required cloning the repo (which meant you’d need to have git installed), installing dependencies (which meant you’d need to also have node/npm installed), and modifying source files.
In the future, Brave will more easily be able to load arbitrary extensions for the purposes of developing and testing. That support isn’t here today, but this doesn’t mean you have to go through the arduous process mentioned above. Instead, there’s another way — an easier way — to test extensions.
The method of extension-loading that we’ll cover today involves the co-opting of an already-installed extension. We’re going to enable an extension, replace its contents, and have Brave load the modified extension on the next run. My goal is to have Wikiwand working in Brave by the end of this walk-through.
WARNING: I am about to load somebody else’s code into my browser, granting it access to authenticated sessions, potentially sensitive information, and more. I do not encourage this with all extensions. I have, however, reviewed Wikiwand 8.2, and feel safe proceeding.
With that said, let’s begin!
Step 1: Locate Chrome extensions
If you have Chrome installed, and you have your target extension installed already, you can locate it in your Chrome folder:
Note that in both cases that my data was in the “Default” folder. This may be different for you.
Step 2: Locate Brave extensions
The next thing we need to do is locate the directory in which Brave extensions reside.
Step 3: Ready the Trojan Horse
As mentioned in the third paragraph of this walk-through, we’ll need to enable an extension that will serve as our Trojan Horse. I am not presently using Honey, so I will use it moving forward.
Navigate to about:preferences#extensions in Brave, and toggle Honey on. At this point, Brave will begin to download the extension in the background. Depending on your connection speed, this could take a few seconds, or up to a minute. For reference, Honey 9.7.7 is roughly 1.3 MB.
Once downloaded, the extension may trigger a new tab, or some other type of UI change. Disregard these cues, and close Brave completely.
At this point, we should see a new folder in the Brave extensions directory named after the Honey ID: bmnlcjabgnpnenekpadlanbbkooimhnj. Immediately within this folder will be a version-folder, with a name like 9.7.7. We want to rename this folder to 9.7.7x (note the addition of a trailing ‘x’).
Step 4: Load your extension
I am now one step away from loading Wikiwand into Brave. All that is needed is to copy the extension from the Chrome directory, and paste it into the Brave directory, giving it the name 9.7.7 (note here how we are co-opting the original folder name).
Note also that the Chrome extension directory has the same structure as the Brave extension directory — a list of folders (named according to extension IDs), which contain 1 or more folders (named according to version numbers). You want to copy/rename the version-number folder.
All that’s left now is to launch Brave, and visit Wikipedia.
Step 5: Cleaning up afterwards
It’s important to note that this walk-through is not a tutorial on loading extensions into Brave for long-term use. Instead, our goal was to quickly test an extension for compatibility.
When you’ve tested the extension, and have shared a list with the Brave team of scenarios that don’t work, it’s time to tear-down our work and restore Brave to its initial state. Fortunately, this is very simple to do.
Visit about:preferences#extensions and toggle-off your extension. Next, delete the folder we used as our Trojan Horse; in our case, it was the Honey folder with the id bmnlcjabgnpnenekpadlanbbkooimhnj.
Restart Brave, and you’re done.
Let’s wrap this up with a quick summary to drive home the first 4 steps above. We are able to load Wikiwand into Brave by co-opting the path of an already-enabled extension in Brave (Honey, in this case).
By replacing the contents of a loaded-extension with the contents of another extension, we’re able to get Brave to load the unsupported extension. This allows us to more easily test arbitrary extensions for support.
I should mention that this approach, while largely reliable, has some hypothetical limitations. I say hypothetical because I have yet to encounter them―but I’m sure somebody will.
When you load an extension via these means, the extension will not have its correct ID. If you load an extension using Honey as the trojan horse, your extension will continue to have the Honey ID. If your extension attempts to query its own ID (via chrome.runtime.id for example), it will not get back the expected value.
As always, I’m happy to assist with any questions you may have about this process. You can find me on Twitter as @jonathansampson. If you test an extension, and find it to be working quite well, shoot me a message. Perhaps we can fast-track it to getting official support in Brave.