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

20
LINES

< > BotCompany Repo | #1019819 // firefoxTabs

JavaX fragment (include)

1  
static L<FirefoxTab> firefoxTabs() {
2  
  File profile = mozillaDefaultProfileDir();
3  
  if (profile == null) null; // print("No default Mozilla profile found");
4  
  Map data = cast decodeMozillaJSONLZ4File(newFile(profile, "sessionstore-backups/recovery.jsonlz4"));
5  
  if (data == null) null; // print("No session found");
6  
  int iWindow = 0;
7  
  new L<FirefoxTab> out;
8  
  for (Map window : unnull((L<Map>) data.get("windows"))) {
9  
    ++iWindow;
10  
    for (Map tab : unnull((L<Map>) window.get("tabs"))) {
11  
      int index = toInt(tab.get("index"))-1;
12  
      L<Map> entries = cast tab.get("entries");
13  
      Map entry = entries.get(index);
14  
      S title = cast entry.get("title");
15  
      S url = cast entry.get("url");
16  
      out.add(FirefoxTab(iWindow, title, url));
17  
    }
18  
  }
19  
  ret out;
20  
}

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: 290 / 312
Referenced in: [show references]