Block File System Browsing

User Help for Mozilla Firefox
User avatar
dickvl
Posts: 54146
Joined: July 18th, 2005, 3:25 am

Re: Block File System Browsing

Post by dickvl »

That particular function (BrowserLoadURL) is removed from browser.jar , so it is no longer possible the modify the BrowserLoadURL function to get that block. I had checked that at the first time of the new post (July 15) and couldn't find it, not code in other functions that looked similar. I didn't check other jar files (e.g. toolkit) to see if the code has been moved there.
User avatar
trolly
Moderator
Posts: 39851
Joined: August 22nd, 2005, 7:25 am

Re: Block File System Browsing

Post by trolly »

Explains a lot.
If the first poster had said that we could have saved a lot of time.
Think for yourself. Otherwise you have to believe what other people tell you.
A society based on individualism is an oxymoron. || Freedom is at first the freedom to starve.
Constitution says: One man, one vote. Supreme court says: One dollar, one vote.
young_einstein
Guest

Re: Block File System Browsing

Post by young_einstein »

trolly wrote:Is the browser.js file no more in browser.jar?


The browser.js file is still there ... but the code inside it is now completely different.

I'm not a big coder [by any stretch of the imagination], but I really can't see anything at all that even remotely resembles the code we were modifying in earlier versions of the program.

I obviously need someone a lot more skilled than me to take a look at it, and see if they can work it out ...

*hint* to all you smart people out there! :)
young_einstein
Guest

Re: Block File System Browsing

Post by young_einstein »

dickvl wrote:I didn't check other jar files (e.g. toolkit) to see if the code has been moved there.


I've searched every file under C:\Program Files\Mozilla Firefox\* [yes ... including all the compressed .jar files] and none of them have any reference to the old 'BrowserLoadURL' function.

Obviously it's possible that it's just been given a different name, but I haven't had any luck trying to track it down, so I'm really not sure ...
young_einstein
Guest

Re: Block File System Browsing

Post by young_einstein »

If it's any help to anyone, I've found another page mentioning the removal of the 'BrowserLoadURL' function, and how they worked around it to fix a different feature which was relying on it.

http://www.x2b4.com/howto/how-to-open-e ... firefox-3/

Update 2009/03/01: For Firefox 3.1, the BrowserLoadUrl doesn’t exist anymore. There is new way to have correct behaviour:

(function() {
urlbar = document.getElementById("urlbar");
eval("urlbar.handleCommand = " + urlbar.handleCommand.toString().replace("&& aTriggeringEvent.altKey","&& !aTriggeringEvent.altKey"));
})();


That doesn't really mean a whole lot to me [not being much of a coder and all] ... but hopefully someone might see something in there which sparks a bit of an idea for them.

Here's hoping anyway ... :D
User avatar
trolly
Moderator
Posts: 39851
Joined: August 22nd, 2005, 7:25 am

Re: Block File System Browsing

Post by trolly »

The script is replacing the default handler. A similar function has to be called during startup. I think it can be done from an addon.
Think for yourself. Otherwise you have to believe what other people tell you.
A society based on individualism is an oxymoron. || Freedom is at first the freedom to starve.
Constitution says: One man, one vote. Supreme court says: One dollar, one vote.
aceuk
Guest

Re: Block File System Browsing

Post by aceuk »

Has anyone had any luck with this? This is the only thing preventing me from deploying Firefox where I work. :(
David Tomic
Guest

Re: Block File System Browsing

Post by David Tomic »

Bumpity bump bump ...

Still hoping that someone's going to come up with an answer / solution for this problem?
v360pc
Guest

Re: Block File System Browsing

Post by v360pc »

ok, I finally figured this out. =)

in the browser.jar there is a file named urlbarBindings.jar.Find the section with the tag "<method name="handleCommand">"

Under the following section (~line 64):

Code: Select all

          var [url, postData] = this._canonizeURL(aTriggeringEvent);
          if (!url)
            return;


Just add:

Code: Select all

       if (url.match(/^file:/) || url.match(/^\//) || url.match(/^resource:/) || url.match(/^about:/)) {
            alert("Access denied.");
            exit
          }


Repack the jar, copy it in place and restart your browser.
User avatar
dickvl
Posts: 54146
Joined: July 18th, 2005, 3:25 am

Re: Block File System Browsing

Post by dickvl »

(that should be: browser.jar/content/browser/urlbarBindings.xml)
v360pc
Guest

Re: Block File System Browsing

Post by v360pc »

dickvl wrote:(that should be: browser.jar/content/browser/urlbarBindings.xml)
yes. good point. thank you for correcting.
aceuk
Guest

Re: Block File System Browsing

Post by aceuk »

Thanks for the tip, v360pc. However, I still can't get it working with Firefox v3.5.3. What am I doing wrong?

Code: Select all

          var [url, postData] = this._canonizeURL(aTriggeringEvent);
         
          if (!url)
            return;

          if (url.match(/^file:/) || url.match(/^\//) || url.match(/^resource:/) || url.match(/^about:/)) {
               alert("Access denied.");
               exit
           }
         
          this.value = url;
          gBrowser.userTypedValue = url;
          try {
            addToUrlbarHistory(url);
          } catch (ex) {
            // Things may go wrong when adding url to session history,
            // but don't let that interfere with the loading of the url.
            Cu.reportError(ex);
          }
aceuk
Guest

Re: Block File System Browsing

Post by aceuk »

Bump.
aceuk
Guest

Re: Block File System Browsing

Post by aceuk »

Found another way of doing it. All you have to do is put the following into your userContent.css file. :D

Code: Select all

@-moz-document url-prefix(file://) {
 html > body { visibility: hidden !important;
}
hendry
Posts: 6
Joined: June 18th, 2003, 6:28 am
Contact:

Re: Block File System Browsing

Post by hendry »

None of these solutions seem to work in 3.5.3 :(

http://webconverger.org/kiosk/
Post Reply