Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

20
LINES

< > BotCompany Repo | #1019819 // firefoxTabs

JavaX fragment (include)

static L<FirefoxTab> firefoxTabs() {
  File profile = mozillaDefaultProfileDir();
  if (profile == null) null; // print("No default Mozilla profile found");
  Map data = cast decodeMozillaJSONLZ4File(newFile(profile, "sessionstore-backups/recovery.jsonlz4"));
  if (data == null) null; // print("No session found");
  int iWindow = 0;
  new L<FirefoxTab> out;
  for (Map window : unnull((L<Map>) data.get("windows"))) {
    ++iWindow;
    for (Map tab : unnull((L<Map>) window.get("tabs"))) {
      int index = toInt(tab.get("index"))-1;
      L<Map> entries = cast tab.get("entries");
      Map entry = entries.get(index);
      S title = cast entry.get("title");
      S url = cast entry.get("url");
      out.add(FirefoxTab(iWindow, title, url));
    }
  }
  ret out;
}

Author comment

Began life as a copy of #1019813

download  show line numbers  debug dex  old transpilations   

Travelled to 9 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1019819
Snippet name: firefoxTabs
Eternal ID of this version: #1019819/1
Text MD5: 15ebdbd1927a35a97016fd45ef2033ea
Author: stefan
Category: javax / firefox
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-11-27 02:20:22
Source code size: 791 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 377 / 393
Referenced in: [show references]