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

29
LINES

< > BotCompany Repo | #1019813 // Get tabs from Firefox Spike 2 [OK on Windows & Linux - just lags a few seconds until Firefox writes session to disk]

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Libraryless. Click here for Pure Java version (6397L/46K).

1  
!7
2  
3  
p-exp {
4  
  File profile = mozillaDefaultProfileDir();
5  
  if (profile == null) ret with print("No default Mozilla profile found");
6  
  Map data = cast decodeMozillaJSONLZ4File(newFile(profile, "sessionstore-backups/recovery.jsonlz4"));
7  
  if (data == null) ret with print("No session found");
8  
  //pnlStruct(data);
9  
  int iWindow = 0;
10  
  for (Map window : unnull((L<Map>) data.get("windows"))) {
11  
    print("\nWindow " + (++iWindow));
12  
    print(keys(window));
13  
    print("selected: " + window.get("selected"));
14  
    for (Map tab : unnull((L<Map>) window.get("tabs"))) {
15  
      print(keys(tab));
16  
      print(tab.get("attributes"));
17  
      int index = toInt(tab.get("index"))-1;
18  
      L<Map> entries = cast tab.get("entries");
19  
      //print("entries: " + l(entries) + ", index=" + index);
20  
      //printStruct(tab);
21  
      Map entry = entries.get(index);
22  
      //printStruct(entry);
23  
      S title = cast entry.get("title");
24  
      S url = cast entry.get("url");
25  
      print(title);
26  
      print("  " + url);
27  
    }
28  
  }
29  
}

Author comment

Began life as a copy of #1019807

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1019813
Snippet name: Get tabs from Firefox Spike 2 [OK on Windows & Linux - just lags a few seconds until Firefox writes session to disk]
Eternal ID of this version: #1019813/16
Text MD5: 4dbe5051c6d4b96e39b65273a2706a67
Transpilation MD5: af94bce5c51022ef02423916022afcc3
Author: stefan
Category: javax / firefox
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-11-27 02:41:00
Source code size: 1031 bytes / 29 lines
Pitched / IR pitched: No / No
Views / Downloads: 309 / 842
Version history: 15 change(s)
Referenced in: [show references]