Why does Firefox developer edition use chrome:// urls to load scripts?

14

1

I just downloaded a copy of the new Firefox Developer Edition browser and started to fiddle around with the dev tools.

I noticed that some of the links and scripts were loaded over chrome:// urls, which I thought were registered for Google Chrome.

enter image description here

Here are some of those lines in specific.

<link id="favicon" rel="icon" type="image/png" href="chrome://branding/content/icon32.png"></link>
<link rel="stylesheet" type="text/css" media="all" href="chrome://browser/content/searchSuggestionUI.css"></link>
<link rel="stylesheet" type="text/css" media="all" defer="defer" href="chrome://browser/content/abouthome/aboutHome.css"></link>
<script type="text/javascript;version=1.8" src="chrome://browser/content/abouthome/aboutHome.js"></script>
<script type="text/javascript;version=1.8" src="chrome://browser/content/searchSuggestionUI.js"></script>

I wondered whether they were hijacking chrome assets, but after checking out one of those scripts, I found a Mozilla comment.

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

I don't know much about custom protocols or how they are registered or used. What's going on here?

Dan Prince

Posted 2014-11-10T18:17:47.907

Reputation: 321

Question was closed 2014-11-11T14:15:37.200

Answers

36

Chrome in this case doesn't refer to the Chrome browser, but the chrome "user interface" part of Firefox.

See https://developer.mozilla.org/en-US/docs/Glossary/Chrome for further information:

Summary

Chrome is originally a term for the parts of a web browser's user interface other than the web page it is showing.

"Chrome" is also often used to refer to the Google Chrome web browser.

...

chrome code or chrome-privileged code is the name given to the JavaScript code in Firefox that implements the browser itself

For future reference, the Mozilla Developer Network (MDN) contains a wealth of knowledge on all things Mozilla.

enalicho

Posted 2014-11-10T18:17:47.907

Reputation: 466

36And note that this word has been used by MOzilla for far longer than the Chrome browser has been around. – Mr Lister – 2014-11-10T22:45:29.667

17And in fact, Google Chrome is named after the concept of browser chrome, because it was designed to be a browser that eliminated as much unnecessary chrome as possible. – 3Doubloons – 2014-11-11T00:15:17.790

2@3Doubloons Does current Chrome still have this philosophy? Using Chrome, especially on the Mac, it's arguably the slowest browser and consumes the most memory. – theGreenCabbage – 2014-11-11T03:49:25.003

4@theGreenCabbage: Memory consumption (efficiency) is not directly related to minimalism (arguably a modern art movement). Although in theory a minimal UI should use less resources that's not true when in order to achieve that minimalism (like in Google Chrome) you ignore OS provided APIs for windows etc. and write everything yourself from scratch. – slebetman – 2014-11-11T05:04:38.260

1

custom protocols or how they are registered or used

It's important to note that this is not a protocol, but rather a URI scheme. A networking protocol defines the format of communication; a URI scheme specifies the semantics of the URI.

which I thought were registered for Google Chrome

The IANA maintains a list of provisional URI schemes. The chrome scheme is currently registered as a provisional scheme, with two definitions: one for the Mozilla usage, and one for the Google usage.

Of course, it is possible to use your own scheme without officially registering it. But that causes issues when others start using the same scheme name for a different purpose, as has happened here.

One of the RFC 4395 guidelines for registering a provisional scheme is:

  There is not already an entry with the same URI scheme name.  (In
  the unfortunate case that there are multiple, different uses of
  the same scheme name, the IESG may approve a request to modify an
  existing entry to note the separate use.)

Of interest is that both current registered definitions have the same listed contact, who uses a microsoft.com email address - and the original registration template was in 2012, after both Mozilla and Chrome were already using it. So it seems that Mozilla never registered it with the IANA, and now we're in this situation with two different uses of the same scheme name.

Bob

Posted 2014-11-10T18:17:47.907

Reputation: 51 526

While the other answer has addressed the actual usage in Firefox, I just wanted to point out how registration actually works, and the current state of the "official" chrome scheme's registration. – Bob – 2014-11-11T09:25:27.740