Isolated Atlases and the Nuclear Option

Discussion in 'Mod Discussions' started by wondible, September 3, 2015.

  1. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    Strategic Filters broke recently - localStorage has been isolated and the new memory api doesn't resolve it's promises in icon_atlas. Shame, because I thought the localStorage trick might also enable a universal server clientside support mod if I ever got around to trying it.

    I'll be on mod triage for a bit yet, then I've got a punchlist of less urgent updates and special projects. But I had an idea and I figured I'd throw it out in case somebody wanted to do all the hard work for me ;^)

    PA exposes the debugger at http://127.0.0.1:9999 To do anything beyond that first page you need the devtools files available (which on OS X involves copying them into PA). However I believe the devtools are accessing a lower level network protocol (websockets?) which are always available, and since both devtools and PA are essentially web pages, it should be possible to access it directly from within PA - including "evaluate javascript in target page" just as if you were at the console.

    The clues are in the devtools source (though needles in a large haystack) and in protocol docs like this:

    https://developer.chrome.com/devtools/docs/protocol/1.1/runtime#command-evaluate

    (I haven't checked what protocol version PA is running, so that may be incorrect)

    In so far as I took it, I found another article that covers the first steps:

    https://www.igvita.com/2012/04/09/driving-google-chrome-via-websocket-api/
    cola_colin likes this.
  2. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    I had little down time to play with this. Fundamentally it works, with the big caveat being that only one connection (user debugger or other process) can be open to each process at once. Fortunately for anything but atlases once should be enough. We could probably get away with opening and closing connections on demand, although timing might be an issue (in which case a retry mechanism might be required)

    Also, Page.reload seems to work on atlases - Uber's reloadScene only worked on things with pageId.

    Other interesting discovery is that atlases use urls like atlas://icon_atlas/icon_atlas.html, which probably has something to do with changing their localStorage domain.

Share This Page