flypig.co.uk

List items

Items from the current list are shown below.

Gecko

11 Feb 2024 : Day 153 #
Yesterday we finally saw the session history start to work. But it wasn't without errors and we were still left with the following showing in the console:
Warning: couldn't PurgeHistory. Was it a file download? TypeError:
    legacyHistory.PurgeHistory is not a function

JavaScript error: resource://gre/modules/LoginManagerChild.jsm, line 541:
    NotFoundError: WindowGlobalChild.getActor:
    No such JSWindowActor 'LoginManager'
That's two separate errors. We started to look into the first of these, which is emanating from embedhelper.js. The PurgeHistory() method has been renamed to purgeHistory() in nsISHistory.idl. So with any luck if we just make the same change in embedhelper.js it'll fix the first of these.

Happily the embedhelper.js file is part of embedlite-components which makes it super-quick to test. No need to rebuild gecko. And the change does the trick: no more PurgeHistory errors. I experience a couple of cases where it seems to drop some items from the history, but I think this might be teething troubles (and also not just an ESR 91 issue... I'm sure I've seen it in the current release build as well). I'll have to see if I can find a way to reliably reproduce it.

What about the second error relating to LoginManagerChild.jsm then?
JavaScript error: resource://gre/modules/LoginManagerChild.jsm, line 541:
    NotFoundError: WindowGlobalChild.getActor:
    No such JSWindowActor 'LoginManager'
Here's the bit of code from LoginManagerChild.jsm causing the error:
  static forWindow(window) {
    let windowGlobal = window.windowGlobalChild;
    if (windowGlobal) {
      return windowGlobal.getActor("LoginManager");
    }

    return null;
  }
There's no change between this bit of code and the code in ESR 78. So the reason for the error must be buried a little deeper.

The code in WindowGlobalChild.cpp related to this has changed — become much simpler in fact — but I'm not yet convinced that this is the reason for the error.
already_AddRefed<JSWindowActorChild> WindowGlobalChild::GetActor(
    JSContext* aCx, const nsACString& aName, ErrorResult& aRv) {
  return JSActorManager::GetActor(aCx, aName, aRv)
      .downcast<JSWindowActorChild>();
}
The simplification is because the code has been moved in to JSActorManager.cpp, but it's really doing something that looks pretty similar.

There are no obvious differences in the LoginManager.jsm code itself. Just some additional telemetry and minor reformatting.

I've checked a bunch of things. The LoginManager.jsm file is contained within omni.ja. It's apparently accessed in multiple other places in both ESR 78 and ESR 91 in the same way. There is a very small change to the way it's being registered. From this:
    {
        'cid': '{cb9e0de8-3598-4ed7-857b-827f011ad5d8}',
        'contract_ids': ['@mozilla.org/login-manager;1'],
        'jsm': 'resource://gre/modules/LoginManager.jsm',
        'constructor': 'LoginManager',
    },
To this:
    {
        'js_name': 'logins',
        'cid': '{cb9e0de8-3598-4ed7-857b-827f011ad5d8}',
        'contract_ids': ['@mozilla.org/login-manager;1'],
        'interfaces': ['nsILoginManager'],
        'jsm': 'resource://gre/modules/LoginManager.jsm',
        'constructor': 'LoginManager',
    },
But I don't see why that change would make any difference. So right now I'm unfortunately a bit stumped. Maybe sleeping on it will help. I guess I'll find out in the morning.

So that's it for today, but hopefully I'll make a bit more progress on this tomorrow.

If you'd like to read any of my other gecko diary entries, they're all available on my Gecko-dev Diary page.

Comments

Uncover Disqus comments