pm 28 autoconfig.js

Users and developers helping users with generic and technical Pale Moon issues on all operating systems.

Moderator: trava90

Forum rules
This board is for technical/general usage questions and troubleshooting for the Pale Moon browser only.
Technical issues and questions not related to the Pale Moon browser should be posted in other boards!
Please keep off-topic and general discussion out of this board, thank you!
pr0fessor

pm 28 autoconfig.js

Unread post by pr0fessor » 2018-08-31, 17:35

in version 27.9.4 x86 linux i edited palemoon/defaults/pref/autoconfig.js

Code: Select all

pref("general.config.filename", "mozilla.cfg");
pref("general.config.obscure_value", 0);
created palemoon/defaults/mozilla.cfg ( https://mike.kaply.com/2016/05/24/defau ... irefox-46/ )

Code: Select all

//
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/FileUtils.jsm");
 
var profileDir = Services.dirsvc.get("ProfD", Ci.nsIFile);
var certDBFile = profileDir.clone();
certDBFile.append("cert8.db")
// If cert8.db isn't there, it's a new profile
if (!certDBFile.exists()) {
  var defaultProfileDir = Services.dirsvc.get("GreD", Ci.nsIFile);
  defaultProfileDir.append("defaults");
  defaultProfileDir.append("profile");
  try {
    copyDir(defaultProfileDir, profileDir);
  } catch (e) {
    Components.utils.reportError(e);
  }
}
  
function copyDir(aOriginal, aDestination) {
  var enumerator = aOriginal.directoryEntries;
  while (enumerator.hasMoreElements()) {
    var file = enumerator.getNext().QueryInterface(Components.interfaces.nsIFile);
    if (file.isDirectory()) {
      var subdir = aDestination.clone();
      subdir.append(file.leafName);
      try {
        subdir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
        copyDir(file, subdir);
      } catch (e) {
        Components.utils.reportError(e);
      }
    } else {
      try {
        file.copyTo(aDestination, null);
      } catch (e) {
        Components.utils.reportError(e);
      }
    }
  }
}
I copied in palemoon/browser/defaults/profile prefs.js and xulstore.json
and all worked, but same things not working in palemoon 28.0
also i tried firefox standard method: https://support.mozilla.org/en-US/kb/cu ... autoconfig and again not working...
all files saved in utf-8 (tried LF and CR+LF)

User avatar
therube
Board Warrior
Board Warrior
Posts: 1651
Joined: 2018-06-08, 17:02

Re: pm 28 autoconfig.js

Unread post by therube » 2018-08-31, 18:24

(I'll just state that over time what might have been allowed, syntax used, & functions available, including the names of said functions, may have changed. So what worked for 27 (FF 28) may not necessarily be directly applicable to 28 (FF 52). [Though if not directly, it might only be a function name change, kind of thing.]

Is there logging available to disclose errors? Or if you start up with -jsconsole, with that log them?)
Last edited by therube on 2018-08-31, 18:33, edited 1 time in total.

pr0fessor

Re: pm 28 autoconfig.js

Unread post by pr0fessor » 2018-09-01, 06:59

i solved the problem (it seems that even the script works, PM started too fast, prefs.js is overridden from default settings (or copied but browser is already started with compiled defaults) and only xulstore.json was working (after moving palemoon/browser/defaults/profile/ to palemoon/defaults/profile/ )). I stopped playing with autoconfig.js and make general solution (why to make script, that will be executed from browser and may not work with new version?). there is much better and fastest way.
I created launcher and replaced symlink in /usr/bin/palemoon:

Code: Select all

#!/bin/sh
if [ ! -d /home/$USER/.moonchild\ productions/ ]; then
mkdir -p /home/$USER/.moonchild\ productions/pale\ moon/profile
cat <<EOF>> /home/$USER/.moonchild\ productions/pale\ moon/profile/prefs.js
# Mozilla User Preferences

/* Do not edit this file.
 *
 * If you make changes to this file while the application is running,
 * the changes will be overwritten when the application exits.
 *
 * To make a manual change to preferences, you can visit the URL about:config
 */
user_pref("browser.backspace_action", 0);
user_pref("browser.cache.disk.enable", false);
user_pref("browser.cache.offline.enable", false);
user_pref("browser.newtab.choice", 0);
user_pref("browser.newtab.url", "about:blank");
user_pref("browser.search.defaultenginename", "Google");
user_pref("browser.search.openintab", true);
user_pref("browser.startup.homepage", "about:home");
user_pref("browser.tabs.onTop", true);
user_pref("browser.tabs.remote.autostart", true);
user_pref("browser.tabs.remote.force-enable", true);
user_pref("dom.disable_beforeunload", true);
user_pref("dom.ipc.plugins.flash.disable-protected-mode", true);
user_pref("dom.indexedDB.logging.details", false);
user_pref("dom.indexedDB.logging.enabled", false);
user_pref("media.gmp.decoder.enabled", true);
user_pref("media.libavcodec.allow-obsolete", true);
user_pref("privacy.clearOnShutdown.connectivityData", true);
user_pref("privacy.clearOnShutdown.cookies", false);
user_pref("privacy.clearOnShutdown.downloads", false);
user_pref("privacy.clearOnShutdown.formdata", false);
user_pref("privacy.clearOnShutdown.history", false);
user_pref("privacy.clearOnShutdown.offlineApps", true);
user_pref("privacy.clearOnShutdown.sessions", false);
user_pref("privacy.sanitize.sanitizeOnShutdown", true);

EOF
cat <<EOF>> /home/$USER/.moonchild\ productions/pale\ moon/profile/xulstore.json
{"chrome://browser/content/browser.xul":{"main-window":{"sizemode":"maximized"},"PersonalToolbar":{"collapsed":"true","currentset":"personal-bookmarks"},"toolbar-menubar":{"autohide":"true","currentset":"menubar-items"},"navigator-toolbox":{"iconsize":"small"},"nav-bar":{"iconsize":"small","currentset":"unified-back-forward-button,reload-button,stop-button,home-button,urlbar-container,search-container,bookmarks-menu-button,history-menu-button,downloads-button,window-controls,webrtc-status-button"},"TabsToolbar":{"currentset":"appmenu-toolbar-button,tabbrowser-tabs,new-tab-button,alltabs-button,tabs-closebutton,tabs-padlock-tbitem"},"addon-bar":{"currentset":"addonbar-closebutton,status4evar-status-widget,status4evar-progress-widget,status-bar","collapsed":"false"},"sidebar-title":{"value":""}}}

EOF
cat <<EOF>> /home/$USER/.moonchild\ productions/pale\ moon/profiles.ini
[General]
StartWithLastProfile=1

[Profile0]
Name=default
IsRelative=1
Path=profile
Default=1
EOF
fi
/usr/lib/palemoon/palemoon &
not forget to make launcher executable "chmod +x ..." :)
this launcher will work with every firefox based browser after correcting paths :)
with my launcher browser work in ram, because my hdd is not hdd, but compact flash and i don't won't continuously writing...

user_pref("media.gmp.decoder.enabled", true);
user_pref("media.libavcodec.allow-obsolete", true);
this will turn on all check boxes in https://www.youtube.com/html5
Last edited by pr0fessor on 2018-09-01, 07:00, edited 1 time in total.

User avatar
therube
Board Warrior
Board Warrior
Posts: 1651
Joined: 2018-06-08, 17:02

Re: pm 28 autoconfig.js

Unread post by therube » 2018-09-01, 10:56

cat <<EOF>>
I only know UNIX from long ago, & had never seen that before, but that's neat - in operation & in look.
(Kind of makes it look like it's not a "redirect" until you look a second time).


Oh, & I'll also note that in you mozilla.cfg, you had cert8.db "hardcoded", if you will.
So I looked on my end, & yes, cert8.db seemed right.
But then on checking other versions of FF, they are now up to cert9.db.
(Point is, a specific item one checks against may or may not be valid between one browser version & another.)
Last edited by therube on 2018-09-01, 11:01, edited 1 time in total.