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 +4 -4
- data/extension/devtools.html +10 -0
- data/extension/devtools.js +41 -0
- data/extension/manifest.json +12 -0
- data/extension/panel.html +8 -0
- data/extension/panel.js +1 -0
- data/lib/ferrum/har/version.rb +1 -1
- metadata +6 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 140d6f93cceb0ee84d05e449aa1fb5a8680a562002850a6ac6e8aeb475505f12
|
4
|
+
data.tar.gz: 14dbb30ee107b7562e3167c44d8cd6460bb5d52a7dd1856caa849dd2e4c1b0f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
+
}
|
data/extension/panel.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
console.log("ferrum-har panel.js loaded");
|
data/lib/ferrum/har/version.rb
CHANGED
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.
|
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
|