Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Customized mozilla.cfg file no longer working after upgrade to v38.01

  • 8 balasan
  • 4 ada masalah ini
  • 10 paparan
  • Balasan terakhir oleh cor-el

more options

I created a custom mozilla.cfg file which has three main sections. Section one locks several preferences. Section two modifies the chrome - hides the Orange button and adds the menu bar. Section three adds a bookmark folder with links specific to our organization.

I have also modified the local-settings.js file so that it points to my cfg file: pref("general.config.filename", "mozilla.cfg"); pref("general.config.obscure_value", 0); // use this to disable the byte-shift

After upgrading to v38.01, Firefox no longer opens. It appears briefly in Task Manager and goes away. I started some testing and found that if I comment out the line "pref("general.config.obscure_value", 0);" in the local-settings.js file, FF opens but none of the settings I have specified are being applied. I'm stuck since I have no idea what the problem could be. Has the allowed syntax changed? Has the file structure changed? I can post the cfg file if needed.

Thanks.

I created a custom mozilla.cfg file which has three main sections. Section one locks several preferences. Section two modifies the chrome - hides the Orange button and adds the menu bar. Section three adds a bookmark folder with links specific to our organization. I have also modified the local-settings.js file so that it points to my cfg file: pref("general.config.filename", "mozilla.cfg"); pref("general.config.obscure_value", 0); // use this to disable the byte-shift After upgrading to v38.01, Firefox no longer opens. It appears briefly in Task Manager and goes away. I started some testing and found that if I comment out the line "pref("general.config.obscure_value", 0);" in the local-settings.js file, FF opens but none of the settings I have specified are being applied. I'm stuck since I have no idea what the problem could be. Has the allowed syntax changed? Has the file structure changed? I can post the cfg file if needed. Thanks.

Penyelesaian terpilih

Yes. That function is gone.

Baca jawapan ini dalam konteks 👍 0

All Replies (8)

more options

Yes. Please post the content of the mozilla.cfg file as it is likely that there is a problem with the file.

You can try to comment out lines with a leading // to check for issues with pref lines.

more options

Hello cor-el, Here is the file I have. I have changed the bookmarks

//these settings turn off and disable Auto Update lockPref("app.update.enabled", false); lockPref("app.update.auto", false); lockPref("browser.startup.homepage", "http://www.somewebsite.com"); lockPref("browser.rights.override", true); lockPref("browser.shell.checkDefaultBrowser", false); lockPref("browser.startup.homepage_override.mstone", "ignore"); //lockPref("plugins.update.notifyUser", true); //******************************************************************************************************************** //******************************************************************************************************************** //this section add all the components needed to run this stuff. //Add Components Components.utils.import("resource://gre/modules/PlacesUtils.jsm"); var navBook = Components.classes["@mozilla.org/browser/nav-bookmarks-service;1"] .getService(Components.interfaces.nsINavBookmarksService); Components.utils.import("resource://gre/modules/Services.jsm"); var ios = Components.classes["@mozilla.org/network/io-service;1"] .getService(Components.interfaces.nsIIOService); var histSer = Components.classes["@mozilla.org/browser/nav-history-service;1"].getService(Components.interfaces.nsINavHistoryService); //End of components //********************************************************************************************************************* //********************************************************************************************************************* //This section copies the file to the users profile\chrome directory var profileDir = Services.dirsvc.get("ProfD", Components.interfaces.nsILocalFile); profileDir.append("chrome"); if( !profileDir.exists() || !profileDir.isDirectory() ) {

 profileDir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0777);

} profileDir.append("userChrome.css"); var fos = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream); fos.init(profileDir, -1, -1, false);

var css1 = "#appmenu-button { display: none !important; }"; var css2 = "\r\n"; var css3 = "#toolbar-menubar { display: inline-table !important; }";

fos.write(css1, css1.length); fos.write(css2, css2.length); fos.write(css3, css3.length); fos.close(); //End of copy. //********************************************************************************************************************* //********************************************************************************************************************* // How to handle errors // try { // Block of code to try // throw new Error("Whoops!"); // } // catch(e) { // Block of code to handle errors // } // End Of handling errors //********************************************************************************************************************* //********************************************************************************************************************* //This section finds the folder title My Title and delete all folders with that name var options = histSer.getNewQueryOptions(); var query = histSer.getNewQuery(); var toolbarFolder = navBook.bookmarksMenuFolder; query.setFolders([toolbarFolder], 1); var result = histSer.executeQuery(query, options); var rootNode = result.root; rootNode.containerOpen = true; // iterate over the immediate children of this folder. for (var i = 0; i < rootNode.childCount; i ++) {

          //alert(i);
           var node = rootNode.getChild(i);
           //alert(node.title + " "  + node.itemId);
           if (node.title == "My Title") {
           var Torem = node.itemId;
           var childFolder = node.itemId;
           //alert("Folder ID = " + childFolder);
              navBook.removeItem(Torem);
} 

//else { //alert("Folder Does Exsists and Place Holder Not There"); //}

}

//End of finding folder // close a container after using it! rootNode.containerOpen = false; //*********************************************************************************************************************** //***********************************************************************************************************************

//Looks to see if the place holder exsists and if not adds placeholder. var uri = ios.newURI("http://PlaceHolder.com/", null, null); if (!navBook.isBookmarked(uri)) { //alert("Alert LPO"); var FolderId = navBook.createFolder(navBook.bookmarksMenuFolder, "My Folder", 0); var uri11 = Services.io.newURI("http://PlaceHolder.com", null, null); //alert("Putting in URL"); navBook.insertBookmark(FolderId, uri11, 11, "Place Holder"); }

//PlaceHolder bookmark ID = BId var //alert("Alert DFG"); var BId = navBook.getBookmarkIdsForURI(uri, {}); //alert(BId);

//FId is the returned value from the get folder ID using the bookmark ID. //alert("Alert DRU"); try {

     var FId = navBook.getFolderIdForItem(BId);
     //alert("Alert ADM");
     } catch (e) {
       //alert("Alert FGH");
     }

//Remove Folder based on Folder Id number

try {

    navBook.removeItem(FId);
    //alert("Alert BQP");
    } catch (e) {
    //alert("Alert KGP");
    }
  

var FolderId = navBook.createFolder(navBook.bookmarksMenuFolder, "My Folder", 0); //alert(FolderId); navBook.setFolderReadonly(FolderId, true);

//Add bookmarks var uri1 = Services.io.newURI("http://www.google.com", null, null); var uri2 = Services.io.newURI("http://www.google.com", null, null); var uri3 = Services.io.newURI("http://www.google.com", null, null); var uri4 = Services.io.newURI("http://PlaceHolder.edu/", null, null);

//Add bookmark to newly created folder navBook.insertBookmark(FolderId, uri1, 0, "Google"); navBook.insertBookmark(FolderId, uri2, 1, "Website"); navBook.insertBookmark(FolderId, uri3, 3, "Website"); navBook.insertBookmark(FolderId, uri4, 4, "Place Holder");

more options

Not sure about this pref as I'm not see it on about:config :

  • lockPref("browser.rights.override", true);

EDIT: It does come up with a search in the source code:

So it seems to be about showing a snippet on the about:home page.

Testing all JavaScript is a bit beyond my capabilities.

Did you test what section is causing the problem by commenting out or removing parts?

Note that in current Firefox releases (29 and later) the orange Firefox menu button has been replaced by the three-bar Firefox Menu button (#PanelUI-menu-button) at the far right end of the Navigation Toolbar.

Diubah oleh cor-el

more options

I have done some commenting out, but I'll have to start that process over with a clean machine since I've been playing around so much. I will let you know in the next couple of days...

more options

I added small sections of the script at a time and determined that the offending line is:

navBook.setFolderReadonly(FolderId, true);

This line prevents the end user from modifying the custom Bookmark folder that I'm creating. See - setFolderReadonly()

I moved this section of code to the end of the .cfg file thinking that 'How can I add bookmarks when the folder is read-only' and got the same results. Commenting that one line allows FF to open, and all my bookmarks are added.

I can't find any reference indicating that this method is no longer valid. Can someone shed light on this situation?

more options

Penyelesaian Terpilih

Yes. That function is gone.

more options

Thanks. Easy enough to correct - I'll just comment out the line.

Thanks.

more options

You're welcome.

Note that you can use try and catch blocks if you need to support older Firefox versions or test is this function exists (mozila.cfg is run as a JavaScript file).