Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extensions.ublock0.adminSettings issue with Firefox 40. #592

Closed
Nurple opened this issue Aug 12, 2015 · 9 comments
Closed

extensions.ublock0.adminSettings issue with Firefox 40. #592

Nurple opened this issue Aug 12, 2015 · 9 comments

Comments

@Nurple
Copy link

Nurple commented Aug 12, 2015

Heya,

The extensions.ublock0.adminSettings feature doesn't seem to works with Firefox 40.

OS: Windows 8 x64.
uBlock0: 1.0.0.1 from AMO.

I had it working fine with Firefox 39, new profiles would pick up the settings, as well as using the uBlock0 reset to defaults option within uBlock0.

I'm seeing this error in the Browser Console when I try resetting uBlock0;

SyntaxError: JSON.parse: bad control character in string literal at line 1 column 1028 of the JSON data
Stack trace:
µBlock.restoreAdminSettings@chrome://ublock0/content/js/storage.js:734:20
µBlock.restart@chrome://ublock0/content/js/start.js:244:5
@chrome://ublock0/content/js/start.js:277:1

I'm deploying the settings using the method shown here;

https://developer.mozilla.org/en-US/Firefox/Enterprise_deployment#Configuration

@Nurple Nurple changed the title extensions.ublock0.adminSettings stopped working. extensions.ublock0.adminSettings issue with Firefox 40. Aug 12, 2015
@gorhill
Copy link
Owner

gorhill commented Aug 12, 2015

The string in extensions.ublock0.adminSettings has to be a JSON-compliant string. As per the error message in the console, it is not compliant in your case:

JSON.parse: bad control character in string literal at line 1 column 1028 of the JSON data

You can validate JSON compliance with this online tool: http://jsonlint.com/. See what is the result with your setting. Actually, look at the 1,028th character in you JSON string, it's where the issue is.

@Nurple Nurple closed this as completed Aug 13, 2015
@Nurple Nurple reopened this Aug 13, 2015
@Nurple
Copy link
Author

Nurple commented Aug 13, 2015

oops, closed by mistake.


Hmm, the string does validate, as I checked this when I first tried this feature using the very site you mention, and it worked fine with Firefox 39, and the string is still the same with Firefox 40, I've even checked it again with multiple json validators.

While looking at the string with notepad++ it shows 's as EMs, and thats at column 1028, the string was copied from within about:config, though notepad++ doesn't show this within my mozilla.cfg file.

@Nurple
Copy link
Author

Nurple commented Aug 13, 2015

That seems to have been the problem, I corrected that, and now it works, guess Firefox changed something, got more strict etc.

@bmkaiser
Copy link

@Nurple are you still using a .cfg file to load the extensions.ublock0.adminsettings with custom uBO settings? I'm having difficulty figuring out how to get it working with a .cfg file, but I'm able to manually set it within FF 46.0.

@Nurple
Copy link
Author

Nurple commented May 12, 2016

@bmkaiser Yep, sure am, I was just messing with it the other day.

Do you already have a working cfg?, but are just having problems with extensions.ublock0.adminsettings bit?.

It took me a few goes to get it working, I'll give it another go later, and this time write down what I did.

@bmkaiser
Copy link

@Nurple yes, we have a working .cfg that we use for other settings and are only having issues with extensions.ublock0.adminsettings.

@Nurple
Copy link
Author

Nurple commented May 12, 2016

You said it works manually, so you just need to copy the section from your prefs.js in that profile, and use that in the .cfg.

This it what mine looks like. http://pastebin.com/SgJtT4pA

@bmkaiser
Copy link

Thank you! Your pastebin link is really helpful. It wasn't escaping the double quotes properly. The last part I'm trying to figure out that I'm not sure how you addressed (because I don't think you had to), is how to handle the line returns in netWhitelist for each definition. When I export the uBO configuration, it looks like this:

"netWhitelist": "about-scheme\nbehind-the-scene\nchrome-extension-scheme\nchrome-scheme\norg\nloopconversation.about-scheme\nopera-scheme"

@Nurple
Copy link
Author

Nurple commented May 19, 2016

This worked for me,

lockPref("extensions.ublock0.adminSettings", "{\"netWhitelist\":\"about-scheme\\nbbc.co.uk\\nbehind-the-scene\\nchrome-extension-scheme\\nchrome-scheme\\nloopconversation.about-scheme\",\"hostnameSwitchesString\":\"no-remote-fonts: * true\\nno-remote-fonts: bbc.co.uk false\\nno-remote-fonts: gandi.net false\\nno-remote-fonts: github.com false\\nno-remote-fonts: virustotal.com false\"}");

What I do is setup uBlock the way I want it, export the settings, clean up / remove bits I don't want, then compact the json, and add that to extensions.ublock0.adminSettings through Firefox, and save what's written to my pref.js to my .cfg.

I'm more likely doing steps I don't need to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants