ferrum-har 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7d8d40ce71b743bf429c007041d4e1df81c0cf82b9765d8cf886249abf882543
4
- data.tar.gz: 33c293040e516c1e28fc1ad31c95a8c6e43ed9509b2b773644efcfe0eca74d2a
3
+ metadata.gz: 140d6f93cceb0ee84d05e449aa1fb5a8680a562002850a6ac6e8aeb475505f12
4
+ data.tar.gz: 14dbb30ee107b7562e3167c44d8cd6460bb5d52a7dd1856caa849dd2e4c1b0f6
5
5
  SHA512:
6
- metadata.gz: 6fa0a91fefc4e7a6c14b176257521e9c02941d420e6ad64e0e5681e1efd3b6121b97c33d685338176a0c8c2381213f994f6989fb92ae55f8e44ad68d99bffe4d
7
- data.tar.gz: 2e93582b28d0c0ceb59638f3e92c0e3ef74178a27ba6d20d1a08b5578d55e091fefc709d14557abe07824cd778c05d8a97b278d79fd4ab9e62ac763842477f05
6
+ metadata.gz: a157840990fdadd2b2dc4c42a9e0464f3b2ef1206da1c3cbd8c7f703d7e4ce5e309298eb25c43818907099fccb4d92329506fa56399f21edcc1e5f9980769b5c
7
+ data.tar.gz: dc280c46aa7285b6dbbaa0f11af62a7279e6d4272b9320171d06da3a1059950f307b5b6d294677d75206eac95f46278480062f0f7f2044e3aced3040ecc3ca71
@@ -0,0 +1,10 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <!-- The only way to get the HAR is to add a chrome extension that can be loaded into the
5
+ devtools window where chrome.devtools.network.getHAR can be called. -->
6
+ <script src="devtools.js"></script>
7
+ </head>
8
+ <body>
9
+ </body>
10
+ </html>
@@ -0,0 +1,41 @@
1
+ const createHarResponse = function() {
2
+ // Ask the network panel for the HAR data. Note, we must wrap this in a "log" key to make it
3
+ // a valid HAR.
4
+ chrome.devtools.network.getHAR(
5
+ function(harLog) {
6
+ // Pass the HAR back to the inspected window. We need to base64 encode it to avoid any quoting
7
+ // and parsing issues.
8
+ const base64EncodedHar = btoa('{"log":' + JSON.stringify(harLog) + '}');
9
+ const comms = 'document.ferrumHar = "' + base64EncodedHar + '";';
10
+ chrome.devtools.inspectedWindow.eval(comms);
11
+ });
12
+ };
13
+
14
+ /**
15
+ * If the HAR is requested, create it and send it back to the inspected window.
16
+ */
17
+ const checkForHarInstruction = function() {
18
+ chrome.devtools.inspectedWindow.eval(
19
+ "document.ferrumHarRequested === true;",
20
+ function() {
21
+ // Prepare to receive another request.
22
+ chrome.devtools.inspectedWindow.eval("document.ferrumHarRequested = null;");
23
+ createHarResponse();
24
+ }
25
+ );
26
+ };
27
+
28
+ /**
29
+ * Start a continuous loop to check for the "create HAR" instruction from Ferrum. This is passed in
30
+ * by setting a JS variable in the inspected window. When this is detected, the HAR is created.
31
+ */
32
+ const loop_speed = 100;
33
+ const loop = function() {
34
+ checkForHarInstruction();
35
+ setTimeout(loop, loop_speed);
36
+ };
37
+ setTimeout(loop, loop_speed);
38
+
39
+ // Add the new chrome devtools panel. We need to do this or the extension cannot access the HAR.
40
+ // null is the image path (not needed).
41
+ chrome.devtools.panels.create("ferrum-har", null, "panel.html");
@@ -0,0 +1,12 @@
1
+ {
2
+ "manifest_version": 3,
3
+ "name": "ferrum-har extension",
4
+ "description": "A chrome extension that programmatically captures the HAR and returns it to the user",
5
+ "version": "1.0",
6
+ "permissions": [
7
+ "tabs"
8
+ ],
9
+ "host_permissions": ["<all_urls>"],
10
+ "devtools_page": "devtools.html",
11
+ "action": {}
12
+ }
@@ -0,0 +1,8 @@
1
+ <html>
2
+ <head>
3
+ <script src="panel.js"></script>
4
+ </head>
5
+ <body>
6
+ <h2>ferrum-har</h2>
7
+ </body>
8
+ </html>
@@ -0,0 +1 @@
1
+ console.log("ferrum-har panel.js loaded");
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ferrum
4
4
  module Har
5
- VERSION = "0.1.2"
5
+ VERSION = "0.1.3"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ferrum-har
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harry Lascelles
@@ -46,6 +46,11 @@ extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
48
  - README.md
49
+ - extension/devtools.html
50
+ - extension/devtools.js
51
+ - extension/manifest.json
52
+ - extension/panel.html
53
+ - extension/panel.js
49
54
  - lib/ferrum/har.rb
50
55
  - lib/ferrum/har/options_extension.rb
51
56
  - lib/ferrum/har/page_extension.rb