<feed xmlns='http://www.w3.org/2005/Atom'>
<title>legacywolf/legacy, branch master</title>
<subtitle>LegacyFox as an addon</subtitle>
<link rel='alternate' type='text/html' href='https://ba.ln.ea.cx/src/marsironpi/legacywolf/'/>
<entry>
<title>support unpacked extensions</title>
<updated>2025-08-10T20:12:57+00:00</updated>
<author>
<name>girst</name>
<email>girst@users.noreply.github.com</email>
</author>
<published>2025-08-10T20:12:57+00:00</published>
<link rel='alternate' type='text/html' href='https://ba.ln.ea.cx/src/marsironpi/legacywolf/commit/?id=7c2fc6e40e8e84d9cecde02e9630318ccca605ab'/>
<id>7c2fc6e40e8e84d9cecde02e9630318ccca605ab</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>optimize legacy-extension-data file operations</title>
<updated>2025-08-05T18:26:12+00:00</updated>
<author>
<name>girst</name>
<email>girst@users.noreply.github.com</email>
</author>
<published>2025-08-05T18:22:55+00:00</published>
<link rel='alternate' type='text/html' href='https://ba.ln.ea.cx/src/marsironpi/legacywolf/commit/?id=836dadeb9ed2ad00465720301a21060ff48f7e11'/>
<id>836dadeb9ed2ad00465720301a21060ff48f7e11</id>
<content type='text'>
for reference: https://searchfox.org/mozilla-central/source/xpcom/io/nsIFile.idl
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
for reference: https://searchfox.org/mozilla-central/source/xpcom/io/nsIFile.idl
</pre>
</div>
</content>
</entry>
<entry>
<title>make compatible with mozilla142 and above</title>
<updated>2025-08-05T18:25:42+00:00</updated>
<author>
<name>girst</name>
<email>girst@users.noreply.github.com</email>
</author>
<published>2025-08-05T17:21:23+00:00</published>
<link rel='alternate' type='text/html' href='https://ba.ln.ea.cx/src/marsironpi/legacywolf/commit/?id=f6ad068eefefd2f081423278d8b0bbb763a6656f'/>
<id>f6ad068eefefd2f081423278d8b0bbb763a6656f</id>
<content type='text'>
the general idea came from onemen and 117649 in the discussion in
https://github.com/xiaoxiaoflood/firefox-scripts/issues/363 but the code
has been written from scratch (as I wasn't convinced of some of their
design decisions). in the end, the overall approach taken looks somewhat
similar, because there seems to be only one way to do that from JS code.

we only rewrite a subset of specified manifest instructions, that are
needed for VimFx. others are passed-through and might make other addons
work. the full list of manifest instructions is documented here:
  https://www.devdoc.net/web/developer.mozilla.org/en-US/Chrome_Registration.html

Further notes on the implementation:

use of constants from (and hence import of) FileUtils has been avoided
by 1) specifying unix file/dir permissions directly instead of using
FileUtils.PERMS_FILE and 2) by relying on default open(2) modes in
FileOutputStream, which are the one we want anyways. its documented at
  https://searchfox.org/mozilla-central/rev/4fd0d5e4669bfa2d0888b730684d8adea061fd30/netwerk/base/nsIFileStreams.idl#96-97

during uninstall(), it does not suffice to re-call .autoRegister() to
remove the chrome.manifest. .checkForNewChrome() has precedence in
mozilla-central:
  https://searchfox.org/mozilla-central/rev/4fd0d5e4669bfa2d0888b730684d8adea061fd30/toolkit/mozapps/extensions/AddonManagerStartup.cpp#770

the file doesn't need to exist in uninstall() at all, and only the
parent directory must exist for install(), but creating it in both cases
simplified the logic a bit. an empty directory will stay behind in the
profile directory after uninstallation - oh, well; too bad.
nsIFile.remove() takes a boolean argument; it determines recursion.
  https://searchfox.org/mozilla-central/rev/820596a140570007ce22a6c137ce2520676cfffe/xpcom/io/nsIFile.idl#272

AddonManagerStartup exposes a method .registerChrome(), which takes a
parsed manifest instead of a file path. This one doesn't support 'skin'
entries (workaround-able with overrides) and does not expose 'content'
entries to the content processes - the latter kills this idea.
  https://searchfox.org/mozilla-central/rev/820596a140570007ce22a6c137ce2520676cfffe/toolkit/mozapps/extensions/AddonManagerStartup.cpp#782
  https://searchfox.org/mozilla-central/rev/820596a140570007ce22a6c137ce2520676cfffe/browser/extensions/formautofill/api.js#124

zipReader code was cribbed from here, with Cc[].createInstance()
replaced by the nicer Components.Constructor call:
  https://searchfox.org/mozilla-central/rev/820596a140570007ce22a6c137ce2520676cfffe/modules/libjar/zipwriter/test/unit/test_alignment.js#73

regressed-by: https://bugzilla.mozilla.org/show_bug.cgi?id=1953136
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
the general idea came from onemen and 117649 in the discussion in
https://github.com/xiaoxiaoflood/firefox-scripts/issues/363 but the code
has been written from scratch (as I wasn't convinced of some of their
design decisions). in the end, the overall approach taken looks somewhat
similar, because there seems to be only one way to do that from JS code.

we only rewrite a subset of specified manifest instructions, that are
needed for VimFx. others are passed-through and might make other addons
work. the full list of manifest instructions is documented here:
  https://www.devdoc.net/web/developer.mozilla.org/en-US/Chrome_Registration.html

Further notes on the implementation:

use of constants from (and hence import of) FileUtils has been avoided
by 1) specifying unix file/dir permissions directly instead of using
FileUtils.PERMS_FILE and 2) by relying on default open(2) modes in
FileOutputStream, which are the one we want anyways. its documented at
  https://searchfox.org/mozilla-central/rev/4fd0d5e4669bfa2d0888b730684d8adea061fd30/netwerk/base/nsIFileStreams.idl#96-97

during uninstall(), it does not suffice to re-call .autoRegister() to
remove the chrome.manifest. .checkForNewChrome() has precedence in
mozilla-central:
  https://searchfox.org/mozilla-central/rev/4fd0d5e4669bfa2d0888b730684d8adea061fd30/toolkit/mozapps/extensions/AddonManagerStartup.cpp#770

the file doesn't need to exist in uninstall() at all, and only the
parent directory must exist for install(), but creating it in both cases
simplified the logic a bit. an empty directory will stay behind in the
profile directory after uninstallation - oh, well; too bad.
nsIFile.remove() takes a boolean argument; it determines recursion.
  https://searchfox.org/mozilla-central/rev/820596a140570007ce22a6c137ce2520676cfffe/xpcom/io/nsIFile.idl#272

AddonManagerStartup exposes a method .registerChrome(), which takes a
parsed manifest instead of a file path. This one doesn't support 'skin'
entries (workaround-able with overrides) and does not expose 'content'
entries to the content processes - the latter kills this idea.
  https://searchfox.org/mozilla-central/rev/820596a140570007ce22a6c137ce2520676cfffe/toolkit/mozapps/extensions/AddonManagerStartup.cpp#782
  https://searchfox.org/mozilla-central/rev/820596a140570007ce22a6c137ce2520676cfffe/browser/extensions/formautofill/api.js#124

zipReader code was cribbed from here, with Cc[].createInstance()
replaced by the nicer Components.Constructor call:
  https://searchfox.org/mozilla-central/rev/820596a140570007ce22a6c137ce2520676cfffe/modules/libjar/zipwriter/test/unit/test_alignment.js#73

regressed-by: https://bugzilla.mozilla.org/show_bug.cgi?id=1953136
</pre>
</div>
</content>
</entry>
<entry>
<title>port legacyfox to ecmascript modules</title>
<updated>2024-03-03T12:18:04+00:00</updated>
<author>
<name>girst</name>
<email>girst@users.noreply.github.com</email>
</author>
<published>2024-03-03T11:59:18+00:00</published>
<link rel='alternate' type='text/html' href='https://ba.ln.ea.cx/src/marsironpi/legacywolf/commit/?id=88413358677fd59dc360076e0a62c2c559f50e38'/>
<id>88413358677fd59dc360076e0a62c2c559f50e38</id>
<content type='text'>
mozilla calls this 'esm-ification'. the last relevant to us modules were
ported in mozilla124[1], so this is our new minimum version. the old
version will likely be compatible with firefox up to version 128esr[2].

static imports are not supported in autoconfig scripts. i tried to keep
the diff as small as possible w.r.t comm-central's final JSMs. because
of this, we don't lazy-load any modules any more, nor provide any lazy
getters, as they would need to be loaded into a `lazy` object instead
the global (`this`) namespace, causing more churn. other than that, the
largest change was removing the now-useless Services.jsm workaround as
well as removing globalGetters for objects already loaded automatically.

[1]: https://hg.mozilla.org/mozilla-central/rev/68ba071ff6fb9978937496f9adc48e378957f594
[2]: bugzil.la/1881890
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
mozilla calls this 'esm-ification'. the last relevant to us modules were
ported in mozilla124[1], so this is our new minimum version. the old
version will likely be compatible with firefox up to version 128esr[2].

static imports are not supported in autoconfig scripts. i tried to keep
the diff as small as possible w.r.t comm-central's final JSMs. because
of this, we don't lazy-load any modules any more, nor provide any lazy
getters, as they would need to be loaded into a `lazy` object instead
the global (`this`) namespace, causing more churn. other than that, the
largest change was removing the now-useless Services.jsm workaround as
well as removing globalGetters for objects already loaded automatically.

[1]: https://hg.mozilla.org/mozilla-central/rev/68ba071ff6fb9978937496f9adc48e378957f594
[2]: bugzil.la/1881890
</pre>
</div>
</content>
</entry>
<entry>
<title>fix setting softDisabled state</title>
<updated>2024-02-29T17:52:05+00:00</updated>
<author>
<name>girst</name>
<email>girst@users.noreply.github.com</email>
</author>
<published>2024-02-29T17:52:05+00:00</published>
<link rel='alternate' type='text/html' href='https://ba.ln.ea.cx/src/marsironpi/legacywolf/commit/?id=25664f0b2c3238704c7509cc661d52b6b5763599'/>
<id>25664f0b2c3238704c7509cc661d52b6b5763599</id>
<content type='text'>
not that it is too important. Blocklist.jsm does not export blocklist
state any more. XPIInstall.jsm does this, since way before mozilla61:

  const { nsIBlocklistService } = Ci;
  addon.softDisabled = addon.blocklistState == nsIBlocklistService.STATE_SOFTBLOCKED;

c.f. https://searchfox.org/mozilla-central/rev/b503616295d69fee56300e5e2093599e6fb4f0e2/toolkit/mozapps/extensions/internal/XPIInstall.jsm#531
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
not that it is too important. Blocklist.jsm does not export blocklist
state any more. XPIInstall.jsm does this, since way before mozilla61:

  const { nsIBlocklistService } = Ci;
  addon.softDisabled = addon.blocklistState == nsIBlocklistService.STATE_SOFTBLOCKED;

c.f. https://searchfox.org/mozilla-central/rev/b503616295d69fee56300e5e2093599e6fb4f0e2/toolkit/mozapps/extensions/internal/XPIInstall.jsm#531
</pre>
</div>
</content>
</entry>
<entry>
<title>keep RDFDataSource.saveToFile around</title>
<updated>2024-02-16T14:26:01+00:00</updated>
<author>
<name>girst</name>
<email>girst@users.noreply.github.com</email>
</author>
<published>2024-02-16T14:23:33+00:00</published>
<link rel='alternate' type='text/html' href='https://ba.ln.ea.cx/src/marsironpi/legacywolf/commit/?id=6ce51d8662f52465830e7ce5f5e42e3ed9c52710'/>
<id>6ce51d8662f52465830e7ce5f5e42e3ed9c52710</id>
<content type='text'>
minimizes the diff we need to keep. note that as previously mentioned
this requires mozilla&gt;=85, but shouldn't cause issues unless called.

This partially reverts commit 553416c2d6d3c760cf98bd2c4afbaf0442321951.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
minimizes the diff we need to keep. note that as previously mentioned
this requires mozilla&gt;=85, but shouldn't cause issues unless called.

This partially reverts commit 553416c2d6d3c760cf98bd2c4afbaf0442321951.
</pre>
</div>
</content>
</entry>
<entry>
<title>remove OS.File references</title>
<updated>2024-02-01T20:39:59+00:00</updated>
<author>
<name>girst</name>
<email>girst@users.noreply.github.com</email>
</author>
<published>2024-02-01T20:22:58+00:00</published>
<link rel='alternate' type='text/html' href='https://ba.ln.ea.cx/src/marsironpi/legacywolf/commit/?id=553416c2d6d3c760cf98bd2c4afbaf0442321951'/>
<id>553416c2d6d3c760cf98bd2c4afbaf0442321951</id>
<content type='text'>
osfile.jsm was removed by bugzil.la/1772262. This method is not used any
more, so we can just remove it. the modern alternative would be the
following, but that only works on mozilla&gt;=85.
    return IOUtils.writeUTF8(file, this.serializeToString());

osfile.jsm was loaded lazily (and in our case therefore never), so we
didn't die immediately upon import, fortunately.

see also: https://hg.mozilla.org/mozilla-central/diff/a11c616997d802e44d1afc0215bfbffac865179e/toolkit/components/passwordmgr/test/LoginTestUtils.jsm
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
osfile.jsm was removed by bugzil.la/1772262. This method is not used any
more, so we can just remove it. the modern alternative would be the
following, but that only works on mozilla&gt;=85.
    return IOUtils.writeUTF8(file, this.serializeToString());

osfile.jsm was loaded lazily (and in our case therefore never), so we
didn't die immediately upon import, fortunately.

see also: https://hg.mozilla.org/mozilla-central/diff/a11c616997d802e44d1afc0215bfbffac865179e/toolkit/components/passwordmgr/test/LoginTestUtils.jsm
</pre>
</div>
</content>
</entry>
<entry>
<title>remove use of deprecated components</title>
<updated>2024-02-01T20:17:50+00:00</updated>
<author>
<name>girst</name>
<email>girst@users.noreply.github.com</email>
</author>
<published>2024-02-01T20:17:50+00:00</published>
<link rel='alternate' type='text/html' href='https://ba.ln.ea.cx/src/marsironpi/legacywolf/commit/?id=49c27725d7d4e98e474b6b7d0a324400255b0f34'/>
<id>49c27725d7d4e98e474b6b7d0a324400255b0f34</id>
<content type='text'>
console.createInstance() is available since firefox59 (Bug 1425574), so
no workaround needed. ChromeUtils.defineLazyGetter() however only is
since firefox112 (Bug 1805288) but the backwards-compatible code is tiny

see also:
  https://bugzilla.mozilla.org/show_bug.cgi?id=1875216
  https://bugzilla.mozilla.org/show_bug.cgi?id=1430810
  https://bugzilla.mozilla.org/show_bug.cgi?id=1828156
  https://groups.google.com/a/mozilla.org/g/dev-platform/c/BdyWnTjLSXg
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
console.createInstance() is available since firefox59 (Bug 1425574), so
no workaround needed. ChromeUtils.defineLazyGetter() however only is
since firefox112 (Bug 1805288) but the backwards-compatible code is tiny

see also:
  https://bugzilla.mozilla.org/show_bug.cgi?id=1875216
  https://bugzilla.mozilla.org/show_bug.cgi?id=1430810
  https://bugzilla.mozilla.org/show_bug.cgi?id=1828156
  https://groups.google.com/a/mozilla.org/g/dev-platform/c/BdyWnTjLSXg
</pre>
</div>
</content>
</entry>
<entry>
<title>add backwards compatible code for Services.jsm removal</title>
<updated>2023-07-14T11:16:56+00:00</updated>
<author>
<name>girst</name>
<email>girst@users.noreply.github.com</email>
</author>
<published>2023-07-14T11:10:18+00:00</published>
<link rel='alternate' type='text/html' href='https://ba.ln.ea.cx/src/marsironpi/legacywolf/commit/?id=fc77a6afa82b058faf12411af45aee62d32450e6'/>
<id>fc77a6afa82b058faf12411af45aee62d32450e6</id>
<content type='text'>
makes LegacyFox compatible with Firefox 117.

regressed-by: https://bugzilla.mozilla.org/show_bug.cgi?id=1780695
see-also: https://hg.mozilla.org/mozilla-central/rev/911d540fce6f
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
makes LegacyFox compatible with Firefox 117.

regressed-by: https://bugzilla.mozilla.org/show_bug.cgi?id=1780695
see-also: https://hg.mozilla.org/mozilla-central/rev/911d540fce6f
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix bug in BootstrapLoader</title>
<updated>2022-09-30T16:49:44+00:00</updated>
<author>
<name>girst</name>
<email>girst@users.noreply.github.com</email>
</author>
<published>2022-09-27T12:18:52+00:00</published>
<link rel='alternate' type='text/html' href='https://ba.ln.ea.cx/src/marsironpi/legacywolf/commit/?id=c2ebaa3a942180370e9318661ceacf4bae55560c'/>
<id>c2ebaa3a942180370e9318661ceacf4bae55560c</id>
<content type='text'>
reported to https://github.com/xiaoxiaoflood/firefox-scripts/issues/115

&gt; I just found that for my legacy addon after restart it some of it
&gt; function calls that initiated by timer or observer callback are
&gt; running in a sandbox context of the last startup which is different
&gt; from current one. And this cause malfunctions for my addon.

see also: https://github.com/xiaoxiaoflood/firefox-scripts/commit/291bebc4f2edc919dd273f2cecbbfda61e157695
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
reported to https://github.com/xiaoxiaoflood/firefox-scripts/issues/115

&gt; I just found that for my legacy addon after restart it some of it
&gt; function calls that initiated by timer or observer callback are
&gt; running in a sandbox context of the last startup which is different
&gt; from current one. And this cause malfunctions for my addon.

see also: https://github.com/xiaoxiaoflood/firefox-scripts/commit/291bebc4f2edc919dd273f2cecbbfda61e157695
</pre>
</div>
</content>
</entry>
</feed>
