Skip to content

Commit 3d4ae41

Browse files
committed
Merge branch 'pre'
2 parents 5d8d732 + 0490e69 commit 3d4ae41

17 files changed

+823
-264
lines changed

#!inf.json

Lines changed: 188 additions & 116 deletions
Large diffs are not rendered by default.

.github/workflows/build.yml

Lines changed: 67 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,70 @@
11
name: Build
22
on:
3-
- push
3+
push:
4+
branches-ignore:
5+
- 'master'
46
jobs:
5-
Build:
6-
runs-on: ubuntu-latest
7-
strategy:
8-
matrix:
9-
node-version:
10-
- 13.x
11-
steps:
12-
- uses: actions/checkout@v2
13-
14-
- name: Cache node modules
15-
uses: actions/cache@v2
16-
env:
17-
cache-name: cache-node-modules
18-
with:
19-
path: node_modules
20-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('package.json') }}-${{ hashFiles('npm-shrinkwrap.json') }}
21-
restore-keys: |
22-
${{ runner.os }}-build-${{ env.cache-name }}-
23-
${{ runner.os }}-build-
24-
${{ runner.os }}-
25-
26-
- name: Install Dependencies
27-
run: npm install
28-
29-
- name: Build
30-
run: npm run build
31-
32-
- name: Upload extension as build artifact
33-
uses: actions/upload-artifact@v1
34-
with:
35-
name: firephp
36-
path: dist/firephp.zip
37-
38-
- name: Upload Release if tagging
39-
uses: fnkr/github-action-ghr@v1
40-
if: startsWith(github.ref, 'refs/tags/')
41-
env:
42-
GHR_PATH: dist/firephp.zip
43-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7+
Build:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
node-version:
12+
- 13.x
13+
steps:
14+
- uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Cache node modules
19+
uses: actions/cache@v2
20+
env:
21+
cache-name: cache-node-modules
22+
with:
23+
path: node_modules
24+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('package.json') }}-${{ hashFiles('npm-shrinkwrap.json') }}
25+
restore-keys: |
26+
${{ runner.os }}-build-${{ env.cache-name }}-
27+
${{ runner.os }}-build-
28+
${{ runner.os }}-
29+
30+
- name: Install Dependencies
31+
run: npm install
32+
33+
- name: "[sm.act] Set env"
34+
uses: sourcemint/sm.act.github.actions/.github/actions/[email protected]
35+
36+
- name: "[sm.act] Show env"
37+
uses: sourcemint/sm.act.github.actions/.github/actions/[email protected]
38+
39+
- name: Build
40+
run: npm run build
41+
42+
- name: Upload firefox extension as build artifact
43+
uses: actions/upload-artifact@v1
44+
with:
45+
name: ${{ env.FIREPHP_BUILD_FILENAME_PREFIX }}-firefox.zip
46+
path: dist/${{ env.FIREPHP_BUILD_FILENAME_PREFIX }}-firefox.zip
47+
48+
- name: Upload chrome extension as build artifact
49+
uses: actions/upload-artifact@v1
50+
with:
51+
name: ${{ env.FIREPHP_BUILD_FILENAME_PREFIX }}-chrome.zip
52+
path: dist/${{ env.FIREPHP_BUILD_FILENAME_PREFIX }}-chrome.zip
53+
54+
- name: Upload firefox release if tagging
55+
uses: fnkr/github-action-ghr@v1
56+
if: startsWith(github.ref, 'refs/tags/')
57+
env:
58+
GHR_PATH: dist/${{ env.FIREPHP_BUILD_FILENAME_PREFIX }}-firefox.zip
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
61+
- name: Upload chrome release if tagging
62+
uses: fnkr/github-action-ghr@v1
63+
if: startsWith(github.ref, 'refs/tags/')
64+
env:
65+
GHR_PATH: dist/${{ env.FIREPHP_BUILD_FILENAME_PREFIX }}-chrome.zip
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
68+
- name: "[sm.act] Write snapshot report"
69+
id: snapshot
70+
uses: sourcemint/sm.act.github.actions/.github/actions/[email protected]

.postbuild.sh

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# TODO: Move to '#!inf.json' once pinf.it/build/v0 executes instructions in sequence.
44

5-
pushd "dist/firephp.build" > /dev/null
5+
function removeFiles {
66

77
# Remove files that we do not need
88
# TODO: Do this in a better way and coordinate with .gitignore
@@ -20,19 +20,42 @@ pushd "dist/firephp.build" > /dev/null
2020
rm -Rf scripts/devtools/dist/dist/reps/golden-layout.rep.js
2121
rm -Rf skin/box.png
2222
rm -Rf run.config.json
23+
}
24+
25+
26+
pushd "dist/firephp.build.firefox" > /dev/null
27+
28+
removeFiles
2329

2430
# Remove signed archive as it needs to be re-signed
25-
rm -f ../firephp.build.xpi 2> /dev/null || true
31+
# rm -f ../firephp.build.xpi 2> /dev/null || true
32+
popd > /dev/null
2633

34+
pushd "dist/firephp.build.chrome" > /dev/null
35+
removeFiles
2736
popd > /dev/null
2837

38+
2939
pushd "dist" > /dev/null
3040

31-
mv firephp.build firephp
32-
zip -r firephp.zip firephp/
33-
mv firephp firephp.build
41+
filename="firephp"
42+
if [ ! -z "${SM_ACT_GIT_BRANCH}" ]; then
43+
filename="${filename}-${SM_ACT_GIT_BRANCH}-${SM_ACT_GIT_SHA3}"
44+
else
45+
filename="${filename}-${SM_ACT_GIT_TAG}"
46+
fi
47+
48+
echo "::set-env name=FIREPHP_BUILD_FILENAME_PREFIX::${filename}"
49+
50+
pushd "firephp.build.firefox" > /dev/null
51+
zip -r "../${filename}-firefox.zip" * --exclude '.DS_Store'
52+
popd > /dev/null
53+
54+
pushd "firephp.build.chrome" > /dev/null
55+
zip -r "../${filename}-chrome.zip" * --exclude '.DS_Store'
56+
popd > /dev/null
3457

3558
popd > /dev/null
3659

37-
BO_cecho "\nBuilt extension source can be found at: dist/firephp.build/" YELLOW BOLD
60+
BO_cecho "\nBuilt extension source can be found at 'dist/firephp.build.firefox/' and 'dist/firephp.build.chrome/'" YELLOW BOLD
3861
BO_cecho "This source can be loaded into a browser when running in extension development mode.\n" YELLOW BOLD

.prepare.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# TODO: Get rid of this file once issues are fixed in underlying libraries.
44

55
[ ! -e '.~/gi0.PINF.it~build~v0' ] || rm -Rf '.~/gi0.PINF.it~build~v0'
6-
[ ! -e 'dist/firephp.build' ] || rm -Rf 'dist/firephp.build'
6+
[ ! -e 'dist/firephp.build.firefox' ] || rm -Rf 'dist/firephp.build.firefox'
7+
[ ! -e 'dist/firephp.build.chrome' ] || rm -Rf 'dist/firephp.build.chrome'
78

89
[ -e '.~lib.json' ] || node_modules/.bin/lib.json from node_modules > '.~lib.json'

manifest.inf.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
'use strict';
3+
4+
exports.inf = async function (inf) {
5+
6+
let manifest = null;
7+
8+
return {
9+
10+
set: function (value) {
11+
manifest = value;
12+
},
13+
14+
get: function () {
15+
return manifest;
16+
}
17+
};
18+
}

npm-shrinkwrap.json

Lines changed: 27 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
{
22
"name": "firephp-for-browser-devtools",
3-
"version": "1.4.6",
3+
"version": "1.5.0",
44
"devDependencies": {
55
"codemirror": "^5.49.0",
66
"eventemitter2": "^4.1.2",
77
"insight-for-js": "^0.2.1-pre.3",
88
"wildfire-for-js": "^0.2.0-pre.1",
9-
"fireconsole.rep.js": "^0.2.0-pre.5",
9+
"fireconsole.rep.js": "^0.2.0-pre.6",
1010
"pinf-loader-js": "^1.1.0-pre.1",
1111
"bash.origin.lib": "^0.5.0-pre.1",
12-
"to.pinf.org.mozilla.web-ext": "^0.3.0-pre.3",
12+
"to.pinf.org.mozilla.web-ext": "^0.3.0-pre.5",
1313
"it.pinf.org.mozilla.web-ext": "^0.3.0-pre.1",
1414
"it.pinf.org.browserify": "^0.2.0-pre.0"
1515
},
1616
"scripts": {
1717
"test": "./.prepare.sh; pinf.it ./#!inf.json test",
18-
"dev": "./.prepare.sh; pinf.it ./#!inf.json dev --watch",
18+
"dev": "./.prepare.sh; pinf.it ./#!inf.json dev",
1919
"build": "./.prepare.sh; pinf.it ./#!inf.json build; ./.postbuild.sh",
2020
"build-via-docker": "./src/docker/build.sh",
2121
"publish": "./.prepare.sh; pinf.it ./#!inf.json publish"
2222
}
23-
}
23+
}

src/adapters/http-request-observer.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ exports.forAPI = function (API) {
6060

6161

6262
self.ensureHooked = function () {
63-
if (!isHooked) {
63+
if (!isHooked) {
64+
API.BROWSER.remap();
6465
API.BROWSER.webRequest.onBeforeSendHeaders.addListener(
6566
onRequest,
6667
{
@@ -73,13 +74,16 @@ exports.forAPI = function (API) {
7374
"requestHeaders"
7475
]
7576
);
77+
// API.BROWSER.webRequest.handlerBehaviorChanged();
7678
isHooked = true;
7779
}
7880
}
7981

8082
self.ensureUnhooked = function () {
81-
API.BROWSER.webRequest.onBeforeSendHeaders.removeListener(onRequest);
82-
isHooked = false;
83+
if (isHooked) {
84+
API.BROWSER.webRequest.onBeforeSendHeaders.removeListener(onRequest);
85+
isHooked = false;
86+
}
8387
}
8488

8589
}

src/adapters/http-response-observer.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ exports.forAPI = function (API) {
6767

6868
self.ensureHooked = function () {
6969
if (!isHooked) {
70+
API.BROWSER.remap();
7071
API.BROWSER.webRequest.onHeadersReceived.addListener(
7172
onHeadersReceived,
7273
{
@@ -83,8 +84,10 @@ exports.forAPI = function (API) {
8384
}
8485

8586
self.ensureUnhooked = function () {
86-
API.BROWSER.webRequest.onHeadersReceived.removeListener(onHeadersReceived);
87-
isHooked = false;
87+
if (isHooked) {
88+
API.BROWSER.webRequest.onHeadersReceived.removeListener(onHeadersReceived);
89+
isHooked = false;
90+
}
8891
pageUrlByTabId = {};
8992
pageTimestampByTabId = {};
9093
}

0 commit comments

Comments
 (0)