<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="entry"><p class="">This is the nineteenth edition of the XUL/XBL Replacement 
Newsletter. Lots to share this time - we’re making progress on the 
remaining XUL replacement work, while also clearing out the XBL 
implementation from mozilla-central.</p>

<h2 id="html-root-in-browserxhtml" class=""><span style="font-size: 12px;" class=""><html> root in browser.xhtml</span></h2><p class="">We had already migrated the main browser window from a XULDocument to
 HTMLDocument and renamed it from browser.xul to browser.xhtml. But 
there are still a lot of XUL elements inside of it. Most notably, the 
documentElement was still a <code class="highlighter-rouge"><xul:window></code>, which meant that we would <a href="https://searchfox.org/mozilla-central/rev/6566d92dd46417a2f57e75c515135ebe84c9cef5/layout/base/nsCSSFrameConstructor.cpp#2449-2498" class="">use a different frame structure</a> than normal webpages.</p><p class="">Brendan Dahl recently <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1492582" class="">landed a change</a> to fix this. Now instead of:</p><div class="highlighter-rouge language-xml"><div class="highlight"><pre class="highlight"><code class=""><span class="nt"><window</span> <span class="na">title=</span><span class="s">"Firefox"</span><span class="nt">></span>
  <span class="nt"><linkset></span>
     <span class="nt"><link</span> <span class="na">rel=</span><span class="s">"localization"</span> <span class="nt">/></span>....
  <span class="nt"></linkset></span>
  <span class="nt"><script</span> <span class="nt">/></span>...
  <span class="nt"><the-rest-of-the-content</span> <span class="nt">/></span>
<span class="nt"></window></span>

</code></pre></div></div><p class="">The document looks like:</p>

<div class="highlighter-rouge language-xml"><div class="highlight"><pre class="highlight"><code class=""><span class="nt"><html></span>
  <span class="nt"><head></span>
    <span class="nt"><title></span>Firefox<span class="nt"></title></span>
    <span class="nt"><link</span> <span class="na">rel=</span><span class="s">"localization"</span> <span class="nt">/></span>....
    <span class="nt"><script</span> <span class="nt">/></span>...
  <span class="nt"></head></span>
  <span class="nt"><body></span>
    <span class="nt"><the-rest-of-the-content</span> <span class="nt">/></span>
  <span class="nt"></body></span>
<span class="nt"></html></span>
</code></pre></div></div><p class="">Ideally, I’d like to do the same thing but for all documents in the tree and then remove <code class="highlighter-rouge">nsDocElementBoxFrame</code> (the layout frame used for XUL root elements). This would be a big job, since there are 1200+ <code class="highlighter-rouge"><window></code>
 tags in tree and the migration likely requires some automatic parsing 
and rewriting XML. But the browser document is an important first step 
and gives us confidence that it’ll work with other documents. Also, Kirk
 Steuber has been taking steps to make the project more manageable by 
migrating away from the non-“window” XUL root elements <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1584283" class=""><code class="highlighter-rouge"><wizard></code></a> and <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1585482" class=""><code class="highlighter-rouge"><dialog></code></a>. I’m also hoping we can use some of the learnings and process from Emma Malysz’ ongoing work to <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1579952" class="">rename all .xul files to .xhtml</a> to help.</p>

<h2 id="l20n" class=""><span style="font-size: 12px;" class="">L20n</span></h2><p class="">L20n is the code name for an effort that started three years ago to introduce Mozilla’s new localization system (called <a href="https://projectfluent.org/" class="">Project Fluent</a>)
 into Firefox. It’s an important part of XUL replacement, but it also 
improves the quality and resilience of localization in Firefox as Zibi 
Braniecki <a href="https://diary.braniecki.net/2018/01/08/multilingual-gecko-in-2017/" class="">outlines</a> in a post summarizing the start of the project.</p><p class="">Since then, the work was <a href="https://docs.google.com/spreadsheets/d/1ubpXFL9UMT9TgN76M3Jm8rGhDUFP6mLJrStbqJlY1M0/edit#gid=900263176" class="">planned</a>,
 the core internationalization module in Gecko was refactored, and 
Fluent was landed and integrated into all major components of the 
Firefox UI. And recently the old DTD-based localization system for 
XUL/XHTML <a href="https://groups.google.com/d/msg/mozilla.dev.platform/3RFCrI0uSCE/KoRLcrXQDwAJ" class="">has officially been deprecated</a>. So as of now, we are considering the L20n project complete.</p><p class="">The next project is to complete migrating all remaining strings in 
the Firefox UI to use Fluent. Today around 37% of Firefox l10n strings 
use Fluent, so there’s still a lot more to do. We are first focusing on 
removing DTD strings that can cause the “Yellow Screen Of Death” (a 
startup crash due to an XML parsing error), and on building tooling to 
help speed the remaining conversions. This work is being tracked at <a href="https://arewefluentyet.com/" class="">https://arewefluentyet.com/</a>.</p>

<h2 id="appwindow-is-the-new-nsxulwindownswebshellwindow" class=""><span style="font-size: 12px;" class="">AppWindow is the new nsXULWindow/nsWebShellWindow</span></h2><p class="">In the past, top level windows (e.g. the browser UI, places UI, etc) 
have had an nsXULWindow associated with them for controlling various 
things related to the OS window. However, as we migrate more of these 
windows to XHTML and HTML, the “nsXULWindow” name makes less sense. So 
after discussing with smaug, Brendan <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1470510" class="">changed the name to AppWindow</a>.
 As part of this cleanup we were also able to merge nsWebShellWindow 
into nsXULWindow, since it was the only class extending nsXULWindow. We 
hope the AppWindow name makes the purpose more clear.</p>

<h2 id="goodbye-xbl" class=""><span style="font-size: 12px;" class="">Goodbye, XBL</span></h2><p class="">Last newsletter, we were building GeckoView without MOZ_XBL. Since then, Brendan has landed a <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1583314" class="">change</a> to also build desktop without MOZ_XBL and Boris Zbarsky has <a href="https://groups.google.com/d/msg/mozilla.governance/S7mMFIN_ccI/Zur7fk8CAgAJ" class="">posted to mozilla.governance</a>
 about removing the XBL module. We’ve also closed all unnecessary bugs 
in Core::XBL on Bugzilla, and moved any still relevant bugs into 
appropriate components.</p><p class="">In the meantime, we’ve started to remove the implementation and clean
 up related code. Thanks to everyone who’s been pitching in here! 
Removing the implementation isn’t as easy as it may seem, since it’s 
wound through many different components and features. If you are aware 
of anything that can be removed or simplified now that XBL is gone, 
please file a bug blocking the <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1566221" class="">remove-xbl-implementation metabug</a>.</p><p class="">Here are some of the recent changes:</p>

<ul class="">
  <li class="">Emilio Cobos Álvarez <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1591297" class="">landed a bunch of cleanups in the layout and style systems</a>, including simplification of the frame constructor and removing <code class="highlighter-rouge">-moz-binding</code> support.</li>
  <li class="">After that, Tom Ritter removed the exception allowing eval() of JS via <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1588816" class="">userChrome.css</a>, which is a step towards the larger goal of completely <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1473549" class="">preventing eval from being used in the parent process or system context</a>.</li>
  <li class="">I <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1587142" class="">removed XBL related tests</a>, <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1593119" class="">unifdef’ed MOZ_XBL</a> using the <a href="https://dotat.at/prog/unifdef/" class="">unifdef utility</a>, and then removed the dom/xbl/ directory from mozilla-central.</li>
  <li class="">After that, Alex Surkov is in the process of <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1594122" class="">porting</a> the remaining still-relevant XBL tests to use Shadow DOM.</li>
  <li class="">Ehsan Akhgari <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1587806" class="">removed the loadBindingDocument method</a> from Document.webidl.</li>
  <li class="">After that, I <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1591145" class="">removed the getAnonymousElementByAttribute method</a> from Document.webidl.</li>
  <li class="">Emma Malysz is in the process of <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1591147" class="">removing getAnonymousNodes</a>, the one remaining XBL method in Document.webidl.</li>
  <li class="">Emma also <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1591588" class="">removed the negative index check from GetWholeText</a>.</li>
  <li class="">Emma also <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1594874" class="">removed the xbl.properties</a> file, which in turn helps with the larger Fluent migration work.</li>
  <li class="">Mark Banner <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1593058" class="">removed eslint support for XBL</a>.
 This was a custom lint processor to partially support linting XBL which
 required parsing the xml to extract out JS. As clever as it was, I 
don’t anyone will be sad to see it go now that we don’t need it anymore.</li>
  <li class="">Tim Nguyen <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1592533" class="">landed some nice cleanups in xul.css</a>, removing the xbl namespace and a handful of CSS rules and selectors.</li>
  <li class="">Nicolas Chevobbe <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1593053" class="">removed the XBL categories for DevTools console messages</a>.</li>
  <li class="">Gabriel (gl) <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1587789" class="">removed XBL handling in the DevTools inspector</a>.</li>
  <li class="">Henrik Skupin <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1587627" class="">removed XBL handling in WebDriver</a>.</li>
  <li class="">Christoph Walcher landed a few frontend simplifications - removing the <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1593051" class="">“ensure the XBL binding is created eagerly” code</a> in applicationManager.js, then removing support for <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1593066" class=""><code class="highlighter-rouge"><xbl:children></code> in arrowscrollbox._getScrollableElements</a>, and finally removing <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1593068" class=""><code class="highlighter-rouge">[text]</code> attribute observing from xul:label</a>.</li>
  <li class="">Edouard Oger <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1593065" class="">removed the XBL workaround</a> for decks in Sync UI.</li>
</ul><div class=""><br class=""></div></div></body></html>